All of 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: matthew.d.roper@intel.com, intel-gfx@lists.freedesktop.org,
	ville.syrjala@intel.com
Subject: Re: [Intel-gfx] [PATCH v1 1/2] drm/i915/xe2lpd: check selective fetch is optimal in some cases
Date: Mon, 6 Nov 2023 22:12:04 +0200	[thread overview]
Message-ID: <ZUlIlPtbb-Mmfb3g@intel.com> (raw)
In-Reply-To: <20231102215519.135847-2-vinod.govindapillai@intel.com>

On Thu, Nov 02, 2023 at 11:55:18PM +0200, Vinod Govindapillai wrote:
> If both PSR2 + FBC is supported, in cases where the selective
> fetch area is greater than 25% of the screen area, FBC might
> be more efficient.

"might be more efficient" is a very weak justification.

This sort of stuff would really need to be accompanied by 
some actual power numbers (for some actually reasonable
workloads) to justify the extra complication.

> So have a possibility to check this and add
> provision to enable FBC in such cases.
> 
> Bspec: 68881
> Signed-off-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
> ---
>  .../drm/i915/display/intel_display_types.h    |  1 +
>  drivers/gpu/drm/i915/display/intel_psr.c      | 42 ++++++++++++++++---
>  2 files changed, 38 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
> index 047fe3f8905a..bcc5fd8d8a00 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -1207,6 +1207,7 @@ struct intel_crtc_state {
>  	bool has_psr;
>  	bool has_psr2;
>  	bool enable_psr2_sel_fetch;
> +	bool full_frame_fetch;
>  	bool req_psr2_sdp_prior_scanline;
>  	bool wm_level_disabled;
>  	u32 dc3co_exitline;
> diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
> index ecd24a0b86cb..6cb32fd29d10 100644
> --- a/drivers/gpu/drm/i915/display/intel_psr.c
> +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> @@ -1987,10 +1987,35 @@ static bool psr2_sel_fetch_pipe_state_supported(const struct intel_crtc_state *c
>  	return true;
>  }
>  
> +/*
> + * Check selective fetch is optimum
> + *
> + * Compare selective fetch area w.r.t screen size in case both FBC and PSR2
> + * is supported. If the selective fetch area is more than 25% of screen
> + * size, FBC is might be more efficient than PSR2. So force full frame
> + * update.
> + */
> +static bool psr2_sel_fetch_not_optimal(struct drm_i915_private *i915,
> +				       struct drm_rect *sel_fetch,
> +				       struct drm_rect *src)
> +{
> +	int screen_area, selfetch_area;
> +
> +	/* This is needed where FBC + PSR can be supported */
> +	if (DISPLAY_VER(i915) < 20 || !i915->display.params.enable_fbc ||
> +	    !HAS_FBC(i915))
> +		return false;
> +
> +	selfetch_area = drm_rect_height(sel_fetch) * drm_rect_width(sel_fetch);
> +	screen_area = drm_rect_height(src) * drm_rect_width(src);
> +
> +	return DIV_ROUND_CLOSEST(screen_area, selfetch_area) <= 4;
> +}
> +
>  int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
>  				struct intel_crtc *crtc)
>  {
> -	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
> +	struct drm_i915_private *i915 = to_i915(state->base.dev);
>  	struct intel_crtc_state *crtc_state = intel_atomic_get_new_crtc_state(state, crtc);
>  	struct drm_rect pipe_clip = { .x1 = 0, .y1 = -1, .x2 = INT_MAX, .y2 = -1 };
>  	struct intel_plane_state *new_plane_state, *old_plane_state;
> @@ -2082,7 +2107,7 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
>  	 * calculation for those.
>  	 */
>  	if (pipe_clip.y1 == -1) {
> -		drm_info_once(&dev_priv->drm,
> +		drm_info_once(&i915->drm,
>  			      "Selective fetch area calculation failed in pipe %c\n",
>  			      pipe_name(crtc->pipe));
>  		full_update = true;
> @@ -2092,9 +2117,9 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
>  		goto skip_sel_fetch_set_loop;
>  
>  	/* Wa_14014971492 */
> -	if ((IS_DISPLAY_IP_STEP(dev_priv, IP_VER(14, 0), STEP_A0, STEP_B0) ||
> -	     IS_ALDERLAKE_P(dev_priv) || IS_TIGERLAKE(dev_priv)) &&
> -	    crtc_state->splitter.enable)
> +	if ((IS_DISPLAY_IP_STEP(i915, IP_VER(14, 0), STEP_A0, STEP_B0) ||
> +	     IS_ALDERLAKE_P(i915) || IS_TIGERLAKE(i915)) &&
> +	     crtc_state->splitter.enable)
>  		pipe_clip.y1 = 0;
>  
>  	ret = drm_atomic_add_affected_planes(&state->base, &crtc->base);
> @@ -2149,7 +2174,14 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
>  		}
>  	}
>  
> +	if (full_update)
> +		goto skip_sel_fetch_set_loop;
> +
> +	full_update = psr2_sel_fetch_not_optimal(i915, &pipe_clip,
> +						 &crtc_state->pipe_src);
> +
>  skip_sel_fetch_set_loop:
> +	crtc_state->full_frame_fetch = full_update;
>  	psr2_man_trk_ctl_calc(crtc_state, &pipe_clip, full_update);
>  	return 0;
>  }
> -- 
> 2.34.1

-- 
Ville Syrjälä
Intel

  parent reply	other threads:[~2023-11-06 20:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-02 21:55 [Intel-gfx] [PATCH v1 0/2] drm/i915/xe2lpd: choose between PSR2 and FBC Vinod Govindapillai
2023-11-02 21:55 ` [Intel-gfx] [PATCH v1 1/2] drm/i915/xe2lpd: check selective fetch is optimal in some cases Vinod Govindapillai
2023-11-06 10:31   ` Hogander, Jouni
2023-11-06 20:12   ` Ville Syrjälä [this message]
2023-11-07  9:32     ` Govindapillai, Vinod
2023-11-07 15:48       ` Ville Syrjälä
2023-11-02 21:55 ` [Intel-gfx] [PATCH v1 2/2] drm/i915/xe2lpd: prefer FBC for full frame fetch in PSR2 Vinod Govindapillai
2023-11-03  8:17 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915/xe2lpd: choose between PSR2 and FBC Patchwork
2023-11-03  8:36 ` [Intel-gfx] ✗ Fi.CI.BAT: 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=ZUlIlPtbb-Mmfb3g@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.d.roper@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 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.