[PATCH 4/6] drm/i915: Implement readout for AVI infoframe SDP
Nautiyal, Ankit K
ankit.k.nautiyal at intel.com
Tue Aug 3 11:06:46 UTC 2021
From: Swati Sharma <swati2.sharma at intel.com>
In this patch readout for AVI infoframes enclosed in GMP
DIP is implemented.
v2:
-Added new case for AVI infoframe in intel_dp_read_sdp, and a call
to test AVI infoframe during ddi_get_config (Gwan-gyeong Mun).
-Used AVI infoframe unpack only to avoid parsing the infoframe header twice,
but only unpack data (Ankit).
Signed-off-by: Swati Sharma <swati2.sharma at intel.com>
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal at intel.com>
---
drivers/gpu/drm/i915/display/intel_ddi.c | 1 +
drivers/gpu/drm/i915/display/intel_dp.c | 77 +++++++++++++++++++++++++++++++-
2 files changed, 76 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index 061a663..c718873 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -3728,6 +3728,7 @@ static void intel_ddi_get_config(struct intel_encoder *encoder,
intel_read_dp_sdp(encoder, pipe_config, HDMI_PACKET_TYPE_GAMUT_METADATA);
intel_read_dp_sdp(encoder, pipe_config, DP_SDP_VSC);
+ intel_read_dp_sdp(encoder, pipe_config, HDMI_INFOFRAME_TYPE_AVI);
intel_psr_get_config(encoder, pipe_config);
}
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index febb248..d98208a 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -3069,6 +3069,44 @@ intel_dp_hdr_metadata_infoframe_sdp_unpack(struct hdmi_drm_infoframe *drm_infofr
return ret;
}
+static int
+intel_dp_avi_infoframe_sdp_unpack(struct hdmi_avi_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_avi_infoframe_unpack_only(frame, &sdp->db[2],
+ HDMI_AVI_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)
@@ -3120,19 +3158,54 @@ 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,
+ struct hdmi_avi_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);
+
switch (type) {
case DP_SDP_VSC:
intel_read_dp_vsc_sdp(encoder, crtc_state,
&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_hdr_metadata_infoframe_sdp(encoder, crtc_state,
+ &crtc_state->infoframes.drm.drm);
break;
+ case HDMI_INFOFRAME_TYPE_AVI:
+ if (intel_dp_is_hdmi_2_1_sink(intel_dp))
+ intel_read_dp_avi_infoframe_sdp(encoder, crtc_state,
+ &crtc_state->infoframes.avi.avi);
+ break;
+
default:
MISSING_CASE(type);
break;
--
2.8.1
More information about the Intel-gfx-trybot
mailing list