drm/i915/vrr: Reorder the DSB "wait for safe window" vs. TRANS_PUSH
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 7 Feb 2025 22:31:57 +0000 (00:31 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 12 Feb 2025 17:22:12 +0000 (19:22 +0200)
commit44397dfe48c4fe8580e3fc27e260b4420d277191
treef57dd8ff9d1a626e6a3fa86b971e2edc0ec0a9fb
parentcdef53897cda82bc3261bf23acb0e8205ec8b19a
drm/i915/vrr: Reorder the DSB "wait for safe window" vs. TRANS_PUSH

Currently we trigger the push send first, then follow it with
a "wait for safe window". That approach no longer works on
PTL+ because triggering the push send immediately ends the safe
window. On prior hardware the safe window extended past the
push being sent (presumably all the way to the pipe's delayed
vblank).

In order to deal with the new hardware behaviour we must reverse
the order of these two operations: first wait for safe window,
then trigger the push.

The only slight danger with this approach is that if we mess up
the vblank evasion around the vmax decision boundary the push
might get postponed until after the next frame's vactive. But
assuming we don't mess up the vblank evasion this approach is
completely safe.

As a slight bonus we can perform the push after we've done the
LUT writes as well, meaning we no longer have to worry about
extending the vblank delay to provide enough time for LUT
programming. Instead we will now depend on the vblank evasion
at vmax decision boundary to guarantee this.

However vblank delay (or framestart delay) is still the only
way to provide extra time for the LUT programming in the
non-VRR use cases. Let's assume we don't need anything extra
for now, but eventually we should come up with some proper
estimates on how long the LUT programming can take and
configure the vblank delay accordingly for the non-VRR use
cases.

Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250207223159.14132-7-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/display/intel_color.c
drivers/gpu/drm/i915/display/intel_display.c