Skip to content

Commit 8e02115

Browse files
committed
drm/i915: Enable display workaround 827 for all planes, v2.
The workaround was applied only to the primary plane, but is required on all planes. Iterate over all planes in the crtc atomic check to see if the workaround is enabled, and only perform the actual toggling in the pre/post plane update functions. Changes since v1: - Track active NV12 planes in a nv12_planes bitmask. (Ville) v2: Removing BROXTON support for NV12 due to WA826 Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/1526074397-10457-2-git-send-email-vidya.srinivas@intel.com
1 parent 2bdd045 commit 8e02115

File tree

3 files changed

+33
-18
lines changed

3 files changed

+33
-18
lines changed

drivers/gpu/drm/i915/intel_atomic_plane.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,16 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
183183
}
184184

185185
/* FIXME pre-g4x don't work like this */
186-
if (intel_state->base.visible)
186+
if (state->visible)
187187
crtc_state->active_planes |= BIT(intel_plane->id);
188188
else
189189
crtc_state->active_planes &= ~BIT(intel_plane->id);
190190

191+
if (state->visible && state->fb->format->format == DRM_FORMAT_NV12)
192+
crtc_state->nv12_planes |= BIT(intel_plane->id);
193+
else
194+
crtc_state->nv12_planes &= ~BIT(intel_plane->id);
195+
191196
return intel_plane_atomic_calc_changes(old_crtc_state,
192197
&crtc_state->base,
193198
old_plane_state,

drivers/gpu/drm/i915/intel_display.c

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5142,6 +5142,22 @@ static bool hsw_post_update_enable_ips(const struct intel_crtc_state *old_crtc_s
51425142
return !old_crtc_state->ips_enabled;
51435143
}
51445144

5145+
static bool needs_nv12_wa(struct drm_i915_private *dev_priv,
5146+
const struct intel_crtc_state *crtc_state)
5147+
{
5148+
if (!crtc_state->nv12_planes)
5149+
return false;
5150+
5151+
if (IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
5152+
return false;
5153+
5154+
if ((INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv)) ||
5155+
IS_CANNONLAKE(dev_priv))
5156+
return true;
5157+
5158+
return false;
5159+
}
5160+
51455161
static void intel_post_plane_update(struct intel_crtc_state *old_crtc_state)
51465162
{
51475163
struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->base.crtc);
@@ -5166,23 +5182,19 @@ static void intel_post_plane_update(struct intel_crtc_state *old_crtc_state)
51665182
if (old_primary_state) {
51675183
struct drm_plane_state *new_primary_state =
51685184
drm_atomic_get_new_plane_state(old_state, primary);
5169-
struct drm_framebuffer *fb = new_primary_state->fb;
51705185

51715186
intel_fbc_post_update(crtc);
51725187

51735188
if (new_primary_state->visible &&
51745189
(needs_modeset(&pipe_config->base) ||
51755190
!old_primary_state->visible))
51765191
intel_post_enable_primary(&crtc->base, pipe_config);
5177-
5178-
/* Display WA 827 */
5179-
if ((INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv)) ||
5180-
IS_CANNONLAKE(dev_priv)) {
5181-
if (fb && fb->format->format == DRM_FORMAT_NV12)
5182-
skl_wa_clkgate(dev_priv, crtc->pipe, false);
5183-
}
5184-
51855192
}
5193+
5194+
/* Display WA 827 */
5195+
if (needs_nv12_wa(dev_priv, old_crtc_state) &&
5196+
!needs_nv12_wa(dev_priv, pipe_config))
5197+
skl_wa_clkgate(dev_priv, crtc->pipe, false);
51865198
}
51875199

51885200
static void intel_pre_plane_update(struct intel_crtc_state *old_crtc_state,
@@ -5206,14 +5218,6 @@ static void intel_pre_plane_update(struct intel_crtc_state *old_crtc_state,
52065218
struct intel_plane_state *new_primary_state =
52075219
intel_atomic_get_new_plane_state(old_intel_state,
52085220
to_intel_plane(primary));
5209-
struct drm_framebuffer *fb = new_primary_state->base.fb;
5210-
5211-
/* Display WA 827 */
5212-
if ((INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv)) ||
5213-
IS_CANNONLAKE(dev_priv)) {
5214-
if (fb && fb->format->format == DRM_FORMAT_NV12)
5215-
skl_wa_clkgate(dev_priv, crtc->pipe, true);
5216-
}
52175221

52185222
intel_fbc_pre_update(crtc, pipe_config, new_primary_state);
52195223
/*
@@ -5225,6 +5229,11 @@ static void intel_pre_plane_update(struct intel_crtc_state *old_crtc_state,
52255229
intel_set_cpu_fifo_underrun_reporting(dev_priv, crtc->pipe, false);
52265230
}
52275231

5232+
/* Display WA 827 */
5233+
if (!needs_nv12_wa(dev_priv, old_crtc_state) &&
5234+
needs_nv12_wa(dev_priv, pipe_config))
5235+
skl_wa_clkgate(dev_priv, crtc->pipe, true);
5236+
52285237
/*
52295238
* Vblank time updates from the shadow to live plane control register
52305239
* are blocked if the memory self-refresh mode is active at that

drivers/gpu/drm/i915/intel_drv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,7 @@ struct intel_crtc_state {
890890

891891
/* bitmask of visible planes (enum plane_id) */
892892
u8 active_planes;
893+
u8 nv12_planes;
893894

894895
/* HDMI scrambling status */
895896
bool hdmi_scrambling;

0 commit comments

Comments
 (0)