diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-12-01 13:26:46 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-12-01 13:26:46 +0000 |
commit | 263d10998617ba935179942d2440a1607cd3c21c (patch) | |
tree | 07ee8220d1d890f18e5a35ea24f5e0d630f8b63a /src/sna/sna_render.c | |
parent | 88e9bb760fbd1249bb364a6b68aceee0b442738c (diff) |
sna: Clamp downsampling tile size
For very large scale factors, it is possible for the current calculation
to underflow and try negative tile sizes.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_render.c')
-rw-r--r-- | src/sna/sna_render.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c index 22bc4910..3fbb9ecb 100644 --- a/src/sna/sna_render.c +++ b/src/sna/sna_render.c @@ -829,9 +829,15 @@ fixup: size = sna->render.max_3d_size - 4096 / pixmap->drawable.bitsPerPixel; while (size * size * 4 > max_size) size /= 2; + DBG(("%s: size=%d (max=%d), scale %dx%d\n", + __FUNCTION__, size, max_size, sx, sy)); sw = size / sx - 2 * sx; + if (sw < 1) + sw = 1; sh = size / sy - 2 * sy; + if (sh < 1) + sh = 1; DBG(("%s %d:%d downsampling using %dx%d GPU tiles\n", __FUNCTION__, (width + sw-1)/sw, (height + sh-1)/sh, sw, sh)); |