xf86-video-intel: 5 commits - Makefile.am src/sna/kgem.c src/sna/kgem.h src/sna/sna_display.c src/sna/sna_dri2.c src/sna/sna_present.c test/present-speed.c test/present-test.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Mar 16 15:15:53 UTC 2016


 Makefile.am           |    2 
 src/sna/kgem.c        |   20 +++++-
 src/sna/kgem.h        |    1 
 src/sna/sna_display.c |    3 
 src/sna/sna_dri2.c    |    2 
 src/sna/sna_present.c |   11 +++
 test/present-speed.c  |   54 +++++++++++++++++
 test/present-test.c   |  158 +++++++++++++++++++++++++++++++++++++++++++++-----
 8 files changed, 233 insertions(+), 18 deletions(-)

New commits:
commit 68913715a2982572e88f943fd4fbe1b07e2fc720
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Mar 16 13:51:15 2016 +0000

    test: Look at Present scaling with number of cpus
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/test/present-speed.c b/test/present-speed.c
index 4d33904..1e6e48b 100644
--- a/test/present-speed.c
+++ b/test/present-speed.c
@@ -52,6 +52,7 @@
 #include <errno.h>
 #include <setjmp.h>
 #include <signal.h>
+#include <sys/wait.h>
 
 #include "dri3.h"
 
@@ -119,6 +120,9 @@ static int
 _check_error_handler(Display     *display,
 		     XErrorEvent *event)
 {
+	if (_x_error_occurred < 0)
+		return True;
+
 	printf("X11 error from display %s, serial=%ld, error=%d, req=%d.%d\n",
 	       DisplayString(display),
 	       event->serial,
@@ -312,6 +316,7 @@ static void run(Display *dpy, Window win, const char *name, unsigned options)
 	if (_x_error_occurred)
 		abort();
 
+	_x_error_occurred = -1;
 	xcb_present_select_input(c, eid, win, 0);
 	XSync(dpy, True);
 	xcb_unregister_for_special_event(c, Q);
@@ -329,6 +334,51 @@ static void run(Display *dpy, Window win, const char *name, unsigned options)
 	       completed / (elapsed(&start, &end) / 1000000));
 }
 
+static int isqrt(int x)
+{
+	int i;
+
+	for (i = 2; i*i < x; i++)
+		;
+	return i;
+}
+
+static void siblings(int max_width, int max_height, int ncpus, unsigned options)
+{
+	int sq_ncpus = isqrt(ncpus);
+	int width = max_width / sq_ncpus;
+	int height = max_height/ sq_ncpus;
+	int child;
+
+	if (ncpus <= 1)
+		return;
+
+	for (child = 0; child < ncpus; child++) {
+		for (; fork() == 0; exit(0)) {
+			int x = (child % sq_ncpus) * width;
+			int y = (child / sq_ncpus) * height;
+			XSetWindowAttributes attr = { .override_redirect = 1 };
+			Display *dpy = XOpenDisplay(NULL);
+			Window win = XCreateWindow(dpy, DefaultRootWindow(dpy),
+						   x, y, width, height, 0,
+						   DefaultDepth(dpy, DefaultScreen(dpy)),
+						   InputOutput,
+						   DefaultVisual(dpy, DefaultScreen(dpy)),
+						   CWOverrideRedirect, &attr);
+			XMapWindow(dpy, win);
+			run(dpy, win, "sibling", options);
+		}
+	}
+
+	while (child) {
+		int status = -1;
+		pid_t pid = wait(&status);
+		if (pid == -1)
+			continue;
+		child--;
+	}
+}
+
 static int has_present(Display *dpy)
 {
 	xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -551,6 +601,10 @@ static void loop(Display *dpy, XRRScreenResources *res, unsigned options)
 			XDestroyWindow(dpy, win);
 			XSync(dpy, True);
 
+			siblings(mode->width, mode->height,
+				 sysconf(_SC_NPROCESSORS_ONLN),
+				 options);
+
 			XRRSetCrtcConfig(dpy, res, output->crtcs[c], CurrentTime,
 					 0, 0, None, RR_Rotate_0, NULL, 0);
 		}
