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

Chris Wilson ickle at kemper.freedesktop.org
Thu Feb 7 05:16:23 PST 2013


 src/sna/kgem.c       |   24 +++++++++++-------------
 src/sna/sna_render.c |    8 +++++---
 2 files changed, 16 insertions(+), 16 deletions(-)

New commits:
commit 8a272971d5971a56f57dde00dceb082d0b142c8c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Feb 6 17:59:10 2013 +0000

    sna: Allow inplace uploads to utilise GTT on LLC machines
    
    Rather than arbitrarily disable the fallback paths for LLC, allow it to
    utilise any available GTT buffers for inplace uploads. The best
    explanation so far is that with the streaming is that we are trashing
    the LLC. On other machines, the difference is in the noise.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index e8ac5c2..ef8cdde 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -5026,9 +5026,6 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
 	/* we should never be asked to create anything TOO large */
 	assert(size <= kgem->max_object_size);
 
-	if (kgem->has_llc)
-		flags &= ~KGEM_BUFFER_INPLACE;
-
 #if !DBG_NO_UPLOAD_CACHE
 	list_for_each_entry(bo, &kgem->batch_buffers, base.list) {
 		assert(bo->base.io);
@@ -5109,8 +5106,13 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
 		alloc = ALIGN(size, kgem->buffer_size);
 	if (alloc > MAX_CACHE_SIZE)
 		alloc = PAGE_ALIGN(size);
+
+	if (alloc > kgem->aperture_mappable / 4)
+		flags &= ~KGEM_BUFFER_INPLACE;
 	alloc /= PAGE_SIZE;
-	if (kgem->has_llc) {
+
+	if (kgem->has_llc &&
+	    (flags & KGEM_BUFFER_WRITE_INPLACE) != KGEM_BUFFER_WRITE_INPLACE) {
 		bo = buffer_alloc();
 		if (bo == NULL)
 			goto skip_llc;
@@ -5147,6 +5149,7 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
 		if (bo->mem) {
 			if (flags & KGEM_BUFFER_WRITE)
 				kgem_bo_sync__cpu(kgem, &bo->base);
+			flags &= ~KGEM_BUFFER_INPLACE;
 			goto init;
 		} else {
 			bo->base.refcnt = 0; /* for valgrind */
@@ -5155,9 +5158,6 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
 	}
 skip_llc:
 
-	if (PAGE_SIZE * alloc > kgem->aperture_mappable / 4)
-		flags &= ~KGEM_BUFFER_INPLACE;
-
 	if ((flags & KGEM_BUFFER_WRITE_INPLACE) == KGEM_BUFFER_WRITE_INPLACE) {
 		/* The issue with using a GTT upload buffer is that we may
 		 * cause eviction-stalls in order to free up some GTT space.
@@ -5220,7 +5220,7 @@ skip_llc:
 			bo->mem = kgem_bo_map(kgem, &bo->base);
 			if (bo->mem) {
 				if (IS_CPU_MAP(bo->base.map))
-				    flags &= ~KGEM_BUFFER_INPLACE;
+					flags &= ~KGEM_BUFFER_INPLACE;
 				goto init;
 			} else {
 				bo->base.refcnt = 0;
@@ -5244,12 +5244,10 @@ skip_llc:
 			goto init;
 		}
 
-		if ((flags & KGEM_BUFFER_WRITE_INPLACE) != KGEM_BUFFER_WRITE_INPLACE) {
+		if ((flags & KGEM_BUFFER_INPLACE) == 0) {
 			bo = create_snoopable_buffer(kgem, alloc);
-			if (bo) {
-				assert((flags & KGEM_BUFFER_INPLACE) == 0);
+			if (bo)
 				goto init;
-			}
 		}
 	}
 
commit bc8a2c30c4f6bb9ce751b6717a3a2feaea0d6d4b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Feb 7 10:42:58 2013 +0000

    sna: Only try the SRC fixup into the buffer if it is CPU mapped
    
    On one particular machine, this operation is behaving as if it is
    reading back UC memory during the explicit write-only composite.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index 8f4f268..7784a5b 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -1576,8 +1576,10 @@ do_fixup:
 	}
 
 	/* Composite in the original format to preserve idiosyncracies */
-	if (picture->format == channel->pict_format)
-		dst = pixman_image_create_bits(picture->format,
+	if (!kgem_buffer_is_inplace(channel->bo) &&
+	    (picture->pDrawable == NULL ||
+	     picture->format == channel->pict_format))
+		dst = pixman_image_create_bits(channel->pict_format,
 					       w, h, ptr, channel->bo->pitch);
 	else
 		dst = pixman_image_create_bits(picture->format, w, h, NULL, 0);
@@ -1603,7 +1605,7 @@ do_fixup:
 	free_pixman_pict(picture, src);
 
 	/* Then convert to card format */
-	if (picture->format != channel->pict_format) {
+	if (pixman_image_get_data(dst) != ptr) {
 		DBG(("%s: performing post-conversion %08x->%08x (%d, %d)\n",
 		     __FUNCTION__,
 		     picture->format, channel->pict_format,
commit 889ed28f52bccdbc54692ea075f95f9635a8d58a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Feb 7 10:42:21 2013 +0000

    sna: Correctly align used buffers to the following page boundary
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index d2be862..e8ac5c2 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -2174,7 +2174,7 @@ static void kgem_finish_buffers(struct kgem *kgem)
 
 			assert(!bo->need_io);
 
-			used = ALIGN(bo->used + PAGE_SIZE-1, PAGE_SIZE);
+			used = ALIGN(bo->used, PAGE_SIZE);
 			if (!DBG_NO_UPLOAD_ACTIVE &&
 			    used + PAGE_SIZE <= bytes(&bo->base) &&
 			    (kgem->has_llc || !IS_CPU_MAP(bo->base.map) || bo->base.snoop)) {


More information about the xorg-commit mailing list