diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-07-01 15:27:38 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-07-01 18:05:17 +0100 |
commit | e648c1f39cc17d39eff077639f23687894724b7b (patch) | |
tree | b3978f2b1fa91c28b97b7af7cc2722cf62c69cf2 | |
parent | 7c6cc0c9edb8f1ebcc8be5edb78c9d858dce1965 (diff) |
sna: Assert that we do not have overlapping damage
Double check that the results of the box query match with the slow
queries.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_accel.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index a51e289f..82b9ec03 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -2358,6 +2358,8 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, DBG(("%s: try to operate inplace (CPU), read? %d, write? %d\n", __FUNCTION__, !!(flags & MOVE_READ), !!(flags & MOVE_WRITE))); assert(priv->cow == NULL || (flags & MOVE_WRITE) == 0); + assert(sna_damage_contains_box(priv->gpu_damage, ®ion->extents) == PIXMAN_REGION_IN); + assert(sna_damage_contains_box(priv->cpu_damage, ®ion->extents) == PIXMAN_REGION_OUT); assert(!priv->mapped); pixmap->devPrivate.ptr = @@ -2515,6 +2517,9 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, } else { if (sna_damage_contains_box__no_reduce(priv->cpu_damage, ®ion->extents)) { + assert(sna_damage_contains_box(priv->gpu_damage, ®ion->extents) == PIXMAN_REGION_OUT); + assert(sna_damage_contains_box(priv->cpu_damage, ®ion->extents) == PIXMAN_REGION_IN); + DBG(("%s: region already in CPU damage\n", __FUNCTION__)); goto done; @@ -2613,6 +2618,9 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, DBG(("%s: region wholly inside damage\n", __FUNCTION__)); + assert(sna_damage_contains_box(priv->gpu_damage, &r->extents) == PIXMAN_REGION_IN); + assert(sna_damage_contains_box(priv->cpu_damage, &r->extents) == PIXMAN_REGION_OUT); + if (use_cpu_bo_for_download(sna, priv, n, box)) { DBG(("%s: using CPU bo for download from GPU\n", __FUNCTION__)); ok = sna->render.copy_boxes(sna, GXcopy, @@ -2965,6 +2973,10 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, const BoxRec *box, unsigned int fl } else if (DAMAGE_IS_ALL(priv->cpu_damage) || sna_damage_contains_box__no_reduce(priv->cpu_damage, box)) { bool ok = false; + + assert(sna_damage_contains_box(priv->gpu_damage, box) == PIXMAN_REGION_OUT); + assert(sna_damage_contains_box(priv->cpu_damage, box) == PIXMAN_REGION_IN); + if (use_cpu_bo_for_upload(sna, priv, 0)) { DBG(("%s: using CPU bo for upload to GPU\n", __FUNCTION__)); ok = sna->render.copy_boxes(sna, GXcopy, @@ -3243,6 +3255,8 @@ create_gpu_bo: ®ion.extents)) { DBG(("%s: region wholly contained within GPU damage\n", __FUNCTION__)); + assert(sna_damage_contains_box(priv->gpu_damage, ®ion.extents) == PIXMAN_REGION_IN); + assert(sna_damage_contains_box(priv->cpu_damage, ®ion.extents) == PIXMAN_REGION_OUT); goto use_gpu_bo; } else { DBG(("%s: partial GPU damage with no CPU damage, continuing to use GPU\n", @@ -3410,9 +3424,11 @@ cpu_fail: } else { if (priv->cpu_damage && sna_damage_contains_box__no_reduce(priv->cpu_damage, - ®ion.extents)) + ®ion.extents)) { + assert(sna_damage_contains_box(priv->gpu_damage, ®ion.extents) == PIXMAN_REGION_OUT); + assert(sna_damage_contains_box(priv->cpu_damage, ®ion.extents) == PIXMAN_REGION_IN); *damage = NULL; - else + } else *damage = &priv->cpu_damage; } @@ -14327,6 +14343,9 @@ sna_get_image_blt(PixmapPtr pixmap, DBG(("%s: download through a temporary map\n", __FUNCTION__)); + assert(sna_damage_contains_box(priv->gpu_damage, ®ion->extents) == PIXMAN_REGION_IN); + assert(sna_damage_contains_box(priv->cpu_damage, ®ion->extents) == PIXMAN_REGION_OUT); + pitch = PixmapBytePad(region->extents.x2 - region->extents.x1, pixmap->drawable.depth); dst_bo = kgem_create_map(&sna->kgem, dst, @@ -14385,6 +14404,9 @@ sna_get_image_inplace(PixmapPtr pixmap, ®ion->extents))) return false; + assert(sna_damage_contains_box(priv->gpu_damage, ®ion->extents) == PIXMAN_REGION_IN); + assert(sna_damage_contains_box(priv->cpu_damage, ®ion->extents) == PIXMAN_REGION_OUT); + src = kgem_bo_map__cpu(&sna->kgem, priv->gpu_bo); if (src == NULL) return false; |