commit ed83d92b50fcd33a46b20f6a2431206db15d9530
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Mar 16 13:49:24 2016 +0000

    sna/present: Check incoming pitch before flipping
    
    Framebuffers are restricted to pitches with a multiple of 64. Check
    before we flip.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_present.c b/src/sna/sna_present.c
index f95a12c..7a7650e 100644
--- a/src/sna/sna_present.c
+++ b/src/sna/sna_present.c
@@ -494,6 +494,12 @@ sna_present_check_flip(RRCrtcPtr crtc,
 				return FALSE;
 			}
 		}
+
+		if (flip->gpu_bo->pitch & 63) {
+			DBG(("%s: pined bo, bad pitch=%d\n",
+			     __FUNCTION__, flip->gpu_bo->pitch));
+			return FALSE;
+		}
 	}
 
 	return TRUE;
@@ -663,6 +669,11 @@ get_flip_bo(PixmapPtr pixmap)
 		return NULL;
 	}
 
+	if (priv->gpu_bo->pitch & 63) {
+		DBG(("%s: invalid pitch, no conversion\n", __FUNCTION__));
+		return NULL;
+	}
+
 	return priv->gpu_bo;
 }
 
commit cd864c005568c68610abb85e4a9453377a460aae
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Mar 16 13:14:40 2016 +0000

    tests: Anticipate Present reporting too early
    
    Given Present bugs, any completion event may be sent too early and
    out-of-order. Make sure we drain all outstanding events before
    continuing on to the next test.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/test/present-test.c b/test/present-test.c
index af1882a..f578adb 100644
--- a/test/present-test.c
+++ b/test/present-test.c
@@ -457,7 +457,7 @@ static int test_future(Display *dpy, Window win, const char *phase, void *Q)
 	unsigned border, depth;
 	int x, y, ret = 0, n;
 	uint64_t msc, ust;
-	int complete;
+	int complete, count;
 	int early = 0, late = 0;
 	int earliest = 0, latest = 0;
 	uint64_t interval;
@@ -511,6 +511,7 @@ static int test_future(Display *dpy, Window win, const char *phase, void *Q)
 	xcb_flush(c);
 
 	complete = 0;
+	count = 0;
 	do {
 		xcb_present_complete_notify_event_t *ce;
 		xcb_generic_event_t *ev;
@@ -553,6 +554,7 @@ static int test_future(Display *dpy, Window win, const char *phase, void *Q)
 				late++;
 				ret++;
 			}
+			count++;
 		}
 		free(ev);
 	} while (!complete);
@@ -562,6 +564,24 @@ static int test_future(Display *dpy, Window win, const char *phase, void *Q)
 	if (late)
 		printf("\t%d frames shown too late (worst %d)!\n", late, latest);
 
+	if (count != 10) {
+		fprintf(stderr, "Sentinel frame received too early! %d frames outstanding\n", 10 - count);
+		ret++;
+
+		do {
+			xcb_present_complete_notify_event_t *ce;
+			xcb_generic_event_t *ev;
+
+			ev = xcb_wait_for_special_event(c, Q);
+			if (ev == NULL)
+				break;
+
+			ce = (xcb_present_complete_notify_event_t *)ev;
+			assert(ce->kind == XCB_PRESENT_COMPLETE_KIND_PIXMAP);
+			free(ev);
+		} while (++count != 10);
+	}
+
 	ret += !!_x_error_occurred;
 
 	return ret;
@@ -703,7 +723,7 @@ static int test_accuracy(Display *dpy, Window win, const char *phase, void *Q)
 	uint64_t target;
 	int early = 0, late = 0;
 	int earliest = 0, latest = 0;
-	int complete;
+	int complete, count;
 
 	XGetGeometry(dpy, win,
 		     &root, &x, &y, &width, &height, &border, &depth);
@@ -745,6 +765,7 @@ static int test_accuracy(Display *dpy, Window win, const char *phase, void *Q)
 	xcb_flush(c);
 
 	complete = 0;
