All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
	"Kandpal, Suraj" <suraj.kandpal@intel.com>
Cc: "dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"Nautiyal, Ankit K" <ankit.k.nautiyal@intel.com>,
	"Murthy, Arun R" <arun.r.murthy@intel.com>,
	"Shankar, Uma" <uma.shankar@intel.com>
Subject: Re: [PATCH 03/28] drm/writeback: Define function to get drm_connector from writeback
Date: Fri, 01 Aug 2025 14:57:48 +0300	[thread overview]
Message-ID: <81dccfde92580d525cab5ce95d529e08c27b972c@intel.com> (raw)
In-Reply-To: <pax7q7t6gqf4v2ots4ycdfpyecyb62eycht5vlzxodxfl5tlzv@axijwakktt2u>

On Fri, 01 Aug 2025, Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> wrote:
> Thinking in OOP terms, the encoder is just a field in the struct.
> drm_connector is a base class for drm_writeback_connector. By making it
> optional, you are definitely semi-breaking the abstraction.

The trouble is, in OOP terms, drm_connector is the "base class" for both
drm_writeback_connector and intel_connector. We're already stretching
what we can do with C.

Currently, it's always guaranteed all drm_connectors i915 ever sees are
embedded within intel_connector. Changing from one pointer to another is
trivial, guaranteed to work, and is never NULL if the source pointer is
non-NULL. This is a design that's been around for the longest time.

The current writeback implementation forces a different design by always
embedding drm_connector itself. We can't use a drm_connector that's
embedded within an intel_connector with it. If we want to have our own
stuff, we'd need an intel_writeback_connector wrapping
drm_writeback_connector, and it gets even more complicated with all the
interfaces that use intel_connector. It really shouldn't have to be this
way.

Using the current drm_writeback_connector in i915 requires careful
auditing of all drm_connector <-> intel_connector conversions, NULL
checks, and graceful error handling, also in places that have no
convenient way to return errors at all.

The OOP abstractions just break hard with C, we can't have multiple
inheritance, and IMO the pragmatic approach is to let *drivers* do what
they want, instead of having a midlayer helper design force something on
them.


BR,
Jani.


-- 
Jani Nikula, Intel

  reply	other threads:[~2025-08-01 11:58 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-25  5:03 [PATCH 00/28] Enable Pipe writeback Suraj Kandpal
2025-07-25  5:03 ` [PATCH 01/28] drm/writeback: Add function that takes preallocated connector Suraj Kandpal
2025-07-26 12:15   ` Dmitry Baryshkov
2025-07-26 16:41     ` Kandpal, Suraj
2025-07-27 15:33       ` Dmitry Baryshkov
2025-08-01  4:03         ` Kandpal, Suraj
2025-07-25  5:03 ` [PATCH 02/28] drm/writeback: Add a helper function to get writeback connector Suraj Kandpal
2025-07-26 12:20   ` Dmitry Baryshkov
2025-07-26 16:43     ` Kandpal, Suraj
2025-07-27 15:33       ` Dmitry Baryshkov
2025-08-01  4:04         ` Kandpal, Suraj
2025-07-25  5:03 ` [PATCH 03/28] drm/writeback: Define function to get drm_connector from writeback Suraj Kandpal
2025-07-26 12:33   ` Dmitry Baryshkov
2025-07-26 16:49     ` Kandpal, Suraj
2025-07-27 15:54       ` Dmitry Baryshkov
2025-08-01  5:18         ` Kandpal, Suraj
2025-08-01 10:17           ` Dmitry Baryshkov
2025-08-01 11:57             ` Jani Nikula [this message]
2025-08-01 13:19               ` Dmitry Baryshkov
2025-08-01 13:57                 ` Jani Nikula
2025-08-01 14:32             ` Kandpal, Suraj
2025-07-25  5:03 ` [PATCH 04/28] drm/i915/writeback: Add writeback registers Suraj Kandpal
2025-07-28  6:31   ` Murthy, Arun R
2025-07-25  5:03 ` [PATCH 05/28] drm/i915/writeback: Add some preliminary writeback definitions Suraj Kandpal
2025-07-25  5:03 ` [PATCH 06/28] drm/i915/writeback: Init writeback connector Suraj Kandpal
2025-07-25  5:03 ` [PATCH 07/28] drm/i915/writeback: Add function for get_writeback_connector Suraj Kandpal
2025-07-25  5:03 ` [PATCH 08/28] drm/i915/writeback: Define the get_connector_from_writeback hook Suraj Kandpal
2025-07-25  5:03 ` [PATCH 09/28] drm/i915/writeback: Add function to get modes Suraj Kandpal
2025-07-25  5:03 ` [PATCH 10/28] drm/i915/writeback: Add hook to check modes Suraj Kandpal
2025-07-25  5:03 ` [PATCH 11/28] drm/i915/writeback: Define encoder->get_hw_state Suraj Kandpal
2025-07-26 11:55   ` kernel test robot
2025-07-25  5:03 ` [PATCH 12/28] drm/i915/writeback: Fill encoder->get_config Suraj Kandpal
2025-07-25  5:03 ` [PATCH 13/28] drm/i915/writeback: Add private structure for writeback job Suraj Kandpal
2025-07-25  5:03 ` [PATCH 14/28] drm/i915/writeback: Define function for prepare and cleanup hooks Suraj Kandpal
2025-07-26 13:42   ` kernel test robot
2025-07-25  5:03 ` [PATCH 15/28] drm/i915/writeback: Define compute_config for writeback Suraj Kandpal
2025-07-25  5:03 ` [PATCH 16/28] drm/i915/writeback: Define function for connector function detect Suraj Kandpal
2025-07-25  5:03 ` [PATCH 17/28] drm/i915/writeback: Define function to destroy writeback connector Suraj Kandpal
2025-07-26 12:40   ` Dmitry Baryshkov
2025-07-26 16:29     ` Kandpal, Suraj
2025-07-27 15:55       ` Dmitry Baryshkov
2025-07-25  5:03 ` [PATCH 18/28] drm/i915/writeback: Add connector atomic check Suraj Kandpal
2025-07-26 12:38   ` Dmitry Baryshkov
2025-07-25  5:04 ` [PATCH 19/28] drm/i915/writeback: Add the enable sequence from writeback Suraj Kandpal
2025-07-25  5:04 ` [PATCH 20/28] drm/i915/writeback: Add writeback to xe Makefile Suraj Kandpal
2025-07-25  5:04 ` [PATCH 21/28] drm/i915/writeback: Define writeback frame capture function Suraj Kandpal
2025-07-25  5:04 ` [PATCH 22/28] drm/i915/writeback: Configure WD_STRIDE reg Suraj Kandpal
2025-07-25  5:04 ` [PATCH 23/28] drm/i915/writeback: Configure WD_SURF register Suraj Kandpal
2025-07-25  5:04 ` [PATCH 24/28] drm/i915/writeback: Enable writeback interrupts Suraj Kandpal
2025-07-25  5:04 ` [PATCH 25/28] drm/i915/writeback: Initialize writeback encoder Suraj Kandpal
2025-07-25  5:04 ` [PATCH 26/28] drm/i915/writeback: Define the disable sequence for writeback Suraj Kandpal
2025-07-25  5:04 ` [PATCH 27/28] drm/i915/writeback: Make exception for writeback connector Suraj Kandpal
2025-07-26 16:06   ` kernel test robot
2025-07-25  5:04 ` [PATCH 28/28] drm/i915/writeback: Modify state verify function Suraj Kandpal
2025-07-25  5:21 ` ✗ CI.checkpatch: warning for Enable Pipe writeback Patchwork
2025-07-25  5:22 ` ✓ CI.KUnit: success " Patchwork
2025-07-25  5:37 ` ✗ CI.checksparse: warning " Patchwork
2025-07-25  6:04 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-07-25  7:15 ` ✗ Xe.CI.Full: " Patchwork
2025-07-26 12:39 ` [PATCH 00/28] " Dmitry Baryshkov
2025-07-26 16:33   ` Kandpal, Suraj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=81dccfde92580d525cab5ce95d529e08c27b972c@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=arun.r.murthy@intel.com \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=suraj.kandpal@intel.com \
    --cc=uma.shankar@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.