]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm: drm_helper_crtc_enable_color_mgmt() => drm_crtc_enable_color_mgmt()
authorJyri Sarha <jsarha@ti.com>
Tue, 7 Jun 2016 12:09:14 +0000 (15:09 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 7 Jun 2016 14:10:49 +0000 (17:10 +0300)
Add drm_crtc_enable_color_mgmt(), remove drm_helper_crtc_enable_color_mgmt()
and update drm/i915-driver (the only user of the old function).

The new function is more flexible. It allows driver to enable only the
features it has without forcing to enable all three color management
properties: degamma lut, csc matrix (ctm), and gamma lut.

Suggested-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/drm_crtc_helper.c
drivers/gpu/drm/i915/intel_color.c
include/drm/drm_crtc.h
include/drm/drm_crtc_helper.h

index 0e3cc66aa8b7d45803e39d36cb26faac494a3568..b25c75981bd3027bf239728759491acec8b978c2 100644 (file)
@@ -6064,3 +6064,48 @@ struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev,
        return tg;
 }
 EXPORT_SYMBOL(drm_mode_create_tile_group);
+
+/**
+ * drm_crtc_enable_color_mgmt - enable color management properties
+ * @crtc: DRM CRTC
+ * @degamma_lut_size: the size of the degamma lut (before CSC)
+ * @has_ctm: whether to attach ctm_property for CSC matrix
+ * @gamma_lut_size: the size of the gamma lut (after CSC)
+ *
+ * This function lets the driver enable the color correction
+ * properties on a CRTC. This includes 3 degamma, csc and gamma
+ * properties that userspace can set and 2 size properties to inform
+ * the userspace of the lut sizes. Each of the properties are
+ * optional. The gamma and degamma properties are only attached if
+ * their size is not 0 and ctm_property is only attached if has_ctm is
+ * true.
+ */
+void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,
+                               uint degamma_lut_size,
+                               bool has_ctm,
+                               uint gamma_lut_size)
+{
+       struct drm_device *dev = crtc->dev;
+       struct drm_mode_config *config = &dev->mode_config;
+
+       if (degamma_lut_size) {
+               drm_object_attach_property(&crtc->base,
+                                          config->degamma_lut_property, 0);
+               drm_object_attach_property(&crtc->base,
+                                          config->degamma_lut_size_property,
+                                          degamma_lut_size);
+       }
+
+       if (has_ctm)
+               drm_object_attach_property(&crtc->base,
+                                          config->ctm_property, 0);
+
+       if (gamma_lut_size) {
+               drm_object_attach_property(&crtc->base,
+                                          config->gamma_lut_property, 0);
+               drm_object_attach_property(&crtc->base,
+                                          config->gamma_lut_size_property,
+                                          gamma_lut_size);
+       }
+}
+EXPORT_SYMBOL(drm_crtc_enable_color_mgmt);
index a6e42433ef0e0d5cde2d87739fb778e59336b705..bf10d7046aa681fe55c257fe843308942051509d 100644 (file)
@@ -1121,36 +1121,3 @@ int drm_helper_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
        return drm_plane_helper_commit(plane, plane_state, old_fb);
 }
 EXPORT_SYMBOL(drm_helper_crtc_mode_set_base);
-
-/**
- * drm_helper_crtc_enable_color_mgmt - enable color management properties
- * @crtc: DRM CRTC
- * @degamma_lut_size: the size of the degamma lut (before CSC)
- * @gamma_lut_size: the size of the gamma lut (after CSC)
- *
- * This function lets the driver enable the color correction properties on a
- * CRTC. This includes 3 degamma, csc and gamma properties that userspace can
- * set and 2 size properties to inform the userspace of the lut sizes.
- */
-void drm_helper_crtc_enable_color_mgmt(struct drm_crtc *crtc,
-                                      int degamma_lut_size,
-                                      int gamma_lut_size)
-{
-       struct drm_device *dev = crtc->dev;
-       struct drm_mode_config *config = &dev->mode_config;
-
-       drm_object_attach_property(&crtc->base,
-                                  config->degamma_lut_property, 0);
-       drm_object_attach_property(&crtc->base,
-                                  config->ctm_property, 0);
-       drm_object_attach_property(&crtc->base,
-                                  config->gamma_lut_property, 0);
-
-       drm_object_attach_property(&crtc->base,
-                                  config->degamma_lut_size_property,
-                                  degamma_lut_size);
-       drm_object_attach_property(&crtc->base,
-                                  config->gamma_lut_size_property,
-                                  gamma_lut_size);
-}
-EXPORT_SYMBOL(drm_helper_crtc_enable_color_mgmt);
index 1b3f97449395fe0a4f2c2c53f34ec1b0d54161c2..522f5a2de01597c73fe458bede96d028615abac7 100644 (file)
@@ -547,7 +547,8 @@ void intel_color_init(struct drm_crtc *crtc)
        /* Enable color management support when we have degamma & gamma LUTs. */
        if (INTEL_INFO(dev)->color.degamma_lut_size != 0 &&
            INTEL_INFO(dev)->color.gamma_lut_size != 0)
-               drm_helper_crtc_enable_color_mgmt(crtc,
+               drm_crtc_enable_color_mgmt(crtc,
                                        INTEL_INFO(dev)->color.degamma_lut_size,
+                                       true,
                                        INTEL_INFO(dev)->color.gamma_lut_size);
 }
index d1559cd04e3de85849eee8df7189f4ce2e09cad4..36d3bbf9ea752ec5c7ca9935ca8fdd16e34aeae4 100644 (file)
@@ -2553,7 +2553,10 @@ extern struct drm_property *drm_mode_create_rotation_property(struct drm_device
                                                              unsigned int supported_rotations);
 extern unsigned int drm_rotation_simplify(unsigned int rotation,
                                          unsigned int supported_rotations);
-
+extern void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,
+                                      uint degamma_lut_size,
+                                      bool has_ctm,
+                                      uint gamma_lut_size);
 /* Helpers */
 
 static inline struct drm_plane *drm_plane_find(struct drm_device *dev,
index 97fa894d4ee27757f60b91721023b8b4348bc5e3..4b37afa2b73b4a106d7beef61f7b5be0198fe983 100644 (file)
@@ -48,9 +48,6 @@ extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
                                     struct drm_display_mode *mode,
                                     int x, int y,
                                     struct drm_framebuffer *old_fb);
-extern void drm_helper_crtc_enable_color_mgmt(struct drm_crtc *crtc,
-                                             int degamma_lut_size,
-                                             int gamma_lut_size);
 extern bool drm_helper_crtc_in_use(struct drm_crtc *crtc);
 extern bool drm_helper_encoder_in_use(struct drm_encoder *encoder);