diff mbox series

drm/i915/hdmi: Detect HDMI 2.0 monitors using multiple EDID capabilities

Message ID 1539817834-23408-1-git-send-email-clinton.a.taylor@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/hdmi: Detect HDMI 2.0 monitors using multiple EDID capabilities | expand

Commit Message

Taylor, Clinton A Oct. 17, 2018, 11:10 p.m. UTC
From: Clint Taylor <clinton.a.taylor@intel.com>

HDMI 2.0 monitors may not support SCDC and still be able to accept VICs
above 63. Use multiple EDID capbilities to determine if the SINK is
actually an HDMI 2.0 device. The QD980B HDMI 2.0 Analyzer generates unique
EDIDs during CTS tests that don't contain a HDMI Forum VSDB if the block is
not used during the test. The current HDMI AVI infoframe code only uses the
SCDC supported information in the HDMI Forum VSDB to determine if the sink
is HDMI 2.0. This patch adds checks for YCbCr420 Deep Color, YCbCR420 VDB,
YCBCR420 CMDB capabilities, and pipe is YCbCr420 to the existing SCDC
supported check to Infer SINK is HDMI 2.0.

HDMI 2.0 CTS HF1-51 test fails on the QD980B.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107894
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Shashank Sharma <shashank.sharma@intel.com>

Signed-off-by: Clint Taylor <clinton.a.taylor@intel.com>
---
 drivers/gpu/drm/i915/intel_hdmi.c | 32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

Comments

Ville Syrjälä Oct. 18, 2018, 10:23 a.m. UTC | #1
On Wed, Oct 17, 2018 at 04:10:34PM -0700, clinton.a.taylor@intel.com wrote:
> From: Clint Taylor <clinton.a.taylor@intel.com>
> 
> HDMI 2.0 monitors may not support SCDC and still be able to accept VICs
> above 63. Use multiple EDID capbilities to determine if the SINK is
> actually an HDMI 2.0 device. The QD980B HDMI 2.0 Analyzer generates unique
> EDIDs during CTS tests that don't contain a HDMI Forum VSDB if the block is
> not used during the test. The current HDMI AVI infoframe code only uses the
> SCDC supported information in the HDMI Forum VSDB to determine if the sink
> is HDMI 2.0. This patch adds checks for YCbCr420 Deep Color, YCbCR420 VDB,
> YCBCR420 CMDB capabilities, and pipe is YCbCr420 to the existing SCDC
> supported check to Infer SINK is HDMI 2.0.
> 
> HDMI 2.0 CTS HF1-51 test fails on the QD980B.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107894
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Shashank Sharma <shashank.sharma@intel.com>
> 
> Signed-off-by: Clint Taylor <clinton.a.taylor@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_hdmi.c | 32 +++++++++++++++++++++++++++++++-
>  1 file changed, 31 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 2c53efc..6913806 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -458,6 +458,34 @@ static void intel_write_infoframe(struct intel_encoder *encoder,
>  					frame->any.type, buffer, len);
>  }
>  
> +static bool is_hdmi2(const struct drm_connector *connector,
> +			const struct intel_crtc_state *crtc_state)
> +{
> +	bool hdmi2 = false;
> +	bool vdb_mode = false;
> +	bool cmdb_mode = false;
> +	int i = 0;
> +
> +	/* check VDB bits for HDMI 2.0 mode */
> +	for (i = 0; i < BITS_TO_LONGS(128); i++)
> +		if (connector->display_info.hdmi.y420_vdb_modes[i])
> +			vdb_mode = true;
> +
> +	/* check CMDB bits for HDMI 2.0 mode */
> +	for (i = 0; i < BITS_TO_LONGS(128); i++)
> +		if (connector->display_info.hdmi.y420_cmdb_modes[i])
> +			cmdb_mode = true;
> +
> +	if (connector->display_info.hdmi.scdc.supported ||
> +	    connector->display_info.hdmi.y420_dc_modes ||
> +	    crtc_state->ycbcr420 || vdb_mode || cmdb_mode) {

I think we can replace all this 4:2:0 related stuff with just a
display_info->color_formats & DRM_COLOR_FORMAT_YCRCB420
check.

> +		DRM_DEBUG_KMS("Inferred HDMI2 sink present\n");
> +		hdmi2 = true;
> +	}
> +
> +	return hdmi2;
> +}
> +
>  static void intel_hdmi_set_avi_infoframe(struct intel_encoder *encoder,
>  					 const struct intel_crtc_state *crtc_state,
>  					 const struct drm_connector_state *conn_state)
> @@ -466,10 +494,12 @@ static void intel_hdmi_set_avi_infoframe(struct intel_encoder *encoder,
>  	const struct drm_display_mode *adjusted_mode =
>  		&crtc_state->base.adjusted_mode;
>  	struct drm_connector *connector = &intel_hdmi->attached_connector->base;
> -	bool is_hdmi2_sink = connector->display_info.hdmi.scdc.supported;
> +	bool is_hdmi2_sink = false;
>  	union hdmi_infoframe frame;
>  	int ret;
>  
> +	is_hdmi2_sink = is_hdmi2(connector, crtc_state);
> +
>  	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
>  						       adjusted_mode,
>  						       is_hdmi2_sink);
> -- 
> 1.9.1
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 2c53efc..6913806 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -458,6 +458,34 @@  static void intel_write_infoframe(struct intel_encoder *encoder,
 					frame->any.type, buffer, len);
 }
 
+static bool is_hdmi2(const struct drm_connector *connector,
+			const struct intel_crtc_state *crtc_state)
+{
+	bool hdmi2 = false;
+	bool vdb_mode = false;
+	bool cmdb_mode = false;
+	int i = 0;
+
+	/* check VDB bits for HDMI 2.0 mode */
+	for (i = 0; i < BITS_TO_LONGS(128); i++)
+		if (connector->display_info.hdmi.y420_vdb_modes[i])
+			vdb_mode = true;
+
+	/* check CMDB bits for HDMI 2.0 mode */
+	for (i = 0; i < BITS_TO_LONGS(128); i++)
+		if (connector->display_info.hdmi.y420_cmdb_modes[i])
+			cmdb_mode = true;
+
+	if (connector->display_info.hdmi.scdc.supported ||
+	    connector->display_info.hdmi.y420_dc_modes ||
+	    crtc_state->ycbcr420 || vdb_mode || cmdb_mode) {
+		DRM_DEBUG_KMS("Inferred HDMI2 sink present\n");
+		hdmi2 = true;
+	}
+
+	return hdmi2;
+}
+
 static void intel_hdmi_set_avi_infoframe(struct intel_encoder *encoder,
 					 const struct intel_crtc_state *crtc_state,
 					 const struct drm_connector_state *conn_state)
@@ -466,10 +494,12 @@  static void intel_hdmi_set_avi_infoframe(struct intel_encoder *encoder,
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->base.adjusted_mode;
 	struct drm_connector *connector = &intel_hdmi->attached_connector->base;
-	bool is_hdmi2_sink = connector->display_info.hdmi.scdc.supported;
+	bool is_hdmi2_sink = false;
 	union hdmi_infoframe frame;
 	int ret;
 
+	is_hdmi2_sink = is_hdmi2(connector, crtc_state);
+
 	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
 						       adjusted_mode,
 						       is_hdmi2_sink);