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

Chris Wilson ickle at kemper.freedesktop.org
Wed Dec 12 14:00:18 PST 2012


 src/sna/kgem.c |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

New commits:
commit 74bbf20e6e652cba55d6d0bc17066f4112f8548c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Dec 12 21:56:22 2012 +0000

    sna: Improve the initialisation failure path for pinned batches
    
    Simplify the later checks by always populating the lists with a single,
    albeit unpinned, bo in the case we fail to create pinned batches.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index f1682da..90594cf 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -869,7 +869,6 @@ static bool kgem_init_pinned_batches(struct kgem *kgem)
 			bo->presumed_offset = pin.offset;
 			debug_alloc__bo(kgem, bo);
 			list_add(&bo->list, &kgem->pinned_batches[n]);
-			bo->refcnt = 1;
 		}
 	}
 
@@ -883,6 +882,25 @@ err:
 							 struct kgem_bo, list));
 		}
 	}
+
+	/* For simplicity populate the lists with a single unpinned bo */
+	for (n = 0; n < ARRAY_SIZE(count); n++) {
+		struct kgem_bo *bo;
+		uint32_t handle;
+
+		handle = gem_create(kgem->fd, size[n]);
+		if (handle == 0)
+			break;
+
+		bo = __kgem_bo_alloc(handle, size[n]);
+		if (bo == NULL) {
+			gem_close(kgem->fd, handle);
+			break;
+		}
+
+		debug_alloc__bo(kgem, bo);
+		list_add(&bo->list, &kgem->pinned_batches[n]);
+	}
 	return false;
 }
 


More information about the xorg-commit mailing list