Add three new limited-range YUV-to-RGB conversion presets to the
CSC Fixed-Function colorop enum:

  - DRM_COLOROP_CSC_FF_YUV601_LIMITED_RGB601
  - DRM_COLOROP_CSC_FF_YUV709_LIMITED_RGB709
  - DRM_COLOROP_CSC_FF_YUV2020_LIMITED_RGB2020

The existing full-range enums (YUV601_RGB601, YUV709_RGB709,
YUV2020_RGB2020) are kept as-is. The limited-range variants are
inserted after their corresponding full-range entries.

This gives drivers the ability to advertise support for both full
and limited range YCbCr framebuffers via the color pipeline,
replacing the need for separate COLOR_ENCODING and COLOR_RANGE
properties on the CSC colorop.

Assisted-by Claude:claude-opus-4.6

Signed-off-by: Harry Wentland <[email protected]>
---
 drivers/gpu/drm/drm_colorop.c | 11 +++++----
 include/drm/drm_colorop.h     | 42 ++++++++++++++++++++++++++++++-----
 2 files changed, 43 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/drm_colorop.c b/drivers/gpu/drm/drm_colorop.c
index 6a345e2e8b15..f0d11cf7e3cd 100644
--- a/drivers/gpu/drm/drm_colorop.c
+++ b/drivers/gpu/drm/drm_colorop.c
@@ -92,10 +92,13 @@ static const struct drm_prop_enum_list 
drm_colorop_lut3d_interpolation_list[] =
 };
 
 static const char * const colorop_csc_ff_type_names[] = {
-       [DRM_COLOROP_CSC_FF_YUV601_RGB601]   = "YUV601 to RGB601",
-       [DRM_COLOROP_CSC_FF_YUV709_RGB709]   = "YUV709 to RGB709",
-       [DRM_COLOROP_CSC_FF_YUV2020_RGB2020] = "YUV2020 to RGB2020",
-       [DRM_COLOROP_CSC_FF_RGB709_RGB2020]  = "RGB709 to RGB2020",
+       [DRM_COLOROP_CSC_FF_YUV601_RGB601]           = "YUV601 to RGB601",
+       [DRM_COLOROP_CSC_FF_YUV601_LIMITED_RGB601]    = "YUV601 Limited to 
RGB601",
+       [DRM_COLOROP_CSC_FF_YUV709_RGB709]            = "YUV709 to RGB709",
+       [DRM_COLOROP_CSC_FF_YUV709_LIMITED_RGB709]    = "YUV709 Limited to 
RGB709",
+       [DRM_COLOROP_CSC_FF_YUV2020_RGB2020]          = "YUV2020 to RGB2020",
+       [DRM_COLOROP_CSC_FF_YUV2020_LIMITED_RGB2020]  = "YUV2020 Limited to 
RGB2020",
+       [DRM_COLOROP_CSC_FF_RGB709_RGB2020]           = "RGB709 to RGB2020",
 };
 
 /* Init Helpers */
diff --git a/include/drm/drm_colorop.h b/include/drm/drm_colorop.h
index 2cd8e0779c2a..c414b9070afb 100644
--- a/include/drm/drm_colorop.h
+++ b/include/drm/drm_colorop.h
@@ -145,31 +145,61 @@ enum drm_colorop_csc_ff_type {
         *
         * enum string "YUV601 to RGB601"
         *
-        * Selects the fixed-function CSC preset that converts YUV
-        * (BT.601) colorimetry to RGB (BT.601).
+        * Selects the fixed-function CSC preset that converts full-range
+        * YUV (BT.601) colorimetry to RGB (BT.601).
         */
        DRM_COLOROP_CSC_FF_YUV601_RGB601,
 
+       /**
+        * @DRM_COLOROP_CSC_FF_YUV601_LIMITED_RGB601:
+        *
+        * enum string "YUV601 Limited to RGB601"
+        *
+        * Selects the fixed-function CSC preset that converts limited-range
+        * YUV (BT.601) colorimetry to RGB (BT.601).
+        */
+       DRM_COLOROP_CSC_FF_YUV601_LIMITED_RGB601,
+
        /**
         * @DRM_COLOROP_CSC_FF_YUV709_RGB709:
         *
         * enum string "YUV709 to RGB709"
         *
-        * Selects the fixed-function CSC preset that converts YUV
-        * (BT.709) colorimetry to RGB (BT.709).
+        * Selects the fixed-function CSC preset that converts full-range
+        * YUV (BT.709) colorimetry to RGB (BT.709).
         */
        DRM_COLOROP_CSC_FF_YUV709_RGB709,
 
+       /**
+        * @DRM_COLOROP_CSC_FF_YUV709_LIMITED_RGB709:
+        *
+        * enum string "YUV709 Limited to RGB709"
+        *
+        * Selects the fixed-function CSC preset that converts limited-range
+        * YUV (BT.709) colorimetry to RGB (BT.709).
+        */
+       DRM_COLOROP_CSC_FF_YUV709_LIMITED_RGB709,
+
        /**
         * @DRM_COLOROP_CSC_FF_YUV2020_RGB2020:
         *
         * enum string "YUV2020 to RGB2020"
         *
-        * Selects the fixed-function CSC preset that converts YUV
-        * (BT.2020) colorimetry to RGB (BT.2020).
+        * Selects the fixed-function CSC preset that converts full-range
+        * YUV (BT.2020) colorimetry to RGB (BT.2020).
         */
        DRM_COLOROP_CSC_FF_YUV2020_RGB2020,
 
+       /**
+        * @DRM_COLOROP_CSC_FF_YUV2020_LIMITED_RGB2020:
+        *
+        * enum string "YUV2020 Limited to RGB2020"
+        *
+        * Selects the fixed-function CSC preset that converts limited-range
+        * YUV (BT.2020) colorimetry to RGB (BT.2020).
+        */
+       DRM_COLOROP_CSC_FF_YUV2020_LIMITED_RGB2020,
+
        /**
         * @DRM_COLOROP_CSC_FF_RGB709_RGB2020:
         *
-- 
2.53.0

Reply via email to