All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: ville.syrjala@intel.com, rodrigo.vivi@intel.com,
	jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com,
	tursulin@ursulin.net, airlied@gmail.com, simona@ffwll.ch,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, sashiko-reviews@lists.linux.dev,
	Javier Martinez Canillas <javierm@redhat.com>
Subject: Re: [PATCH RESEND v3] drm/i915/display: Handle struct drm_plane_state.ignore_damage_clips
Date: Thu, 3 Dec 2026 19:09:53 +0200	[thread overview]
Message-ID: <axGiYfUocY3jjzAP@intel.com> (raw)
In-Reply-To: <6ff6d43b-fa7e-475b-b15c-6854f7da189d@suse.de>

On Thu, Dec 03, 2026 at 05:44:19PM +0100, Thomas Zimmermann wrote:
> Hi
> 
> Am 03.12.26 um 16:49 schrieb Ville Syrjälä:
> > On Tue, Nov 24, 2026 at 09:40:01AM +0100, Thomas Zimmermann wrote:
> >> Call drm_atomic_helper_check_plane_damage() in plane_atomic_check()
> >> before copying the damage information to guarantees that ignore_damage_clips
> >> from struct drm_plane_state has the correct value. Although i915 does not
> >> directly modify or use the flag, DRM's damage iterator will soon rely on
> >> it.
> >>
> >> As a side effect, if the CRTC has been marked for a full modeset before
> >> the call to drm_atomic_helper_check_plane_damage() happens, the plane now
> >> ignores all damage clips and does a full update.
> >>
> >> Git commit 35ed38d58257 ("drm: Allow drivers to indicate the damage
> >> helpers to ignore damage clips") introduced ignore_damage_clips to
> >> selectively ignore damage clipping for certain framebuffer changes. The
> >> mode-setting pipeline can disabled damage clippings for an atomic commit
> >> by setting ignore_damage_clips in struct drm_plane_state. The atomic
> >> commit will then do a full display update.
> >>
> >> Future directions: there's currently a multitude of options that affect
> >> damage clipping; with different places seeing different state. In order
> >> to unify this, drm_atomic_helper_check_plane_state() will soon evaluate
> >> all options in a single place and set ignore_damage_clips accordingly. All
> >> later stages of the mode-setting pipeline will only look at this field.
> >>
> >> v3:
> >> - fix the call to drm_atomic_helper_check_plane_state()
> >> - use primary-CRTC's plane state (Sashiko)
> >> - note full-plane updates in commit description
> >> v2:
> >> - move _check_plane_damage() before reading damage first time (Sashiko)
> >> - expand commit description
> >>
> >> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> >> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
> >> ---
> >>   drivers/gpu/drm/i915/display/intel_plane.c | 10 +++++++++-
> >>   1 file changed, 9 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/drm/i915/display/intel_plane.c b/drivers/gpu/drm/i915/display/intel_plane.c
> >> index d23de0f34e4b..058e92f383e4 100644
> >> --- a/drivers/gpu/drm/i915/display/intel_plane.c
> >> +++ b/drivers/gpu/drm/i915/display/intel_plane.c
> >> @@ -955,7 +955,7 @@ static int plane_atomic_check(struct intel_atomic_state *state,
> >>   		intel_atomic_get_new_plane_state(state, plane);
> >>   	const struct intel_plane_state *old_plane_state =
> >>   		intel_atomic_get_old_plane_state(state, plane);
> >> -	const struct intel_plane_state *new_primary_crtc_plane_state;
> >> +	struct intel_plane_state *new_primary_crtc_plane_state;
> >>   	const struct intel_plane_state *old_primary_crtc_plane_state;
> >>   	struct intel_crtc *crtc = intel_crtc_for_pipe(display, plane->pipe);
> >>   	const struct intel_crtc_state *old_crtc_state =
> >> @@ -978,6 +978,14 @@ static int plane_atomic_check(struct intel_atomic_state *state,
> >>   		old_primary_crtc_plane_state = old_plane_state;
> >>   	}
> >>   
> >> +	/*
> >> +	 * Prepare plane-damage state before using it; do this on all
> >> +	 * display versions to keep the underlying DRM plane state in
> >> +	 * good shape.
> >> +	 */
> >> +	drm_atomic_helper_check_plane_damage(&state->base,
> >> +					     &new_primary_crtc_plane_state->uapi);
> > This seems to be making assumptions about what the
> > hardware/driver aims to do with the damage. And we don't
> > even know yet whether a full modeset is going to happen
> > or not, so this more or less just adding checks that we
> > anyway have to repeat later.
> >
> > I also really dislike the fact that the helper is now messing
> > with the actual uapi provided blob. IMO nothing but the
> > direct uapi facing code should ever mutate the uapi state.
> >
> > In general I think the entire damage helper is rather
> > overengineered. All we really want is a trivial
> >
> > for_each_damage_rect
> > 	drm_rect_union()
> >
> > to get the full uapi damage, and then we can do with it as
> > we wish. I have a local branch where I'm rewriting our PSR
> > selective fetch stuff and there I used just such a simple
> > approach.
> >
> > So, I suspect this wouldn't actually break anything, but
> > it's not really doing anything useful either. And as
> > mentioned I think the "mutate the uapi state in the helper"
> > approach is very wrong.
> 
> That's not working now and it never will. The damage is nothing more 
> than a hint from userspace. We already have plenty of exceptions, as you 
> know. And the worst part is that state is currently inconsistent across 
> different steps of the modeset.  Specifically when we commit a state, we 
> should already know what to do. Instead the damage-handling code keeps 
> on evaluating the old plane state to detect damage. The current 
> situation is quite a mess.
> 
> If you really want something special for i915, maybe fork the damage 
> logic. All the other drivers would be better off with a refactored approach.

I think what you want is just the usual derived vs. uapi state
approach where you move the unionized damage drm_rect into 
drm_plane_state. Have the helper fill that and have the drivers
just use it. Then you can adjust that via some helpers during
atomic_check() if you need to, without having to mess with the
uapi state.

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2026-12-03 17:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  8:40 [PATCH RESEND v3] drm/i915/display: Handle struct drm_plane_state.ignore_damage_clips Thomas Zimmermann
2026-11-24  8:50 ` ✗ CI.checkpatch: warning for drm/i915/display: Handle struct drm_plane_state.ignore_damage_clips (rev4) Patchwork
2026-11-24  8:52 ` ✗ CI.KUnit: failure " Patchwork
2026-11-24 10:06 ` ✓ i915.CI.BAT: success " Patchwork
2026-11-24 19:52 ` ✗ i915.CI.Full: failure " Patchwork
2026-12-03 15:49 ` [PATCH RESEND v3] drm/i915/display: Handle struct drm_plane_state.ignore_damage_clips Ville Syrjälä
2026-12-03 16:44   ` Thomas Zimmermann
2026-12-03 17:09     ` Ville Syrjälä [this message]
2026-12-04  8:13       ` Thomas Zimmermann

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=axGiYfUocY3jjzAP@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=javierm@redhat.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=simona@ffwll.ch \
    --cc=tursulin@ursulin.net \
    --cc=tzimmermann@suse.de \
    --cc=ville.syrjala@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.