From: Matt Roper <matthew.d.roper@intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 4/8] drm/i915/skl+: Clean up minimum allocations.
Date: Wed, 19 Oct 2016 15:55:34 -0700 [thread overview]
Message-ID: <20161019225534.GZ19156@intel.com> (raw)
In-Reply-To: <1476278901-15750-5-git-send-email-maarten.lankhorst@linux.intel.com>
On Wed, Oct 12, 2016 at 03:28:17PM +0200, Maarten Lankhorst wrote:
> 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.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
> drivers/gpu/drm/i915/intel_pm.c | 66 ++++++++++++++++++++++++-----------------
> 1 file changed, 39 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 83c1b0acef38..45fb8275abea 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -3342,6 +3342,32 @@ 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;
> + enum pipe pipe = to_intel_crtc(cstate->base.crtc)->pipe;
> +
> + 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 (intel_plane->pipe != pipe ||
> + 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 */)
> @@ -3350,12 +3376,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;
> @@ -3384,35 +3407,21 @@ 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 (intel_plane->pipe != pipe)
> - continue;
> -
> - if (!pstate->visible)
> - continue;
> + skl_ddb_calc_min(cstate, num_active, minimum, y_minimum);
>
> - if (plane->type == DRM_PLANE_TYPE_CURSOR)
> - continue;
> -
> - 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
Minor style nitpick; different multi-line comment format than we
typically use (and that we use for #2 below).
Otherwise,
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
> + * 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.
> @@ -3428,6 +3437,9 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate,
> unsigned rate;
> uint16_t plane_blocks, y_plane_blocks = 0;
>
> + if (id == PLANE_CURSOR)
> + continue;
> +
> rate = data_rate[id];
>
> /*
> --
> 2.7.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Matt Roper
Graphics Software Engineer
IoTG Platform Enabling & Development
Intel Corporation
(916) 356-2795
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-10-19 22:55 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-12 13:28 [PATCH 0/8] drm/i915/gen9+: Atomic wm fixes Maarten Lankhorst
2016-10-12 13:28 ` [PATCH 1/8] drm/i915/skl+: Prepare for removing data rate from skl watermark state Maarten Lankhorst
2016-10-19 22:13 ` Matt Roper
2016-10-20 8:14 ` Maarten Lankhorst
2016-10-20 13:11 ` Paulo Zanoni
2016-10-24 7:00 ` Maarten Lankhorst
2016-10-12 13:28 ` [PATCH 2/8] drm/i915/skl+: Remove data_rate from watermark struct Maarten Lankhorst
2016-10-19 22:13 ` Matt Roper
2016-10-20 17:18 ` Paulo Zanoni
2016-10-20 17:20 ` Paulo Zanoni
2016-10-24 7:09 ` Maarten Lankhorst
2016-10-12 13:28 ` [PATCH 3/8] drm/i915/skl+: Remove minimum block allocation from crtc state Maarten Lankhorst
2016-10-19 22:13 ` Matt Roper
2016-10-20 17:24 ` Paulo Zanoni
2016-10-12 13:28 ` [PATCH 4/8] drm/i915/skl+: Clean up minimum allocations Maarten Lankhorst
2016-10-19 22:55 ` Matt Roper [this message]
2016-10-20 17:36 ` Paulo Zanoni
2016-10-12 13:28 ` [PATCH 5/8] drm/i915: Add a atomic evasion step to watermark programming Maarten Lankhorst
2016-10-19 23:15 ` Matt Roper
2016-10-19 23:26 ` Matt Roper
2016-10-20 6:05 ` Maarten Lankhorst
2016-10-20 17:51 ` Paulo Zanoni
2016-10-24 7:13 ` Maarten Lankhorst
2016-10-12 13:28 ` [PATCH 6/8] drm/i915/gen9+: Use the watermarks from crtc_state for everything Maarten Lankhorst
2016-10-20 17:55 ` Matt Roper
2016-10-20 17:59 ` Paulo Zanoni
2016-10-12 13:28 ` [PATCH 7/8] drm/i915/gen9+: Program watermarks as a separate step during evasion Maarten Lankhorst
2016-10-12 17:03 ` Lyude
2016-10-12 17:04 ` Lyude
2016-10-12 17:15 ` Lyude
2016-10-13 7:26 ` Maarten Lankhorst
2016-10-20 18:35 ` Matt Roper
2016-10-24 8:59 ` Maarten Lankhorst
2016-10-20 21:57 ` Matt Roper
2016-11-01 8:38 ` Maarten Lankhorst
2016-10-12 13:28 ` [PATCH 8/8] drm/i915/gen9+: Preserve old allocation from crtc_state Maarten Lankhorst
2016-10-20 22:09 ` Matt Roper
2016-10-24 8:49 ` Maarten Lankhorst
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=20161019225534.GZ19156@intel.com \
--to=matthew.d.roper@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).