summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-05-09 21:11:13 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2016-05-09 21:11:13 +0100
commit512284fd47bc225236e403920647703ea4842666 (patch)
tree3aae3faf8fe996e998b2cfb8069da0f8095f0f87 /src
parent88733a7874f7c9b45da5d612802947a9de12893a (diff)
sna/dri2: Enforce swap-limits on stale buffers
If the client sends an out-of-date swap request, first make sure that we don't cause an error by chasing a NULL CRTC and secondly force them to wait for a whole vblank before the next swap. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/sna/sna_dri2.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index d3fe18b6..4ffa7c31 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -1617,6 +1617,9 @@ static void fake_swap_complete(struct sna *sna, ClientPtr client,
assert(draw);
+ if (crtc == NULL)
+ crtc = sna_primary_crtc(sna);
+
swap = sna_crtc_last_swap(crtc);
DBG(("%s(type=%d): draw=%ld, pipe=%d, frame=%lld [msc %lld], tv=%d.%06d\n",
__FUNCTION__, type, (long)draw->id, crtc ? sna_crtc_pipe(crtc) : -1,
@@ -3340,7 +3343,7 @@ sna_dri2_schedule_swap(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front,
__FUNCTION__,
get_private(front)->pixmap->drawable.serialNumber,
get_drawable_pixmap(draw)->drawable.serialNumber));
- goto fake;
+ goto skip;
}
if (get_private(back)->stale) {
@@ -3484,7 +3487,7 @@ skip:
if (!sna_next_vblank(info))
goto fake;
- swap_limit(draw, 2);
+ swap_limit(draw, 1);
} else {
fake:
/* XXX Use a Timer to throttle the client? */