[RFC][PATCH 3/3] drm/i915: Implement readout for AVI infoframe SDP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In this patch readout for AVI infoframes enclosed in GMP
DIP is implemented.

Signed-off-by: Swati Sharma <swati2.sharma@xxxxxxxxx>
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@xxxxxxxxx>
---
 drivers/gpu/drm/i915/display/intel_dp.c | 74 ++++++++++++++++++++++++-
 1 file changed, 72 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index d96e69dd2197..4821c96991f2 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -5738,6 +5738,44 @@ intel_dp_hdr_metadata_infoframe_sdp_unpack(struct hdmi_drm_infoframe *drm_infofr
 	return ret;
 }
 
+static int
+intel_dp_avi_infoframe_sdp_unpack(union hdmi_infoframe *frame,
+				  const void *buffer, size_t size)
+{
+	int ret;
+
+	const struct dp_sdp *sdp = buffer;
+
+	if (size < sizeof(struct dp_sdp))
+		return -EINVAL;
+
+	if (sdp->sdp_header.HB0 != 0)
+		return -EINVAL;
+
+	if (sdp->sdp_header.HB1 != HDMI_INFOFRAME_TYPE_AVI)
+		return -EINVAL;
+
+	if (sdp->sdp_header.HB2 != 0x1D)
+		return -EINVAL;
+
+	if ((sdp->sdp_header.HB3 & 0x3) != 0)
+		return -EINVAL;
+
+	if (((sdp->sdp_header.HB3 >> 2) & 0x3f) != 0x13)
+		return -EINVAL;
+
+	if (sdp->db[0] != 2)
+		return -EINVAL;
+
+	if (sdp->db[1] != HDMI_AVI_INFOFRAME_SIZE)
+		return -EINVAL;
+
+	ret = hdmi_infoframe_unpack(frame, &sdp->db[2],
+				    HDMI_DRM_INFOFRAME_SIZE);
+
+	return ret;
+}
+
 static void intel_read_dp_vsc_sdp(struct intel_encoder *encoder,
 				  struct intel_crtc_state *crtc_state,
 				  struct drm_dp_vsc_sdp *vsc)
@@ -5790,10 +5828,37 @@ static void intel_read_dp_hdr_metadata_infoframe_sdp(struct intel_encoder *encod
 			    "Failed to unpack DP HDR Metadata Infoframe SDP\n");
 }
 
+static void intel_read_dp_avi_infoframe_sdp(struct intel_encoder *encoder,
+					    struct intel_crtc_state *crtc_state,
+					    union hdmi_infoframe *frame)
+{
+	struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	unsigned int type = HDMI_PACKET_TYPE_GAMUT_METADATA;
+	struct dp_sdp sdp = {};
+	int ret;
+
+	if ((crtc_state->infoframes.enable &
+	    intel_hdmi_infoframe_enable(type)) == 0)
+		return;
+
+	dig_port->read_infoframe(encoder, crtc_state, type, &sdp,
+				 sizeof(sdp));
+
+	ret = intel_dp_avi_infoframe_sdp_unpack(frame, &sdp,
+						sizeof(sdp));
+
+	if (ret)
+		drm_dbg_kms(&dev_priv->drm,
+			    "Failed to unpack DP AVI Infoframe SDP\n");
+}
+
 void intel_read_dp_sdp(struct intel_encoder *encoder,
 		       struct intel_crtc_state *crtc_state,
 		       unsigned int type)
 {
+	struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+
 	if (encoder->type != INTEL_OUTPUT_DDI)
 		return;
 
@@ -5803,8 +5868,13 @@ void intel_read_dp_sdp(struct intel_encoder *encoder,
 				      &crtc_state->infoframes.vsc);
 		break;
 	case HDMI_PACKET_TYPE_GAMUT_METADATA:
-		intel_read_dp_hdr_metadata_infoframe_sdp(encoder, crtc_state,
-							 &crtc_state->infoframes.drm.drm);
+		if (intel_dp_is_hdmi_2_1_sink(intel_dp)) {
+		    intel_read_dp_avi_infoframe_sdp(encoder, crtc_state,
+						    &crtc_state->infoframes.avi);
+		} else {
+		    intel_read_dp_hdr_metadata_infoframe_sdp(encoder, crtc_state,
+							     &crtc_state->infoframes.drm.drm);
+		}
 		break;
 	default:
 		MISSING_CASE(type);
-- 
2.25.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux