aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2019-02-05 11:08:41 -0500
committerVille Syrjälä <ville.syrjala@linux.intel.com>2019-02-07 14:45:44 -0500
commit051a6d8d3ca09da2cfcbf15ca3dbe6afe330d51f (patch)
treef0451d2f82d1e18a81d6793dbb2509455fbad805
parent4d8ed54c044703f96b1df9ef7ac689b18899a470 (diff)
drm/i915: Move LUT programming to happen after vblank waits
The LUTs are single buffered so we should program them after the double buffered pipe updates have been latched by the hardware. We'll also fix up the IPS vs. split gamma w/a to do the IPS disable like everyone else. Note that this is currently dead code as we don't use the split gamma mode on HSW, but that will be fixed up shortly. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190205160848.24662-7-ville.syrjala@linux.intel.com Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
-rw-r--r--drivers/gpu/drm/i915/intel_color.c25
-rw-r--r--drivers/gpu/drm/i915/intel_display.c47
2 files changed, 42 insertions, 30 deletions
diff --git a/drivers/gpu/drm/i915/intel_color.c b/drivers/gpu/drm/i915/intel_color.c
index c364cb7cb14c..71a1f12c6b2a 100644
--- a/drivers/gpu/drm/i915/intel_color.c
+++ b/drivers/gpu/drm/i915/intel_color.c
@@ -361,29 +361,6 @@ static void hsw_color_commit(const struct intel_crtc_state *crtc_state)
361 ilk_load_csc_matrix(crtc_state); 361 ilk_load_csc_matrix(crtc_state);
362} 362}
363 363
364/* Loads the legacy palette/gamma unit for the CRTC on Haswell. */
365static void haswell_load_luts(const struct intel_crtc_state *crtc_state)
366{
367 struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
368 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
369 bool reenable_ips = false;
370
371 /*
372 * Workaround : Do not read or write the pipe palette/gamma data while
373 * GAMMA_MODE is configured for split gamma and IPS_CTL has IPS enabled.
374 */
375 if (IS_HASWELL(dev_priv) && crtc_state->ips_enabled &&
376 (crtc_state->gamma_mode == GAMMA_MODE_MODE_SPLIT)) {
377 hsw_disable_ips(crtc_state);
378 reenable_ips = true;
379 }
380
381 i9xx_load_luts(crtc_state);
382
383 if (reenable_ips)
384 hsw_enable_ips(crtc_state);
385}
386
387static void bdw_load_degamma_lut(const struct intel_crtc_state *crtc_state) 364static void bdw_load_degamma_lut(const struct intel_crtc_state *crtc_state)
388{ 365{
389 struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc); 366 struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
@@ -675,7 +652,7 @@ void intel_color_init(struct intel_crtc *crtc)
675 if (IS_CHERRYVIEW(dev_priv)) { 652 if (IS_CHERRYVIEW(dev_priv)) {
676 dev_priv->display.load_luts = cherryview_load_luts; 653 dev_priv->display.load_luts = cherryview_load_luts;
677 } else if (IS_HASWELL(dev_priv)) { 654 } else if (IS_HASWELL(dev_priv)) {
678 dev_priv->display.load_luts = haswell_load_luts; 655 dev_priv->display.load_luts = i9xx_load_luts;
679 dev_priv->display.color_commit = hsw_color_commit; 656 dev_priv->display.color_commit = hsw_color_commit;
680 } else if (IS_BROADWELL(dev_priv) || IS_GEN9_BC(dev_priv) || 657 } else if (IS_BROADWELL(dev_priv) || IS_GEN9_BC(dev_priv) ||
681 IS_BROXTON(dev_priv)) { 658 IS_BROXTON(dev_priv)) {
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 63b61f61eccc..2802674c94ef 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5373,18 +5373,36 @@ intel_pre_disable_primary_noatomic(struct drm_crtc *crtc)
5373static bool hsw_pre_update_disable_ips(const struct intel_crtc_state *old_crtc_state, 5373static bool hsw_pre_update_disable_ips(const struct intel_crtc_state *old_crtc_state,
5374 const struct intel_crtc_state *new_crtc_state) 5374 const struct intel_crtc_state *new_crtc_state)
5375{ 5375{
5376 struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->base.crtc);
5377 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
5378
5376 if (!old_crtc_state->ips_enabled) 5379 if (!old_crtc_state->ips_enabled)
5377 return false; 5380 return false;
5378 5381
5379 if (needs_modeset(&new_crtc_state->base)) 5382 if (needs_modeset(&new_crtc_state->base))
5380 return true; 5383 return true;
5381 5384
5385 /*
5386 * Workaround : Do not read or write the pipe palette/gamma data while
5387 * GAMMA_MODE is configured for split gamma and IPS_CTL has IPS enabled.
5388 *
5389 * Disable IPS before we program the LUT.
5390 */
5391 if (IS_HASWELL(dev_priv) &&
5392 (new_crtc_state->base.color_mgmt_changed ||
5393 new_crtc_state->update_pipe) &&
5394 new_crtc_state->gamma_mode == GAMMA_MODE_MODE_SPLIT)
5395 return true;
5396
5382 return !new_crtc_state->ips_enabled; 5397 return !new_crtc_state->ips_enabled;
5383} 5398}
5384 5399
5385static bool hsw_post_update_enable_ips(const struct intel_crtc_state *old_crtc_state, 5400static bool hsw_post_update_enable_ips(const struct intel_crtc_state *old_crtc_state,
5386 const struct intel_crtc_state *new_crtc_state) 5401 const struct intel_crtc_state *new_crtc_state)
5387{ 5402{
5403 struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->base.crtc);
5404 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
5405
5388 if (!new_crtc_state->ips_enabled) 5406 if (!new_crtc_state->ips_enabled)
5389 return false; 5407 return false;
5390 5408
@@ -5392,6 +5410,18 @@ static bool hsw_post_update_enable_ips(const struct intel_crtc_state *old_crtc_s
5392 return true; 5410 return true;
5393 5411
5394 /* 5412 /*
5413 * Workaround : Do not read or write the pipe palette/gamma data while
5414 * GAMMA_MODE is configured for split gamma and IPS_CTL has IPS enabled.
5415 *
5416 * Re-enable IPS after the LUT has been programmed.
5417 */
5418 if (IS_HASWELL(dev_priv) &&
5419 (new_crtc_state->base.color_mgmt_changed ||
5420 new_crtc_state->update_pipe) &&
5421 new_crtc_state->gamma_mode == GAMMA_MODE_MODE_SPLIT)
5422 return true;
5423
5424 /*
5395 * We can't read out IPS on broadwell, assume the worst and 5425 * We can't read out IPS on broadwell, assume the worst and
5396 * forcibly enable IPS on the first fastset. 5426 * forcibly enable IPS on the first fastset.
5397 */ 5427 */
@@ -11136,7 +11166,7 @@ static int intel_crtc_atomic_check(struct drm_crtc *crtc,
11136 return ret; 11166 return ret;
11137 } 11167 }
11138 11168
11139 if (crtc_state->color_mgmt_changed) { 11169 if (mode_changed || crtc_state->color_mgmt_changed) {
11140 ret = intel_color_check(pipe_config); 11170 ret = intel_color_check(pipe_config);
11141 if (ret) 11171 if (ret)
11142 return ret; 11172 return ret;
@@ -13225,6 +13255,16 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)
13225 */ 13255 */
13226 drm_atomic_helper_wait_for_flip_done(dev, state); 13256 drm_atomic_helper_wait_for_flip_done(dev, state);
13227 13257
13258 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
13259 new_intel_crtc_state = to_intel_crtc_state(new_crtc_state);
13260
13261 if (new_crtc_state->active &&
13262 !needs_modeset(new_crtc_state) &&
13263 (new_intel_crtc_state->base.color_mgmt_changed ||
13264 new_intel_crtc_state->update_pipe))
13265 intel_color_load_luts(new_intel_crtc_state);
13266 }
13267
13228 /* 13268 /*
13229 * Now that the vblank has passed, we can go ahead and program the 13269 * Now that the vblank has passed, we can go ahead and program the
13230 * optimal watermarks on platforms that need two-step watermark 13270 * optimal watermarks on platforms that need two-step watermark
@@ -13740,11 +13780,6 @@ static void intel_begin_crtc_commit(struct drm_crtc *crtc,
13740 intel_atomic_get_new_crtc_state(old_intel_state, intel_crtc); 13780 intel_atomic_get_new_crtc_state(old_intel_state, intel_crtc);
13741 bool modeset = needs_modeset(&intel_cstate->base); 13781 bool modeset = needs_modeset(&intel_cstate->base);
13742 13782
13743 if (!modeset &&
13744 (intel_cstate->base.color_mgmt_changed ||
13745 intel_cstate->update_pipe))
13746 intel_color_load_luts(intel_cstate);
13747
13748 /* Perform vblank evasion around commit operation */ 13783 /* Perform vblank evasion around commit operation */
13749 intel_pipe_update_start(intel_cstate); 13784 intel_pipe_update_start(intel_cstate);
13750 13785