+	count = 0;
 	do {
 		xcb_present_complete_notify_event_t *ce;
 		xcb_generic_event_t *ev;
@@ -773,6 +794,7 @@ static int test_accuracy(Display *dpy, Window win, const char *phase, void *Q)
 				late++;
 				ret++;
 			}
+			count++;
 		} else
 			complete = 1;
 		free(ev);
@@ -783,6 +805,23 @@ static int test_accuracy(Display *dpy, Window win, const char *phase, void *Q)
 	if (late)
 		printf("\t%d frames shown too late (worst %d)!\n", late, latest);
 
+	if (count != N_VBLANKS+1) {
+		fprintf(stderr, "Sentinel frame received too early! %d frames outstanding\n", N_VBLANKS+1 - count);
+		ret++;
+		do {
+			xcb_present_complete_notify_event_t *ce;
+			xcb_generic_event_t *ev;
+
+			ev = xcb_wait_for_special_event(c, Q);
+			if (ev == NULL)
+				break;
+
+			ce = (xcb_present_complete_notify_event_t *)ev;
+			assert(ce->kind == XCB_PRESENT_COMPLETE_KIND_PIXMAP);
+			free(ev);
+		} while (++count != N_VBLANKS+1);
+	}
+
 	XFreePixmap(dpy, pixmap);
 
 	XSync(dpy, True);
@@ -804,7 +843,7 @@ static int test_modulus(Display *dpy, Window win, const char *phase, void *Q)
 	uint64_t target;
 	int early = 0, late = 0;
 	int earliest = 0, latest = 0;
-	int complete;
+	int complete, expect, count;
 
 	XGetGeometry(dpy, win,
 		     &root, &x, &y, &width, &height, &border, &depth);
@@ -817,6 +856,7 @@ static int test_modulus(Display *dpy, Window win, const char *phase, void *Q)
 
 	pixmap = XCreatePixmap(dpy, win, width, height, depth);
 	target = flush_flips(dpy, win, pixmap, Q, NULL);
+	expect = 0;
 	for (x = 1; x <= 7; x++) {
 		for (y = 0; y < x; y++) {
 			xcb_present_pixmap(c, win, pixmap,
@@ -833,6 +873,7 @@ static int test_modulus(Display *dpy, Window win, const char *phase, void *Q)
 					   x, /* divisor */
 					   y, /* remainder */
 					   0, NULL);
+			expect++;
 		}
 	}
 	xcb_present_pixmap(c, win, pixmap,
@@ -852,6 +893,7 @@ static int test_modulus(Display *dpy, Window win, const char *phase, void *Q)
 	xcb_flush(c);
 
 	complete = 0;
+	count = 0;
 	do {
 		xcb_present_complete_notify_event_t *ce;
 		xcb_generic_event_t *ev;
@@ -894,6 +936,7 @@ static int test_modulus(Display *dpy, Window win, const char *phase, void *Q)
 				late++;
 				ret++;
 			}
+			count++;
 		} else
 			complete = 1;
 		free(ev);
@@ -904,6 +947,23 @@ static int test_modulus(Display *dpy, Window win, const char *phase, void *Q)
 	if (late)
 		printf("\t%d frames shown too late (worst %d)!\n", late, latest);
 
+	if (count != expect) {
+		fprintf(stderr, "Sentinel frame received too early! %d frames outstanding\n", expect - count);
+		ret++;
+		do {
+			xcb_present_complete_notify_event_t *ce;
+			xcb_generic_event_t *ev;
+
+			ev = xcb_wait_for_special_event(c, Q);
+			if (ev == NULL)
+				break;
+
+			ce = (xcb_present_complete_notify_event_t *)ev;
+			assert(ce->kind == XCB_PRESENT_COMPLETE_KIND_NOTIFY_MSC);
+			free(ev);
+		} while (++count != expect);
+	}
+
 	XFreePixmap(dpy, pixmap);
 	xcb_xfixes_destroy_region(c, region);
 
@@ -919,7 +979,7 @@ static int test_future_msc(Display *dpy, void *Q)
 	Window root = DefaultRootWindow(dpy);
 	int ret = 0, n;
 	uint64_t msc, ust;
-	int complete;
+	int complete, count;
 	int early = 0, late = 0;
 	int earliest = 0, latest = 0;
 	uint64_t interval;
