summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorCristian Ciocaltea <cristian.ciocaltea@collabora.com>2024-12-24 19:22:43 +0100
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>2025-01-13 10:18:20 +0100
commitf2f96619590f944f74f3c2b0b57a6dcc5d13cd9f (patch)
treef7805e794869d4c696e9d83f981a4eaf134e1112 /drivers
parentdrm/bridge-connector: Sync supported_formats with computed ycbcr_420_allowed (diff)
downloadlinux-f2f96619590f944f74f3c2b0b57a6dcc5d13cd9f.tar.xz
linux-f2f96619590f944f74f3c2b0b57a6dcc5d13cd9f.zip
drm/connector: hdmi: Validate supported_formats matches ycbcr_420_allowed
Ensure HDMI connector initialization fails when the presence of HDMI_COLORSPACE_YUV420 in the given supported_formats bitmask doesn't match the value of drm_connector->ycbcr_420_allowed. Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Reviewed-by: Maxime Ripard <mripard@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20241224-bridge-conn-fmt-prio-v4-3-a9ceb5671379@collabora.com Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/drm_connector.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index fc35f47e2849..ca7f43c8d6f1 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -507,6 +507,9 @@ int drmm_connector_hdmi_init(struct drm_device *dev,
if (!supported_formats || !(supported_formats & BIT(HDMI_COLORSPACE_RGB)))
return -EINVAL;
+ if (connector->ycbcr_420_allowed != !!(supported_formats & BIT(HDMI_COLORSPACE_YUV420)))
+ return -EINVAL;
+
if (!(max_bpc == 8 || max_bpc == 10 || max_bpc == 12))
return -EINVAL;