drm/i915: Update vblank timestamping stuff on seamless M/N change
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 10 Mar 2023 23:58:25 +0000 (01:58 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Sat, 18 Mar 2023 12:24:44 +0000 (14:24 +0200)
commit8cb1f95cca68421b08333175719fdd3615372ca8
tree3a72f9f256ae2763f940a9699cdbe7b58e416672
parentaf3004c9ac81a532a8106d1d3c06e09eb95f0dd6
drm/i915: Update vblank timestamping stuff on seamless M/N change

When we change the M/N values seamlessly during a fastset we should
also update the vblank timestamping stuff to make sure the vblank
timestamp corrections/guesstimations come out exact.

Note that only crtc_clock and framedur_ns can actually end up
changing here during fastsets. Everything else we touch can
only change during full modesets.

Technically we should try to do this exactly at the start of
vblank, but that would require some kind of double buffering
scheme. Let's skip that for now and just update things right
after the commit has been submitted to the hardware. This
means the information will be properly up to date when the
vblank irq handler goes to work. Only if someone ends up
querying some vblanky stuff in between the commit and start
of vblank may we see a slight discrepancy.

Also this same problem really exists for the DRRS downclocking
stuff. But as that is supposed to be more or less transparent
to the user, and it only drops to low gear after a long delay
(1 sec currently) we probably don't have to worry about it.
Any time something is actively submitting updates DRRS will
remain in high gear and so the timestamping constants will
match the hardware state.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
Fixes: e6f29923c048 ("drm/i915: Allow M/N change during fastset on bdw+")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230310235828.17439-1-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/display/intel_crtc.c