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>
This commit is contained in:
Chris Wilson 2012-01-30 11:41:07 +00:00
parent 95f3734dd6
commit c65ec096e7
2 changed files with 13 additions and 4 deletions

View File

@ -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,

View File

@ -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;