diff options
| -rw-r--r-- | drivers/gpu/drm/drm_crtc.c | 45 | ||||
| -rw-r--r-- | drivers/gpu/drm/drm_crtc_helper.c | 33 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/intel_color.c | 3 | ||||
| -rw-r--r-- | include/drm/drm_crtc.h | 5 | ||||
| -rw-r--r-- | include/drm/drm_crtc_helper.h | 3 |
5 files changed, 51 insertions, 38 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 | } |
| 6066 | EXPORT_SYMBOL(drm_mode_create_tile_group); | 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); | ||
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 | } |
| 1123 | EXPORT_SYMBOL(drm_helper_crtc_mode_set_base); | 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); | ||
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 | } |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index d1559cd04e3d..36d3bbf9ea75 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
| @@ -2553,7 +2553,10 @@ extern struct drm_property *drm_mode_create_rotation_property(struct drm_device | |||
| 2553 | unsigned int supported_rotations); | 2553 | unsigned int supported_rotations); |
| 2554 | extern unsigned int drm_rotation_simplify(unsigned int rotation, | 2554 | extern unsigned int drm_rotation_simplify(unsigned int rotation, |
| 2555 | unsigned int supported_rotations); | 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 | /* Helpers */ | 2560 | /* Helpers */ |
| 2558 | 2561 | ||
| 2559 | static inline struct drm_plane *drm_plane_find(struct drm_device *dev, | 2562 | static inline struct drm_plane *drm_plane_find(struct drm_device *dev, |
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h index 97fa894d4ee2..4b37afa2b73b 100644 --- a/include/drm/drm_crtc_helper.h +++ b/include/drm/drm_crtc_helper.h | |||
| @@ -48,9 +48,6 @@ extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, | |||
| 48 | struct drm_display_mode *mode, | 48 | struct drm_display_mode *mode, |
| 49 | int x, int y, | 49 | int x, int y, |
| 50 | struct drm_framebuffer *old_fb); | 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 | extern bool drm_helper_crtc_in_use(struct drm_crtc *crtc); | 51 | extern bool drm_helper_crtc_in_use(struct drm_crtc *crtc); |
| 55 | extern bool drm_helper_encoder_in_use(struct drm_encoder *encoder); | 52 | extern bool drm_helper_encoder_in_use(struct drm_encoder *encoder); |
| 56 | 53 | ||
