xf86-video-intel: src/sna/kgem.c src/sna/sna_dri2.c

Chris Wilson ickle at kemper.freedesktop.org
Fri Jul 24 03:32:03 PDT 2015


 src/sna/kgem.c     |   25 ++++++++++---------------
 src/sna/sna_dri2.c |    6 +++---
 2 files changed, 13 insertions(+), 18 deletions(-)

New commits:
commit ad20fd401b8c3ca128bd0fcf5a71ba90beda9d70
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Jul 24 11:30:46 2015 +0100

    sna: Ensure that DRI2 buffers are created with a fence
    
    We use the fence as a backchannel to commuicated the tiling mode to the
    DRI2 client, so in such cases we cannot tolerate a failure to set the
    tiling mode.
    
    References: https://bugs.freedesktop.org/show_bug.cgi?id=70461#c114
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 44259a8..fc269b2 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -5108,6 +5108,7 @@ static void __kgem_bo_make_scanout(struct kgem *kgem,
 
 static void set_gpu_tiling(struct kgem_bo *bo, int tiling, int pitch)
 {
+	assert(!kgem->can_fence);
 	bo->tiling = tiling;
 	bo->pitch = pitch;
 	if (tiling && bo->map__gtt) {
@@ -5294,10 +5295,9 @@ struct kgem_bo *kgem_create_2d(struct kgem *kgem,
 				if (num_pages(bo) < size)
 					continue;
 
-				if (!kgem_set_tiling(kgem, bo, tiling, pitch)) {
-					assert(!kgem->can_fence);
+				if (!kgem_set_tiling(kgem, bo, tiling, pitch) &&
+				    !exact)
 					set_gpu_tiling(bo, tiling, pitch);
-				}
 			}
 
 			kgem_bo_remove_from_active(kgem, bo);
@@ -5324,10 +5324,9 @@ large_inactive:
 				continue;
 
 			if (!kgem_set_tiling(kgem, bo, tiling, pitch)) {
-				if (kgem->gen >= 040) {
-					assert(!kgem->can_fence);
+				if (kgem->gen >= 040 && !exact)
 					set_gpu_tiling(bo, tiling, pitch);
-				} else
+				else
 					continue;
 			}
 
@@ -5472,10 +5471,9 @@ search_active:
 				if (num_pages(bo) < size)
 					continue;
 
-				if (!kgem_set_tiling(kgem, bo, tiling, pitch)) {
-					assert(!kgem->can_fence);
+				if (!kgem_set_tiling(kgem, bo, tiling, pitch) &&
+				    !exact)
 					set_gpu_tiling(bo, tiling, pitch);
-				}
 			}
 			assert(bo->tiling == tiling);
 			assert(bo->pitch >= pitch);
@@ -5534,8 +5532,7 @@ search_active:
 					continue;
 
 				if (!kgem_set_tiling(kgem, bo, tiling, pitch)) {
-					if (kgem->gen >= 040) {
-						assert(!kgem->can_fence);
+					if (kgem->gen >= 040 && !exact) {
 						set_gpu_tiling(bo, tiling, pitch);
 					} else {
 						kgem_bo_free(kgem, bo);
@@ -5626,8 +5623,7 @@ search_inactive:
 		}
 
 		if (!kgem_set_tiling(kgem, bo, tiling, pitch)) {
-			if (kgem->gen >= 040) {
-				assert(!kgem->can_fence);
+			if (kgem->gen >= 040 && !exact) {
 				set_gpu_tiling(bo, tiling, pitch);
 			} else {
 				kgem_bo_free(kgem, bo);
@@ -5693,8 +5689,7 @@ search_inactive:
 			__kgem_bo_clear_busy(bo);
 
 			if (!kgem_set_tiling(kgem, bo, tiling, pitch)) {
-				if (kgem->gen >= 040) {
-					assert(!kgem->can_fence);
+				if (kgem->gen >= 040 && !exact) {
 					set_gpu_tiling(bo, tiling, pitch);
 				} else {
 					kgem_bo_free(kgem, bo);
diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index ba4bcf9..e64c8ac 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -329,7 +329,7 @@ sna_dri2_get_back(struct sna *sna,
 		bo = kgem_create_2d(&sna->kgem,
 				    draw->width, draw->height, draw->bitsPerPixel,
 				    get_private(back)->bo->tiling,
-				    get_private(back)->bo->scanout ? CREATE_SCANOUT : 0);
+				    get_private(back)->bo->scanout ? CREATE_SCANOUT | CREATE_EXACT : CREATE_EXACT);
 		if (bo == NULL)
 			return;
 
@@ -613,7 +613,7 @@ sna_dri2_create_buffer(DrawablePtr draw,
 	PixmapPtr pixmap;
 	struct kgem_bo *bo;
 	unsigned bpp = format ?: draw->bitsPerPixel;
-	unsigned flags = 0;
+	unsigned flags = CREATE_EXACT;
 	uint32_t size;
 
 	DBG(("%s pixmap=%ld, (attachment=%d, format=%d, drawable=%dx%d), window?=%d\n",
@@ -2263,7 +2263,7 @@ static void sna_dri2_xchg_crtc(struct sna *sna, DrawablePtr draw, xf86CrtcPtr cr
 		bo = kgem_create_2d(&sna->kgem,
 				    draw->width, draw->height, draw->bitsPerPixel,
 				    get_private(back)->bo->tiling,
-				    CREATE_SCANOUT);
+				    CREATE_SCANOUT | CREATE_EXACT);
 		if (bo != NULL) {
 			get_private(back)->bo = bo;
 			back->pitch = bo->pitch;


More information about the xorg-commit mailing list