]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/connector: hdmi: Validate supported_formats matches ycbcr_420_allowed
authorCristian Ciocaltea <cristian.ciocaltea@collabora.com>
Tue, 24 Dec 2024 18:22:43 +0000 (20:22 +0200)
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Mon, 13 Jan 2025 09:18:20 +0000 (11:18 +0200)
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>
drivers/gpu/drm/drm_connector.c

index fc35f47e2849ed6786d6223ac9c69e1c359fc648..ca7f43c8d6f1b31ef9d3a1ee05f4df930ecffac4 100644 (file)
@@ -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;