From: Kausal Malladi <kausalmall...@gmail.com>

Color Management is an extension to Kernel display framework. It allows
abstraction of hardware color correction and enhancement capabilities by
virtue of DRM properties.

This patch initializes color management framework by :
1. Introducing new pointers in DRM mode_config structure to
   carry CTM and Palette color correction properties.
2. Creating these DRM properties in DRM standard properties creation
   sequence.

Signed-off-by: Shashank Sharma <shashank.sharma at intel.com>
Signed-off-by: Kausal Malladi <kausalmalladi at gmail.com>
---
 drivers/gpu/drm/drm_crtc.c | 26 ++++++++++++++++++++++++++
 include/drm/drm_crtc.h     |  6 ++++++
 2 files changed, 32 insertions(+)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index bd515da..c12871c 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1462,6 +1462,32 @@ static int drm_mode_create_standard_properties(struct 
drm_device *dev)
                return -ENOMEM;
        dev->mode_config.prop_mode_id = prop;

+       /* Color Management properties */
+       prop = drm_property_create(dev,
+                       DRM_MODE_PROP_BLOB | DRM_MODE_PROP_IMMUTABLE,
+                       "CRTC_PALETTE_CAPABILITIES", 0);
+       if (!prop)
+               return -ENOMEM;
+       dev->mode_config.cm_crtc_palette_capabilities_property = prop;
+
+       prop = drm_property_create(dev,
+                       DRM_MODE_PROP_BLOB, "PALETTE_AFTER_CTM", 0);
+       if (!prop)
+               return -ENOMEM;
+       dev->mode_config.cm_palette_after_ctm_property = prop;
+
+       prop = drm_property_create(dev,
+                       DRM_MODE_PROP_BLOB, "PALETTE_BEFORE_CTM", 0);
+       if (!prop)
+               return -ENOMEM;
+       dev->mode_config.cm_palette_before_ctm_property = prop;
+
+       prop = drm_property_create(dev,
+                       DRM_MODE_PROP_BLOB, "CTM", 0);
+       if (!prop)
+               return -ENOMEM;
+       dev->mode_config.cm_ctm_property = prop;
+
        return 0;
 }

diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 5746569..3c59045 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1157,6 +1157,12 @@ struct drm_mode_config {
        struct drm_property *suggested_x_property;
        struct drm_property *suggested_y_property;

+       /* Color Management Properties */
+       struct drm_property *cm_crtc_palette_capabilities_property;
+       struct drm_property *cm_palette_before_ctm_property;
+       struct drm_property *cm_palette_after_ctm_property;
+       struct drm_property *cm_ctm_property;
+
        /* dumb ioctl parameters */
        uint32_t preferred_depth, prefer_shadow;

-- 
1.9.1

Reply via email to