[PATCH 07/10] INTEL_DII: drm/i915/color: Add checks for extended luts
Borah, Chaitanya Kumar
chaitanya.kumar.borah at intel.com
Wed Sep 14 12:48:00 UTC 2022
Add functions to check extended LUTs with type struct drm_color_lut_ext
Signed-off-by: Borah, Chaitanya Kumar <chaitanya.kumar.borah at intel.com>
---
drivers/gpu/drm/i915/display/intel_color.c | 44 ++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c
index bb45e6809bbf7d..016e67c2aa5343 100644
--- a/drivers/gpu/drm/i915/display/intel_color.c
+++ b/drivers/gpu/drm/i915/display/intel_color.c
@@ -1434,6 +1434,46 @@ intel_color_add_affected_planes(struct intel_crtc_state *new_crtc_state)
return 0;
}
+static int check_lut_ext_size(const struct drm_property_blob *lut, int expected)
+{
+ int len;
+
+ if (!lut)
+ return 0;
+
+ len = drm_color_lut_ext_size(lut);
+ if (len != expected) {
+ DRM_DEBUG_KMS("Invalid LUT size; got %d, expected %d\n",
+ len, expected);
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static int check_ext_luts(const struct intel_crtc_state *crtc_state)
+{
+ struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev);
+ const struct drm_property_blob *degamma_lut = crtc_state->hw.degamma_lut;
+ int degamma_length;
+ u32 degamma_tests;
+
+ if (degamma_lut)
+ degamma_length = drm_color_lut_ext_size(degamma_lut);
+ else
+ degamma_length = INTEL_INFO(i915)->display.color.degamma_lut_size;
+
+ degamma_tests = INTEL_INFO(i915)->display.color.degamma_lut_tests;
+
+ if (check_lut_ext_size(degamma_lut, degamma_length))
+ return -EINVAL;
+
+ if (drm_color_lut_ext_check(degamma_lut, degamma_tests))
+ return -EINVAL;
+
+ return 0;
+}
+
static int check_lut_size(const struct drm_property_blob *lut, int expected)
{
int len;
@@ -1463,6 +1503,10 @@ static int check_luts(const struct intel_crtc_state *crtc_state)
if (crtc_state_is_legacy_gamma(crtc_state))
return 0;
+ /* If extended degamma property set*/
+ if (degamma_lut && crtc_state->uapi.advance_degamma_mode_active)
+ return check_ext_luts(crtc_state);
+
/* C8 relies on its palette being stored in the legacy LUT */
if (crtc_state->c8_planes) {
drm_dbg_kms(&dev_priv->drm,
--
2.25.1
More information about the Intel-gfx-trybot
mailing list