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

Chris Wilson ickle at kemper.freedesktop.org
Fri Nov 8 01:56:28 PST 2013


 src/sna/kgem.c |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

New commits:
commit 84d667b94a97ad5fde68d730d57a19e1f4241ed5
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Nov 8 08:53:55 2013 +0000

    sna: Always schedule upload buffers for retirement after use
    
    Even if they are multiply referenced due to cached references.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 5a540e4..a87b2a5 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1590,10 +1590,15 @@ kgem_add_handle(struct kgem *kgem, struct kgem_bo *bo)
 
 static void kgem_add_bo(struct kgem *kgem, struct kgem_bo *bo)
 {
+	assert(bo->refcnt);
+	assert(bo->proxy == NULL);
+
 	bo->exec = kgem_add_handle(kgem, bo);
 	bo->rq = MAKE_REQUEST(kgem->next_request, kgem->ring);
 
 	list_move_tail(&bo->request, &kgem->next_request->buffers);
+	if (bo->io && !list_is_empty(&bo->list))
+		list_move(&bo->list, &kgem->batch_buffers);
 
 	/* XXX is it worth working around gcc here? */
 	kgem->flush |= bo->flush;
@@ -2073,17 +2078,18 @@ static void kgem_bo_unref(struct kgem *kgem, struct kgem_bo *bo)
 
 static void kgem_buffer_release(struct kgem *kgem, struct kgem_buffer *bo)
 {
+	assert(bo->base.io);
 	while (!list_is_empty(&bo->base.vma)) {
 		struct kgem_bo *cached;
 
 		cached = list_first_entry(&bo->base.vma, struct kgem_bo, vma);
 		assert(cached->proxy == &bo->base);
+		assert(cached != &bo->base);
 		list_del(&cached->vma);
 
 		assert(*(struct kgem_bo **)cached->map__gtt == cached);
 		*(struct kgem_bo **)cached->map__gtt = NULL;
 		cached->map__gtt = NULL;
-		assert(cached->map__cpu == NULL);
 
 		kgem_bo_destroy(kgem, cached);
 	}
@@ -2285,7 +2291,7 @@ bool kgem_retire(struct kgem *kgem)
 {
 	bool retired = false;
 
-	DBG(("%s\n", __FUNCTION__));
+	DBG(("%s, need_retire?=%d\n", __FUNCTION__, kgem->need_retire));
 
 	kgem->need_retire = false;
 
@@ -2460,11 +2466,9 @@ static void kgem_finish_buffers(struct kgem *kgem)
 				DBG(("%s: retaining upload buffer (%d/%d): used=%d, refcnt=%d\n",
 				     __FUNCTION__, bo->used, bytes(&bo->base), used, bo->base.refcnt));
 				bo->used = used;
-				if (bo->base.refcnt == 1) {
-					list_move(&bo->base.list,
-						  &kgem->active_buffers);
-					kgem->need_retire = true;
-				}
+				list_move(&bo->base.list,
+					  &kgem->active_buffers);
+				kgem->need_retire = true;
 				continue;
 			}
 			DBG(("%s: discarding mmapped buffer, used=%d, map type=%d\n",
commit cb579a4444146a0736c7bad5edc1f382a32b6bf6
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Nov 7 14:54:39 2013 +0000

    sna: Only assert that the bo is small enough to be mmapped
    
    Not that is currently in a position to be mapped without eviction.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 8283df8..5a540e4 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -330,7 +330,7 @@ static void *__kgem_bo_map__gtt(struct kgem *kgem, struct kgem_bo *bo)
 	     bo->handle, bytes(bo)));
 	assert(bo->proxy == NULL);
 	assert(!bo->snoop);
-	assert(kgem_bo_can_map(kgem, bo));
+	assert(num_pages(bo) <= kgem->aperture_mappable / 4);
 
 retry_gtt:
 	VG_CLEAR(mmap_arg);


More information about the xorg-commit mailing list