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

Chris Wilson ickle at kemper.freedesktop.org
Thu Jan 31 08:45:17 PST 2013


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

New commits:
commit 0a08de1f02577aef0da289108270c1b35e5d9703
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jan 31 16:39:47 2013 +0000

    sna: After removing the bo from a batch, check whether it is still busy
    
    If we transfer a bo to the current batch, then subsequently discard it,
    we lose the information about its current active state. Try to recover
    this information, by querying the kernel and adding it to the flushing
    list if necessary.
    
    Reported-by: Jiri Slaby <jirislaby at gmail.com>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index fed6d8c..653a091 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -2111,6 +2111,7 @@ static void kgem_commit(struct kgem *kgem)
 			list_del(&bo->request);
 			bo->rq = NULL;
 			bo->exec = NULL;
+			bo->needs_flush = false;
 		}
 
 		kgem->scanout_busy |= bo->scanout;
@@ -2355,6 +2356,7 @@ static void kgem_cleanup(struct kgem *kgem)
 				bo->exec = NULL;
 				bo->domain = DOMAIN_NONE;
 				bo->dirty = false;
+				bo->needs_flush = false;
 				if (bo->refcnt == 0)
 					kgem_bo_free(kgem, bo);
 			}
@@ -2419,9 +2421,16 @@ void kgem_reset(struct kgem *kgem)
 			bo->exec = NULL;
 			bo->target_handle = -1;
 			bo->dirty = false;
-			bo->rq = NULL;
 			bo->domain = DOMAIN_NONE;
 
+			if (bo->needs_flush && kgem_busy(kgem, bo->handle)) {
+				list_add(&bo->request, &kgem->flushing);
+				bo->rq = (void *)kgem;
+			} else {
+				bo->rq = NULL;
+				bo->needs_flush = false;
+			}
+
 			if (!bo->refcnt && !bo->reusable) {
 				assert(!bo->snoop);
 				DBG(("%s: discarding handle=%d\n",


More information about the xorg-commit mailing list