From 41f401ae27ee753d66aae341be60b27167bc5b62 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 27 Jun 2015 20:24:45 +0100 Subject: [PATCH] sna/dri2: Early return for empty DRI2CopyRegion It's possible if the Window is redirected whilst the client render for its backbuffer to no longer overlap with the visible Window. In this case, we attempt to copy an empty region, but it debugging is enabled this throws an assert. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91120 Signed-off-by: Chris Wilson --- src/sna/sna_dri2.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c index b2814dad..1c3716a3 100644 --- a/src/sna/sna_dri2.c +++ b/src/sna/sna_dri2.c @@ -1188,11 +1188,12 @@ __sna_dri2_copy_region(struct sna *sna, DrawablePtr draw, RegionPtr region, scratch.height = src_priv->size >> 16; src_draw = &scratch; - DBG(("%s: source size %dx%d, region size %dx%d\n", + DBG(("%s: source size %dx%d, region size %dx%d, src offset %dx%d\n", __FUNCTION__, scratch.width, scratch.height, clip.extents.x2 - clip.extents.x1, - clip.extents.y2 - clip.extents.y1)); + clip.extents.y2 - clip.extents.y1, + -sx, -sy)); source.extents.x1 = -sx; source.extents.y1 = -sy; @@ -1203,6 +1204,10 @@ __sna_dri2_copy_region(struct sna *sna, DrawablePtr draw, RegionPtr region, assert(region == NULL || region == &clip); pixman_region_intersect(&clip, &clip, &source); + if (!pixman_region_not_empty(&clip)) { + DBG(("%s: region doesn't overlap pixmap\n", __FUNCTION__)); + return NULL; + } } dst_bo = dst_priv->bo;