[Intel-gfx] [PATCH 6/6] drm/i915: Register color correction capabilities
Lionel Landwerlin
lionel.g.landwerlin at intel.com
Thu Dec 17 10:57:58 PST 2015
From: Shashank Sharma <shashank.sharma at intel.com>
Register cm_coeff_after_ctm_property & cm_coeff_before_ctm_property
indicating the size of the LUT to be supplied to palette_after_ctm &
palette_before_ctm and also register the ctm property to enable color
correction matrix.
Signed-off-by: Shashank Sharma <shashank.sharma at intel.com>
Signed-off-by: Kausal Malladi <kausalmalladi at gmail.com>
---
drivers/gpu/drm/i915/intel_color_manager.c | 53 ++++++++++++++++++++++++++++++
drivers/gpu/drm/i915/intel_display.c | 1 +
2 files changed, 54 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_color_manager.c b/drivers/gpu/drm/i915/intel_color_manager.c
index bca07c1..b50665b 100644
--- a/drivers/gpu/drm/i915/intel_color_manager.c
+++ b/drivers/gpu/drm/i915/intel_color_manager.c
@@ -801,4 +801,57 @@ void intel_color_manager_commit(struct drm_device *dev,
void intel_crtc_attach_color_properties(struct drm_crtc *crtc)
{
+ struct drm_device *dev = crtc->dev;
+ struct drm_mode_config *config = &dev->mode_config;
+ struct drm_mode_object *mode_obj = &crtc->base;
+
+ /*
+ * Register:
+ * =========
+ * Gamma correction as palette_after_ctm property
+ * Degamma correction as palette_before_ctm property
+ *
+ * Load:
+ * =====
+ * no. of coefficients supported on this platform for gamma
+ * and degamma with the query properties. A user
+ * space agent should read these query property, and prepare
+ * the color correction values accordingly. Its expected from the
+ * driver to load the right number of coefficients during the init
+ * phase.
+ */
+ if (config->cm_coeff_after_ctm_property) {
+ drm_object_attach_property(mode_obj,
+ config->cm_coeff_after_ctm_property,
+ INTEL_INFO(dev)->num_samples_after_ctm);
+ DRM_DEBUG_DRIVER("Gamma query property initialized\n");
+ }
+
+ if (config->cm_coeff_before_ctm_property) {
+ drm_object_attach_property(mode_obj,
+ config->cm_coeff_before_ctm_property,
+ INTEL_INFO(dev)->num_samples_before_ctm);
+ DRM_DEBUG_DRIVER("Degamma query property initialized\n");
+ }
+
+ /* Gamma correction */
+ if (config->cm_palette_after_ctm_property) {
+ drm_object_attach_property(mode_obj,
+ config->cm_palette_after_ctm_property, 0);
+ DRM_DEBUG_DRIVER("gamma property attached to CRTC\n");
+ }
+
+ /* Degamma correction */
+ if (config->cm_palette_before_ctm_property) {
+ drm_object_attach_property(mode_obj,
+ config->cm_palette_before_ctm_property, 0);
+ DRM_DEBUG_DRIVER("degamma property attached to CRTC\n");
+ }
+
+ /* CSC */
+ if (config->cm_ctm_property) {
+ drm_object_attach_property(mode_obj,
+ config->cm_ctm_property, 0);
+ DRM_DEBUG_DRIVER("CSC property attached to CRTC\n");
+ }
}
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index b9eb507..7cf56cb 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -14264,6 +14264,7 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
intel_crtc->cursor_size = ~0;
intel_crtc->wm.cxsr_allowed = true;
+ intel_crtc_attach_color_properties(&intel_crtc->base);
BUG_ON(pipe >= ARRAY_SIZE(dev_priv->plane_to_crtc_mapping) ||
dev_priv->plane_to_crtc_mapping[intel_crtc->plane] != NULL);
--
2.6.3
More information about the Intel-gfx
mailing list