Skip to content

Commit 2a1297b

Browse files
mripardpopcornmix
authored andcommitted
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. Signed-off-by: Maxime Ripard <maxime@cerno.tech>
1 parent 81c6b9d commit 2a1297b

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

‎drivers/gpu/drm/drm_connector.c‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2164,6 +2164,26 @@ int drm_connector_attach_hdr_output_metadata_property(struct drm_connector *conn
21642164
}
21652165
EXPORT_SYMBOL(drm_connector_attach_hdr_output_metadata_property);
21662166

2167+
/**
2168+
* drm_connector_attach_colorspace_property - attach "Colorspace" property
2169+
* @connector: connector to attach the property on.
2170+
*
2171+
* This is used to allow the userspace to signal the output colorspace
2172+
* to the driver.
2173+
*
2174+
* Returns:
2175+
* Zero on success, negative errno on failure.
2176+
*/
2177+
int drm_connector_attach_colorspace_property(struct drm_connector *connector)
2178+
{
2179+
struct drm_property *prop = connector->colorspace_property;
2180+
2181+
drm_object_attach_property(&connector->base, prop, DRM_MODE_COLORIMETRY_DEFAULT);
2182+
2183+
return 0;
2184+
}
2185+
EXPORT_SYMBOL(drm_connector_attach_colorspace_property);
2186+
21672187
/**
21682188
* drm_connector_atomic_hdr_metadata_equal - checks if the hdr metadata changed
21692189
* @old_state: old connector state to compare

‎drivers/gpu/drm/i915/display/intel_connector.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,5 @@ intel_attach_colorspace_property(struct drm_connector *connector)
297297
return;
298298
}
299299

300-
drm_object_attach_property(&connector->base,
301-
connector->colorspace_property, 0);
300+
drm_connector_attach_colorspace_property(connector);
302301
}

‎include/drm/drm_connector.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,6 +1622,7 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
16221622
u32 scaling_mode_mask);
16231623
int drm_connector_attach_vrr_capable_property(
16241624
struct drm_connector *connector);
1625+
int drm_connector_attach_colorspace_property(struct drm_connector *connector);
16251626
int drm_connector_attach_hdr_output_metadata_property(struct drm_connector *connector);
16261627
bool drm_connector_atomic_hdr_metadata_equal(struct drm_connector_state *old_state,
16271628
struct drm_connector_state *new_state);

0 commit comments

Comments
 (0)