[v8,04/10] drm/i915/display: Add macro to compare gamma hw/sw lut
diff mbox series

Message ID 1566800772-18412-5-git-send-email-swati2.sharma@intel.com
State New
Headers show
Series
  • drm/i915: adding state checker for gamma lut value
Related show

Commit Message

Swati Sharma Aug. 26, 2019, 6:26 a.m. UTC
Add macro to compare hw/sw gamma lut values. First need to
check whether hw/sw gamma mode matches or not. If not
no need to compare lut values, if matches then only compare
lut entries.

Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Comments

Shankar, Uma Aug. 28, 2019, 3:35 p.m. UTC | #1
>-----Original Message-----
>From: Sharma, Swati2
>Sent: Monday, August 26, 2019 11:56 AM
>To: intel-gfx@lists.freedesktop.org
>Cc: Nikula, Jani <jani.nikula@intel.com>; Sharma, Shashank
><shashank.sharma@intel.com>; Manna, Animesh <animesh.manna@intel.com>;
>Nautiyal, Ankit K <ankit.k.nautiyal@intel.com>; daniel.vetter@ffwll.ch;
>ville.syrjala@linux.intel.com; Shankar, Uma <uma.shankar@intel.com>; Sharma,
>Swati2 <swati2.sharma@intel.com>
>Subject: [v8][PATCH 04/10] drm/i915/display: Add macro to compare gamma hw/sw
>lut
>
>Add macro to compare hw/sw gamma lut values. First need to check whether hw/sw
>gamma mode matches or not. If not no need to compare lut values, if matches then
>only compare lut entries.

Looks good to me.
Reviewed-by: Uma Shankar <uma.shankar@intel.com>

>Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
>---
> drivers/gpu/drm/i915/display/intel_display.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
>diff --git a/drivers/gpu/drm/i915/display/intel_display.c
>b/drivers/gpu/drm/i915/display/intel_display.c
>index ca88c70..63b7ad7 100644
>--- a/drivers/gpu/drm/i915/display/intel_display.c
>+++ b/drivers/gpu/drm/i915/display/intel_display.c
>@@ -12529,6 +12529,7 @@ static bool fastboot_enabled(struct drm_i915_private
>*dev_priv)  {
> 	struct drm_i915_private *dev_priv = to_i915(current_config->base.crtc-
>>dev);
> 	bool ret = true;
>+	u32 bp_gamma = 0;
> 	bool fixup_inherited = fastset &&
> 		(current_config->base.mode.private_flags &
>I915_MODE_FLAG_INHERITED) &&
> 		!(pipe_config->base.mode.private_flags &
>I915_MODE_FLAG_INHERITED); @@ -12680,6 +12681,24 @@ static bool
>fastboot_enabled(struct drm_i915_private *dev_priv)
> 	} \
> } while (0)
>
>+#define PIPE_CONF_CHECK_COLOR_LUT(name1, name2, bit_precision) do { \
>+	if (current_config->name1 != pipe_config->name1) { \
>+		pipe_config_mismatch(fastset, __stringify(name1), \
>+				"(expected %i, found %i, won't compare lut
>values)\n", \
>+				current_config->name1, \
>+				pipe_config->name1); \
>+		ret = false;\
>+	} else { \
>+		if (!intel_color_lut_equal(current_config->name2, \
>+					pipe_config->name2, pipe_config->name1, \
>+					bit_precision)) { \
>+			pipe_config_mismatch(fastset, __stringify(name2), \
>+					"hw_state doesn't match sw_state\n"); \
>+			ret = false; \
>+		} \
>+	} \
>+} while (0)
>+
> #define PIPE_CONF_QUIRK(quirk) \
> 	((current_config->quirks | pipe_config->quirks) & (quirk))
>
>@@ -12775,6 +12794,11 @@ static bool fastboot_enabled(struct drm_i915_private
>*dev_priv)
> 			PIPE_CONF_CHECK_X(csc_mode);
> 		PIPE_CONF_CHECK_BOOL(gamma_enable);
> 		PIPE_CONF_CHECK_BOOL(csc_enable);
>+
>+		bp_gamma = intel_color_get_gamma_bit_precision(pipe_config);
>+		if (bp_gamma)
>+			PIPE_CONF_CHECK_COLOR_LUT(gamma_mode,
>base.gamma_lut, bp_gamma);
>+
> 	}
>
> 	PIPE_CONF_CHECK_BOOL(double_wide);
>@@ -12837,6 +12861,7 @@ static bool fastboot_enabled(struct drm_i915_private
>*dev_priv)  #undef PIPE_CONF_CHECK_P  #undef PIPE_CONF_CHECK_FLAGS  #undef
>PIPE_CONF_CHECK_CLOCK_FUZZY
>+#undef PIPE_CONF_CHECK_COLOR_LUT
> #undef PIPE_CONF_QUIRK
>
> 	return ret;
>--
>1.9.1

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index ca88c70..63b7ad7 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -12529,6 +12529,7 @@  static bool fastboot_enabled(struct drm_i915_private *dev_priv)
 {
 	struct drm_i915_private *dev_priv = to_i915(current_config->base.crtc->dev);
 	bool ret = true;
+	u32 bp_gamma = 0;
 	bool fixup_inherited = fastset &&
 		(current_config->base.mode.private_flags & I915_MODE_FLAG_INHERITED) &&
 		!(pipe_config->base.mode.private_flags & I915_MODE_FLAG_INHERITED);
@@ -12680,6 +12681,24 @@  static bool fastboot_enabled(struct drm_i915_private *dev_priv)
 	} \
 } while (0)
 
+#define PIPE_CONF_CHECK_COLOR_LUT(name1, name2, bit_precision) do { \
+	if (current_config->name1 != pipe_config->name1) { \
+		pipe_config_mismatch(fastset, __stringify(name1), \
+				"(expected %i, found %i, won't compare lut values)\n", \
+				current_config->name1, \
+				pipe_config->name1); \
+		ret = false;\
+	} else { \
+		if (!intel_color_lut_equal(current_config->name2, \
+					pipe_config->name2, pipe_config->name1, \
+					bit_precision)) { \
+			pipe_config_mismatch(fastset, __stringify(name2), \
+					"hw_state doesn't match sw_state\n"); \
+			ret = false; \
+		} \
+	} \
+} while (0)
+
 #define PIPE_CONF_QUIRK(quirk) \
 	((current_config->quirks | pipe_config->quirks) & (quirk))
 
@@ -12775,6 +12794,11 @@  static bool fastboot_enabled(struct drm_i915_private *dev_priv)
 			PIPE_CONF_CHECK_X(csc_mode);
 		PIPE_CONF_CHECK_BOOL(gamma_enable);
 		PIPE_CONF_CHECK_BOOL(csc_enable);
+
+		bp_gamma = intel_color_get_gamma_bit_precision(pipe_config);
+		if (bp_gamma)
+			PIPE_CONF_CHECK_COLOR_LUT(gamma_mode, base.gamma_lut, bp_gamma);
+
 	}
 
 	PIPE_CONF_CHECK_BOOL(double_wide);
@@ -12837,6 +12861,7 @@  static bool fastboot_enabled(struct drm_i915_private *dev_priv)
 #undef PIPE_CONF_CHECK_P
 #undef PIPE_CONF_CHECK_FLAGS
 #undef PIPE_CONF_CHECK_CLOCK_FUZZY
+#undef PIPE_CONF_CHECK_COLOR_LUT
 #undef PIPE_CONF_QUIRK
 
 	return ret;