Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Xinhui Pan" <Xinhui.Pan@amd.com>,
	"Patrik Jakobsson" <patrik.r.jakobsson@gmail.com>,
	"Rob Clark" <robdclark@gmail.com>,
	"Abhinav Kumar" <quic_abhinavk@quicinc.com>,
	"Dmitry Baryshkov" <dmitry.baryshkov@linaro.org>,
	"Sean Paul" <sean@poorly.run>,
	"Marijn Suijten" <marijn.suijten@somainline.org>,
	"Karol Herbst" <kherbst@redhat.com>,
	"Lyude Paul" <lyude@redhat.com>,
	"Danilo Krummrich" <dakr@redhat.com>,
	"Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"Andy Yan" <andy.yan@rock-chips.com>,
	amd-gfx@lists.freedesktop.org, linux-arm-msm@vger.kernel.org,
	freedreno@lists.freedesktop.org, nouveau@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm: Move plane->{fb,old_fb,crtc} to legacy sub-structure
Date: Fri, 25 Oct 2024 12:57:50 +0300	[thread overview]
Message-ID: <875xpgqzc1.fsf@intel.com> (raw)
In-Reply-To: <Zv58AalhFaMgh7c5@intel.com>

On Thu, 03 Oct 2024, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> On Wed, Oct 02, 2024 at 09:21:59PM +0300, Ville Syrjala wrote:
>> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> 
>> Hide the plane->fb/etc. footguns better by stashing them inside
>> a "legacy" sub struct.
>> 
>> Eventually maybe we could turn 'legacy' into a pointer
>> that only exists on legacy drivers to completely prevent
>> any abuse by atomic drivers...
>
> Hmm. I should probably make it a pointer from the start,
> to avoid having to go through the same churn yet again.

[snip]

>> diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
>> index dd718c62ac31..a2d91ee4b40c 100644
>> --- a/include/drm/drm_plane.h
>> +++ b/include/drm/drm_plane.h
>> @@ -663,31 +663,33 @@ struct drm_plane {
>>  	/** @modifier_count: Size of the array pointed at by @modifier_count. */
>>  	unsigned int modifier_count;
>>  
>> -	/**
>> -	 * @crtc:
>> -	 *
>> -	 * Currently bound CRTC, only meaningful for non-atomic drivers. For
>> -	 * atomic drivers this is forced to be NULL, atomic drivers should
>> -	 * instead check &drm_plane_state.crtc.
>> -	 */
>> -	struct drm_crtc *crtc;
>> -
>> -	/**
>> -	 * @fb:
>> -	 *
>> -	 * Currently bound framebuffer, only meaningful for non-atomic drivers.
>> -	 * For atomic drivers this is forced to be NULL, atomic drivers should
>> -	 * instead check &drm_plane_state.fb.
>> -	 */
>> -	struct drm_framebuffer *fb;
>> -
>> -	/**
>> -	 * @old_fb:
>> -	 *
>> -	 * Temporary tracking of the old fb while a modeset is ongoing. Only
>> -	 * used by non-atomic drivers, forced to be NULL for atomic drivers.
>> -	 */
>> -	struct drm_framebuffer *old_fb;
>> +	struct {

Do you mean something along the lines of:

	struct __plane_legacy_or_something {

>> +		/**
>> +		 * @crtc:
>> +		 *
>> +		 * Currently bound CRTC, only meaningful for non-atomic drivers. For
>> +		 * atomic drivers this is forced to be NULL, atomic drivers should
>> +		 * instead check &drm_plane_state.crtc.
>> +		 */
>> +		struct drm_crtc *crtc;
>> +
>> +		/**
>> +		 * @fb:
>> +		 *
>> +		 * Currently bound framebuffer, only meaningful for non-atomic drivers.
>> +		 * For atomic drivers this is forced to be NULL, atomic drivers should
>> +		 * instead check &drm_plane_state.fb.
>> +		 */
>> +		struct drm_framebuffer *fb;
>> +
>> +		/**
>> +		 * @old_fb:
>> +		 *
>> +		 * Temporary tracking of the old fb while a modeset is ongoing. Only
>> +		 * used by non-atomic drivers, forced to be NULL for atomic drivers.
>> +		 */
>> +		struct drm_framebuffer *old_fb;
>> +	} legacy;

and

	} __legacy;

	struct __plane_legacy_or_something *legacy;

and initially unconditionally:

       	p->legacy = &p->__legacy;

but later, once atomic drivers have been fixed:

	if (!drm_core_check_feature(dev, DRIVER_COMPUTE_ATOMIC))
		p->legacy = &p->__legacy;

It would make the last update really simple.

BR,
Jani.


>>  
>>  	/** @funcs: plane control functions */
>>  	const struct drm_plane_funcs *funcs;
>> -- 
>> 2.45.2

-- 
Jani Nikula, Intel

  reply	other threads:[~2024-10-25  9:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-02 18:21 [PATCH 0/2] drm: Treewide plane/crtc legacy state sweeping Ville Syrjala
2024-10-02 18:21 ` [PATCH 1/2] drm: Move plane->{fb, old_fb, crtc} to legacy sub-structure Ville Syrjala
2024-10-03 11:12   ` [PATCH 1/2] drm: Move plane->{fb,old_fb,crtc} " Ville Syrjälä
2024-10-25  9:57     ` Jani Nikula [this message]
2024-10-25 10:15       ` Ville Syrjälä
2024-10-02 18:22 ` [PATCH 2/2] drm: Move crtc->{x, y, mode, enabled} " Ville Syrjala
2024-10-03 12:38   ` Louis Chauvet
2024-10-03 13:46     ` Ville Syrjälä
2024-10-03 15:07       ` Louis Chauvet
2024-10-03 15:29         ` Ville Syrjälä
2024-10-03 15:45           ` Louis Chauvet
2024-10-02 19:29 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Treewide plane/crtc legacy state sweeping Patchwork
2024-10-02 19:29 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-10-02 19:41 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-10-25  7:46 ` [PATCH 0/2] " Ville Syrjälä
2024-10-25  9:54   ` Dmitry Baryshkov
2024-10-25  9:59   ` Jani Nikula

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=875xpgqzc1.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=andy.yan@rock-chips.com \
    --cc=christian.koenig@amd.com \
    --cc=dakr@redhat.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=hjc@rock-chips.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=kherbst@redhat.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=lyude@redhat.com \
    --cc=marijn.suijten@somainline.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=patrik.r.jakobsson@gmail.com \
    --cc=quic_abhinavk@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    --cc=ville.syrjala@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox