[PATCH v5 16/17] drm/connector: Register color format property on HDMI connectors
Nicolas Frattaroli
nicolas.frattaroli at collabora.com
Fri Nov 28 13:05:52 PST 2025
The drmm_connector_hdmi_init function can figure out what DRM color
formats are supported by a particular connector based on the supported
HDMI format bitmask that's passed in.
Use it to register the drm color format property.
Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli at collabora.com>
---
drivers/gpu/drm/drm_connector.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 13151d9bfb82..7c38123f99cd 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -578,6 +578,7 @@ int drmm_connector_hdmi_init(struct drm_device *dev,
unsigned long supported_formats,
unsigned int max_bpc)
{
+ u32 supported_drm_formats = 0;
int ret;
if (!vendor || !product)
@@ -621,6 +622,18 @@ int drmm_connector_hdmi_init(struct drm_device *dev,
if (max_bpc > 8)
drm_connector_attach_hdr_output_metadata_property(connector);
+ if (supported_formats & BIT(HDMI_COLORSPACE_RGB))
+ supported_drm_formats |= DRM_COLOR_FORMAT_RGB444;
+ if (supported_formats & BIT(HDMI_COLORSPACE_YUV444))
+ supported_drm_formats |= DRM_COLOR_FORMAT_YCBCR444;
+ if (supported_formats & BIT(HDMI_COLORSPACE_YUV422))
+ supported_drm_formats |= DRM_COLOR_FORMAT_YCBCR422;
+ if (supported_formats & BIT(HDMI_COLORSPACE_YUV420))
+ supported_drm_formats |= DRM_COLOR_FORMAT_YCBCR420;
+
+ if (!drm_mode_create_color_format_property(connector, supported_drm_formats))
+ drm_connector_attach_color_format_property(connector);
+
connector->hdmi.funcs = hdmi_funcs;
return 0;
--
2.52.0
More information about the Linux-rockchip
mailing list