summaryrefslogtreecommitdiff
path: root/src/sna/sna.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-05-21 23:02:52 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-05-21 23:07:36 +0100
commit1f237bb6db9724358eca0467362c03dc6a41dc4a (patch)
tree1f9b7adfcf07d39fc4de9d2749935400ede875b9 /src/sna/sna.h
parent00d9396f6bf0bbbdfca7cdb1cbdbde8f0b2ad59c (diff)
sna/dri2: Apply a margin of error to the sequence wrap detection
If we have a queue of events, we may set the msc from a recent vblank query only to then process an older vblank event and declare the counter wrapped. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna.h')
-rw-r--r--src/sna/sna.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h
index 59e44725..c3eb248e 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -472,8 +472,12 @@ extern bool sna_wait_for_scanline(struct sna *sna, PixmapPtr pixmap,
static inline uint64_t msc64(struct sna *sna, int pipe, uint32_t seq)
{
assert((unsigned)pipe < MAX_PIPES);
- if (seq < sna->mode.msc[pipe].last)
+ if ((int32_t)(seq - sna->mode.msc[pipe].last) < -0x40000000) {
sna->mode.msc[pipe].wraps++;
+ DBG(("%s: pipe=%d wrapped was %u, now %u, wraps=%u\n",
+ __FUNCTION__, pipe, sna->mode.msc[pipe].last, seq,
+ sna->mode.msc[pipe].wraps));
+ }
sna->mode.msc[pipe].last = seq;
return (uint64_t)sna->mode.msc[pipe].wraps << 32 | seq;
}