From: Chaitanya Kumar Borah <chaitanya.kumar.bo...@intel.com>

Add support for color ops that can be programmed
by 1 dimensional multi segmented Look Up Tables.

v2: Fixed the documentation for Multi segmented lut (Dmitry)

Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.bo...@intel.com>
Signed-off-by: Uma Shankar <uma.shan...@intel.com>
---
 drivers/gpu/drm/drm_atomic.c      |  4 ++++
 drivers/gpu/drm/drm_atomic_uapi.c |  3 +++
 drivers/gpu/drm/drm_colorop.c     |  1 +
 include/uapi/drm/drm_mode.h       | 10 ++++++++++
 4 files changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 3ab32fe7fe1c..71160a71f5a3 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -800,6 +800,10 @@ static void drm_atomic_colorop_print_state(struct 
drm_printer *p,
                           
drm_get_colorop_lut1d_interpolation_name(colorop->lut1d_interpolation));
                drm_printf(p, "\tdata blob id=%d\n", state->data ? 
state->data->base.id : 0);
                break;
+       case DRM_COLOROP_1D_LUT_MULTSEG:
+               drm_printf(p, "\thw cap blob id=%d\n", state->hw_caps ? 
state->hw_caps->base.id : 0);
+               drm_printf(p, "\tdata blob id=%d\n", state->data ? 
state->data->base.id : 0);
+               break;
        case DRM_COLOROP_CTM_3X4:
                drm_printf(p, "\tdata blob id=%d\n", state->data ? 
state->data->base.id : 0);
                break;
diff --git a/drivers/gpu/drm/drm_atomic_uapi.c 
b/drivers/gpu/drm/drm_atomic_uapi.c
index 81a8da09fbfe..c59f6671b73d 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -723,6 +723,9 @@ static int drm_atomic_color_set_data_property(struct 
drm_colorop *colorop,
                size = colorop->lut_size * colorop->lut_size * 
colorop->lut_size *
                       sizeof(struct drm_color_lut_32);
                break;
+       case DRM_COLOROP_1D_LUT_MULTSEG:
+               elem_size = sizeof(struct drm_color_lut_32);
+               break;
        default:
                /* should never get here */
                return -EINVAL;
diff --git a/drivers/gpu/drm/drm_colorop.c b/drivers/gpu/drm/drm_colorop.c
index 52c08d717944..97e9acbb0f2c 100644
--- a/drivers/gpu/drm/drm_colorop.c
+++ b/drivers/gpu/drm/drm_colorop.c
@@ -65,6 +65,7 @@
 static const struct drm_prop_enum_list drm_colorop_type_enum_list[] = {
        { DRM_COLOROP_1D_CURVE, "1D Curve" },
        { DRM_COLOROP_1D_LUT, "1D LUT" },
+       { DRM_COLOROP_1D_LUT_MULTSEG, "1D LUT Multi Segmented" },
        { DRM_COLOROP_CTM_3X4, "3x4 Matrix"},
        { DRM_COLOROP_MULTIPLIER, "Multiplier"},
        { DRM_COLOROP_3D_LUT, "3D LUT"},
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index dd223077f4e9..18e36cbe10f7 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -915,6 +915,16 @@ enum drm_colorop_type {
         */
        DRM_COLOROP_1D_LUT,
 
+       /**
+        * @DRM_COLOROP_1D_LUT_MULTSEG:
+        *
+        * A 1D LUT with multiple segments to cover the full color range with 
non-uniformly
+        * distributed &drm_color_lut entries, packed into a blob via the DATA 
property.
+        * The driver's expected LUT size and segmented capabilities are 
advertised via the
+        * HW_CAPS property.
+        */
+       DRM_COLOROP_1D_LUT_MULTSEG,
+
        /**
         * @DRM_COLOROP_CTM_3X4:
         *
-- 
2.42.0

Reply via email to