intel_vrr_compute_optimized_guardband() calls
intel_dp_sdp_min_guardband(crtc_state, true) so that enabling an SDP
later does not have to grow crtc_vblank_start and trigger a full
modeset.

The Adaptive-Sync clause ignores assume_all_enabled and only looks at
infoframes.enable. Toggling vrr.enable therefore changes the
guardband, which is why sending AS SDP cannot currently follow
vrr.enable.

Reserve the AS SDP lines whenever assume_all_enabled is set on a
HAS_AS_SDP platform, same as the other SDP types in this function.
The next patch can then gate transmission on vrr.enable without
moving vblank.

Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/work_items/9252
Cc: [email protected] # 7.2+
Signed-off-by: Xizhe Tang <[email protected]>
Tested-by: Xizhe Tang <[email protected]> # 7.2.8 xe.ko and drm-tip, PTL 
eDP; Never<->Always stays a fastset
---
Changes in v3:
- New patch. Addresses Ville's review of v2: needs_as_sdp is also
  how the optimized guardband is sized, so the send predicate must
  not be tied to vrr.enable until this reservation is independent.
- Hunks retargeted to drm-tip line numbers.

 drivers/gpu/drm/i915/display/intel_dp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
b/drivers/gpu/drm/i915/display/intel_dp.c
index d8c0d93..7bfe796 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -7500,6 +7500,7 @@ int intel_dp_get_lines_for_sdp(const struct 
intel_crtc_state *crtc_state, u32 ty
 int intel_dp_sdp_min_guardband(const struct intel_crtc_state *crtc_state,
                               bool assume_all_enabled)
 {
+       struct intel_display *display = to_intel_display(crtc_state);
        int sdp_guardband = 0;
 
        if (assume_all_enabled ||
@@ -7514,7 +7515,9 @@ int intel_dp_sdp_min_guardband(const struct 
intel_crtc_state *crtc_state,
                sdp_guardband = max(sdp_guardband,
                                    intel_dp_get_lines_for_sdp(crtc_state, 
DP_SDP_PPS));
 
-       if (crtc_state->infoframes.enable &
+       /* Keep the VRR guardband independent of vrr.enable. */
+       if ((assume_all_enabled && HAS_AS_SDP(display)) ||
+           crtc_state->infoframes.enable &
            intel_hdmi_infoframe_enable(DP_SDP_ADAPTIVE_SYNC))
                sdp_guardband = max(sdp_guardband,
                                    intel_dp_get_lines_for_sdp(crtc_state, 
DP_SDP_ADAPTIVE_SYNC));
-- 
2.55.0

Reply via email to