From 50b41cb485ffb38e6bf705a3a62840bb78af669b Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 23 Jan 2013 21:16:49 +0000 Subject: [PATCH] sna/dri: Only reject DRI2 buffers that are too small for the request blit The goal is to reject stale DRI2 buffers that are smaller than the target due to not-yet-handled ConfigureNotify, but not to reject blitting from Windows that are larger than the frontbuffer. Fixes a regression from the overzealous commit b27ecf3059bc066ef59f2a71c1d8d8f0ffec7191 Author: Chris Wilson Date: Mon Nov 12 14:06:06 2012 +0000 sna/dri: Prevent scheduling a swap on stale buffers Signed-off-by: Chris Wilson --- src/sna/sna_dri.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c index fbc0cdbc..94834a09 100644 --- a/src/sna/sna_dri.c +++ b/src/sna/sna_dri.c @@ -841,14 +841,23 @@ can_blit(struct sna * sna, DRI2BufferPtr front, DRI2BufferPtr back) { - uint32_t f, b; + RegionPtr clip; + uint32_t s; if (draw->type == DRAWABLE_PIXMAP) return true; - f = get_private(front)->size; - b = get_private(back)->size; - return (f >> 16) >= (b >> 16) && (f & 0xffff) >= (b & 0xffff); + clip = &((WindowPtr)draw)->clipList; + + s = get_private(front)->size; + if ((s>>16) < clip->extents.y2 || (s&0xffff) < clip->extents.x2) + return false; + + s = get_private(back)->size; + if ((s>>16) < clip->extents.y2 || (s&0xffff) < clip->extents.x2) + return false; + + return true; } static void