sna: For an unbounded op, we need to convert the whole surface

Otherwise if we fail to check, then we create a 0x0 surface to sample
with the operation -- net result is that we end up using a clear source
instead of the desired mask.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2011-06-23 15:51:59 +01:00
parent 356ded1308
commit 03e6aee8fd
1 changed files with 29 additions and 15 deletions

View File

@ -714,28 +714,36 @@ sna_render_picture_convert(struct sna *sna,
return -1;
#endif
box.x1 = x;
box.y1 = y;
box.x2 = x + w;
box.y2 = y + h;
if (w != 0 && h != 0) {
box.x1 = x;
box.y1 = y;
box.x2 = x + w;
box.y2 = y + h;
if (channel->transform) {
DBG(("%s: has transform, uploading whole surface\n",
if (channel->transform) {
DBG(("%s: has transform, converting whole surface\n",
__FUNCTION__));
box.x1 = box.y1 = 0;
box.x2 = pixmap->drawable.width;
box.y2 = pixmap->drawable.height;
}
if (box.x1 < 0)
box.x1 = 0;
if (box.y1 < 0)
box.y1 = 0;
if (box.x2 > pixmap->drawable.width)
box.x2 = pixmap->drawable.width;
if (box.y2 > pixmap->drawable.height)
box.y2 = pixmap->drawable.height;
} else {
DBG(("%s: op no bounds, converting whole surface\n",
__FUNCTION__));
box.x1 = box.y1 = 0;
box.x2 = pixmap->drawable.width;
box.y2 = pixmap->drawable.height;
}
if (box.x1 < 0)
box.x1 = 0;
if (box.y1 < 0)
box.y1 = 0;
if (box.x2 > pixmap->drawable.width)
box.x2 = pixmap->drawable.width;
if (box.y2 > pixmap->drawable.height)
box.y2 = pixmap->drawable.height;
w = box.x2 - box.x1;
h = box.y2 - box.y1;
@ -744,6 +752,12 @@ sna_render_picture_convert(struct sna *sna,
pixmap->drawable.width,
pixmap->drawable.height));
if (w == 0 || h == 0) {
DBG(("%s: sample extents lie outside of source, using clear\n",
__FUNCTION__));
return 0;
}
sna_pixmap_move_to_cpu(pixmap, false);
src = pixman_image_create_bits(picture->format,