Commit 4d4e766f authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Jani Nikula

drm/i915: Workaround ICL CSC_MODE sticky arming

Unlike SKL/GLK the ICL CSC unit suffers from a new issue where
CSC_MODE arming is sticky. That is, once armed it remains armed
causing the CSC coeff/offset registers to become effectively
self-arming.

CSC coeff/offset registers writes no longer disarm the CSC,
but fortunately register read still do. So we can use that
to disarm the CSC unit once the registers for the current
frame have been latched. This avoid s the self-arming behaviour
from persisting into the next frame's .color_commit_noarm()
call.

Cc: <stable@vger.kernel.org> #v5.19+
Cc: Manasi Navare <navaremanasi@google.com>
Cc: Drew Davenport <ddavenport@chromium.org>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Jouni Högander <jouni.hogander@intel.com>
Fixes: d13dde44 ("drm/i915: Split pipe+output CSC programming to noarm+arm pair")
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230320095438.17328-5-ville.syrjala@linux.intel.comReviewed-by: default avatarImre Deak <imre.deak@intel.com>
(cherry picked from commit 92736f1b)
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
parent c880f855
...@@ -619,6 +619,14 @@ static void ilk_lut_12p4_pack(struct drm_color_lut *entry, u32 ldw, u32 udw) ...@@ -619,6 +619,14 @@ static void ilk_lut_12p4_pack(struct drm_color_lut *entry, u32 ldw, u32 udw)
static void icl_color_commit_noarm(const struct intel_crtc_state *crtc_state) static void icl_color_commit_noarm(const struct intel_crtc_state *crtc_state)
{ {
/*
* Despite Wa_1406463849, ICL no longer suffers from the SKL
* DC5/PSR CSC black screen issue (see skl_color_commit_noarm()).
* Possibly due to the extra sticky CSC arming
* (see icl_color_post_update()).
*
* On TGL+ all CSC arming issues have been properly fixed.
*/
icl_load_csc_matrix(crtc_state); icl_load_csc_matrix(crtc_state);
} }
...@@ -720,6 +728,28 @@ static void icl_color_commit_arm(const struct intel_crtc_state *crtc_state) ...@@ -720,6 +728,28 @@ static void icl_color_commit_arm(const struct intel_crtc_state *crtc_state)
crtc_state->csc_mode); crtc_state->csc_mode);
} }
static void icl_color_post_update(const struct intel_crtc_state *crtc_state)
{
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
struct drm_i915_private *i915 = to_i915(crtc->base.dev);
/*
* Despite Wa_1406463849, ICL CSC is no longer disarmed by
* coeff/offset register *writes*. Instead, once CSC_MODE
* is armed it stays armed, even after it has been latched.
* Afterwards the coeff/offset registers become effectively
* self-arming. That self-arming must be disabled before the
* next icl_color_commit_noarm() tries to write the next set
* of coeff/offset registers. Fortunately register *reads*
* do still disarm the CSC. Naturally this must not be done
* until the previously written CSC registers have actually
* been latched.
*
* TGL+ no longer need this workaround.
*/
intel_de_read_fw(i915, PIPE_CSC_PREOFF_HI(crtc->pipe));
}
static struct drm_property_blob * static struct drm_property_blob *
create_linear_lut(struct drm_i915_private *i915, int lut_size) create_linear_lut(struct drm_i915_private *i915, int lut_size)
{ {
...@@ -3115,10 +3145,20 @@ static const struct intel_color_funcs i9xx_color_funcs = { ...@@ -3115,10 +3145,20 @@ static const struct intel_color_funcs i9xx_color_funcs = {
.lut_equal = i9xx_lut_equal, .lut_equal = i9xx_lut_equal,
}; };
static const struct intel_color_funcs tgl_color_funcs = {
.color_check = icl_color_check,
.color_commit_noarm = icl_color_commit_noarm,
.color_commit_arm = icl_color_commit_arm,
.load_luts = icl_load_luts,
.read_luts = icl_read_luts,
.lut_equal = icl_lut_equal,
};
static const struct intel_color_funcs icl_color_funcs = { static const struct intel_color_funcs icl_color_funcs = {
.color_check = icl_color_check, .color_check = icl_color_check,
.color_commit_noarm = icl_color_commit_noarm, .color_commit_noarm = icl_color_commit_noarm,
.color_commit_arm = icl_color_commit_arm, .color_commit_arm = icl_color_commit_arm,
.color_post_update = icl_color_post_update,
.load_luts = icl_load_luts, .load_luts = icl_load_luts,
.read_luts = icl_read_luts, .read_luts = icl_read_luts,
.lut_equal = icl_lut_equal, .lut_equal = icl_lut_equal,
...@@ -3231,7 +3271,9 @@ void intel_color_init_hooks(struct drm_i915_private *i915) ...@@ -3231,7 +3271,9 @@ void intel_color_init_hooks(struct drm_i915_private *i915)
else else
i915->display.funcs.color = &i9xx_color_funcs; i915->display.funcs.color = &i9xx_color_funcs;
} else { } else {
if (DISPLAY_VER(i915) >= 11) if (DISPLAY_VER(i915) >= 12)
i915->display.funcs.color = &tgl_color_funcs;
else if (DISPLAY_VER(i915) == 11)
i915->display.funcs.color = &icl_color_funcs; i915->display.funcs.color = &icl_color_funcs;
else if (DISPLAY_VER(i915) == 10) else if (DISPLAY_VER(i915) == 10)
i915->display.funcs.color = &glk_color_funcs; i915->display.funcs.color = &glk_color_funcs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment