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 <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2015-06-27 20:24:45 +01:00
parent 6fc7b16b93
commit 41f401ae27
1 changed files with 7 additions and 2 deletions

View File

@ -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;