All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <paulo.r.zanoni@intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 07/11] drm/i915: move ddb_blocks to be a watermark parameter
Date: Mon, 22 Oct 2018 15:29:22 -0700	[thread overview]
Message-ID: <1540247362.2734.36.camel@intel.com> (raw)
In-Reply-To: <20181018134104.GB9144@intel.com>

Em Qui, 2018-10-18 às 16:41 +0300, Ville Syrjälä escreveu:
> On Tue, Oct 16, 2018 at 03:01:29PM -0700, Paulo Zanoni wrote:
> > The goal of struct skl_wm_params is to cache every watermark
> > parameter so the other functions can just use them without worrying
> > about the appropriate place to fetch each parameter requested by
> > the
> > spec, and without having to recompute parameters that are used in
> > different steps of the calculation.
> > 
> > The ddb_blocks parameter is one that is used by both the the plane
> > watermarks and the transition watermarks. Move ddb_blocks to the
> > parameter struct so we can simplify the code.
> > 
> > Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_drv.h |  1 +
> >  drivers/gpu/drm/i915/intel_pm.c | 44 ++++++++++++++++-------------
> > ------------
> >  2 files changed, 18 insertions(+), 27 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h
> > b/drivers/gpu/drm/i915/i915_drv.h
> > index 4b1e8471609b..b32d680d9bf0 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -1255,6 +1255,7 @@ struct skl_wm_params {
> >  	bool rc_surface;
> >  	bool is_planar;
> >  	uint32_t width;
> > +	uint16_t ddb_blocks;
> >  	uint8_t cpp;
> >  	uint32_t plane_pixel_rate;
> >  	uint32_t y_min_scanlines;
> > diff --git a/drivers/gpu/drm/i915/intel_pm.c
> > b/drivers/gpu/drm/i915/intel_pm.c
> > index f388bfa99a97..4053f4a68657 100644
> > --- a/drivers/gpu/drm/i915/intel_pm.c
> > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > @@ -4522,11 +4522,13 @@ static int
> >  skl_compute_plane_wm_params(const struct drm_i915_private
> > *dev_priv,
> >  			    struct intel_crtc_state *cstate,
> >  			    const struct intel_plane_state
> > *intel_pstate,
> > +			    const struct skl_ddb_allocation *ddb,
> >  			    struct skl_wm_params *wp, int
> > plane_id)
> >  {
> >  	struct intel_plane *plane = to_intel_plane(intel_pstate-
> > >base.plane);
> >  	const struct drm_plane_state *pstate = &intel_pstate-
> > >base;
> >  	const struct drm_framebuffer *fb = pstate->fb;
> > +	enum pipe pipe = to_intel_crtc(cstate->base.crtc)->pipe;
> >  	uint32_t interm_pbpl;
> >  	struct intel_atomic_state *state =
> >  		to_intel_atomic_state(cstate->base.state);
> > @@ -4624,13 +4626,16 @@ skl_compute_plane_wm_params(const struct
> > drm_i915_private *dev_priv,
> >  	wp->linetime_us = fixed16_to_u32_round_up(
> >  					intel_get_linetime_us(csta
> > te));
> >  
> > +	wp->ddb_blocks = plane_id ?
> 
> Ugh. That 'plane_id' really should be renamed to something else.
> 'color_plane' would be the newfangled name I started to use
> elsewhere.

I completely agree: there's plane_id and plane->id and they mean
different things.

If you're already using color_plane I can totally go with it so we have
consistency. But, well, for RGB planes, plane 0 does contain color
information... But can I suggest us to use "subplane" terminology when
talking about the planes of a plane? What about subplane_index?
Something that does not use the word "plane" is probably better.

> 
> Patch looks good to me.
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> > +		     skl_ddb_entry_size(&ddb-
> > >uv_plane[pipe][plane->id]) :
> > +		     skl_ddb_entry_size(&ddb->plane[pipe][plane-
> > >id]);
> > +
> >  	return 0;
> >  }
> >  
> >  static int skl_compute_plane_wm(const struct drm_i915_private
> > *dev_priv,
> >  				struct intel_crtc_state *cstate,
> >  				const struct intel_plane_state
> > *intel_pstate,
> > -				uint16_t ddb_allocation,
> >  				int level,
> >  				const struct skl_wm_params *wp,
> >  				const struct skl_wm_level
> > *result_prev,
> > @@ -4674,7 +4679,7 @@ static int skl_compute_plane_wm(const struct
> > drm_i915_private *dev_priv,
> >  		     wp->dbuf_block_size < 1) &&
> >  		     (wp->plane_bytes_per_line / wp-
> > >dbuf_block_size < 1)) {
> >  			selected_result = method2;
> > -		} else if (ddb_allocation >=
> > +		} else if (wp->ddb_blocks >=
> >  			 fixed16_to_u32_round_up(wp-
> > >plane_blocks_per_line)) {
> >  			if (INTEL_GEN(dev_priv) == 9 &&
> >  			    !IS_GEMINILAKE(dev_priv))
> > @@ -4747,8 +4752,8 @@ static int skl_compute_plane_wm(const struct
> > drm_i915_private *dev_priv,
> >  	}
> >  
> >  	if ((level > 0 && res_lines > 31) ||
> > -	    res_blocks >= ddb_allocation ||
> > -	    min_disp_buf_needed >= ddb_allocation) {
> > +	    res_blocks >= wp->ddb_blocks ||
> > +	    min_disp_buf_needed >= wp->ddb_blocks) {
> >  		result->plane_en = false;
> >  
> >  		/*
> > @@ -4763,7 +4768,7 @@ static int skl_compute_plane_wm(const struct
> > drm_i915_private *dev_priv,
> >  			DRM_DEBUG_KMS("Requested display
> > configuration exceeds system watermark limitations\n");
> >  			DRM_DEBUG_KMS("[PLANE:%d:%s] blocks
> > required = %u/%u, lines required = %u/31\n",
> >  				      plane->base.id, plane->name,
> > -				      res_blocks, ddb_allocation,
> > res_lines);
> > +				      res_blocks, wp->ddb_blocks,
> > res_lines);
> >  			return -EINVAL;
> >  		}
> >  	}
> > @@ -4789,26 +4794,15 @@ static int skl_compute_plane_wm(const
> > struct drm_i915_private *dev_priv,
> >  
> >  static int
> >  skl_compute_wm_levels(const struct drm_i915_private *dev_priv,
> > -		      struct skl_ddb_allocation *ddb,
> >  		      struct intel_crtc_state *cstate,
> >  		      const struct intel_plane_state
> > *intel_pstate,
> >  		      const struct skl_wm_params *wm_params,
> >  		      struct skl_plane_wm *wm,
> >  		      int plane_id)
> >  {
> > -	struct intel_crtc *intel_crtc = to_intel_crtc(cstate-
> > >base.crtc);
> > -	struct drm_plane *plane = intel_pstate->base.plane;
> > -	struct intel_plane *intel_plane = to_intel_plane(plane);
> > -	uint16_t ddb_blocks;
> > -	enum pipe pipe = intel_crtc->pipe;
> >  	int level, max_level = ilk_wm_max_level(dev_priv);
> > -	enum plane_id intel_plane_id = intel_plane->id;
> >  	int ret;
> >  
> > -	ddb_blocks = plane_id ?
> > -		     skl_ddb_entry_size(&ddb-
> > >uv_plane[pipe][intel_plane_id]) :
> > -		     skl_ddb_entry_size(&ddb-
> > >plane[pipe][intel_plane_id]);
> > -
> >  	for (level = 0; level <= max_level; level++) {
> >  		struct skl_wm_level *result = plane_id ? &wm-
> > >uv_wm[level] :
> >  							  &wm-
> > >wm[level];
> > @@ -4823,7 +4817,6 @@ skl_compute_wm_levels(const struct
> > drm_i915_private *dev_priv,
> >  		ret = skl_compute_plane_wm(dev_priv,
> >  					   cstate,
> >  					   intel_pstate,
> > -					   ddb_blocks,
> >  					   level,
> >  					   wm_params,
> >  					   result_prev,
> > @@ -4863,7 +4856,6 @@ skl_compute_linetime_wm(struct
> > intel_crtc_state *cstate)
> >  static void skl_compute_transition_wm(struct intel_crtc_state
> > *cstate,
> >  				      struct skl_wm_params *wp,
> >  				      struct skl_wm_level *wm_l0,
> > -				      uint16_t ddb_allocation,
> >  				      struct skl_wm_level
> > *trans_wm /* out */)
> >  {
> >  	struct drm_device *dev = cstate->base.crtc->dev;
> > @@ -4914,7 +4906,7 @@ static void skl_compute_transition_wm(struct
> > intel_crtc_state *cstate,
> >  
> >  	res_blocks += 1;
> >  
> > -	if (res_blocks < ddb_allocation) {
> > +	if (res_blocks < wp->ddb_blocks) {
> >  		trans_wm->plane_res_b = res_blocks;
> >  		trans_wm->plane_en = true;
> >  		return;
> > @@ -4947,37 +4939,35 @@ static int skl_build_pipe_wm(struct
> > intel_crtc_state *cstate,
> >  						to_intel_plane_sta
> > te(pstate);
> >  		enum plane_id plane_id = to_intel_plane(plane)-
> > >id;
> >  		struct skl_wm_params wm_params;
> > -		enum pipe pipe = to_intel_crtc(cstate->base.crtc)-
> > >pipe;
> > -		uint16_t ddb_blocks;
> >  
> >  		wm = &pipe_wm->planes[plane_id];
> > -		ddb_blocks = skl_ddb_entry_size(&ddb-
> > >plane[pipe][plane_id]);
> >  
> >  		ret = skl_compute_plane_wm_params(dev_priv,
> > cstate,
> > -						  intel_pstate,
> > &wm_params, 0);
> > +						  intel_pstate,
> > ddb,
> > +						  &wm_params, 0);
> >  		if (ret)
> >  			return ret;
> >  
> >  		if (!wm_params.plane_visible)
> >  			continue;
> >  
> > -		ret = skl_compute_wm_levels(dev_priv, ddb, cstate,
> > +		ret = skl_compute_wm_levels(dev_priv, cstate,
> >  					    intel_pstate,
> > &wm_params, wm, 0);
> >  		if (ret)
> >  			return ret;
> >  
> >  		skl_compute_transition_wm(cstate, &wm_params, &wm-
> > >wm[0],
> > -					  ddb_blocks, &wm-
> > >trans_wm);
> > +					  &wm->trans_wm);
> >  
> >  		/* uv plane watermarks must also be validated for
> > NV12/Planar */
> >  		if (wm_params.is_planar) {
> >  			ret =
> > skl_compute_plane_wm_params(dev_priv, cstate,
> > -							  intel_ps
> > tate,
> > +							  intel_ps
> > tate, ddb,
> >  							  &wm_para
> > ms, 1);
> >  			if (ret)
> >  				return ret;
> >  
> > -			ret = skl_compute_wm_levels(dev_priv, ddb,
> > cstate,
> > +			ret = skl_compute_wm_levels(dev_priv,
> > cstate,
> >  						    intel_pstate,
> > &wm_params,
> >  						    wm, 1);
> >  			if (ret)
> > -- 
> > 2.14.4
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-10-22 22:29 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-16 22:01 [PATCH 00/11] More watermarks improvements Paulo Zanoni
2018-10-16 22:01 ` [PATCH 01/11] drm/i915: don't apply Display WAs 1125 and 1126 to GLK/CNL+ Paulo Zanoni
2018-10-18 13:14   ` Ville Syrjälä
2018-10-22 23:32     ` Paulo Zanoni
2018-10-22 23:55       ` Rodrigo Vivi
2018-10-23  0:12         ` Paulo Zanoni
2018-10-23  0:18           ` Rodrigo Vivi
2018-10-23  7:30             ` Jani Nikula
2018-10-26  0:43               ` Rodrigo Vivi
2018-11-09  0:50       ` [PATCH] " Paulo Zanoni
2018-10-16 22:01 ` [PATCH 02/11] drm/i915: remove padding from struct skl_wm_level Paulo Zanoni
2018-10-16 23:00   ` Lucas De Marchi
2018-10-16 22:01 ` [PATCH 03/11] drm/i915: fix handling of invisible planes in watermarks code Paulo Zanoni
2018-10-18 13:28   ` Ville Syrjälä
2018-10-16 22:01 ` [PATCH 04/11] drm/i915: remove useless memset() for watermarks parameters Paulo Zanoni
2018-10-18 13:31   ` Ville Syrjälä
2018-10-16 22:01 ` [PATCH 05/11] drm/i915: simplify wm->is_planar assignment Paulo Zanoni
2018-10-18 13:34   ` Ville Syrjälä
2018-10-16 22:01 ` [PATCH 06/11] drm/i915: refactor skl_write_plane_wm() Paulo Zanoni
2018-10-18 13:36   ` Ville Syrjälä
2018-10-16 22:01 ` [PATCH 07/11] drm/i915: move ddb_blocks to be a watermark parameter Paulo Zanoni
2018-10-18 13:41   ` Ville Syrjälä
2018-10-22 22:29     ` Paulo Zanoni [this message]
2018-10-23 12:07       ` Ville Syrjälä
2018-10-16 22:01 ` [PATCH 08/11] drm/i915: reorganize the error message for invalid watermarks Paulo Zanoni
2018-10-18 13:55   ` Ville Syrjälä
2018-10-18 16:18     ` Ville Syrjälä
2018-10-22 22:22     ` Paulo Zanoni
2018-10-23 12:02       ` Ville Syrjälä
2018-10-16 22:01 ` [PATCH 09/11] drm/i915: make skl_needs_memory_bw_wa() take dev_priv instead of state Paulo Zanoni
2018-10-18 14:02   ` Ville Syrjälä
2018-10-16 22:01 ` [PATCH 10/11] drm/i915: add pipe_htotal to struct skl_wm_params Paulo Zanoni
2018-10-18 14:14   ` Ville Syrjälä
2018-10-16 22:01 ` [PATCH 11/11] drm/i915: pass dev_priv instead of cstate to skl_compute_transition_wm() Paulo Zanoni
2018-10-18 14:20   ` Ville Syrjälä
2018-10-16 22:21 ` ✗ Fi.CI.CHECKPATCH: warning for More watermarks improvements Patchwork
2018-10-16 22:31   ` Paulo Zanoni
2018-10-16 22:25 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-10-16 22:39 ` ✗ Fi.CI.BAT: failure " Patchwork
2018-10-16 22:52   ` Paulo Zanoni
2018-10-18 14:34     ` Saarinen, Jani
2018-10-23  0:09 ` ✓ Fi.CI.BAT: success " Patchwork
2018-10-23  1:41 ` ✓ Fi.CI.IGT: " Patchwork
2018-11-09  1:28 ` ✗ Fi.CI.BAT: failure for More watermarks improvements (rev2) 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=1540247362.2734.36.camel@intel.com \
    --to=paulo.r.zanoni@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --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 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.