@@ -933,6 +993,8 @@ static int test_future_msc(Display *dpy, void *Q)
 		return 1;
 	}
 	msc = check_msc(dpy, root, Q, 0, &ust);
+	printf("Initial msc=%llx, interval between frames %lldus\n",
+	       (long long)msc, (long long)interval);
 
 	for (n = 1; n <= 10; n++)
 		xcb_present_notify_msc(c, root, n, msc + 60 + n*15*60, 0, 0);
@@ -940,6 +1002,7 @@ static int test_future_msc(Display *dpy, void *Q)
 	xcb_flush(c);
 
 	complete = 0;
+	count = 0;
 	do {
 		xcb_present_complete_notify_event_t *ce;
 		xcb_generic_event_t *ev;
@@ -952,21 +1015,33 @@ static int test_future_msc(Display *dpy, void *Q)
 		assert(ce->kind == XCB_PRESENT_COMPLETE_KIND_NOTIFY_MSC);
 
 		if (ce->serial == 0xdeadbeef) {
-			int64_t time;
+			int64_t time, tolerance;
+
+			tolerance = 60 + 15*60*n/10;
+			if (tolerance < interval)
+				tolerance = interval;
 
 			time = ce->ust - (ust + (60 + 15*60*n) * interval);
-			if (time < -(int64_t)interval) {
+			if (time < -(int64_t)tolerance) {
 				fprintf(stderr,
-					"\tnotifies completed too early by %lldms\n",
-					(long long)(-time / 1000));
-			} else if (time > (int64_t)interval) {
+					"\tnotifies completed too early by %lldms, tolerance %lldus\n",
+					(long long)(-time / 1000), (long long)tolerance);
+			} else if (time > (int64_t)tolerance) {
 				fprintf(stderr,
-					"\tnotifies completed too late by %lldms\n",
-					(long long)(time / 1000));
+					"\tnotifies completed too late by %lldms, tolerance %lldus\n",
+					(long long)(time / 1000), (long long)tolerance);
 			}
 			complete = 1;
 		} else {
 			int diff = (int64_t)(ce->msc - (15*60*ce->serial + msc + 60));
+
+			if (ce->serial != count + 1) {
+				fprintf(stderr, "vblank received out of order! expected %d, received %d\n",
+					count + 1, (int)ce->serial);
+				ret++;
+			}
+			count++;
+
 			if (diff < 0) {
 				if (-diff > earliest) {
 					fprintf(stderr, "\tnotify %d early by %d msc\n", ce->serial, -diff);
@@ -991,6 +1066,23 @@ static int test_future_msc(Display *dpy, void *Q)
 	if (late)
 		printf("\t%d notifies too late (worst %d)!\n", late, latest);
 
+	if (count != 10) {
+		fprintf(stderr, "Sentinel vblank received too early! %d waits outstanding\n", 10 - count);
+		ret++;
+		do {
+			xcb_present_complete_notify_event_t *ce;
+			xcb_generic_event_t *ev;
+
+			ev = xcb_wait_for_special_event(c, Q);
+			if (ev == NULL)
+				break;
+
+			ce = (xcb_present_complete_notify_event_t *)ev;
+			assert(ce->kind == XCB_PRESENT_COMPLETE_KIND_NOTIFY_MSC);
+			free(ev);
+		} while (++count != 10);
+	}
+
 	XSync(dpy, True);
 	ret += !!_x_error_occurred;
 
@@ -1070,7 +1162,7 @@ static int test_accuracy_msc(Display *dpy, void *Q)
 	uint64_t msc;
 	int early = 0, late = 0;
 	int earliest = 0, latest = 0;
-	int complete;
+	int complete, count;
 
 	printf("Testing notify accuracy\n");
 	_x_error_occurred = 0;
@@ -1082,6 +1174,7 @@ static int test_accuracy_msc(Display *dpy, void *Q)
 	xcb_flush(c);
 
 	complete = 0;
+	count = 0;
 	do {
 		xcb_present_complete_notify_event_t *ce;
 		xcb_generic_event_t *ev;
@@ -1110,6 +1203,7 @@ static int test_accuracy_msc(Display *dpy, void *Q)
 				late++;
 				ret++;
 			}
+			count++;
 		} else
 			complete = 1;
 		free(ev);
@@ -1120,6 +1214,23 @@ static int test_accuracy_msc(Display *dpy, void *Q)
 	if (late)
 		printf("\t%d notifies too late (worst %d)!\n", late, latest);
 
+	if (count != N_VBLANKS+1) {
+		fprintf(stderr, "Sentinel vblank received too early! %d waits outstanding\n", N_VBLANKS+1 - count);
+		ret++;
+		do {
+			xcb_present_complete_notify_event_t *ce;
+			xcb_generic_event_t *ev;
+
+			ev = xcb_wait_for_special_event(c, Q);
+			if (ev == NULL)
+				break;
+
+			ce = (xcb_present_complete_notify_event_t *)ev;
+			assert(ce->kind == XCB_PRESENT_COMPLETE_KIND_NOTIFY_MSC);
+			free(ev);
+		} while (++count != N_VBLANKS+1);
+	}
+
 	XSync(dpy, True);
 	ret += !!_x_error_occurred;
 
@@ -1137,17 +1248,20 @@ static int test_modulus_msc(Display *dpy, void *Q)
 	uint64_t target;
 	int early = 0, late = 0;
 	int earliest = 0, latest = 0;
-	int complete;
+	int complete, count, expect;
 
 	printf("Testing notify modulus\n");
 	_x_error_occurred = 0;
 
 	target = wait_vblank(dpy, root, Q);
 
+	expect = 0;
 	xcb_present_notify_msc(c, root, 0, 0, 0, 0);
 	for (x = 1; x <= 19; x++) {
-		for (y = 0; y < x; y++)
+		for (y = 0; y < x; y++) {
 			xcb_present_notify_msc(c, root, y << 16 | x, 0, x, y);
+			expect++;
+		}
 	}
 	xcb_present_notify_msc(c, root, 0xdeadbeef, target + 2*x, 0, 0);
 	xcb_flush(c);
@@ -1162,6 +1276,7 @@ static int test_modulus_msc(Display *dpy, void *Q)
 	}
 
 	complete = 0;
+	count = 0;
 	do {
 		ev = xcb_wait_for_special_event(c, Q);
 		if (ev == NULL)
@@ -1200,6 +1315,7 @@ static int test_modulus_msc(Display *dpy, void *Q)
 				late++;
 				ret++;
 			}
+			count++;
 		} else
 			complete = 1;
 		free(ev);
