drm/i915: Add Guess-o-matic for pageflip timestamping.
authorMario Kleiner <mario.kleiner@tuebingen.mpg.de>
Thu, 9 Dec 2010 06:00:07 +0000 (07:00 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 16 Dec 2010 21:02:26 +0000 (21:02 +0000)
commit49b14a5ca26fc18bafe33bd9704a1a1cea681fbf
tree0186100e398c5837040b3b994e3531fee9906d3c
parent0af7e4dff50454905092d468e91c1ef92e10e6b4
drm/i915: Add Guess-o-matic for pageflip timestamping.

This patch changes the strategy for pageflip completion
timestamping. It detects if the pageflip completion
routine gets executed before or after drm_handle_vblank,
and thereby decides if the returned vblank count and
timestamp must be incremented by 1 frame(duration) or
not. It compares the current system time at invocation
against the current vblank timestamp. If the difference
is more than 0.9 video refresh interval durations then
it assumes the vblank timestamp and count are outdated
and need to be incremented and does so. Otherwise it
assumes a delayed pageflip irq and doesn't correct
the timestamp and count.

Advantage of this patch: Pageflip timestamping becomes
more robust against implementation errors and is
maintenance free for future GPU's.

Disadvantage: A few dozen (hundred?) nsecs extra
time spent in pageflip irq handler for each flip,
compared to hard-coded per-gpu settings?

Signed-off-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
drivers/gpu/drm/i915/intel_display.c