diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-06-18 23:47:21 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-06-18 23:50:03 +0100 |
commit | a9045699b9cd66d0b0d96bfc964458c96845f97f (patch) | |
tree | 8fb6590cda38ba7ca9bd664cdf4a815fdeec0499 | |
parent | 9f51311a7d95bf4bc23926b8e6bf8ee52afd180c (diff) |
sna: Reset region after transferring to cpu
If we adjust the region for the pixmap offset, be sure that we reset it
before returning it back to the caller.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_accel.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 2623e707..73808f75 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -1467,8 +1467,11 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, if (!kgem_bo_is_busy(priv->gpu_bo)) { pixmap->devPrivate.ptr = kgem_bo_map(&sna->kgem, priv->gpu_bo); - if (pixmap->devPrivate.ptr == NULL) + if (pixmap->devPrivate.ptr == NULL) { + if (dx | dy) + RegionTranslate(region, -dx, -dy); return false; + } priv->mapped = true; pixmap->devKind = priv->gpu_bo->pitch; @@ -1486,6 +1489,8 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, priv->clear = false; assert_pixmap_damage(pixmap); + if (dx | dy) + RegionTranslate(region, -dx, -dy); return true; } } @@ -1495,8 +1500,11 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, kgem_retire(&sna->kgem); if (sync_will_stall(priv->cpu_bo)) { sna_damage_subtract(&priv->cpu_damage, region); - if (!sna_pixmap_move_to_gpu(pixmap, MOVE_WRITE)) + if (!sna_pixmap_move_to_gpu(pixmap, MOVE_WRITE)) { + if (dx | dy) + RegionTranslate(region, -dx, -dy); return false; + } sna_pixmap_free_cpu(sna, priv); } @@ -1508,8 +1516,11 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, sna_pixmap_create_mappable_gpu(pixmap)) { pixmap->devPrivate.ptr = kgem_bo_map(&sna->kgem, priv->gpu_bo); - if (pixmap->devPrivate.ptr == NULL) + if (pixmap->devPrivate.ptr == NULL) { + if (dx | dy) + RegionTranslate(region, -dx, -dy); return false; + } priv->mapped = true; pixmap->devKind = priv->gpu_bo->pitch; @@ -1526,6 +1537,8 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, assert_pixmap_damage(pixmap); priv->clear = false; + if (dx | dy) + RegionTranslate(region, -dx, -dy); return true; } } @@ -1558,6 +1571,8 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, } assert_pixmap_damage(pixmap); priv->clear = false; + if (dx | dy) + RegionTranslate(region, -dx, -dy); return true; } @@ -1577,8 +1592,11 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, } if (pixmap->devPrivate.ptr == NULL && - !sna_pixmap_alloc_cpu(sna, pixmap, priv, priv->gpu_damage != NULL)) + !sna_pixmap_alloc_cpu(sna, pixmap, priv, priv->gpu_damage != NULL)) { + if (dx | dy) + RegionTranslate(region, -dx, -dy); return false; + } if (priv->gpu_bo == NULL) { assert(priv->gpu_damage == NULL); |