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

Chris Wilson ickle at kemper.freedesktop.org
Mon Jan 30 04:44:40 PST 2012


 src/sna/kgem.c       |   29 ++++++++++++++++++++++++-----
 src/sna/sna_render.c |   10 ++++++++--
 src/sna/sna_tiling.c |    7 +++++--
 3 files changed, 37 insertions(+), 9 deletions(-)

New commits:
commit 6f99555b6b64a0e1baad1853569f7bf521c327c3
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jan 30 11:48:59 2012 +0000

    sna: Allow the creation of render targets larger than the maximum bo cache
    
    Given that we now handle uploads to and from bo that are larger than the
    aperture and that usage of such large bo is rare and so unlikely to
    benefit from caching, allow them to be created as render targets and
    destroy as soon as they become inactive.
    
    In principle, this finally enables GPU acceleration of ocitysmap on gen4+,
    but due to the large cost of creating and destroying large bo it is
    disabled on systems that require clflushing. It is, however, a
    pre-requisite for exploiting the enhanced capabilities of IvyBridge.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 30c46fb..d97a6ac 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -661,7 +661,9 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, int gen)
 
 	kgem->max_object_size = kgem->aperture_total / 2;
 	kgem->max_cpu_size = kgem->aperture_total / 2;
-	kgem->max_gpu_size = MAX_CACHE_SIZE;
+	kgem->max_gpu_size = kgem->aperture_total / 2;
+	if (!kgem->has_llc)
+		kgem->max_gpu_size = MAX_CACHE_SIZE;
 	if (gen < 40) {
 		/* If we have to use fences for blitting, we have to make
 		 * sure we can fit them into the aperture.
@@ -672,8 +674,9 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, int gen)
 	}
 	if (kgem->max_gpu_size > kgem->max_cpu_size)
 		kgem->max_gpu_size = kgem->max_cpu_size;
+
 	kgem->max_tile_size = kgem->aperture_total / 4;
-	if (kgem->max_tile_size < kgem->max_gpu_size / 2)
+	if (kgem->max_tile_size > kgem->max_gpu_size / 2)
 		kgem->max_tile_size = kgem->max_gpu_size / 2;
 
 	DBG(("%s: max object size (gpu=%d, cpu=%d, tile=%d)\n",
commit c65ec096e79aa6bda7b2b3ef235e3fd9698b4da7
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jan 30 11:41:07 2012 +0000

    sna: Decrease tiling step size in case we need to enlarge the box later
    
    We can juggle rendering into large bo on gen4 by redirecting the
    rendering through a proxy that is tile aligned, and so the render target
    may be slightly larger than the tiling step size. As that is then larger
    than the maximum 3D pipeline, the trick fails and we need to resort to a
    temporary render target with copies in and out. In this case, check that
    the tile is aligned to the most pessimistic tiling width and reduce the
    step size to accomodate the enlargement.
    
    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 9a98990..43e8642 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -1565,6 +1565,9 @@ sna_render_composite_redirect(struct sna *sna,
 		BoxRec box;
 		int w, h;
 
+		DBG(("%s: dst pitch (%d) fits within render pipeline (%d)\n",
+		     __FUNCTION__, op->dst.bo->pitch, sna->render.max_3d_pitch));
+
 		kgem_get_tile_size(&sna->kgem, op->dst.bo->tiling,
 				   &tile_width, &tile_height, &tile_size);
 
@@ -1615,10 +1618,11 @@ sna_render_composite_redirect(struct sna *sna,
 				return FALSE;
 			}
 
+			assert(op->dst.bo != t->real_bo);
 			op->dst.bo->pitch = t->real_bo->pitch;
 
-			op->dst.x += -box.x1;
-			op->dst.y += -box.y1;
+			op->dst.x -= box.x1;
+			op->dst.y -= box.y1;
 			op->dst.width  = w;
 			op->dst.height = h;
 			return TRUE;
@@ -1675,6 +1679,8 @@ sna_render_composite_redirect_done(struct sna *sna,
 	const struct sna_composite_redirect *t = &op->redirect;
 
 	if (t->real_bo) {
+		assert(op->dst.bo != t->real_bo);
+
 		if (t->box.x2 > t->box.x1) {
 			DBG(("%s: copying temporary to dst\n", __FUNCTION__));
 			sna_blt_copy_boxes(sna, GXcopy,
diff --git a/src/sna/sna_tiling.c b/src/sna/sna_tiling.c
index 0bc4539..a3bf19d 100644
--- a/src/sna/sna_tiling.c
+++ b/src/sna/sna_tiling.c
@@ -140,12 +140,15 @@ sna_tiling_composite_done(struct sna *sna,
 	struct sna_composite_op tmp;
 	int x, y, n, step;
 
+	/* Use a small step to accommodate enlargement through tile alignment */
 	step = sna->render.max_3d_size;
+	if (tile->dst_x & (8*512 / tile->dst->pDrawable->bitsPerPixel - 1))
+		step /= 2;
 	while (step * step * 4 > sna->kgem.max_tile_size)
 		step /= 2;
 
-	DBG(("%s -- %dx%d, count=%d\n", __FUNCTION__,
-	     tile->width, tile->height, tile->rect_count));
+	DBG(("%s -- %dx%d, count=%d, step size=%d\n", __FUNCTION__,
+	     tile->width, tile->height, tile->rect_count, step));
 
 	if (tile->rect_count == 0)
 		goto done;
commit 95f3734dd69b82e007095a599cc21f4c63d6ec00
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jan 30 11:40:02 2012 +0000

    sna: Allow creation of proxies to proxies
    
    Just update the offset of the new bo by the offset of the existing
    proxy.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 64f729b..30c46fb 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -3105,20 +3105,25 @@ struct kgem_bo *kgem_create_proxy(struct kgem_bo *target,
 
 	DBG(("%s: target handle=%d, offset=%d, length=%d, io=%d\n",
 	     __FUNCTION__, target->handle, offset, length, target->io));
-	assert(target->proxy == NULL);
 
 	bo = __kgem_bo_alloc(target->handle, length);
 	if (bo == NULL)
 		return NULL;
 
+	bo->reusable = false;
 	bo->size.bytes = length;
+
 	bo->io = target->io;
 	bo->dirty = target->dirty;
 	bo->tiling = target->tiling;
 	bo->pitch = target->pitch;
+
+	if (target->proxy) {
+		offset += target->delta;
+		target = target->proxy;
+	}
 	bo->proxy = kgem_bo_reference(target);
 	bo->delta = offset;
-	bo->reusable = false;
 	return bo;
 }
 
commit 488937edb67a60389380b405f8f8a548f51e64c7
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jan 30 11:38:36 2012 +0000

    sna: Base prefer-gpu hint on default tiling choice
    
    As on gen4+, tiling increases the maximum usable pitch we can
    accommodate wider pixmaps on the GPU.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 7019638..64f729b 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -2211,6 +2211,10 @@ bool kgem_can_create_cpu(struct kgem *kgem,
 	size = kgem_surface_size(kgem, false, false,
 				 width, height, bpp,
 				 I915_TILING_NONE, &pitch);
+	DBG(("%s? %d, cpu size %d, max %d\n",
+	     __FUNCTION__,
+	     size > 0 && size <= kgem->max_cpu_size,
+	     size, kgem->max_cpu_size));
 	return size > 0 && size <= kgem->max_cpu_size;
 }
 
@@ -2223,8 +2227,15 @@ static bool _kgem_can_create_gpu(struct kgem *kgem,
 		return false;
 
 	size = kgem_surface_size(kgem, false, false,
-				 width, height, bpp, I915_TILING_NONE,
+				 width, height, bpp,
+				 kgem_choose_tiling(kgem,
+						    I915_TILING_X,
+						    width, height, bpp),
 				 &pitch);
+	DBG(("%s? %d, gpu size %d, max %d\n",
+	     __FUNCTION__,
+	     size > 0 && size < kgem->max_gpu_size,
+	     size, kgem->max_gpu_size));
 	return size > 0 && size < kgem->max_gpu_size;
 }
 


More information about the xorg-commit mailing list