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

Chris Wilson ickle at kemper.freedesktop.org
Mon Dec 10 15:21:30 PST 2012


 src/sna/sna_dri.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 162e9a2bfc693db186aa481551cf76b3dc5ee55c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Dec 10 23:11:48 2012 +0000

    sna/dri: Disable name exchanges for SwapBuffers
    
    The DRI2 protocol is inherently racy. Fortuituously, this can be swept
    under the carpet by forcing the serialisation between the DRI2 clients
    by using a blit for the SwapBuffers.
    
    References: https://bugs.freedesktop.org/show_bug.cgi?id=58005
    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 2ff138f..83a00dd 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -1164,6 +1164,12 @@ can_exchange(struct sna * sna,
 	WindowPtr win = (WindowPtr)draw;
 	PixmapPtr pixmap;
 
+	/* XXX There is an inherent race between the DRI2 client and the DRI2
+	 * compositor which is only masked if we force a blit and serialise
+	 * the operations through the kernel command queue. Hopeless.
+	 */
+	return false;
+
 	if (front->format != back->format) {
 		DBG(("%s: no, format mismatch, front = %d, back = %d\n",
 		     __FUNCTION__, front->format, back->format));
commit 0c2287c735f990a98b39d00f28168d7a5df25aba
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Dec 10 20:09:22 2012 +0000

    sna/dri: Only special case 'divisor && msc-passed' for immediate flipping
    
    As Jesse pointed out, it is legal for the client to request that the
    flip be some frame in the future even with no divisor.
    
    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 4453997..2ff138f 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -1719,7 +1719,7 @@ sna_dri_schedule_flip(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front,
 	/* Truncate to match kernel interfaces; means occasional overflow
 	 * misses, but that's generally not a big deal */
 	divisor &= 0xffffffff;
-	if (divisor == 0) {
+	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));
 
@@ -1848,6 +1848,9 @@ sna_dri_schedule_flip(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front,
 			     (int)*target_msc,
 			     (int)divisor));
 
+			if (divisor == 0)
+				divisor = 1;
+
 			vbl.request.sequence = current_msc - current_msc % divisor + remainder;
 
 			/*
@@ -2059,7 +2062,7 @@ sna_dri_schedule_swap(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front,
 	sna_dri_reference_buffer(back);
 
 	info->type = swap_type;
-	if (divisor == 0) {
+	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)) {
@@ -2117,6 +2120,9 @@ sna_dri_schedule_swap(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front,
 	     (int)*target_msc,
 	     (int)divisor));
 
+	if (divisor == 0)
+		divisor = 1;
+
 	vbl.request.type =
 		DRM_VBLANK_ABSOLUTE |
 		DRM_VBLANK_EVENT |


More information about the xorg-commit mailing list