diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-04-23 21:42:12 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-04-23 22:56:08 +0100 |
commit | bca4e0e35e4ac27f2dcd1a8e5fcbf7ce69cec358 (patch) | |
tree | 44fb610784a0405bafb4ccff85432fd824a9b4f5 | |
parent | cac8e1ee74fa8704a42a5c5ebe65d5ec777cbd67 (diff) |
sna: Limit generic convolution to smallish kernels
Since the naive implementation uses an 8bit temporary, we can only
support so many passes before the quantization artefacts become
apparent. We have to be extra conservation in order to support
multi-pass convolution algorithms (notable 2-pass separable Gaussian
kernels).
References: https://bugs.freedesktop.org/show_bug.cgi?id=95091
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_render.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c index d8b77566..5a8df06d 100644 --- a/src/sna/sna_render.c +++ b/src/sna/sna_render.c @@ -1326,6 +1326,8 @@ sna_render_picture_convolve(struct sna *sna, */ DBG(("%s: origin=(%d,%d) kernel=%dx%d, size=%dx%d\n", __FUNCTION__, x_off, y_off, cw, ch, w, h)); + if (cw*ch > 32) /* too much loss of precision from quantization! */ + return -1; assert(picture->pDrawable); assert(picture->filter == PictFilterConvolution); @@ -1376,9 +1378,9 @@ sna_render_picture_convolve(struct sna *sna, alpha = CreateSolidPicture(0, &color, &error); if (alpha) { sna_composite(PictOpAdd, picture, alpha, tmp, - x, y, + x-(x_off+i), y-(y_off+j), + 0, 0, 0, 0, - x_off+i, y_off+j, w, h); FreePicture(alpha, 0); } |