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

Chris Wilson ickle at kemper.freedesktop.org
Sat Jul 21 06:49:00 PDT 2012


 src/sna/kgem.c |   24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

New commits:
commit e95825d17ce65ad8173a5e6518a98969e236a4f8
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Jul 21 14:38:17 2012 +0100

    sna: Enable snooping on the reused linear buffer
    
    This explains why suddenly I was seeing clflush again on a couple of
    machines...
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index ab78e51..1aa8af9 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -3284,8 +3284,6 @@ struct kgem_bo *kgem_create_cpu_2d(struct kgem *kgem,
 			kgem_bo_destroy(kgem, bo);
 			return NULL;
 		}
-
-		bo->reusable = false;
 		bo->snoop = true;
 
 		if (kgem_bo_map__cpu(kgem, bo) == NULL) {
@@ -3803,7 +3801,6 @@ struct kgem_bo *kgem_create_map(struct kgem *kgem,
 	}
 
 	bo->snoop = true;
-
 	debug_alloc__bo(kgem, bo);
 
 	DBG(("%s(ptr=%p, size=%d, pages=%d, read_only=%d) => handle=%d\n",
@@ -4024,12 +4021,6 @@ create_snoopable_buffer(struct kgem *kgem, unsigned alloc)
 				return NULL;
 			}
 
-			if (!gem_set_cacheing(kgem->fd, handle, SNOOPED)) {
-				gem_close(kgem->fd, handle);
-				free(bo);
-				return NULL;
-			}
-
 			debug_alloc(kgem, alloc);
 			__kgem_bo_init(&bo->base, handle, alloc);
 			DBG(("%s: created CPU handle=%d for buffer, size %d\n",
@@ -4040,15 +4031,20 @@ create_snoopable_buffer(struct kgem *kgem, unsigned alloc)
 		assert(bo->mmapped == true);
 		assert(bo->need_io == false);
 
+		if (!gem_set_cacheing(kgem->fd, bo->base.handle, SNOOPED))
+			goto free_cacheing;
+
 		bo->base.snoop = true;
 
 		bo->mem = kgem_bo_map__cpu(kgem, &bo->base);
-		if (bo->mem == NULL) {
-			bo->base.refcnt = 0; /* for valgrind */
-			kgem_bo_free(kgem, &bo->base);
-			bo = NULL;
-		}
+		if (bo->mem == NULL)
+			goto free_cacheing;
+
 		return bo;
+
+free_cacheing:
+		bo->base.refcnt = 0; /* for valgrind */
+		kgem_bo_free(kgem, &bo->base);
 	}
 
 	if (kgem->has_userptr) {


More information about the xorg-commit mailing list