[PATCH 03/14] drm/display: hdmi: Convert to drm_output_color_format

Maxime Ripard
2026-02-24T10:59:01Z

Now that we introduced a new drm_output_color_format enum to represent
what DRM_COLOR_FORMAT_* bits were representing, we can switch to the new
enum.

The main different is that while DRM_COLOR_FORMAT_ was a bitmask,
drm_output_color_format is a proper enum. However, the enum was done is
such a way than DRM_COLOR_FORMAT_X = BIT(DRM_OUTPUT_COLOR_FORMAT_X) so
the transitition is easier.

The only thing we need to consider is if the original code meant to use
that value as a bitmask, in which case we do need to keep the bit shift,
or as a discriminant in which case we don't.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
drivers/gpu/drm/display/drm_hdmi_state_helper.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
index a1d16762ac7a9ebdc48f081c5d2f5e200d406099..f2aec6f65e7a374cea9a1e3adafb4f1cc4d6ab9a 100644
--- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
+++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
@@ -426,11 +426,11 @@ sink_supports_format_bpc(const struct drm_connector *connector,
* color_formats field will be blank and not report any
* format supported. In such a case, assume that RGB is
* supported so we can keep things going and light up
* the display.
*/
- if (!(info->color_formats & DRM_COLOR_FORMAT_RGB444))
+ if (!(info->color_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444)))
drm_warn(dev, "HDMI Sink doesn't support RGB, something's wrong.\n");

if (bpc == 10 && !(info->edid_hdmi_rgb444_dc_modes & DRM_EDID_HDMI_DC_30)) {
drm_dbg_kms(dev, "10 BPC but sink doesn't support Deep Color 30.\n");
return false;
@@ -446,11 +446,11 @@ sink_supports_format_bpc(const struct drm_connector *connector,
return true;

case HDMI_COLORSPACE_YUV420:
drm_dbg_kms(dev, "YUV420 format, checking the constraints.\n");

- if (!(info->color_formats & DRM_COLOR_FORMAT_YCBCR420)) {
+ if (!(info->color_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR420))) {
drm_dbg_kms(dev, "Sink doesn't support YUV420.\n");
return false;
}

if (!drm_mode_is_420(info, mode)) {
@@ -478,11 +478,11 @@ sink_supports_format_bpc(const struct drm_connector *connector,
return true;

case HDMI_COLORSPACE_YUV422:
drm_dbg_kms(dev, "YUV422 format, checking the constraints.\n");

- if (!(info->color_formats & DRM_COLOR_FORMAT_YCBCR422)) {
+ if (!(info->color_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422))) {
drm_dbg_kms(dev, "Sink doesn't support YUV422.\n");
return false;
}

if (bpc > 12) {
@@ -501,11 +501,11 @@ sink_supports_format_bpc(const struct drm_connector *connector,
return true;

case HDMI_COLORSPACE_YUV444:
drm_dbg_kms(dev, "YUV444 format, checking the constraints.\n");

- if (!(info->color_formats & DRM_COLOR_FORMAT_YCBCR444)) {
+ if (!(info->color_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444))) {
drm_dbg_kms(dev, "Sink doesn't support YUV444.\n");
return false;
}

if (bpc == 10 && !(info->edid_hdmi_ycbcr444_dc_modes & DRM_EDID_HDMI_DC_30)) {

--
2.52.0