summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-30 11:41:07 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-30 12:05:51 +0000
commitc65ec096e79aa6bda7b2b3ef235e3fd9698b4da7 (patch)
tree8df7305d4328c517ac075e58f92f36e257d2c236
parent95f3734dd69b82e007095a599cc21f4c63d6ec00 (diff)
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@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_render.c10
-rw-r--r--src/sna/sna_tiling.c7
2 files changed, 13 insertions, 4 deletions
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index 9a98990a..43e86424 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 0bc45390..a3bf19d9 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;