summaryrefslogtreecommitdiff
path: root/src/sna/sna_tiling.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sna/sna_tiling.c')
-rw-r--r--src/sna/sna_tiling.c45
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(&region, 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(&region, 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(&region, box, nbox);