diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-04-05 20:01:07 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-04-05 20:01:07 +0100 |
commit | 4b4324cd059590cbeb37b6d6fd79446171cd04c4 (patch) | |
tree | 2572714c679f49986688b9299890e523b6496a89 /src | |
parent | f4ce7fee6cb760353ce1fef9272e927461d8a21b (diff) |
sna/present: Update the vblank timestamp after a blocking wait
After doing a blocking wait (rather than event driven) for the imminent
arrival of the next frame (when it is expected less than 1ms in the
future), update the timestamp and frame counter that we then report back
to present.
Reported-by: Christoph Haag <haagch@frickel.club>
References: https://bugs.freedesktop.org/show_bug.cgi?id=94829#c15
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/sna/sna_present.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/sna/sna_present.c b/src/sna/sna_present.c index cd7a741f..621791ad 100644 --- a/src/sna/sna_present.c +++ b/src/sna/sna_present.c @@ -202,9 +202,14 @@ static CARD32 sna_fake_vblank_handler(OsTimerPtr timer, CARD32 now, void *data) DBG(("%s: blocking wait!\n", __FUNCTION__)); vbl.request.type = DRM_VBLANK_ABSOLUTE; vbl.request.sequence = info->target_msc; - (void)sna_wait_vblank(info->sna, &vbl, sna_crtc_pipe(info->crtc)); + if (sna_wait_vblank(info->sna, &vbl, sna_crtc_pipe(info->crtc)) == 0) { + ust = ust64(vbl.reply.tval_sec, vbl.reply.tval_usec); + msc = sna_crtc_record_vblank(info->crtc, &vbl); + } else + goto fixup; } } else { +fixup: ust = gettime_ust64(); msc = info->target_msc; DBG(("%s: event=%lld, CRTC OFF, target msc=%lld, was %lld (off)\n", |