[RFC 3/4] drm/i915/display/: Write Adaptive Sync SDP Content
Mitul Golani
mitulkumar.ajitkumar.golani at intel.com
Tue Nov 21 05:03:03 UTC 2023
Fill AS SDP structure which includes Adaptive Sync information.
Signed-off-by: Mitul Golani <mitulkumar.ajitkumar.golani at intel.com>
---
drivers/gpu/drm/i915/display/intel_dp.c | 49 +++++++++++++++++++++++--
1 file changed, 45 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index a5a32c66951b..67769b003d00 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -4079,6 +4079,42 @@ intel_dp_needs_vsc_sdp(const struct intel_crtc_state *crtc_state,
return false;
}
+static ssize_t intel_dp_as_sdp_pack(const struct drm_dp_as_sdp *async,
+ struct dp_sdp *sdp, size_t size)
+{
+ size_t length = sizeof(struct dp_sdp);
+
+ if (size < length)
+ return -ENOSPC;
+
+ memset(sdp, 0, size);
+
+ /* Prepare AS (Adaptive Sync) VSC Header */
+ sdp->sdp_header.HB0 = 0;
+ sdp->sdp_header.HB1 = async->sdp_type;
+ sdp->sdp_header.HB2 = 0x02;
+ sdp->sdp_header.HB3 = async->length;
+
+ /* Fill AS (Adaptive Sync) SDP Payload */
+ if ((sdp->db[0] & 0x03) == 0) {
+ sdp->db[3] = 0;
+ sdp->db[4] &= 0xFC;
+ }
+
+ sdp->db[1] = async->vmin & 0xFF;
+ sdp->db[2] = (async->vmin >> 8) & 0xF;
+ sdp->db[17] = (async->vmin >> 8) & 0xFF;
+ sdp->db[18] = async->vmax & 0xFF;
+ sdp->db[19] = (async->vmax >> 8) & 0xFF;
+ sdp->db[20] = async->target_rr & 0xFF;
+ sdp->db[21] = (async->target_rr >> 8) & 0xFF;
+ sdp->db[22] = async->duration_incr_ms;
+ sdp->db[23] = async->duration_decr_ms;
+ sdp->db[24] = async->operation_mode;
+
+ return length;
+}
+
static ssize_t intel_dp_vsc_sdp_pack(const struct drm_dp_vsc_sdp *vsc,
struct dp_sdp *sdp, size_t size)
{
@@ -4246,6 +4282,10 @@ static void intel_write_dp_sdp(struct intel_encoder *encoder,
&crtc_state->infoframes.drm.drm,
&sdp, sizeof(sdp));
break;
+ case DP_SDP_ADAPTIVE_SYNC:
+ len = intel_dp_as_sdp_pack(&crtc_state->infoframes.async, &sdp,
+ sizeof(sdp));
+ break;
default:
MISSING_CASE(type);
return;
@@ -4511,9 +4551,10 @@ static void intel_read_dp_vsc_sdp(struct intel_encoder *encoder,
drm_dbg_kms(&dev_priv->drm, "Failed to unpack DP VSC SDP\n");
}
-static void intel_read_dp_hdr_metadata_infoframe_sdp(struct intel_encoder *encoder,
- struct intel_crtc_state *crtc_state,
- struct hdmi_drm_infoframe *drm_infoframe)
+static void
+intel_read_dp_hdr_metadata_infoframe_sdp(struct intel_encoder *encoder,
+ struct intel_crtc_state *crtc_state,
+ struct hdmi_drm_infoframe *drm_infoframe)
{
struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
@@ -4522,7 +4563,7 @@ static void intel_read_dp_hdr_metadata_infoframe_sdp(struct intel_encoder *encod
int ret;
if ((crtc_state->infoframes.enable &
- intel_hdmi_infoframe_enable(type)) == 0)
+ intel_hdmi_infoframe_enable(type)) == 0)
return;
dig_port->read_infoframe(encoder, crtc_state, type, &sdp,
--
2.25.1
More information about the Intel-gfx-trybot
mailing list