]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/display: hdmi: Convert to drm_output_color_format
authorMaxime Ripard <mripard@kernel.org>
Thu, 5 Mar 2026 09:04:55 +0000 (10:04 +0100)
committerMaxime Ripard <mripard@kernel.org>
Tue, 24 Mar 2026 12:54:29 +0000 (13:54 +0100)
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 difference 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.

Acked-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260305-drm-rework-color-formats-v3-3-f3935f6db579@kernel.org
Signed-off-by: Maxime Ripard <mripard@kernel.org>
drivers/gpu/drm/display/drm_hdmi_state_helper.c

index a1d16762ac7a9ebdc48f081c5d2f5e200d406099..f2aec6f65e7a374cea9a1e3adafb4f1cc4d6ab9a 100644 (file)
@@ -428,7 +428,7 @@ sink_supports_format_bpc(const struct drm_connector *connector,
                 * 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)) {
@@ -448,7 +448,7 @@ sink_supports_format_bpc(const struct drm_connector *connector,
        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;
                }
@@ -480,7 +480,7 @@ sink_supports_format_bpc(const struct drm_connector *connector,
        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;
                }
@@ -503,7 +503,7 @@ sink_supports_format_bpc(const struct drm_connector *connector,
        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;
                }