@@ -1210,6 +1326,20 @@ static int test_modulus_msc(Display *dpy, void *Q)
 	if (late)
 		printf("\t%d notifies too late (worst %d)!\n", late, latest);
 
+	if (count != expect) {
+		fprintf(stderr, "Sentinel vblank received too early! %d waits outstanding\n", expect - count);
+		ret++;
+		do {
+			ev = xcb_wait_for_special_event(c, Q);
+			if (ev == NULL)
+				break;
+
+			ce = (xcb_present_complete_notify_event_t *)ev;
+			assert(ce->kind == XCB_PRESENT_COMPLETE_KIND_NOTIFY_MSC);
+			free(ev);
+		} while (++count != expect);
+	}
+
 	XSync(dpy, True);
 	ret += !!_x_error_occurred;
 
commit 945d4f7b12047f8e0ecbb5a56865c91d9a691f1f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Mar 16 11:21:16 2016 +0000

    configure: Replace ${} with $() for libtool
    
    One version libtool doesn't like ${} and errors out unless we use $().
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/Makefile.am b/Makefile.am
index 853e622..c60e8a7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,7 +18,7 @@
 #  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 #  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4
+ACLOCAL_AMFLAGS = $(ACLOCAL_FLAGS) -I m4
 
 SUBDIRS = man libobj xvmc src tools
 
