From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Damien Lespiau <damien.lespiau@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/8] drm/i915/skl: Make 'end' of the DDB allocation entry exclusive
Date: Wed, 29 Oct 2014 17:32:53 +0200 [thread overview]
Message-ID: <20141029153253.GK4284@intel.com> (raw)
In-Reply-To: <1413304266-32127-2-git-send-email-damien.lespiau@intel.com>
On Tue, Oct 14, 2014 at 05:30:59PM +0100, Damien Lespiau wrote:
> Ville suggested that we should use the same semantics as C arrays to
> reduce the number of those pesky +1/-1 in the allocation code.
>
> This patch leaves the debugfs file as is, showing the internal DDB
> allocation structure, not the values written in the registers.
>
> Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
> drivers/gpu/drm/i915/i915_drv.h | 4 ++--
> drivers/gpu/drm/i915/intel_pm.c | 28 +++++++++++++++++++---------
> 2 files changed, 21 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 14be1dc..0320698 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1414,7 +1414,7 @@ struct ilk_wm_values {
> };
>
> struct skl_ddb_entry {
> - uint16_t start, end; /* in number of blocks */
> + uint16_t start, end; /* in number of blocks, 'end' is exclusive */
> };
>
> static inline uint16_t skl_ddb_entry_size(const struct skl_ddb_entry *entry)
> @@ -1423,7 +1423,7 @@ static inline uint16_t skl_ddb_entry_size(const struct skl_ddb_entry *entry)
> if (entry->end == 0)
> return 0;
We can now drop the special case for end==0. The rest looks good so
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> - return entry->end - entry->start + 1;
> + return entry->end - entry->start;
> }
>
> static inline bool skl_ddb_entry_equal(const struct skl_ddb_entry *e1,
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 2a41ae8..016b54e 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -3038,7 +3038,7 @@ skl_ddb_get_pipe_allocation_limits(struct drm_device *dev,
>
> pipe_size = ddb_size / config->num_pipes_active;
> alloc->start = nth_active_pipe * ddb_size / config->num_pipes_active;
> - alloc->end = alloc->start + pipe_size - 1;
> + alloc->end = alloc->start + pipe_size;
> }
>
> static unsigned int skl_cursor_allocation(const struct intel_wm_config *config)
> @@ -3053,6 +3053,8 @@ static void skl_ddb_entry_init_from_hw(struct skl_ddb_entry *entry, u32 reg)
> {
> entry->start = reg & 0x3ff;
> entry->end = (reg >> 16) & 0x3ff;
> + if (entry->end)
> + entry->end += 1;
> }
>
> void skl_ddb_get_hw_state(struct drm_i915_private *dev_priv,
> @@ -3129,7 +3131,7 @@ skl_allocate_pipe_ddb(struct drm_crtc *crtc,
> }
>
> cursor_blocks = skl_cursor_allocation(config);
> - ddb->cursor[pipe].start = alloc.end - cursor_blocks + 1;
> + ddb->cursor[pipe].start = alloc.end - cursor_blocks;
> ddb->cursor[pipe].end = alloc.end;
>
> alloc_size -= cursor_blocks;
> @@ -3163,7 +3165,7 @@ skl_allocate_pipe_ddb(struct drm_crtc *crtc,
> total_data_rate);
>
> ddb->plane[pipe][plane].start = start;
> - ddb->plane[pipe][plane].end = start + plane_blocks - 1;
> + ddb->plane[pipe][plane].end = start + plane_blocks;
>
> start += plane_blocks;
> }
> @@ -3467,6 +3469,15 @@ static void skl_compute_wm_results(struct drm_device *dev,
> r->wm_linetime[pipe] = p_wm->linetime;
> }
>
> +static void skl_ddb_entry_write(struct drm_i915_private *dev_priv, uint32_t reg,
> + const struct skl_ddb_entry *entry)
> +{
> + if (entry->end)
> + I915_WRITE(reg, (entry->end - 1) << 16 | entry->start);
> + else
> + I915_WRITE(reg, 0);
> +}
> +
> static void skl_write_wm_values(struct drm_i915_private *dev_priv,
> const struct skl_wm_values *new)
> {
> @@ -3494,13 +3505,12 @@ static void skl_write_wm_values(struct drm_i915_private *dev_priv,
> I915_WRITE(CUR_WM_TRANS(pipe), new->cursor_trans[pipe]);
>
> for (i = 0; i < intel_num_planes(crtc); i++)
> - I915_WRITE(PLANE_BUF_CFG(pipe, i),
> - new->ddb.plane[pipe][i].end << 16 |
> - new->ddb.plane[pipe][i].start);
> + skl_ddb_entry_write(dev_priv,
> + PLANE_BUF_CFG(pipe, i),
> + &new->ddb.plane[pipe][i]);
>
> - I915_WRITE(CUR_BUF_CFG(pipe),
> - new->ddb.cursor[pipe].end << 16 |
> - new->ddb.cursor[pipe].start);
> + skl_ddb_entry_write(dev_priv, CUR_BUF_CFG(pipe),
> + &new->ddb.cursor[pipe]);
> }
> }
> }
> --
> 1.8.3.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2014-10-29 15:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-14 16:30 [PATCH 0/8] SKL WM fixups Damien Lespiau
2014-10-14 16:30 ` [PATCH 1/8] drm/i915/skl: Make 'end' of the DDB allocation entry exclusive Damien Lespiau
2014-10-29 15:32 ` Ville Syrjälä [this message]
2014-10-14 16:31 ` [PATCH 2/8] drm/i915/skl: Use a more descriptive parameter name in skl_compute_plane_wm() Damien Lespiau
2014-10-14 16:31 ` [PATCH 3/8] drm/i915/skl: Move the per-latency maximum test earlier Damien Lespiau
2014-10-29 16:53 ` Ville Syrjälä
2014-11-03 14:26 ` [PATCH 1/8 v2] drm/i915/skl: Make 'end' of the DDB allocation entry exclusive Damien Lespiau
2014-11-03 15:21 ` [PATCH 3/8 v2] drm/i915/skl: Make res_blocks/lines intermediate values 32 bits Damien Lespiau
2014-10-14 16:31 ` [PATCH 4/8] drm/i915/skl: Reduce the number of holes in struct skl_wm_level Damien Lespiau
2014-10-14 16:31 ` [PATCH 5/8] drm/i915/skl: Move all the WM compute functions in one place Damien Lespiau
2014-10-14 16:31 ` [PATCH 6/8] drm/i915/skl: Rework when the transition WMs are computed Damien Lespiau
2014-10-14 16:31 ` [PATCH 7/8] drm/i915/skl: Correctly align skl_compute_plane_wm() arguments Damien Lespiau
2014-10-14 16:31 ` [PATCH 8/8] drm/i915/skl: Reduce the indentation level in skl_write_wm_values() Damien Lespiau
2014-10-29 17:22 ` [PATCH 0/8] SKL WM fixups Ville Syrjälä
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=20141029153253.GK4284@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=damien.lespiau@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/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.