Skip to content

Commit 695dc55

Browse files
rodrigoviviickle
authored andcommitted
drm/i915/tgl: Fix Media power gate sequence.
Some media power gates are disabled by default. commit 5d86923 ("drm/i915/tgl: Enable VD HCP/MFX sub-pipe power gating") tried to enable it, but it duplicated an existent register. So, the main PG setup sequences ended up overwriting it. So, let's now merge this to the main PG setup sequence. v2: (Chris): s/BIT/REG_BIT, remove useless comment, remove useless =0, use the right gt, remove rc6 sequence doubt from commit message. Fixes: 5d86923 ("drm/i915/tgl: Enable VD HCP/MFX sub-pipe power gating") Cc: Lucas De Marchi <lucas.demarchi@intel.com> Cc: stable@vger.kernel.org#v5.5+ Cc: Dale B Stimson <dale.b.stimson@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Link: https://patchwork.freedesktop.org/patch/msgid/20201111072859.1186070-1-rodrigo.vivi@intel.com
1 parent 330b7d3 commit 695dc55

File tree

3 files changed

+22
-25
lines changed

3 files changed

+22
-25
lines changed

drivers/gpu/drm/i915/gt/intel_rc6.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,12 @@ static inline void set(struct intel_uncore *uncore, i915_reg_t reg, u32 val)
5656

5757
static void gen11_rc6_enable(struct intel_rc6 *rc6)
5858
{
59-
struct intel_uncore *uncore = rc6_to_uncore(rc6);
59+
struct intel_gt *gt = rc6_to_gt(rc6);
60+
struct intel_uncore *uncore = gt->uncore;
6061
struct intel_engine_cs *engine;
6162
enum intel_engine_id id;
63+
u32 pg_enable;
64+
int i;
6265

6366
/* 2b: Program RC6 thresholds.*/
6467
set(uncore, GEN6_RC6_WAKE_RATE_LIMIT, 54 << 16 | 85);
@@ -102,10 +105,19 @@ static void gen11_rc6_enable(struct intel_rc6 *rc6)
102105
GEN6_RC_CTL_RC6_ENABLE |
103106
GEN6_RC_CTL_EI_MODE(1);
104107

105-
set(uncore, GEN9_PG_ENABLE,
106-
GEN9_RENDER_PG_ENABLE |
107-
GEN9_MEDIA_PG_ENABLE |
108-
GEN11_MEDIA_SAMPLER_PG_ENABLE);
108+
pg_enable =
109+
GEN9_RENDER_PG_ENABLE |
110+
GEN9_MEDIA_PG_ENABLE |
111+
GEN11_MEDIA_SAMPLER_PG_ENABLE;
112+
113+
if (INTEL_GEN(gt->i915) >= 12) {
114+
for (i = 0; i < I915_MAX_VCS; i++)
115+
if (HAS_ENGINE(gt, _VCS(i)))
116+
pg_enable |= (VDN_HCP_POWERGATE_ENABLE(i) |
117+
VDN_MFX_POWERGATE_ENABLE(i));
118+
}
119+
120+
set(uncore, GEN9_PG_ENABLE, pg_enable);
109121
}
110122

111123
static void gen9_rc6_enable(struct intel_rc6 *rc6)

drivers/gpu/drm/i915/i915_reg.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8984,10 +8984,6 @@ enum {
89848984
#define GEN9_PWRGT_MEDIA_STATUS_MASK (1 << 0)
89858985
#define GEN9_PWRGT_RENDER_STATUS_MASK (1 << 1)
89868986

8987-
#define POWERGATE_ENABLE _MMIO(0xa210)
8988-
#define VDN_HCP_POWERGATE_ENABLE(n) BIT(((n) * 2) + 3)
8989-
#define VDN_MFX_POWERGATE_ENABLE(n) BIT(((n) * 2) + 4)
8990-
89918987
#define GTFIFODBG _MMIO(0x120000)
89928988
#define GT_FIFO_SBDEDICATE_FREE_ENTRY_CHV (0x1f << 20)
89938989
#define GT_FIFO_FREE_ENTRIES_CHV (0x7f << 13)
@@ -9127,9 +9123,11 @@ enum {
91279123
#define GEN9_MEDIA_PG_IDLE_HYSTERESIS _MMIO(0xA0C4)
91289124
#define GEN9_RENDER_PG_IDLE_HYSTERESIS _MMIO(0xA0C8)
91299125
#define GEN9_PG_ENABLE _MMIO(0xA210)
9130-
#define GEN9_RENDER_PG_ENABLE REG_BIT(0)
9131-
#define GEN9_MEDIA_PG_ENABLE REG_BIT(1)
9132-
#define GEN11_MEDIA_SAMPLER_PG_ENABLE REG_BIT(2)
9126+
#define GEN9_RENDER_PG_ENABLE REG_BIT(0)
9127+
#define GEN9_MEDIA_PG_ENABLE REG_BIT(1)
9128+
#define GEN11_MEDIA_SAMPLER_PG_ENABLE REG_BIT(2)
9129+
#define VDN_HCP_POWERGATE_ENABLE(n) REG_BIT(3 + 2 * (n))
9130+
#define VDN_MFX_POWERGATE_ENABLE(n) REG_BIT(4 + 2 * (n))
91339131
#define GEN8_PUSHBUS_CONTROL _MMIO(0xA248)
91349132
#define GEN8_PUSHBUS_ENABLE _MMIO(0xA250)
91359133
#define GEN8_PUSHBUS_SHIFT _MMIO(0xA25C)

drivers/gpu/drm/i915/intel_pm.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7118,23 +7118,10 @@ static void icl_init_clock_gating(struct drm_i915_private *dev_priv)
71187118

71197119
static void tgl_init_clock_gating(struct drm_i915_private *dev_priv)
71207120
{
7121-
u32 vd_pg_enable = 0;
7122-
unsigned int i;
7123-
71247121
/* Wa_1409120013:tgl */
71257122
I915_WRITE(ILK_DPFC_CHICKEN,
71267123
ILK_DPFC_CHICKEN_COMP_DUMMY_PIXEL);
71277124

7128-
/* This is not a WA. Enable VD HCP & MFX_ENC powergate */
7129-
for (i = 0; i < I915_MAX_VCS; i++) {
7130-
if (HAS_ENGINE(&dev_priv->gt, _VCS(i)))
7131-
vd_pg_enable |= VDN_HCP_POWERGATE_ENABLE(i) |
7132-
VDN_MFX_POWERGATE_ENABLE(i);
7133-
}
7134-
7135-
I915_WRITE(POWERGATE_ENABLE,
7136-
I915_READ(POWERGATE_ENABLE) | vd_pg_enable);
7137-
71387125
/* Wa_1409825376:tgl (pre-prod)*/
71397126
if (IS_TGL_REVID(dev_priv, TGL_REVID_A0, TGL_REVID_A0))
71407127
I915_WRITE(GEN9_CLKGATE_DIS_3, I915_READ(GEN9_CLKGATE_DIS_3) |

0 commit comments

Comments
 (0)