[PATCH] drm/xe/display: Program double buffer gamma

Chaitanya Kumar Borah chaitanya.kumar.borah at intel.com
Mon Dec 9 13:56:44 UTC 2024


Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah at intel.com>
---
 drivers/gpu/drm/i915/display/intel_color.c | 38 +++++++++++++++++++++-
 drivers/gpu/drm/i915/display/intel_crtc.c  |  6 ++--
 2 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c
index 7cd902bbd244..98487a49cf17 100644
--- a/drivers/gpu/drm/i915/display/intel_color.c
+++ b/drivers/gpu/drm/i915/display/intel_color.c
@@ -1911,6 +1911,25 @@ static void chv_load_luts(const struct intel_crtc_state *crtc_state)
 			  crtc_state->cgm_mode);
 }
 
+static void ptl_color_commit_noarm(struct intel_dsb *dsb,
+				   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(dsb, crtc_state);
+	if (crtc_state->preload_luts || intel_crtc_needs_modeset(crtc_state))
+		return;
+
+	icl_load_luts(crtc_state);
+}
+
 void intel_color_load_luts(const struct intel_crtc_state *crtc_state)
 {
 	struct intel_display *display = to_intel_display(crtc_state);
@@ -1980,6 +1999,10 @@ void intel_color_prepare_commit(struct intel_atomic_state *state,
 	if (!crtc_state->pre_csc_lut && !crtc_state->post_csc_lut)
 		return;
 
+	if (DISPLAY_VER(display) >= 30)
+		return;
+
+	/* Should be disabled for PTL? We don't need to use DSB because they are double buffered */
 	crtc_state->dsb_color_vblank = intel_dsb_prepare(state, crtc, INTEL_DSB_1, 1024);
 	if (!crtc_state->dsb_color_vblank)
 		return;
@@ -3842,6 +3865,17 @@ static const struct intel_color_funcs i9xx_color_funcs = {
 	.get_config = i9xx_get_config,
 };
 
+static const struct intel_color_funcs ptl_color_funcs = {
+	.color_check = icl_color_check,
+	.color_commit_noarm = ptl_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,
+	.read_csc = icl_read_csc,
+	.get_config = skl_get_config,
+};
+
 static const struct intel_color_funcs tgl_color_funcs = {
 	.color_check = icl_color_check,
 	.color_commit_noarm = icl_color_commit_noarm,
@@ -3989,7 +4023,9 @@ void intel_color_init_hooks(struct intel_display *display)
 		else
 			display->funcs.color = &i9xx_color_funcs;
 	} else {
-		if (DISPLAY_VER(display) >= 12)
+		if (DISPLAY_VER(display) >= 30)
+			display->funcs.color = &ptl_color_funcs;
+		else if (DISPLAY_VER(display) >= 12)
 			display->funcs.color = &tgl_color_funcs;
 		else if (DISPLAY_VER(display) == 11)
 			display->funcs.color = &icl_color_funcs;
diff --git a/drivers/gpu/drm/i915/display/intel_crtc.c b/drivers/gpu/drm/i915/display/intel_crtc.c
index a2c528d707f4..8c2572d2b59d 100644
--- a/drivers/gpu/drm/i915/display/intel_crtc.c
+++ b/drivers/gpu/drm/i915/display/intel_crtc.c
@@ -418,7 +418,7 @@ static bool intel_crtc_needs_vblank_work(const struct intel_crtc_state *crtc_sta
 	return crtc_state->hw.active &&
 		!crtc_state->preload_luts &&
 		!intel_crtc_needs_modeset(crtc_state) &&
-		intel_crtc_needs_color_update(crtc_state) &&
+		intel_crtc_needs_color_update(crtc_state) && /* TODO: might need change */
 		!intel_color_uses_dsb(crtc_state) &&
 		!crtc_state->use_dsb;
 }
@@ -429,10 +429,12 @@ static void intel_crtc_vblank_work(struct kthread_work *base)
 	struct intel_crtc_state *crtc_state =
 		container_of(work, typeof(*crtc_state), vblank_work);
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+	struct intel_display *display = to_intel_display(crtc_state);
 
 	trace_intel_crtc_vblank_work_start(crtc);
 
-	intel_color_load_luts(crtc_state);
+	if (DISPLAY_VER(display) < 30)
+		intel_color_load_luts(crtc_state);
 
 	if (crtc_state->uapi.event) {
 		spin_lock_irq(&crtc->base.dev->event_lock);
-- 
2.25.1



More information about the Intel-gfx-trybot mailing list