summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-02-03 20:06:43 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-02-04 15:19:37 +0000
commit2653524dffc1fe0dbff7d74bfc9be535d9ececb1 (patch)
treeeb27777dc0e6353d45ce98e7f75f1337e50c1523 /src
parent93a0b10f163ee79b6a6a7ea46b0a33b622b1f86e (diff)
sna: Reduce the downsample tile size to accommodate alignment
If we need to enlarge the sampled tile due to tiling alignments, the resulting sample can become larger than we can accommodate through the 3D pipeline, resulting in FAIL. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/sna/sna_render.c11
-rw-r--r--src/sna/sna_tiling.c10
2 files changed, 17 insertions, 4 deletions
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index bc8b2de7..c2b9e798 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -622,7 +622,7 @@ static int sna_render_picture_downsample(struct sna *sna,
struct sna_pixmap *priv;
pixman_transform_t t;
PixmapPtr tmp;
- int width, height;
+ int width, height, size;
int sx, sy, ox, oy, ow, oh;
int error, ret = 0;
BoxRec box, b;
@@ -743,8 +743,13 @@ static int sna_render_picture_downsample(struct sna *sna,
ValidatePicture(tmp_dst);
ValidatePicture(tmp_src);
- w = sna->render.max_3d_size / sx - 2 * sx;
- h = sna->render.max_3d_size / sy - 2 * sy;
+ /* Use a small size to accommodate enlargement through tile alignment */
+ size = sna->render.max_3d_size - 4096 / pixmap->drawable.bitsPerPixel;
+ while (size * size * 4 > sna->kgem.max_copy_tile_size)
+ size /= 2;
+
+ w = size / sx - 2 * sx;
+ h = size / sy - 2 * sy;
DBG(("%s %d:%d downsampling using %dx%d GPU tiles\n",
__FUNCTION__, (width + w-1)/w, (height + h-1)/h, w, h));
diff --git a/src/sna/sna_tiling.c b/src/sna/sna_tiling.c
index 00e111ce..c6e898b1 100644
--- a/src/sna/sna_tiling.c
+++ b/src/sna/sna_tiling.c
@@ -142,7 +142,8 @@ sna_tiling_composite_done(struct sna *sna,
/* 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))
+ 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)
step /= 2;
@@ -330,7 +331,11 @@ sna_tiling_fill_boxes(struct sna *sna,
pixman_region_init_rects(&region, box, n);
+ /* Use a small step to accommodate enlargement through tile alignment */
step = sna->render.max_3d_size;
+ 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)
step /= 2;
@@ -443,7 +448,10 @@ Bool sna_tiling_blt_copy_boxes(struct sna *sna, uint8_t alu,
pixman_region_init_rects(&region, 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)
step /= 2;