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

Chris Wilson ickle at kemper.freedesktop.org
Thu Jun 16 06:28:26 PDT 2011


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

New commits:
commit 17bf0019b6962c06c87a08e4b41799481eaccd26
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jun 16 14:26:06 2011 +0100

    sna: Only retire requests after IO if the bo was active
    
    We only want to process retirements if we know we caused a stall waiting
    for the GPU to release the bo before performing IO.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 4297937..f5f87d4 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -177,9 +177,9 @@ Bool kgem_bo_write(struct kgem *kgem, struct kgem_bo *bo,
 		return FALSE;
 
 	bo->needs_flush = false;
-	if (bo->gpu)
+	if (bo->rq)
 		kgem_retire(kgem);
-	assert(bo->gpu == false);
+	bo->gpu = false;
 	return TRUE;
 }
 
@@ -546,9 +546,6 @@ void kgem_retire(struct kgem *kgem)
 
 	list_for_each_entry_safe(bo, next, &kgem->flushing, request) {
 		if (!kgem_busy(kgem, bo->handle)) {
-			assert(bo->rq == NULL);
-			assert(bo->needs_flush);
-			assert(bo->deleted);
 			bo->needs_flush = 0;
 			bo->gpu = false;
 			list_move(&bo->list, inactive(kgem, bo->size));
@@ -1610,9 +1607,9 @@ void kgem_bo_sync(struct kgem *kgem, struct kgem_bo *bo, bool for_write)
 
 	drmIoctl(kgem->fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &set_domain);
 	bo->needs_flush = false;
-	if (bo->gpu)
+	if (bo->rq)
 		kgem_retire(kgem);
-	assert(bo->gpu == false);
+	bo->gpu = false;
 	bo->cpu_read = true;
 	if (for_write)
 		bo->cpu_write = true;
@@ -1809,9 +1806,9 @@ void kgem_buffer_sync(struct kgem *kgem, struct kgem_bo *_bo)
 		else
 			gem_read(kgem->fd, bo->base.handle, bo+1, bo->used);
 		bo->base.needs_flush = false;
-		if (bo->base.gpu)
+		if (bo->base.rq)
 			kgem_retire(kgem);
-		assert(bo->base.gpu == false);
+		bo->base.gpu = false;
 		bo->need_io = 0;
 	}
 
commit b707f18d17564653a2b45adf46a4e8eafcc6ab2c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jun 16 14:16:06 2011 +0100

    sna: Purge the bo cache only if we detect aperture thrashing
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index fd220ab..4297937 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -510,7 +510,7 @@ static void __kgem_bo_destroy(struct kgem *kgem, struct kgem_bo *bo)
 
 	if (!bo->deleted && !bo->exec) {
 		if (!gem_madvise(kgem->fd, bo->handle, I915_MADV_DONTNEED)) {
-			kgem->need_purge = 1;
+			kgem->need_purge |= bo->gpu;
 			goto destroy;
 		}
 
@@ -1037,7 +1037,7 @@ search_linear_cache(struct kgem *kgem, int size, bool active)
 		if (bo->deleted) {
 			if (!gem_madvise(kgem->fd, bo->handle,
 					 I915_MADV_WILLNEED)) {
-				kgem->need_purge = 1;
+				kgem->need_purge |= bo->gpu;
 				goto next_bo;
 			}
 
@@ -1282,7 +1282,7 @@ struct kgem_bo *kgem_create_2d(struct kgem *kgem,
 		if (bo->deleted) {
 			if (!gem_madvise(kgem->fd, bo->handle,
 					 I915_MADV_WILLNEED)) {
-				kgem->need_purge = 1;
+				kgem->need_purge |= bo->gpu;
 				gem_close(kgem->fd, bo->handle);
 				list_del(&bo->request);
 				free(bo);
@@ -1331,7 +1331,7 @@ skip_active_search:
 		if (bo->deleted) {
 			if (!gem_madvise(kgem->fd, bo->handle,
 					 I915_MADV_WILLNEED)) {
-				kgem->need_purge = 1;
+				kgem->need_purge |= bo->gpu;
 				goto next_bo;
 			}
 


More information about the xorg-commit mailing list