summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-12-11 17:47:09 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-12-11 17:47:09 +0000
commit2502218a9340044bb660be68f059971119077e29 (patch)
treed95bfb5f50c5b148a04f110f3af140d254546afe
parent39d6c65f437d7877c1647b7ecf45e76daabc76a6 (diff)
downloadxf86-video-intel-2502218a9340044bb660be68f059971119077e29.tar.gz
xf86-video-intel-2502218a9340044bb660be68f059971119077e29.tar.bz2
xf86-video-intel-2502218a9340044bb660be68f059971119077e29.zip
sna/dri: Fix handling of current_msc > target_msc
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_dri.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 2e3cd1224..e7e5e35ac 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -1723,16 +1723,19 @@ sna_dri_schedule_flip(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front,
}
/* Get current count */
- vbl.request.type = DRM_VBLANK_RELATIVE | pipe_select(pipe);
- vbl.request.sequence = 0;
- if (sna_wait_vblank(sna, &vbl))
- return false;
- current_msc = vbl.reply.sequence;
+ if (*target_msc) {
+ vbl.request.type = DRM_VBLANK_RELATIVE | pipe_select(pipe);
+ vbl.request.sequence = 0;
+ if (sna_wait_vblank(sna, &vbl))
+ return false;
+ current_msc = vbl.reply.sequence;
+ } else
+ current_msc = 0;
/* Truncate to match kernel interfaces; means occasional overflow
* misses, but that's generally not a big deal */
divisor &= 0xffffffff;
- if (divisor == 0 && current_msc <= *target_msc) {
+ if (divisor == 0 && current_msc >= *target_msc) {
DBG(("%s: performing immediate swap on pipe %d, pending? %d\n",
__FUNCTION__, pipe, sna->dri.flip_pending != NULL));
@@ -2067,14 +2070,17 @@ sna_dri_schedule_swap(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front,
info->type = swap_type;
- /* Get current count */
- vbl.request.type = DRM_VBLANK_RELATIVE | pipe_select(pipe);
- vbl.request.sequence = 0;
- if (sna_wait_vblank(sna, &vbl))
- goto blit_fallback;
- current_msc = vbl.reply.sequence;
+ if (*target_msc) {
+ /* Get current count */
+ vbl.request.type = DRM_VBLANK_RELATIVE | pipe_select(pipe);
+ vbl.request.sequence = 0;
+ if (sna_wait_vblank(sna, &vbl))
+ goto blit_fallback;
+ current_msc = vbl.reply.sequence;
+ } else
+ current_msc = 0;
- if (divisor == 0 && current_msc <= *target_msc) {
+ if (divisor == 0 && current_msc >= *target_msc) {
if (can_exchange(sna, draw, front, back)) {
sna_dri_immediate_xchg(sna, draw, info);
} else if (can_blit(sna, draw, front, back)) {