[PATCH v7 2/7] drm/i915/xe3: update and store the plane damage clips

Ville Syrjälä ville.syrjala at linux.intel.com
Wed Feb 12 20:42:17 UTC 2025


On Wed, Feb 12, 2025 at 08:14:12PM +0000, Govindapillai, Vinod wrote:
> On Wed, 2025-02-12 at 20:35 +0200, Ville Syrjälä wrote:
> > On Wed, Feb 12, 2025 at 03:14:15PM +0200, Vinod Govindapillai wrote:
> > > Userspace can pass damage area clips per plane to track
> > > changes in a plane and some display components can utilze
> > > these damage clips for efficiently handling use cases like
> > > FBC, PSR etc. A merged damage area is generated and its
> > > coordinates are updated relative to viewport and HW and
> > > stored in the plane_state. This merged damage areas will be
> > > used for FBC dirty rect support in xe3 in the follow-up
> > > patch.
> > > 
> > > Big thanks to Ville Syrjala for his contribuitions in shaping
> > > up of this series.
> > > 
> > > v1: - Move damage_merged helper to cover bigjoiner case and use
> > >     the correct plane state for damage find helper (Ville)
> > >     - Damage handling code under HAS_FBC_DIRTY_RECT() so the
> > >     the related part will be executed only for xe3+
> > >     - Changed dev_priv to i915 in one of the functions
> > > 
> > > v2: - damage reported is stored in the plane state after coords
> > >       adjustmentments irrespective of fbc dirty rect support.
> > >     - Damage to be empty in case of plane not visible (Ville)
> > >     - Handle fb could be NULL and plane not visible cases (Ville)
> > > 
> > > Signed-off-by: Vinod Govindapillai <vinod.govindapillai at intel.com>
> > > ---
> > >  .../gpu/drm/i915/display/intel_atomic_plane.c | 31 +++++++++++++
> > >  .../drm/i915/display/intel_display_types.h    |  2 +
> > >  .../drm/i915/display/skl_universal_plane.c    | 46 ++++++++++++++++++-
> > >  3 files changed, 78 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> > > b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> > > index 8a49d87d9bd9..b4e94dd01173 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> > > @@ -36,6 +36,7 @@
> > >  
> > >  #include <drm/drm_atomic_helper.h>
> > >  #include <drm/drm_blend.h>
> > > +#include <drm/drm_damage_helper.h>
> > >  #include <drm/drm_fourcc.h>
> > >  #include <drm/drm_gem.h>
> > >  #include <drm/drm_gem_atomic_helper.h>
> > > @@ -117,6 +118,7 @@ intel_plane_duplicate_state(struct drm_plane *plane)
> > >  	intel_state->ggtt_vma = NULL;
> > >  	intel_state->dpt_vma = NULL;
> > >  	intel_state->flags = 0;
> > > +	intel_state->damage = DRM_RECT_INIT(0, 0, 0, 0);
> > >  
> > >  	/* add reference to fb */
> > >  	if (intel_state->hw.fb)
> > > @@ -322,6 +324,27 @@ static void intel_plane_clear_hw_state(struct intel_plane_state
> > > *plane_state)
> > >  	memset(&plane_state->hw, 0, sizeof(plane_state->hw));
> > >  }
> > >  
> > > +static void
> > > +intel_plane_copy_uapi_plane_damage(struct intel_plane_state *new_plane_state,
> > > +				   const struct intel_plane_state *old_uapi_plane_state,
> > > +				   const struct intel_plane_state *new_uapi_plane_state)
> > > +{
> > > +	struct intel_display *display = to_intel_display(new_plane_state);
> > > +	struct drm_rect *damage = &new_plane_state->damage;
> > > +
> > > +	/* damage property tracking enabled from display version 12 onwards */
> > > +	if (DISPLAY_VER(display) < 12) {
> > > +		*damage = DRM_RECT_INIT(0, 0, 0, 0);
> > > +		return;
> > > +	}
> > 
> > I don't think that is needed. If we have no damage prop then the helper
> > will give us full damage.
> 
> We do this drm_plane_enable_fb_damage_clips from from display version 12 onwards.
> 
> 	if (DISPLAY_VER(display) >= 12)
> 		drm_plane_enable_fb_damage_clips(&plane->base);
> 
> There will be a dmesg warn if we call that damage helper without the enable_fb_damage_clips
> 
> "4> [44.199485] i915 0000:00:02.0: [drm] drm_plane_enable_fb_damage_clips() not called"

Sigh. This "helper" is even worse than I thought. I think we
should just roll our own. But I guess we can live with the platform
check for now. You should be able to drop the RECT_INIT though since
the rectagle will be empty already anyway.

-- 
Ville Syrjälä
Intel


More information about the dri-devel mailing list