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>
This commit is contained in:
Chris Wilson 2014-05-21 23:02:52 +01:00
parent 00d9396f6b
commit 1f237bb6db
1 changed files with 5 additions and 1 deletions

View File

@ -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;
}