Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jyri Sarha and committed by
Tomi Valkeinen
f8ed34ac a1dec226

+51 -38
+45
drivers/gpu/drm/drm_crtc.c
··· 6064 6064 return tg; 6065 6065 } 6066 6066 EXPORT_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 + */ 6083 + void 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 + } 6111 + EXPORT_SYMBOL(drm_crtc_enable_color_mgmt);
-33
drivers/gpu/drm/drm_crtc_helper.c
··· 1121 1121 return drm_plane_helper_commit(plane, plane_state, old_fb); 1122 1122 } 1123 1123 EXPORT_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 - */ 1135 - void 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 - } 1156 - EXPORT_SYMBOL(drm_helper_crtc_enable_color_mgmt);
+2 -1
drivers/gpu/drm/i915/intel_color.c
··· 547 547 /* Enable color management support when we have degamma & gamma LUTs. */ 548 548 if (INTEL_INFO(dev)->color.degamma_lut_size != 0 && 549 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 551 INTEL_INFO(dev)->color.degamma_lut_size, 552 + true, 552 553 INTEL_INFO(dev)->color.gamma_lut_size); 553 554 }
+4 -1
include/drm/drm_crtc.h
··· 2553 2553 unsigned int supported_rotations); 2554 2554 extern unsigned int drm_rotation_simplify(unsigned int rotation, 2555 2555 unsigned int supported_rotations); 2556 - 2556 + extern void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, 2557 + uint degamma_lut_size, 2558 + bool has_ctm, 2559 + uint gamma_lut_size); 2557 2560 /* Helpers */ 2558 2561 2559 2562 static inline struct drm_plane *drm_plane_find(struct drm_device *dev,
-3
include/drm/drm_crtc_helper.h
··· 48 48 struct drm_display_mode *mode, 49 49 int x, int y, 50 50 struct drm_framebuffer *old_fb); 51 - extern void drm_helper_crtc_enable_color_mgmt(struct drm_crtc *crtc, 52 - int degamma_lut_size, 53 - int gamma_lut_size); 54 51 extern bool drm_helper_crtc_in_use(struct drm_crtc *crtc); 55 52 extern bool drm_helper_encoder_in_use(struct drm_encoder *encoder); 56 53