diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-04-06 10:03:36 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-04-06 10:03:36 +0100 |
commit | ff0ab2c2eadfb832e1e1393b6664b214e0a31a3b (patch) | |
tree | 9be51fbb06733e95f166243221295e9f0fd95458 /src/sna | |
parent | a76560107f7d97b80d47e90b46535a8aba273c32 (diff) |
sna/present: Only compensate the timer delay on the final frame
For delays over a frame, we aim to fire a frame early and so
compensating again for less than a whole frame is irrelevant.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna')
-rw-r--r-- | src/sna/sna_present.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/sna/sna_present.c b/src/sna/sna_present.c index d27c9125..3998043a 100644 --- a/src/sna/sna_present.c +++ b/src/sna/sna_present.c @@ -147,12 +147,15 @@ static uint32_t msc_to_delay(xf86CrtcPtr crtc, uint64_t target) delay = target - swap->msc; assert(delay >= 0); - if (delay > 1) /* try to use the hw vblank for the last frame */ + if (delay > 1) { /* try to use the hw vblank for the last frame */ delay--; + subframe = 0; + } else { + subframe = gettime_ust64() - swap_ust(swap); + subframe += 500; + subframe /= 1000; + } delay *= mode->VTotal * mode->HTotal / mode->Clock; - subframe = gettime_ust64() - swap_ust(swap); - subframe += 500; - subframe /= 1000; if (subframe < delay) delay -= subframe; else |