diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-04-28 07:53:13 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-04-28 08:38:58 +0100 |
commit | 534a0e6433a37c95f7181f7ce9046a4e7c82532d (patch) | |
tree | cdf594a89b9d7da8b3bd9d908d0dc3a03c4ed774 /src/sna/sna_tiling.c | |
parent | 11cc397cb1cded40f7ab43c1add3fd00b97c6bdc (diff) |
sna: Factor in destination sizes for choosing intermediate tiling bo size
When tiling, factor in the destination usage of the aperture in case
that reduces the available aperture for the intermediate bo.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_tiling.c')
-rw-r--r-- | src/sna/sna_tiling.c | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/src/sna/sna_tiling.c b/src/sna/sna_tiling.c index 5fc7b404..2552fd32 100644 --- a/src/sna/sna_tiling.c +++ b/src/sna/sna_tiling.c @@ -138,14 +138,19 @@ sna_tiling_composite_done(struct sna *sna, { struct sna_tile_state *tile = op->priv; struct sna_composite_op tmp; - int x, y, n, step; + int x, y, n, step, max_size; /* 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) || tile->dst_y & 63) step /= 2; - while (step * step * 4 > sna->kgem.max_copy_tile_size) + + max_size = sna_max_tile_copy_size(sna, op->dst.bo, op->dst.bo); + if (max_size == 0) + goto done; + + while (step * step * 4 > max_size) step /= 2; DBG(("%s -- %dx%d, count=%d, step size=%d\n", __FUNCTION__, @@ -373,7 +378,7 @@ sna_tiling_composite_spans_done(struct sna *sna, { struct sna_tile_state *tile = op->base.priv; struct sna_composite_spans_op tmp; - int x, y, n, step; + int x, y, n, step, max_size; bool force_fallback = false; /* Use a small step to accommodate enlargement through tile alignment */ @@ -381,7 +386,12 @@ sna_tiling_composite_spans_done(struct sna *sna, if (tile->dst_x & (8*512 / tile->dst->pDrawable->bitsPerPixel - 1) || tile->dst_y & 63) step /= 2; - while (step * step * 4 > sna->kgem.max_copy_tile_size) + + max_size = sna_max_tile_copy_size(sna, op->base.dst.bo, op->base.dst.bo); + if (max_size == 0) + goto done; + + while (step * step * 4 > max_size) step /= 2; DBG(("%s -- %dx%d, count=%d, step size=%d\n", __FUNCTION__, @@ -589,7 +599,7 @@ sna_tiling_fill_boxes(struct sna *sna, { RegionRec region, tile, this; struct kgem_bo *bo; - int step; + int step, max_size; bool ret = false; pixman_region_init_rects(®ion, box, n); @@ -599,7 +609,12 @@ sna_tiling_fill_boxes(struct sna *sna, if (region.extents.x1 & (8*512 / dst->drawable.bitsPerPixel - 1) || region.extents.y1 & 63) step /= 2; - while (step * step * 4 > sna->kgem.max_copy_tile_size) + + max_size = sna_max_tile_copy_size(sna, dst_bo, dst_bo); + if (max_size == 0) + goto done; + + while (step * step * 4 > max_size) step /= 2; DBG(("%s (op=%d, format=%x, color=(%04x,%04x,%04x, %04x), tile.size=%d, box=%dx[(%d, %d), (%d, %d)])\n", @@ -790,14 +805,9 @@ sna_tiling_blt_copy_boxes__with_alpha(struct sna *sna, uint8_t alu, return false; } - max_size = sna->kgem.aperture_high * PAGE_SIZE; - max_size -= MAX(kgem_bo_size(src_bo), kgem_bo_size(dst_bo)); - if (max_size <= 0) { - DBG(("%s: tiles cannot fit into aperture\n", __FUNCTION__)); + max_size = sna_max_tile_copy_size(sna, src_bo, dst_bo); + if (max_size == 0) return false; - } - if (max_size > sna->kgem.max_copy_tile_size) - max_size = sna->kgem.max_copy_tile_size; pixman_region_init_rects(®ion, box, nbox); @@ -1019,14 +1029,9 @@ bool sna_tiling_blt_copy_boxes(struct sna *sna, uint8_t alu, return false; } - max_size = sna->kgem.aperture_high * PAGE_SIZE; - max_size -= MAX(kgem_bo_size(src_bo), kgem_bo_size(dst_bo)); - if (max_size <= 0) { - DBG(("%s: tiles cannot fit into aperture\n", __FUNCTION__)); + max_size = sna_max_tile_copy_size(sna, src_bo, dst_bo); + if (max_size == 0) return false; - } - if (max_size > sna->kgem.max_copy_tile_size) - max_size = sna->kgem.max_copy_tile_size; pixman_region_init_rects(®ion, box, nbox); |