From 56fe89b9e66b52499b8c051f0fee8b7eb426311a Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Thu, 21 Nov 2024 18:43:28 +0000
Subject: [PATCH] drm/connector: hdmi: Attempt YUV422 output if RGB isn't
 supported

Drop from RGB to YUV422 output if RGB couldn't be supported
within the defined max_bpc and TMDS rates, and then try
dropping max_bpc.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
 drivers/gpu/drm/display/drm_hdmi_state_helper.c | 5 +++++
 1 file changed, 5 insertions(+)

--- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
+++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
@@ -294,6 +294,11 @@ hdmi_compute_format(const struct drm_con
 		return 0;
 	}
 
+	if (hdmi_try_format_bpc(connector, conn_state, mode, bpc, HDMI_COLORSPACE_YUV422)) {
+		conn_state->hdmi.output_format = HDMI_COLORSPACE_YUV422;
+		return 0;
+	}
+
 	drm_dbg_kms(dev, "Failed. No Format Supported for that bpc count.\n");
 
 	return -EINVAL;
