Subject: [PATCH] drm: Print HDMI 2.0 support from monitor

From: Shashank Sharma <[email-masked]>
Date: Thu, 1 Mar 2018 12:38:17 +0530

This patch dumps HDMI 2.0 monitor info (if any)

Signed-off-by: Shashank Sharma <[email-masked]>
---
 drivers/gpu/drm/drm_edid.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index ddd5379..166edc4 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -4245,6 +4245,29 @@ static void drm_parse_ycbcr420_deep_color_info(struct drm_connector *connector,
 	hdmi->y420_dc_modes |= dc_mask;
 }
 
+
+static void drm_print_hdmi2_features(struct drm_hdmi_info *hdmi)
+{
+	struct drm_scdc *scdc = &hdmi->scdc;
+	struct drm_scrambling *scrambling = &scdc->scrambling;
+
+	DRM_ERROR("======== Shashank: Monitor HDMI 2.0 status   =============\n");
+	DRM_ERROR("======== Shashank: Monitor scrambling =============\n");
+	DRM_ERROR("supported > 340M=%s\n", scrambling->supported ? "Y" : "N");
+	DRM_ERROR("supported < 340M=%s\n", scrambling->low_rates? "Y" : "N");
+	DRM_ERROR("======== Shashank: Monitor SCDC =============\n");
+	DRM_ERROR("supported =%s\n", scdc->supported ? "Y" : "N");
+	DRM_ERROR("rr supported =%s\n", scdc->read_request ? "Y" : "N");
+	DRM_ERROR("======== Shashank: Monitor 420  =============\n");
+	DRM_ERROR("YCBCR420 (also) supported =%s\n", hdmi->y420_cmdb_map ? "Y" : "N");
+	DRM_ERROR("YCBCR420 (only) supported =%s\n", (hdmi->y420_vdb_modes[0] ||
+								hdmi->y420_vdb_modes[1]  ||
+								hdmi->y420_vdb_modes[2]  ||
+								hdmi->y420_vdb_modes[3] ) ? "Y" : "N");
+	DRM_ERROR("YCBCR420 dc support =%s\n", hdmi->y420_dc_modes ? "Y" : "N");
+	DRM_ERROR("======== ====================================\n");
+}
+
 static void drm_parse_hdmi_forum_vsdb(struct drm_connector *connector,
 				 const u8 *hf_vsdb)
 {
@@ -4289,6 +4312,7 @@ static void drm_parse_hdmi_forum_vsdb(struct drm_connector *connector,
 	}
 
 	drm_parse_ycbcr420_deep_color_info(connector, hf_vsdb);
+	drm_print_hdmi2_features(hdmi);
 }
 
 static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
@@ -4328,7 +4352,8 @@ static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
 		DRM_DEBUG("%s: No deep color support on this HDMI sink.\n",
 			  connector->name);
 		return;
-	}
+	} else
+		DRM_ERROR("Shashank: Monitor does deep color, dc_dpc=%d\n", dc_bpc);
 
 	DRM_DEBUG("%s: Assigning HDMI sink color depth as %d bpc.\n",
 		  connector->name, dc_bpc);
-- 
2.7.4