Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Vinod Govindapillai <vinod.govindapillai@intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	ville.syrjala@intel.com, santhosh.reddy.guddati@intel.com,
	jani.saarinen@intel.com
Subject: Re: [PATCH v5 4/7] drm/i915/display: update and store the plane damage clips
Date: Tue, 28 Jan 2025 18:14:09 +0200	[thread overview]
Message-ID: <Z5kCUciT96HT6IBI@intel.com> (raw)
In-Reply-To: <20250128155418.305595-5-vinod.govindapillai@intel.com>

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.

> +
>  	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().

> +}
> +
> +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

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2025-01-28 16: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ä [this message]
2025-01-29  9:14     ` Govindapillai, Vinod
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=Z5kCUciT96HT6IBI@intel.com \
    --to=ville.syrjala@linux.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=vinod.govindapillai@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