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

Chris Wilson ickle at kemper.freedesktop.org
Wed Oct 2 07:04:36 PDT 2013


 src/sna/kgem.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit a048f436a0210d076fc844404bf56b8b7fcb4b7b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Oct 2 14:59:11 2013 +0100

    sna: Only delete unused io buffers
    
    Before deleting the io buffer, we need to check that it is not active.
    Currently we check that it is not pending use in the current batch, but
    we also need to double check that it does not have outstanding use by
    the GPU. Failing to do so could mean overwriting the data prior to it
    being read by the GPU, a very small race but often hit!
    
    Reported-by: Vedran Rodic <vrodic at gmail.com> # and many others
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66990
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 81ca65e..eb51149 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -4568,7 +4568,7 @@ void _kgem_bo_destroy(struct kgem *kgem, struct kgem_bo *bo)
 	if (bo->proxy) {
 		_list_del(&bo->vma);
 		_list_del(&bo->request);
-		if (bo->io && bo->exec == NULL)
+		if (bo->io && bo->exec == NULL && bo->domain == DOMAIN_CPU)
 			_kgem_bo_delete_buffer(kgem, bo);
 		kgem_bo_unref(kgem, bo->proxy);
 		kgem_bo_binding_free(kgem, bo);
commit 660e9e14bd49fad75dd2fd73c285e035e2672da4
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Oct 2 15:01:53 2013 +0100

    sna: Add a few more asserts around handling of buffers
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 9685fb3..81ca65e 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -2407,7 +2407,7 @@ static void kgem_finish_buffers(struct kgem *kgem)
 		}
 
 		if (bo->mmapped) {
-			int used;
+			uint32_t used;
 
 			assert(!bo->need_io);
 
@@ -2417,6 +2417,7 @@ static void kgem_finish_buffers(struct kgem *kgem)
 			    (kgem->has_llc || bo->mmapped == MMAPPED_GTT || bo->base.snoop)) {
 				DBG(("%s: retaining upload buffer (%d/%d)\n",
 				     __FUNCTION__, bo->used, bytes(&bo->base)));
+				assert(used >= bo->used);
 				bo->used = used;
 				list_move(&bo->base.list,
 					  &kgem->active_buffers);
@@ -5985,6 +5986,7 @@ init:
 
 done:
 	bo->used = ALIGN(bo->used, UPLOAD_ALIGNMENT);
+	assert(bo->used && bo->used <= bytes(&bo->base));
 	assert(bo->mem);
 	*ret = (char *)bo->mem + offset;
 	return kgem_create_proxy(kgem, &bo->base, offset, size);


More information about the xorg-commit mailing list