summaryrefslogtreecommitdiff
path: root/src/sna/sna_tiling.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-29 18:07:14 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-29 20:12:39 +0000
commitdf148c962108a7f3efead0b80ab4fe77f3f79c8b (patch)
treecf55f05e74271b3710b96b5b6349ddc86119b47d /src/sna/sna_tiling.c
parente1e67e8f394480eb4fef1238ccfd49cc36e4b6f2 (diff)
sna: Limit the tile size for uploading into large pixmaps
As we may have a constrained aperture, we need to be careful not to exceed our resources limits when uploading the pixel data. (For example, fitting two of the maximum bo into a single batch may fail due to fragmentation of the GATT.) So be cautious and use more tiles to reduce the size of each individual batch. 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.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/sna/sna_tiling.c b/src/sna/sna_tiling.c
index 52572bc6..eac664e3 100644
--- a/src/sna/sna_tiling.c
+++ b/src/sna/sna_tiling.c
@@ -138,7 +138,11 @@ sna_tiling_composite_done(struct sna *sna,
{
struct sna_tile_state *tile = op->u.priv;
struct sna_composite_op tmp;
- int x, y, n, step = sna->render.max_3d_size;
+ int x, y, n, step;
+
+ step = sna->render.max_3d_size;
+ 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));
@@ -318,21 +322,26 @@ sna_tiling_fill_boxes(struct sna *sna,
{
RegionRec region, tile, this;
struct kgem_bo *bo;
+ int step;
Bool ret = FALSE;
pixman_region_init_rects(&region, box, n);
+ step = sna->render.max_3d_size;
+ while (step * step * 4 > sna->kgem.max_tile_size)
+ step /= 2;
+
DBG(("%s (op=%d, format=%x, color=(%04x,%04x,%04x, %04x), tile.size=%d, box=%dx[(%d, %d), (%d, %d)])\n",
__FUNCTION__, op, (int)format,
color->red, color->green, color->blue, color->alpha,
- sna->render.max_3d_size, n,
+ step, n,
region.extents.x1, region.extents.y1,
region.extents.x2, region.extents.y2));
for (tile.extents.y1 = tile.extents.y2 = region.extents.y1;
tile.extents.y2 < region.extents.y2;
tile.extents.y1 = tile.extents.y2) {
- tile.extents.y2 = tile.extents.y1 + sna->render.max_3d_size;
+ tile.extents.y2 = tile.extents.y1 + step;
if (tile.extents.y2 > region.extents.y2)
tile.extents.y2 = region.extents.y2;
@@ -341,7 +350,7 @@ sna_tiling_fill_boxes(struct sna *sna,
tile.extents.x1 = tile.extents.x2) {
PixmapRec tmp;
- tile.extents.x2 = tile.extents.x1 + sna->render.max_3d_size;
+ tile.extents.x2 = tile.extents.x1 + step;
if (tile.extents.x2 > region.extents.x2)
tile.extents.x2 = region.extents.x2;