drm/edid: Split deep color modes between RGB and YUV444
authorjsg <jsg@openbsd.org>
Mon, 11 Apr 2022 03:46:07 +0000 (03:46 +0000)
committerjsg <jsg@openbsd.org>
Mon, 11 Apr 2022 03:46:07 +0000 (03:46 +0000)
From Maxime Ripard
da491fc54e4e387419948840636df15f4a611ec4 in linux 5.15.y/5.15.33
4adc33f36d80489339f1b43dfeee96bb9ea8e459 in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_connectors.c
sys/dev/pci/drm/drm_edid.c
sys/dev/pci/drm/i915/display/intel_hdmi.c
sys/dev/pci/drm/include/drm/drm_connector.h
sys/dev/pci/drm/radeon/radeon_connectors.c

index df1f9b8..a09876b 100644 (file)
@@ -175,7 +175,7 @@ int amdgpu_connector_get_monitor_bpc(struct drm_connector *connector)
 
                        /* Check if bpc is within clock limit. Try to degrade gracefully otherwise */
                        if ((bpc == 12) && (mode_clock * 3/2 > max_tmds_clock)) {
-                               if ((connector->display_info.edid_hdmi_dc_modes & DRM_EDID_HDMI_DC_30) &&
+                               if ((connector->display_info.edid_hdmi_rgb444_dc_modes & DRM_EDID_HDMI_DC_30) &&
                                    (mode_clock * 5/4 <= max_tmds_clock))
                                        bpc = 10;
                                else
index 19b3c1d..895587a 100644 (file)
@@ -5018,21 +5018,21 @@ static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
 
        if (hdmi[6] & DRM_EDID_HDMI_DC_30) {
                dc_bpc = 10;
-               info->edid_hdmi_dc_modes |= DRM_EDID_HDMI_DC_30;
+               info->edid_hdmi_rgb444_dc_modes |= DRM_EDID_HDMI_DC_30;
                DRM_DEBUG("%s: HDMI sink does deep color 30.\n",
                          connector->name);
        }
 
        if (hdmi[6] & DRM_EDID_HDMI_DC_36) {
                dc_bpc = 12;
-               info->edid_hdmi_dc_modes |= DRM_EDID_HDMI_DC_36;
+               info->edid_hdmi_rgb444_dc_modes |= DRM_EDID_HDMI_DC_36;
                DRM_DEBUG("%s: HDMI sink does deep color 36.\n",
                          connector->name);
        }
 
        if (hdmi[6] & DRM_EDID_HDMI_DC_48) {
                dc_bpc = 16;
-               info->edid_hdmi_dc_modes |= DRM_EDID_HDMI_DC_48;
+               info->edid_hdmi_rgb444_dc_modes |= DRM_EDID_HDMI_DC_48;
                DRM_DEBUG("%s: HDMI sink does deep color 48.\n",
                          connector->name);
        }
@@ -5049,6 +5049,7 @@ static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
 
        /* YCRCB444 is optional according to spec. */
        if (hdmi[6] & DRM_EDID_HDMI_DC_Y444) {
+               info->edid_hdmi_ycbcr444_dc_modes = info->edid_hdmi_rgb444_dc_modes;
                DRM_DEBUG("%s: HDMI sink does YCRCB444 in deep color.\n",
                          connector->name);
        }
index 292fe83..1754a78 100644 (file)
@@ -1892,7 +1892,7 @@ static bool intel_hdmi_bpc_possible(struct drm_connector *connector,
                if (ycbcr420_output)
                        return hdmi->y420_dc_modes & DRM_EDID_YCBCR420_DC_36;
                else
-                       return info->edid_hdmi_dc_modes & DRM_EDID_HDMI_DC_36;
+                       return info->edid_hdmi_rgb444_dc_modes & DRM_EDID_HDMI_DC_36;
        case 10:
                if (DISPLAY_VER(i915) < 11)
                        return false;
@@ -1903,7 +1903,7 @@ static bool intel_hdmi_bpc_possible(struct drm_connector *connector,
                if (ycbcr420_output)
                        return hdmi->y420_dc_modes & DRM_EDID_YCBCR420_DC_30;
                else
-                       return info->edid_hdmi_dc_modes & DRM_EDID_HDMI_DC_30;
+                       return info->edid_hdmi_rgb444_dc_modes & DRM_EDID_HDMI_DC_30;
        case 8:
                return true;
        default:
index 0146eca..1e070c2 100644 (file)
@@ -566,10 +566,16 @@ struct drm_display_info {
        bool rgb_quant_range_selectable;
 
        /**
-        * @edid_hdmi_dc_modes: Mask of supported hdmi deep color modes. Even
-        * more stuff redundant with @bus_formats.
+        * @edid_hdmi_dc_rgb444_modes: Mask of supported hdmi deep color modes
+        * in RGB 4:4:4. Even more stuff redundant with @bus_formats.
         */
-       u8 edid_hdmi_dc_modes;
+       u8 edid_hdmi_rgb444_dc_modes;
+
+       /**
+        * @edid_hdmi_dc_ycbcr444_modes: Mask of supported hdmi deep color
+        * modes in YCbCr 4:4:4. Even more stuff redundant with @bus_formats.
+        */
+       u8 edid_hdmi_ycbcr444_dc_modes;
 
        /**
         * @cea_rev: CEA revision of the HDMI sink.
index 607ad56..1546abc 100644 (file)
@@ -204,7 +204,7 @@ int radeon_get_monitor_bpc(struct drm_connector *connector)
 
                        /* Check if bpc is within clock limit. Try to degrade gracefully otherwise */
                        if ((bpc == 12) && (mode_clock * 3/2 > max_tmds_clock)) {
-                               if ((connector->display_info.edid_hdmi_dc_modes & DRM_EDID_HDMI_DC_30) &&
+                               if ((connector->display_info.edid_hdmi_rgb444_dc_modes & DRM_EDID_HDMI_DC_30) &&
                                        (mode_clock * 5/4 <= max_tmds_clock))
                                        bpc = 10;
                                else