From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v12 4/5] drm/i915: Introduce parameterized DBUF_CTL
Date: Thu, 16 Jan 2020 19:23:31 +0200 [thread overview]
Message-ID: <20200116172331.GJ13686@intel.com> (raw)
In-Reply-To: <20200116092214.2342-5-stanislav.lisovskiy@intel.com>
On Thu, Jan 16, 2020 at 11:22:13AM +0200, Stanislav Lisovskiy wrote:
> Now start using parameterized DBUF_CTL instead
> of hardcoded, this would allow shorter access
> functions when reading or storing entire state.
>
> Tried to implement it in a MMIO_PIPE manner, however
> DBUF_CTL1 address is higher than DBUF_CTL2, which
> implies that we have to now subtract from base
> rather than add.
>
> v2: - Removed unneeded DBUF_CTL_DIST and DBUF_CTL_ADDR
> macros. Started to use _PICK construct as suggested
> by Matt Roper.
>
> Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
> Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> ---
> .../drm/i915/display/intel_display_power.c | 19 +++----------------
> drivers/gpu/drm/i915/i915_reg.h | 7 ++++---
> drivers/gpu/drm/i915/intel_pm.c | 18 ++----------------
> 3 files changed, 9 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c b/drivers/gpu/drm/i915/display/intel_display_power.c
> index 474d6d4f3eb5..4729bcafb937 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_power.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
> @@ -4410,22 +4410,9 @@ void icl_dbuf_slices_update(struct drm_i915_private *dev_priv,
> DRM_DEBUG_KMS("Updating dbuf slices to 0x%x\n", req_slices);
>
> for (i = 0; i < max_slices; i++) {
> - u8 slice_set = req_slices & BIT(i);
> -
> - switch (i) {
> - case DBUF_S1:
> - intel_dbuf_slice_set(dev_priv,
> - DBUF_CTL_S1,
> - slice_set);
> - break;
> - case DBUF_S2:
> - intel_dbuf_slice_set(dev_priv,
> - DBUF_CTL_S2,
> - slice_set);
> - break;
> - default:
> - MISSING_CASE(i);
> - }
I think you added this code in one of the previous patches. So would be
better to make this patch the first in the series so you don't end up
adding code only to rewrite it one patch later.
> + intel_dbuf_slice_set(dev_priv,
> + DBUF_CTL_S(i),
> + (req_slices & BIT(i)) != 0);
> }
>
> dev_priv->enabled_dbuf_slices_mask = req_slices;
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index e5071af4a3b3..b3de69a0ea50 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -7745,9 +7745,10 @@ enum {
> #define DISP_ARB_CTL2 _MMIO(0x45004)
> #define DISP_DATA_PARTITION_5_6 (1 << 6)
> #define DISP_IPC_ENABLE (1 << 3)
> -#define DBUF_CTL _MMIO(0x45008)
> -#define DBUF_CTL_S1 _MMIO(0x45008)
> -#define DBUF_CTL_S2 _MMIO(0x44FE8)
> +#define DBUF_CTL_ADDR1 0x45008
> +#define DBUF_CTL_ADDR2 0x44FE8
_DBUF_CTL_S1 etc. is the usual naming pattern for the raw reg offsets.
> +#define DBUF_CTL_S(X) _MMIO(_PICK(X, DBUF_CTL_ADDR1, DBUF_CTL_ADDR2))
s/X/slice/ perhaps
_PICK_EVEN() will work just fine here.
With those
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Was more or less also expecting to see the enum here, but I guess
that ended up somewhere else?
> +#define DBUF_CTL DBUF_CTL_S(0)
> #define DBUF_POWER_REQUEST (1 << 31)
> #define DBUF_POWER_STATE (1 << 30)
> #define GEN7_MSG_CTL _MMIO(0x45010)
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 525578933658..b4b291d4244b 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -3651,22 +3651,8 @@ u8 intel_enabled_dbuf_slices_mask(struct drm_i915_private *dev_priv)
> u8 enabled_slices_mask = 0;
>
> for (i = 0; i < max_slices; i++) {
> - u8 slice_bit = BIT(i);
> - bool res;
> -
> - switch (i) {
> - case DBUF_S1:
> - res = I915_READ(DBUF_CTL_S1) & DBUF_POWER_STATE;
> - break;
> - case DBUF_S2:
> - res = I915_READ(DBUF_CTL_S2) & DBUF_POWER_STATE;
> - break;
> - default:
> - MISSING_CASE(slice_bit);
> - }
> -
> - if (res)
> - enabled_slices_mask |= slice_bit;
> + if (I915_READ(DBUF_CTL_S(i)) & DBUF_POWER_STATE)
> + enabled_slices_mask |= BIT(i);
> }
>
> return enabled_slices_mask;
> --
> 2.24.1.485.gad05a3d8e5
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2020-01-16 17:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-16 9:22 [Intel-gfx] [PATCH v12 0/5] Enable second DBuf slice for ICL and TGL Stanislav Lisovskiy
2020-01-16 9:22 ` [Intel-gfx] [PATCH v12 1/5] drm/i915: Remove skl_ddl_allocation struct Stanislav Lisovskiy
2020-01-16 9:22 ` [Intel-gfx] [PATCH v12 2/5] drm/i915: Move dbuf slice update to proper place Stanislav Lisovskiy
2020-01-16 9:22 ` [Intel-gfx] [PATCH v12 3/5] drm/i915: Manipulate DBuf slices properly Stanislav Lisovskiy
2020-01-16 9:22 ` [Intel-gfx] [PATCH v12 4/5] drm/i915: Introduce parameterized DBUF_CTL Stanislav Lisovskiy
2020-01-16 17:23 ` Ville Syrjälä [this message]
2020-01-16 9:22 ` [Intel-gfx] [PATCH v12 5/5] drm/i915: Correctly map DBUF slices to pipes Stanislav Lisovskiy
2020-01-16 10:23 ` [Intel-gfx] ✓ Fi.CI.BAT: success for Enable second DBuf slice for ICL and TGL (rev16) Patchwork
2020-01-16 10:23 ` [Intel-gfx] ✗ Fi.CI.BUILD: warning " Patchwork
2020-01-18 20:57 ` [Intel-gfx] ✓ Fi.CI.IGT: success " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2020-01-15 21:45 [Intel-gfx] [PATCH v12 0/5] Enable second DBuf slice for ICL and TGL Stanislav Lisovskiy
2020-01-15 21:45 ` [Intel-gfx] [PATCH v12 4/5] drm/i915: Introduce parameterized DBUF_CTL Stanislav Lisovskiy
2020-01-15 22:29 ` Matt Roper
2020-01-15 14:30 [Intel-gfx] [PATCH v12 0/5] Enable second DBuf slice for ICL and TGL Stanislav Lisovskiy
2020-01-15 14:30 ` [Intel-gfx] [PATCH v12 4/5] drm/i915: Introduce parameterized DBUF_CTL Stanislav Lisovskiy
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=20200116172331.GJ13686@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=stanislav.lisovskiy@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.