Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Govindapillai, Vinod" <vinod.govindapillai@intel.com>
To: "ville.syrjala@linux.intel.com" <ville.syrjala@linux.intel.com>
Cc: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
	"Saarinen, Jani" <jani.saarinen@intel.com>,
	"Reddy Guddati, Santhosh" <santhosh.reddy.guddati@intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"Syrjala, Ville" <ville.syrjala@intel.com>
Subject: Re: [PATCH v5 4/7] drm/i915/display: update and store the plane damage clips
Date: Wed, 29 Jan 2025 09:14:43 +0000	[thread overview]
Message-ID: <9c32af64eb275c58250da2674289fbff6301c135.camel@intel.com> (raw)
In-Reply-To: <Z5kCUciT96HT6IBI@intel.com>

On Tue, 2025-01-28 at 18:14 +0200, Ville Syrjälä wrote:
> On Tue, Jan 28, 2025 at 05:54: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.
> > 
> > Signed-off-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
> > ---
> >  .../gpu/drm/i915/display/intel_atomic_plane.c |  5 ++
> >  .../drm/i915/display/intel_display_types.h    |  2 +
> >  .../drm/i915/display/skl_universal_plane.c    | 47 +++++++++++++++++++
> >  3 files changed, 54 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> > b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> > index 8da7ee13447c..3d463cfe1f3c 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>
> > @@ -713,6 +714,10 @@ int intel_plane_atomic_check(struct intel_atomic_state *state,
> >  					  new_primary_crtc_plane_state,
> >  					  crtc);
> >  
> > +	/* Verify plane damage - damage discarded on full modeset */
> > +	drm_atomic_helper_check_plane_damage(&state->base,
> > +					     &new_plane_state->uapi);
> 
> That guy doesn't seem to do anything that we want.

Hi Ville,

Thanks your time in reviewing this!!

Okay. I thought this will cause the damage_help return the whole region in case of a full modeset.

