Hi Harry,

On 23.06.26 18:48, Harry Wentland wrote:
From: Chaitanya Kumar Borah <[email protected]>

Introduce DRM_COLOROP_FIXED_MATRIX, a new colorop type representing a
hardware that performs a fixed matrix operation.

Unlike CTM-based colorops, this block does not expose programmable
coefficients. Instead, userspace selects one of the predefined
hardware modes via a new FIXED_MATRIX_TYPE enum property. Supported modes
include common YCbCr->RGB and RGB709->RGB2020 conversions.

v2:
  - Naming changes (Pekka)

v3:
  - Fix NC matrix enum name and string (Melissa)
  - Rebase

Signed-off-by: Chaitanya Kumar Borah <[email protected]>
Reviewed-by: Melissa Wen <[email protected]>
Reviewed-by: Harry Wentland <[email protected]>
---
  drivers/gpu/drm/drm_atomic.c      |   4 ++
  drivers/gpu/drm/drm_atomic_uapi.c |   4 ++
  drivers/gpu/drm/drm_colorop.c     | 106 ++++++++++++++++++++++++++++++
  include/drm/drm_colorop.h         |  84 +++++++++++++++++++++++
  include/uapi/drm/drm_mode.h       |  12 ++++
  5 files changed, 210 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 3af1b9cc9a06..ced591c4a0bd 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -925,6 +925,10 @@ static void drm_atomic_colorop_print_state(struct 
drm_printer *p,
                                  
drm_get_colorop_lut3d_interpolation_name(colorop->lut3d_interpolation));
                drm_printf_indent(p, 1, "data blob id=%d\n", state->data ? 
state->data->base.id : 0);
                break;
+       case DRM_COLOROP_FIXED_MATRIX:
+               drm_printf_indent(p, 1, "fixed_matrix_type=%s\n",
+                                 
drm_get_colorop_fixed_matrix_type_name(state->fixed_matrix_type));
+               break;
        default:
                break;
        }
diff --git a/drivers/gpu/drm/drm_atomic_uapi.c 
b/drivers/gpu/drm/drm_atomic_uapi.c
index c7f80d90794c..cee4550ffdbd 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -761,6 +761,8 @@ static int drm_atomic_colorop_set_property(struct 
drm_colorop *colorop,
        } else if (property == colorop->data_property) {
                return drm_atomic_color_set_data_property(colorop, state,
                                                          property, val);
+       } else if (property == colorop->fixed_matrix_type_property) {
+               state->fixed_matrix_type = val;
        } else {
                drm_dbg_atomic(colorop->dev,
                               "[COLOROP:%d:%d] unknown property 
[PROP:%d:%s]\n",
@@ -793,6 +795,8 @@ drm_atomic_colorop_get_property(struct drm_colorop *colorop,
                *val = colorop->lut3d_interpolation;
        else if (property == colorop->data_property)
                *val = (state->data) ? state->data->base.id : 0;
+       else if (property == colorop->fixed_matrix_type_property)
+               *val = state->fixed_matrix_type;
        else
                return -EINVAL;
diff --git a/drivers/gpu/drm/drm_colorop.c b/drivers/gpu/drm/drm_colorop.c
index c0eecde8c176..c11c3012fcc5 100644
--- a/drivers/gpu/drm/drm_colorop.c
+++ b/drivers/gpu/drm/drm_colorop.c
@@ -68,6 +68,7 @@ static const struct drm_prop_enum_list 
drm_colorop_type_enum_list[] = {
        { DRM_COLOROP_CTM_3X4, "3x4 Matrix"},
        { DRM_COLOROP_MULTIPLIER, "Multiplier"},
        { DRM_COLOROP_3D_LUT, "3D LUT"},
+       { DRM_COLOROP_FIXED_MATRIX, "Fixed Matrix"},
  };
static const char * const colorop_curve_1d_type_names[] = {
@@ -90,6 +91,14 @@ static const struct drm_prop_enum_list 
drm_colorop_lut3d_interpolation_list[] =
        { DRM_COLOROP_LUT3D_INTERPOLATION_TETRAHEDRAL, "Tetrahedral" },
  };
+static const char * const colorop_fixed_matrix_type_names[] = {
+       [DRM_COLOROP_FM_YCBCR601_FULL_RGB] = "YCbCr 601 Full to RGB",
+       [DRM_COLOROP_FM_YCBCR709_FULL_RGB] = "YCbCr 709 Full to RGB",
+       [DRM_COLOROP_FM_YCBCR2020_NC_FULL_RGB] = "YCbCr 2020 NC Full to RGB",
+       [DRM_COLOROP_FM_YCBCR_LIMITED_FULL] = "YCbCr limited to full",
+       [DRM_COLOROP_FM_RGB709_RGB2020] = "RGB709 to RGB2020",

The last two ops do not get implemented in the series, even though they were the original ones mentioned in the commit message. I'd suggest to drop them - they can get re-added once there's a testable implementation. Instead I'd include the limited-range ones from the following commit, making the series cleaner.

Just suggestions, though. So either way:

Reviewed-by: Robert Mader <[email protected]>

--
Robert Mader
Consultant Software Developer

Collabora Ltd.
Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK
Registered in England & Wales, no. 5513718

Reply via email to