summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sna/sna_present.c11
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