> 
> > +
> >  	new_plane_state->uapi.visible = false;
> >  	if (!new_crtc_state)
> >  		return 0;
> > diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h
> > b/drivers/gpu/drm/i915/display/intel_display_types.h
> > index bc65c4bd9dc0..495c497645c0 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> > +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> > @@ -695,6 +695,8 @@ struct intel_plane_state {
> >  	u64 ccval;
> >  
> >  	const char *no_fbc_reason;
> > +
> > +	struct drm_rect damage_merged;
> >  };
> >  
> >  struct intel_initial_plane_config {
> > diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c
> > b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> > index 8d09a1f8c3e1..fc5b9d56c8bc 100644
> > --- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
> > +++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> > @@ -2249,6 +2249,47 @@ static void check_protection(struct intel_plane_state *plane_state)
> >  		!plane_state->decrypt;
> >  }
> >  
> > +static void
> > +skl_plane_check_plane_damage(const struct intel_plane_state *old_plane_state,
> > +			     struct intel_plane_state *new_plane_state)
> > +{
> > +	struct drm_rect *damage_merged = &new_plane_state->damage_merged;
> > +
> > +	drm_atomic_helper_damage_merged(&old_plane_state->uapi,
> > +					&new_plane_state->uapi,
> > +					damage_merged);
> 
> You're calling that too late. With bigjoiner it's now going to
> use the uapi state from the wrong plane. This thing needs to be
> done in intel_plane_copy_uapi_to_hw_state().

Ok. So I have to get and store the damage_merged before the copy.
You mentioned that to be done inside intel_plane_copy_uapi_to_hw_state()! Any specific reason? The
reason I am asking this is because, the drm_atomic_helper_damage_merged() expects old_plane_state as
a mean to check the rect changes and returns full region as damaged in case of src rect is not equal
between old and new plane states. So wondering if I need to pass the old_plane_state to
intel_plane_copy_uapi_to_hw_state()?

And then just wanted to double check that the rest of the coordinate conversions you suggested
earlier stays as it is in case of bigjoiner?

If the plane_state is not visible, drm_atomic_helper_damage_merged() return false. You mentioned
before that we might need a state variable to track the validity of the damage_merged and update the
FBC dirty_rect  registers only if it is valid. So fare in my trials all the case where we end up in
atomic_commit_tail->fbc_dirty_rect upadte->page_flip, usually ends up having valid damage_merged
coordinates. Do you see any other cases and suggest to have such state variable required?

Thanks
Vinod

> 
> > +}
> > +
> > +static void
> > +skl_plane_check_damage_with_viewport(struct intel_plane_state *plane_state)
> > +{
> > +	struct drm_rect *damage_merged = &plane_state->damage_merged;
> > +	const struct drm_framebuffer *fb = plane_state->hw.fb;
> > +	unsigned int rotation = plane_state->hw.rotation;
> > +	struct drm_rect *src = &plane_state->uapi.src;
> > +
> > +	if (drm_rotation_90_or_270(rotation)) {
> > +		drm_rect_rotate(damage_merged, fb->width, fb->height,
> > +				DRM_MODE_ROTATE_270);
> > +		drm_rect_translate(damage_merged, -(src->y1 >> 16),
> > +				   -(src->x1 >> 16));
> > +	} else {
> > +		drm_rect_translate(damage_merged, -(src->x1 >> 16),
> > +				   -(src->y1 >> 16));
> > +	}
> > +}
> > +
> > +static void
> > +skl_plane_check_damage_with_plane_surf(struct intel_plane_state *plane_state)
> > +{
> > +	struct drm_rect *damage_merged = &plane_state->damage_merged;
> > +	struct drm_rect src;
> > +
> > +	drm_rect_fp_to_int(&src, &plane_state->uapi.src);
> > +	drm_rect_translate(damage_merged, src.x1, src.y1);
> > +	drm_rect_intersect(damage_merged, &src);
> > +}
> > +
> >  static int skl_plane_check(struct intel_crtc_state *crtc_state,
> >  			   const struct intel_plane_state *old_plane_state,
> >  			   struct intel_plane_state *plane_state)
> > @@ -2275,6 +2316,10 @@ static int skl_plane_check(struct intel_crtc_state *crtc_state,
> >  	if (ret)
> >  		return ret;
> >  
> > +	skl_plane_check_plane_damage(old_plane_state, plane_state);
> > +
> > +	skl_plane_check_damage_with_viewport(plane_state);
> > +
> >  	ret = skl_check_plane_surface(plane_state);
> >  	if (ret)
> >  		return ret;
> > @@ -2290,6 +2335,8 @@ static int skl_plane_check(struct intel_crtc_state *crtc_state,
> >  	if (ret)
> >  		return ret;
> >  
> > +	skl_plane_check_damage_with_plane_surf(plane_state);
> > +
> >  	ret = skl_plane_check_nv12_rotation(plane_state);
> >  	if (ret)
> >  		return ret;
> > -- 
> > 2.43.0
> 


  reply	other threads:[~2025-01-29  9:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-28 15:54 [PATCH v5 0/7] drm/i915/xe3: FBC Dirty rect feature support Vinod Govindapillai
2025-01-28 15:54 ` [PATCH v5 1/7] drm/i915/xe3: add register definitions for fbc dirty rect support Vinod Govindapillai
2025-01-28 15:54 ` [PATCH v5 2/7] drm/i915/xe3: introduce HAS_FBC_DIRTY_RECT() for FBC " Vinod Govindapillai
2025-01-28 15:54 ` [PATCH v5 3/7] drm/i915/display: get old_plane_state to the check_plane routine Vinod Govindapillai
2025-01-28 15:54 ` [PATCH v5 4/7] drm/i915/display: update and store the plane damage clips Vinod Govindapillai
2025-01-28 16:14   ` Ville Syrjälä
2025-01-29  9:14     ` Govindapillai, Vinod [this message]
2025-01-28 15:54 ` [PATCH v5 5/7] drm/i915/xe3: avoid calling fbc activate if fbc is active Vinod Govindapillai
2025-01-28 15:54 ` [PATCH v5 6/7] drm/i915/xe3: dirty rect support for FBC Vinod Govindapillai
2025-01-28 15:54 ` [PATCH v5 7/7] drm/i915/xe3: disable FBC if PSR2 selective fetch is enabled Vinod Govindapillai
2025-01-28 17:27 ` ✓ CI.Patch_applied: success for drm/i915/xe3: FBC Dirty rect feature support (rev6) Patchwork
2025-01-28 17:27 ` ✗ CI.checkpatch: warning " Patchwork
2025-01-28 17:28 ` ✓ CI.KUnit: success " Patchwork
2025-01-28 17:45 ` ✓ CI.Build: " Patchwork
2025-01-28 17:47 ` ✗ CI.Hooks: failure " Patchwork
2025-01-28 17:48 ` ✗ CI.checksparse: warning " Patchwork
2025-01-28 18:11 ` ✓ Xe.CI.BAT: success " Patchwork
2025-01-29  6:38 ` ✗ Xe.CI.Full: failure " Patchwork

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=9c32af64eb275c58250da2674289fbff6301c135.camel@intel.com \
    --to=vinod.govindapillai@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.saarinen@intel.com \
    --cc=santhosh.reddy.guddati@intel.com \
    --cc=ville.syrjala@intel.com \
    --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