With the introduction of the "color format" DRM property, which allows
userspace to request a specific color format, the HDMI state helper
should implement this.

Implement it by checking whether the property is set and set to
something other than auto. If so, pass the requested color format, and
otherwise set RGB.

Signed-off-by: Nicolas Frattaroli <[email protected]>
---
 drivers/gpu/drm/display/drm_hdmi_state_helper.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c 
b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
index a561f124be99..add0d51fce33 100644
--- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
+++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
@@ -650,9 +650,15 @@ hdmi_compute_config(const struct drm_connector *connector,
                                       conn_state->max_bpc,
                                       8, connector->max_bpc);
        int ret;
+       enum hdmi_colorspace hdmi_colorspace;
+
+       if (conn_state->color_format && conn_state->color_format != 
DRM_COLOR_FORMAT_AUTO)
+               hdmi_colorspace = 
color_format_to_hdmi_colorspace(conn_state->color_format);
+       else
+               hdmi_colorspace = HDMI_COLORSPACE_RGB;
 
        ret = hdmi_compute_format_bpc(connector, conn_state, mode, max_bpc,
-                                     HDMI_COLORSPACE_RGB);
+                                     hdmi_colorspace);
        if (ret) {
                if (connector->ycbcr_420_allowed) {
                        ret = hdmi_compute_format_bpc(connector, conn_state,

-- 
2.51.2

Reply via email to