xf86-video-intel: src/sna/sna_dri.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Dec 11 07:35:47 PST 2012


 src/sna/sna_dri.c |   32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

New commits:
commit 39d6c65f437d7877c1647b7ecf45e76daabc76a6
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Dec 11 15:30:54 2012 +0000

    sna/dri: Query current msc before use
    
    Might be worth caching the last-known-value so we can skip the query for
    an old swap request.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 83a00dd..2e3cd12 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -1722,6 +1722,13 @@ sna_dri_schedule_flip(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front,
 			return false;
 	}
 
+	/* 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;
+
 	/* Truncate to match kernel interfaces; means occasional overflow
 	 * misses, but that's generally not a big deal */
 	divisor &= 0xffffffff;
@@ -1818,15 +1825,6 @@ sna_dri_schedule_flip(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front,
 		sna_dri_reference_buffer(front);
 		sna_dri_reference_buffer(back);
 
-		/* Get current count */
-		vbl.request.type = DRM_VBLANK_RELATIVE | pipe_select(pipe);
-		vbl.request.sequence = 0;
-		if (sna_wait_vblank(sna, &vbl)) {
-			sna_dri_frame_event_info_free(sna, draw, info);
-			return false;
-		}
-
-		current_msc = vbl.reply.sequence;
 		*target_msc &= 0xffffffff;
 		remainder &= 0xffffffff;
 
@@ -2068,6 +2066,14 @@ sna_dri_schedule_swap(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front,
 	sna_dri_reference_buffer(back);
 
 	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 (divisor == 0 && current_msc <= *target_msc) {
 		if (can_exchange(sna, draw, front, back)) {
 			sna_dri_immediate_xchg(sna, draw, info);
@@ -2081,14 +2087,6 @@ sna_dri_schedule_swap(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front,
 		return TRUE;
 	}
 
-	/* 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 divisor is zero, or current_msc is smaller than target_msc
 	 * we just need to make sure target_msc passes before initiating


More information about the xorg-commit mailing list