drm/i915/display: Compute Adaptive sync SDP params
authorMitul Golani <mitulkumar.ajitkumar.golani@intel.com>
Mon, 10 Jun 2024 07:22:00 +0000 (12:52 +0530)
committerSuraj Kandpal <suraj.kandpal@intel.com>
Tue, 11 Jun 2024 04:28:16 +0000 (09:58 +0530)
Compute params for Adaptive Sync SDP when Fixed Average Vtotal
mode is enabled.

--v2:
Since vrr.enable is set in case of cmrr also, handle accordingly(Ankit).

--v3:
- Since vrr.enable is set in case of cmrr also, handle
accordingly(Ankit).
- check cmrr.enable when CMRR flags are set during intel_dp_compute_as_sdp.

--v4:
- Use drm_mode_vrefresh instead of manual calculation (Ankit).

Signed-off-by: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240610072203.24956-8-mitulkumar.ajitkumar.golani@intel.com
drivers/gpu/drm/i915/display/intel_dp.c

index ac81b172b1ec038dd917438b2ab68693865bbbe5..b5915c23302f963884a50450b6e1d29977f63ca7 100644 (file)
@@ -2637,11 +2637,19 @@ static void intel_dp_compute_as_sdp(struct intel_dp *intel_dp,
        /* Currently only DP_AS_SDP_AVT_FIXED_VTOTAL mode supported */
        as_sdp->sdp_type = DP_SDP_ADAPTIVE_SYNC;
        as_sdp->length = 0x9;
-       as_sdp->mode = DP_AS_SDP_AVT_FIXED_VTOTAL;
-       as_sdp->vtotal = adjusted_mode->vtotal;
-       as_sdp->target_rr = 0;
        as_sdp->duration_incr_ms = 0;
        as_sdp->duration_incr_ms = 0;
+
+       if (crtc_state->cmrr.enable) {
+               as_sdp->mode = DP_AS_SDP_FAVT_TRR_REACHED;
+               as_sdp->vtotal = adjusted_mode->vtotal;
+               as_sdp->target_rr = drm_mode_vrefresh(adjusted_mode);
+               as_sdp->target_rr_divider = true;
+       } else {
+               as_sdp->mode = DP_AS_SDP_AVT_FIXED_VTOTAL;
+               as_sdp->vtotal = adjusted_mode->vtotal;
+               as_sdp->target_rr = 0;
+       }
 }
 
 static void intel_dp_compute_vsc_sdp(struct intel_dp *intel_dp,