commit b306dc20e3e92a62f60c4155e18cdcba650b1a62
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Mar 16 11:12:01 2016 +0000

    sna: Relax tiling requirements to cope with kernel errors
    
    If the kernel can't accept our tiling requirements, don't fret until we
    actually need that fence! If we do, then we either stop tiling with the
    buffer or we use another.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index abb9e02..06c1684 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -4945,6 +4945,8 @@ int kgem_bo_export_to_prime(struct kgem *kgem, struct kgem_bo *bo)
 #if defined(DRM_IOCTL_PRIME_HANDLE_TO_FD) && defined(O_CLOEXEC)
 	struct drm_prime_handle args;
 
+	assert(kgem_bo_is_fenced(kgem, bo));
+
 	VG_CLEAR(args);
 	args.handle = bo->handle;
 	args.flags = O_CLOEXEC;
@@ -5322,8 +5324,6 @@ static void set_gpu_tiling(struct kgem *kgem,
 	DBG(("%s: handle=%d, tiling=%d, pitch=%d\n",
 	     __FUNCTION__, bo->handle, tiling, pitch));
 
-	assert(!kgem->can_fence);
-
 	if (tiling_changed(bo, tiling, pitch) && bo->map__gtt) {
 		if (!list_is_empty(&bo->vma)) {
 			list_del(&bo->vma);
@@ -5337,6 +5337,20 @@ static void set_gpu_tiling(struct kgem *kgem,
 	bo->pitch = pitch;
 }
 
+bool kgem_bo_is_fenced(struct kgem *kgem, struct kgem_bo *bo)
+{
+	struct drm_i915_gem_get_tiling tiling;
+
+	assert(kgem);
+	assert(bo);
+
+	VG_CLEAR(tiling);
+	tiling.handle = bo->handle;
+	tiling.tiling_mode = 0;
+	(void)do_ioctl(kgem->fd, DRM_IOCTL_I915_GEM_GET_TILING, &tiling);
+	return tiling.tiling_mode == bo->tiling; /* assume pitch is fine! */
+}
+
 struct kgem_bo *kgem_create_2d(struct kgem *kgem,
 			       int width,
 			       int height,
@@ -6954,6 +6968,8 @@ uint32_t kgem_bo_flink(struct kgem *kgem, struct kgem_bo *bo)
 {
 	struct drm_gem_flink flink;
 
+	assert(kgem_bo_is_fenced(kgem, bo));
+
 	VG_CLEAR(flink);
 	flink.handle = bo->handle;
 	if (do_ioctl(kgem->fd, DRM_IOCTL_GEM_FLINK, &flink))
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index 0a941e0..3630b5c 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -326,6 +326,7 @@ bool kgem_bo_convert_to_gpu(struct kgem *kgem,
 			    struct kgem_bo *bo,
 			    unsigned flags);
 
+bool kgem_bo_is_fenced(struct kgem *kgem, struct kgem_bo *bo);
 uint32_t kgem_bo_get_binding(struct kgem_bo *bo, uint32_t format);
 void kgem_bo_set_binding(struct kgem_bo *bo, uint32_t format, uint16_t offset);
 
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 9256300..7d2478c 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -534,6 +534,9 @@ static unsigned get_fb(struct sna *sna, struct kgem_bo *bo,
 	ScrnInfoPtr scrn = sna->scrn;
 	struct drm_mode_fb_cmd arg;
 
+	if (!kgem_bo_is_fenced(&sna->kgem, bo))
+		return 0;
+
 	assert(bo->refcnt);
 	assert(bo->proxy == NULL);
 	assert(!bo->snoop);
diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index afd2603..18ff264 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -528,7 +528,7 @@ static struct kgem_bo *sna_pixmap_set_dri(struct sna *sna,
 	assert(priv->gpu_bo);
 	assert(priv->gpu_bo->proxy == NULL);
 
-	if (!sna->kgem.can_fence) {
+	if (!kgem_bo_is_fenced(&sna->kgem, priv->gpu_bo)) {
 		if (priv->gpu_bo->tiling &&
 		    !sna_pixmap_change_tiling(pixmap, I915_TILING_NONE)) {
 			DBG(("%s: failed to discard tiling (%d) for DRI2 protocol\n", __FUNCTION__, priv->gpu_bo->tiling));


More information about the xorg-commit mailing list