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

Chris Wilson ickle at kemper.freedesktop.org
Wed Nov 21 08:11:42 PST 2012


 src/sna/kgem.c |    6 +++---
 src/sna/kgem.h |   17 +++++++++++------
 2 files changed, 14 insertions(+), 9 deletions(-)

New commits:
commit 9c627a05247690891062a2c0c1c8f7bbc0273104
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Nov 21 16:03:02 2012 +0000

    sna: Remove the kgem_bo_is_mappable refcnt assertion from freed paths
    
    A few callers of kgem_bo_is_mappable operate on freed bo, and so need to
    avoid the assert(bo->refcnt).
    
    References: https://bugs.freedesktop.org/show_bug.cgi?id=47597
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index ac60957..034e182 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1374,7 +1374,7 @@ inline static void kgem_bo_move_to_inactive(struct kgem *kgem,
 	if (bo->map) {
 		int type = IS_CPU_MAP(bo->map);
 		if (bucket(bo) >= NUM_CACHE_BUCKETS ||
-		    (!type && !kgem_bo_is_mappable(kgem, bo))) {
+		    (!type && !__kgem_bo_is_mappable(kgem, bo))) {
 			munmap(MAP(bo->map), bytes(bo));
 			bo->map = NULL;
 		}
@@ -4777,7 +4777,7 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
 						  CREATE_EXACT | CREATE_INACTIVE | CREATE_GTT_MAP);
 		if (old == NULL) {
 			old = search_linear_cache(kgem, alloc, CREATE_INACTIVE);
-			if (old && !kgem_bo_is_mappable(kgem, old)) {
+			if (old && !__kgem_bo_is_mappable(kgem, old)) {
 				_kgem_bo_destroy(kgem, old);
 				old = NULL;
 			}
@@ -4785,7 +4785,7 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
 		if (old) {
 			DBG(("%s: reusing handle=%d for buffer\n",
 			     __FUNCTION__, old->handle));
-			assert(kgem_bo_is_mappable(kgem, old));
+			assert(__kgem_bo_is_mappable(kgem, old));
 			assert(!old->snoop);
 			assert(old->rq == NULL);
 
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index 01efc8e..c20b4f3 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -483,13 +483,9 @@ static inline bool kgem_bo_can_blt(struct kgem *kgem,
 	return kgem_bo_blt_pitch_is_ok(kgem, bo);
 }
 
-static inline bool kgem_bo_is_mappable(struct kgem *kgem,
-				       struct kgem_bo *bo)
+static inline bool __kgem_bo_is_mappable(struct kgem *kgem,
+					 struct kgem_bo *bo)
 {
-	DBG(("%s: domain=%d, offset: %d size: %d\n",
-	     __FUNCTION__, bo->domain, bo->presumed_offset, kgem_bo_size(bo)));
-	assert(bo->refcnt);
-
 	if (bo->domain == DOMAIN_GTT)
 		return true;
 
@@ -503,6 +499,15 @@ static inline bool kgem_bo_is_mappable(struct kgem *kgem,
 	return bo->presumed_offset + kgem_bo_size(bo) <= kgem->aperture_mappable;
 }
 
+static inline bool kgem_bo_is_mappable(struct kgem *kgem,
+				       struct kgem_bo *bo)
+{
+	DBG(("%s: domain=%d, offset: %d size: %d\n",
+	     __FUNCTION__, bo->domain, bo->presumed_offset, kgem_bo_size(bo)));
+	assert(bo->refcnt);
+	return __kgem_bo_is_mappable(kgem, bo);
+}
+
 static inline bool kgem_bo_mapped(struct kgem *kgem, struct kgem_bo *bo)
 {
 	DBG(("%s: map=%p, tiling=%d, domain=%d\n",


More information about the xorg-commit mailing list