aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJyri Sarha <jsarha@ti.com>2016-06-07 08:09:14 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2016-06-07 10:10:49 -0400
commitf8ed34ac7b453296cf36d6eb7ae911de353e1351 (patch)
treef06b3786f36450df962791939f489b8634b3d51a /drivers
parenta1dec226a686077a9822013e601327b189f419df (diff)
drm: drm_helper_crtc_enable_color_mgmt() => drm_crtc_enable_color_mgmt()
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/drm_crtc.c45
-rw-r--r--drivers/gpu/drm/drm_crtc_helper.c33
-rw-r--r--drivers/gpu/drm/i915/intel_color.c3
3 files changed, 47 insertions, 34 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 0e3cc66aa8b7..b25c75981bd3 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -6064,3 +6064,48 @@ struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev,
6064 return tg; 6064 return tg;
6065} 6065}
6066EXPORT_SYMBOL(drm_mode_create_tile_group); 6066EXPORT_SYMBOL(drm_mode_create_tile_group);
6067
6068/**
6069 * drm_crtc_enable_color_mgmt - enable color management properties
6070 * @crtc: DRM CRTC
6071 * @degamma_lut_size: the size of the degamma lut (before CSC)
6072 * @has_ctm: whether to attach ctm_property for CSC matrix
6073 * @gamma_lut_size: the size of the gamma lut (after CSC)
6074 *
6075 * This function lets the driver enable the color correction
6076 * properties on a CRTC. This includes 3 degamma, csc and gamma
6077 * properties that userspace can set and 2 size properties to inform
6078 * the userspace of the lut sizes. Each of the properties are
6079 * optional. The gamma and degamma properties are only attached if
6080 * their size is not 0 and ctm_property is only attached if has_ctm is
6081 * true.
6082 */
6083void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,
6084 uint degamma_lut_size,
6085 bool has_ctm,
6086 uint gamma_lut_size)
6087{
6088 struct drm_device *dev = crtc->dev;
6089 struct drm_mode_config *config = &dev->mode_config;
6090
6091 if (degamma_lut_size) {
6092 drm_object_attach_property(&crtc->base,
6093 config->degamma_lut_property, 0);
6094 drm_object_attach_property(&crtc->base,
6095 config->degamma_lut_size_property,
6096 degamma_lut_size);
6097 }
6098
6099 if (has_ctm)
6100 drm_object_attach_property(&crtc->base,
6101 config->ctm_property, 0);
6102
6103 if (gamma_lut_size) {
6104 drm_object_attach_property(&crtc->base,
6105 config->gamma_lut_property, 0);
6106 drm_object_attach_property(&crtc->base,
6107 config->gamma_lut_size_property,
6108 gamma_lut_size);
6109 }
6110}
6111EXPORT_SYMBOL(drm_crtc_enable_color_mgmt);
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index a6e42433ef0e..bf10d7046aa6 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -1121,36 +1121,3 @@ int drm_helper_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
1121 return drm_plane_helper_commit(plane, plane_state, old_fb); 1121 return drm_plane_helper_commit(plane, plane_state, old_fb);
1122} 1122}
1123EXPORT_SYMBOL(drm_helper_crtc_mode_set_base); 1123EXPORT_SYMBOL(drm_helper_crtc_mode_set_base);
1124
1125/**
1126 * drm_helper_crtc_enable_color_mgmt - enable color management properties
1127 * @crtc: DRM CRTC
1128 * @degamma_lut_size: the size of the degamma lut (before CSC)
1129 * @gamma_lut_size: the size of the gamma lut (after CSC)
1130 *
1131 * This function lets the driver enable the color correction properties on a
1132 * CRTC. This includes 3 degamma, csc and gamma properties that userspace can
1133 * set and 2 size properties to inform the userspace of the lut sizes.
1134 */
1135void drm_helper_crtc_enable_color_mgmt(struct drm_crtc *crtc,
1136 int degamma_lut_size,
1137 int gamma_lut_size)
1138{
1139 struct drm_device *dev = crtc->dev;
1140 struct drm_mode_config *config = &dev->mode_config;
1141
1142 drm_object_attach_property(&crtc->base,
1143 config->degamma_lut_property, 0);
1144 drm_object_attach_property(&crtc->base,
1145 config->ctm_property, 0);
1146 drm_object_attach_property(&crtc->base,
1147 config->gamma_lut_property, 0);
1148
1149 drm_object_attach_property(&crtc->base,
1150 config->degamma_lut_size_property,
1151 degamma_lut_size);
1152 drm_object_attach_property(&crtc->base,
1153 config->gamma_lut_size_property,
1154 gamma_lut_size);
1155}
1156EXPORT_SYMBOL(drm_helper_crtc_enable_color_mgmt);
diff --git a/drivers/gpu/drm/i915/intel_color.c b/drivers/gpu/drm/i915/intel_color.c
index 1b3f97449395..522f5a2de015 100644
--- a/drivers/gpu/drm/i915/intel_color.c
+++ b/drivers/gpu/drm/i915/intel_color.c
@@ -547,7 +547,8 @@ void intel_color_init(struct drm_crtc *crtc)
547 /* Enable color management support when we have degamma & gamma LUTs. */ 547 /* Enable color management support when we have degamma & gamma LUTs. */
548 if (INTEL_INFO(dev)->color.degamma_lut_size != 0 && 548 if (INTEL_INFO(dev)->color.degamma_lut_size != 0 &&
549 INTEL_INFO(dev)->color.gamma_lut_size != 0) 549 INTEL_INFO(dev)->color.gamma_lut_size != 0)
550 drm_helper_crtc_enable_color_mgmt(crtc, 550 drm_crtc_enable_color_mgmt(crtc,
551 INTEL_INFO(dev)->color.degamma_lut_size, 551 INTEL_INFO(dev)->color.degamma_lut_size,
552 true,
552 INTEL_INFO(dev)->color.gamma_lut_size); 553 INTEL_INFO(dev)->color.gamma_lut_size);
553} 554}