Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH 08/10] drm/i915: Assert {pre, post}_csc_lut were assigned sensibly
Date: Thu, 29 Sep 2022 10:15:19 +0300	[thread overview]
Message-ID: <20220929071521.26612-9-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20220929071521.26612-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Since we now have the extra step from hw.(de)gamma_lut into
{pre,post}_csc_lut let's make sure we didn't forget to assign
them appropriately. Ie. basically making sure intel_color_check()
was called when necessary (and that it did its job suitable well).

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_color.c   | 20 ++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_color.h   |  1 +
 drivers/gpu/drm/i915/display/intel_display.c |  2 ++
 3 files changed, 23 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c
index 380f44720fe6..575d2a23682a 100644
--- a/drivers/gpu/drm/i915/display/intel_color.c
+++ b/drivers/gpu/drm/i915/display/intel_color.c
@@ -1355,6 +1355,26 @@ static u32 i9xx_gamma_mode(struct intel_crtc_state *crtc_state)
 		return GAMMA_MODE_MODE_10BIT; /* i965+ only */
 }
 
+void intel_color_assert_luts(const struct intel_crtc_state *crtc_state)
+{
+	struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev);
+
+	/* make sure {pre,post}_csc_lut were correctly assigned */
+	if (DISPLAY_VER(i915) >= 10 || HAS_GMCH(i915)) {
+		drm_WARN_ON(&i915->drm,
+			    crtc_state->pre_csc_lut != crtc_state->hw.degamma_lut);
+		drm_WARN_ON(&i915->drm,
+			    crtc_state->post_csc_lut != crtc_state->hw.gamma_lut);
+	} else {
+		drm_WARN_ON(&i915->drm,
+			    crtc_state->pre_csc_lut != crtc_state->hw.degamma_lut &&
+			    crtc_state->pre_csc_lut != crtc_state->hw.gamma_lut);
+		drm_WARN_ON(&i915->drm,
+			    crtc_state->post_csc_lut != crtc_state->hw.degamma_lut &&
+			    crtc_state->post_csc_lut != crtc_state->hw.gamma_lut);
+	}
+}
+
 static void intel_assign_luts(struct intel_crtc_state *crtc_state)
 {
 	drm_property_replace_blob(&crtc_state->pre_csc_lut,
diff --git a/drivers/gpu/drm/i915/display/intel_color.h b/drivers/gpu/drm/i915/display/intel_color.h
index 67702451e2fd..b76f18e6c452 100644
--- a/drivers/gpu/drm/i915/display/intel_color.h
+++ b/drivers/gpu/drm/i915/display/intel_color.h
@@ -24,5 +24,6 @@ int intel_color_get_gamma_bit_precision(const struct intel_crtc_state *crtc_stat
 bool intel_color_lut_equal(struct drm_property_blob *blob1,
 			   struct drm_property_blob *blob2,
 			   u32 gamma_mode, u32 bit_precision);
+void intel_color_assert_luts(const struct intel_crtc_state *crtc_state);
 
 #endif /* __INTEL_COLOR_H__ */
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 20569b6838d1..441811ac0ab0 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -6906,6 +6906,8 @@ static int intel_atomic_check(struct drm_device *dev,
 
 	for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
 					    new_crtc_state, i) {
+		intel_color_assert_luts(new_crtc_state);
+
 		ret = intel_async_flip_check_hw(state, crtc);
 		if (ret)
 			goto fail;
-- 
2.35.1


  parent reply	other threads:[~2022-09-29  7:16 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-29  7:15 [Intel-gfx] [PATCH 00/10] drm/i915: Prep work for finishing (de)gamma readout Ville Syrjala
2022-09-29  7:15 ` [Intel-gfx] [PATCH 01/10] drm/i915: Remove PLL asserts from .load_luts() Ville Syrjala
2022-09-29 11:54   ` Jani Nikula
2022-09-29  7:15 ` [Intel-gfx] [PATCH 02/10] drm/i915: Split up intel_color_init() Ville Syrjala
2022-09-29 10:41   ` Jani Nikula
2022-09-29 11:55     ` Jani Nikula
2022-09-29  7:15 ` [Intel-gfx] [PATCH 03/10] drm/i915: Simplify the intel_color_init_hooks() if ladder Ville Syrjala
2022-09-29 11:56   ` Jani Nikula
2022-09-29  7:15 ` [Intel-gfx] [PATCH 04/10] drm/i915: Clean up intel_color_init_hooks() Ville Syrjala
2022-09-29 11:57   ` Jani Nikula
2022-09-29  7:15 ` [Intel-gfx] [PATCH 05/10] drm/i915: Change glk_load_degamma_lut() calling convention Ville Syrjala
2022-09-29 11:58   ` Jani Nikula
2022-09-29  7:15 ` [Intel-gfx] [PATCH 06/10] drm/i915: Make ilk_load_luts() deal with degamma Ville Syrjala
2022-09-29  7:15 ` [Intel-gfx] [PATCH 07/10] drm/i915: Introduce crtc_state->{pre, post}_csc_lut Ville Syrjala
2022-10-19  7:06   ` Shankar, Uma
2022-09-29  7:15 ` Ville Syrjala [this message]
2022-10-19  7:09   ` [Intel-gfx] [PATCH 08/10] drm/i915: Assert {pre, post}_csc_lut were assigned sensibly Shankar, Uma
2022-09-29  7:15 ` [Intel-gfx] [PATCH 09/10] drm/i915: Get rid of glk_load_degamma_lut_linear() Ville Syrjala
2022-10-19  7:20   ` Shankar, Uma
2022-10-19  7:29     ` Ville Syrjälä
2022-10-19  7:49       ` Shankar, Uma
2022-09-29  7:15 ` [Intel-gfx] [PATCH 10/10] drm/i915: Stop loading linear degammma LUT on glk needlessly Ville Syrjala
2022-10-19  7:24   ` Shankar, Uma
2022-09-29  9:19 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915: Prep work for finishing (de)gamma readout Patchwork
2022-09-29  9:40 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-09-30  6:35 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220929071521.26612-9-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox