All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <paulo.r.zanoni@intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 06/11] drm/i915/skl+: Clean up minimum allocations, v2.
Date: Thu, 27 Oct 2016 17:25:26 -0200	[thread overview]
Message-ID: <1477596326.19886.91.camel@intel.com> (raw)
In-Reply-To: <1477489299-25777-7-git-send-email-maarten.lankhorst@linux.intel.com>

Em Qua, 2016-10-26 às 15:41 +0200, Maarten Lankhorst escreveu:
> Move calculating minimum allocations to a helper, which cleans up the
> code some more. The cursor is still allocated in advance because it
> doesn't count towards data rate and should always be reserved.
> 
> changes since v1:
> - Change comment to have a extra opening line. (Matt)
> - Rebase to remove unused plane->pipe == pipe, handled by the
> iterator
>   now. (Paulo)
> 
> Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

> ---
>  drivers/gpu/drm/i915/intel_pm.c | 62 +++++++++++++++++++++++++----
> ------------
>  1 file changed, 38 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pm.c
> b/drivers/gpu/drm/i915/intel_pm.c
> index c2b965d36ead..41953cc41809 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -3364,6 +3364,30 @@ skl_ddb_min_alloc(const struct drm_plane_state
> *pstate,
>  	return DIV_ROUND_UP((4 * src_w * plane_bpp), 512) *
> min_scanlines/4 + 3;
>  }
>  
> +static void
> +skl_ddb_calc_min(const struct intel_crtc_state *cstate, int
> num_active,
> +		 uint16_t *minimum, uint16_t *y_minimum)
> +{
> +	const struct drm_plane_state *pstate;
> +	struct drm_plane *plane;
> +
> +	drm_atomic_crtc_state_for_each_plane_state(plane, pstate,
> &cstate->base) {
> +		struct intel_plane *intel_plane =
> to_intel_plane(plane);
> +		int id = skl_wm_plane_id(intel_plane);
> +
> +		if (id == PLANE_CURSOR)
> +			continue;
> +
> +		if (!pstate->visible)
> +			continue;
> +
> +		minimum[id] = skl_ddb_min_alloc(pstate, 0);
> +		y_minimum[id] = skl_ddb_min_alloc(pstate, 1);
> +	}
> +
> +	minimum[PLANE_CURSOR] = skl_cursor_allocation(num_active);
> +}
> +
>  static int
>  skl_allocate_pipe_ddb(struct intel_crtc_state *cstate,
>  		      struct skl_ddb_allocation *ddb /* out */)
> @@ -3372,12 +3396,9 @@ skl_allocate_pipe_ddb(struct intel_crtc_state
> *cstate,
>  	struct drm_crtc *crtc = cstate->base.crtc;
>  	struct drm_device *dev = crtc->dev;
>  	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> -	struct intel_plane *intel_plane;
> -	struct drm_plane *plane;
> -	const struct drm_plane_state *pstate;
>  	enum pipe pipe = intel_crtc->pipe;
>  	struct skl_ddb_entry *alloc = &cstate->wm.skl.ddb;
> -	uint16_t alloc_size, start, cursor_blocks;
> +	uint16_t alloc_size, start;
>  	uint16_t minimum[I915_MAX_PLANES] = {};
>  	uint16_t y_minimum[I915_MAX_PLANES] = {};
>  	unsigned int total_data_rate;
> @@ -3405,32 +3426,22 @@ skl_allocate_pipe_ddb(struct intel_crtc_state
> *cstate,
>  		return 0;
>  	}
>  
> -	cursor_blocks = skl_cursor_allocation(num_active);
> -	ddb->plane[pipe][PLANE_CURSOR].start = alloc->end -
> cursor_blocks;
> -	ddb->plane[pipe][PLANE_CURSOR].end = alloc->end;
> -
> -	alloc_size -= cursor_blocks;
> -
> -	/* 1. Allocate the mininum required blocks for each active
> plane */
> -	drm_atomic_crtc_state_for_each_plane_state(plane, pstate,
> &cstate->base) {
> -		intel_plane = to_intel_plane(plane);
> -		id = skl_wm_plane_id(intel_plane);
> -
> -		if (!pstate->visible)
> -			continue;
> -
> -		if (plane->type == DRM_PLANE_TYPE_CURSOR)
> -			continue;
> +	skl_ddb_calc_min(cstate, num_active, minimum, y_minimum);
>  
> -		minimum[id] = skl_ddb_min_alloc(pstate, 0);
> -		y_minimum[id] = skl_ddb_min_alloc(pstate, 1);
> -	}
> +	/*
> +	 * 1. Allocate the mininum required blocks for each active
> plane
> +	 * and allocate the cursor, it doesn't require extra
> allocation
> +	 * proportional to the data rate.
> +	 */
>  
> -	for (i = 0; i < PLANE_CURSOR; i++) {
> +	for (i = 0; i < I915_MAX_PLANES; i++) {
>  		alloc_size -= minimum[i];
>  		alloc_size -= y_minimum[i];
>  	}
>  
> +	ddb->plane[pipe][PLANE_CURSOR].start = alloc->end -
> minimum[PLANE_CURSOR];
> +	ddb->plane[pipe][PLANE_CURSOR].end = alloc->end;
> +
>  	/*
>  	 * 2. Distribute the remaining space in proportion to the
> amount of
>  	 * data each plane needs to fetch from memory.
> @@ -3448,6 +3459,9 @@ skl_allocate_pipe_ddb(struct intel_crtc_state
> *cstate,
>  		unsigned int data_rate, y_data_rate;
>  		uint16_t plane_blocks, y_plane_blocks = 0;
>  
> +		if (id == PLANE_CURSOR)
> +			continue;
> +
>  		data_rate = plane_data_rate[id];
>  
>  		/*
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-10-27 19:25 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-26 13:41 [PATCH v2 00/11] drm/i915/gen9+: Atomic watermark fixes Maarten Lankhorst
2016-10-26 13:41 ` [PATCH v2 01/11] drm/i915/skl+: Prepare for removing data rate from skl watermark state, v2 Maarten Lankhorst
2016-10-27  7:12   ` Daniel Vetter
2016-10-27  8:31     ` Maarten Lankhorst
2016-10-27 17:48       ` Paulo Zanoni
2016-10-27 17:55         ` Matt Roper
2016-10-26 13:41 ` [PATCH v2 02/11] drm/i915/gen9+: Use cstate plane mask instead of crtc->state Maarten Lankhorst
2016-10-27 14:50   ` Matt Roper
2016-10-26 13:41 ` [PATCH v2 03/11] drm/i915/gen9+: Use for_each_intel_plane_on_crtc in skl_print_wm_changes Maarten Lankhorst
2016-10-27 13:03   ` Ville Syrjälä
2016-10-27 17:47   ` Matt Roper
2016-10-27 17:57     ` Paulo Zanoni
2016-11-01 11:04       ` [PATCH v2.1 03/11] drm/i915/gen9+: Use for_each_intel_plane_on_crtc in skl_print_wm_changes, v2 Maarten Lankhorst
2016-11-01 12:33         ` Paulo Zanoni
2016-10-26 13:41 ` [PATCH v2 04/11] drm/i915/skl+: Remove data_rate from watermark struct, v2 Maarten Lankhorst
2016-10-27 18:14   ` Paulo Zanoni
2016-10-26 13:41 ` [PATCH v2 05/11] drm/i915/skl+: Remove minimum block allocation from crtc state Maarten Lankhorst
2016-10-26 13:41 ` [PATCH v2 06/11] drm/i915/skl+: Clean up minimum allocations, v2 Maarten Lankhorst
2016-10-27 19:25   ` Paulo Zanoni [this message]
2016-10-26 13:41 ` [PATCH v2 07/11] drm/i915: Add a atomic evasion step to watermark programming, v2 Maarten Lankhorst
2016-10-26 16:19   ` Ville Syrjälä
2016-10-27  7:10     ` Daniel Vetter
2016-10-27 10:37     ` [PATCH v2.1 07/11] drm/i915: Add a atomic evasion step to watermark programming, v3 Maarten Lankhorst
2016-10-26 23:10   ` [PATCH v2 07/11] drm/i915: Add a atomic evasion step to watermark programming, v2 Matt Roper
2016-10-26 13:41 ` [PATCH v2 08/11] drm/i915/gen9+: Use the watermarks from crtc_state for everything, v2 Maarten Lankhorst
2016-10-26 23:13   ` Matt Roper
2016-10-26 13:41 ` [PATCH v2 09/11] drm/i915/gen9+: Program watermarks as a separate step during evasion, v2 Maarten Lankhorst
2016-10-26 16:05   ` Lyude Paul
2016-10-26 23:24   ` Matt Roper
2016-10-27  8:29     ` Maarten Lankhorst
2016-10-27 11:45       ` [PATCH v2.1 09/11] drm/i915/gen9+: Program watermarks as a separate step during evasion, v3 Maarten Lankhorst
2016-10-26 13:41 ` [PATCH v2 10/11] drm/i915/gen9+: Preserve old allocation from crtc_state Maarten Lankhorst
2016-10-26 13:41 ` [PATCH v2 11/11] drm/i915/gen9+: Kill off hw_ddb from intel_crtc Maarten Lankhorst
2016-10-26 14:16 ` ✓ Fi.CI.BAT: success for drm/i915/gen9+: Atomic watermark fixes 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=1477596326.19886.91.camel@intel.com \
    --to=paulo.r.zanoni@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=maarten.lankhorst@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.