diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-03-07 23:03:52 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-03-07 23:04:54 +0000 |
commit | dcd52d0c186e8b17569335338232298fbbea2b2d (patch) | |
tree | 59d84ea48103224c152afd2917cd456cee3f132b | |
parent | 50d0ea02b3908156534fc00def55cfca30bbfecc (diff) |
sna: Fallback if we cannot fit the tiling copy into the aperture
If we cannot fit the source/destination and a tile into the aperture,
then we cannot perform the copy and must do it using the CPU.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_tiling.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/sna/sna_tiling.c b/src/sna/sna_tiling.c index 5bebf002..019b50a5 100644 --- a/src/sna/sna_tiling.c +++ b/src/sna/sna_tiling.c @@ -690,7 +690,7 @@ bool sna_tiling_blt_copy_boxes(struct sna *sna, uint8_t alu, { RegionRec region, tile, this; struct kgem_bo *bo; - int step; + int max_size, step; bool ret = false; if (!kgem_bo_can_blt(&sna->kgem, src_bo) || @@ -703,14 +703,27 @@ 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__)); + 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); /* Use a small step to accommodate enlargement through tile alignment */ step = sna->render.max_3d_size; if (region.extents.x1 & (8*512 / bpp - 1) || region.extents.y1 & 63) step /= 2; - while (step * step * 4 > sna->kgem.max_copy_tile_size) + while (step * step * 4 > max_size) step /= 2; + if (step == 0) { + DBG(("%s: tiles cannot fit into aperture\n", __FUNCTION__)); + return false; + } DBG(("%s (alu=%d), tile.size=%d, box=%dx[(%d, %d), (%d, %d)])\n", __FUNCTION__, alu, step, nbox, |