From ef2a45731ef55b9fbafe5da67e0251b9b871bda9 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 24 Jul 2013 19:44:15 +0100 Subject: [PATCH] sna/dri: Restore the comparison of bottom-right extents to the pixmap origin This reverts a portion of commit 6d80bd6a73 so that we do not compare an offset redirected window against its outer frame (e.g. glxgears in a 300x300 under unity sits within a much larger ~330x330 frame). References: https://bugs.freedesktop.org/show_bug.cgi?id=67210 Reported-by: Joseph Yasi Signed-off-by: Chris Wilson --- src/sna/sna_dri.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c index 1c71fba5..f4481b67 100644 --- a/src/sna/sna_dri.c +++ b/src/sna/sna_dri.c @@ -915,9 +915,9 @@ can_blit(struct sna *sna, if (STRICT_BLIT && dst->attachment == DRI2BufferFrontLeft) { if (unlikely(get_private(dst)->pixmap != get_drawable_pixmap(draw))) { DBG(("%s: reject as dst pixmap=%ld, but expecting pixmap=%ld\n", - __FUNCTION__, - get_private(dst)->pixmap ? get_private(dst)->pixmap->drawable.serialNumber : 0, - get_drawable_pixmap(draw)->drawable.serialNumber)); + __FUNCTION__, + get_private(dst)->pixmap ? get_private(dst)->pixmap->drawable.serialNumber : 0, + get_drawable_pixmap(draw)->drawable.serialNumber)); return false; } @@ -946,25 +946,32 @@ can_blit(struct sna *sna, /* This should never happen as the Drawable->Pixmap is local! */ if (unlikely(extents.x1 < 0 || extents.y1 < 0)) { - DBG(("%s: reject as read/write extents is out of bounds\n", - __FUNCTION__)); + DBG(("%s: reject as read/write extents, origin=(%d, %d), is out of bounds\n", + __FUNCTION__, extents.x1, extents.y1)); return false; } /* But the dst/src bo may be stale (older than the Drawable) and be * too small for the blit. */ + extents.x1 -= draw->x; extents.x2 -= draw->x; + extents.y1 -= draw->y; extents.y2 -= draw->y; + s = get_private(dst)->size; if (unlikely((s>>16) < extents.y2 || (s&0xffff) < extents.x2)) { - DBG(("%s: reject as read/write extents is out of bounds\n", - __FUNCTION__)); + DBG(("%s: reject as write extents (bottom-right=(%d, %d), size=(%d, %d)) is out of bounds\n", + __FUNCTION__, + extents.x2, extents.y2, + s&0xffff, s>>16)); return false; } s = get_private(src)->size; if (unlikely((s>>16) < extents.y2 || (s&0xffff) < extents.x2)) { - DBG(("%s: reject as read/write extents is out of bounds\n", - __FUNCTION__)); + DBG(("%s: reject as src read extents (bottom-right=(%d, %d), size=(%d, %d)) is out of bounds\n", + __FUNCTION__, + extents.x2, extents.y2, + s&0xffff, s>>16)); return false; }