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

drm/connector: Add a helper to attach the colorspace property

The intel driver uses the same logic to attach the Colorspace property
in multiple places and we'll need it in vc4 too. Let's move that common
code in a helper.

Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20210430094451.2145002-4-maxime@cerno.tech

+23 -4
+20
drivers/gpu/drm/drm_connector.c
··· 2174 2174 EXPORT_SYMBOL(drm_connector_attach_hdr_output_metadata_property); 2175 2175 2176 2176 /** 2177 + * drm_connector_attach_colorspace_property - attach "Colorspace" property 2178 + * @connector: connector to attach the property on. 2179 + * 2180 + * This is used to allow the userspace to signal the output colorspace 2181 + * to the driver. 2182 + * 2183 + * Returns: 2184 + * Zero on success, negative errno on failure. 2185 + */ 2186 + int drm_connector_attach_colorspace_property(struct drm_connector *connector) 2187 + { 2188 + struct drm_property *prop = connector->colorspace_property; 2189 + 2190 + drm_object_attach_property(&connector->base, prop, DRM_MODE_COLORIMETRY_DEFAULT); 2191 + 2192 + return 0; 2193 + } 2194 + EXPORT_SYMBOL(drm_connector_attach_colorspace_property); 2195 + 2196 + /** 2177 2197 * drm_connector_atomic_hdr_metadata_equal - checks if the hdr metadata changed 2178 2198 * @old_state: old connector state to compare 2179 2199 * @new_state: new connector state to compare
+2 -4
drivers/gpu/drm/i915/display/intel_connector.c
··· 282 282 intel_attach_hdmi_colorspace_property(struct drm_connector *connector) 283 283 { 284 284 if (!drm_mode_create_hdmi_colorspace_property(connector)) 285 - drm_object_attach_property(&connector->base, 286 - connector->colorspace_property, 0); 285 + drm_connector_attach_colorspace_property(connector); 287 286 } 288 287 289 288 void 290 289 intel_attach_dp_colorspace_property(struct drm_connector *connector) 291 290 { 292 291 if (!drm_mode_create_dp_colorspace_property(connector)) 293 - drm_object_attach_property(&connector->base, 294 - connector->colorspace_property, 0); 292 + drm_connector_attach_colorspace_property(connector); 295 293 }
+1
include/drm/drm_connector.h
··· 1671 1671 u32 scaling_mode_mask); 1672 1672 int drm_connector_attach_vrr_capable_property( 1673 1673 struct drm_connector *connector); 1674 + int drm_connector_attach_colorspace_property(struct drm_connector *connector); 1674 1675 int drm_connector_attach_hdr_output_metadata_property(struct drm_connector *connector); 1675 1676 bool drm_connector_atomic_hdr_metadata_equal(struct drm_connector_state *old_state, 1676 1677 struct drm_connector_state *new_state);