sna: Add some asserts to track redundant damage operations
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 11 Jun 2014 12:18:33 +0000 (13:18 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Wed, 11 Jun 2014 12:18:33 +0000 (13:18 +0100)
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
src/sna/sna_blt.c
src/sna/sna_damage.c

index 75a65f4..958d4f9 100644 (file)
@@ -3631,6 +3631,7 @@ bool sna_blt_copy_boxes(struct sna *sna, uint8_t alu,
             __FUNCTION__, src_dx, src_dy, dst_dx, dst_dy, nbox,
            src_bo->tiling, dst_bo->tiling,
            src_bo->pitch, dst_bo->pitch));
+       assert(nbox);
 
        if (wedged(sna) || !kgem_bo_can_blt(kgem, src_bo) || !kgem_bo_can_blt(kgem, dst_bo)) {
                DBG(("%s: cannot blt to src? %d or dst? %d\n",
index 8c041de..ffbd74d 100644 (file)
@@ -370,6 +370,7 @@ _sna_damage_create_elt(struct sna_damage *damage,
 
        DBG(("    %s: prev=(remain %d), count=%d\n",
             __FUNCTION__, damage->remain, count));
+       assert(count);
 
 restart:
        n = count;
@@ -421,6 +422,7 @@ _sna_damage_create_elt_from_boxes(struct sna_damage *damage,
        int i, n;
 
        DBG(("    %s: prev=(remain %d)\n", __FUNCTION__, damage->remain));
+       assert(count);
 
 restart:
        n = count;
@@ -483,6 +485,7 @@ _sna_damage_create_elt_from_rectangles(struct sna_damage *damage,
 
        DBG(("    %s: prev=(remain %d), count=%d\n",
             __FUNCTION__, damage->remain, count));
+       assert(count);
 
 restart:
        n = count;
@@ -545,6 +548,7 @@ _sna_damage_create_elt_from_points(struct sna_damage *damage,
 
        DBG(("    %s: prev=(remain %d), count=%d\n",
             __FUNCTION__, damage->remain, count));
+       assert(count);
 
 restart:
        n = count;
@@ -1532,6 +1536,9 @@ static int __sna_damage_get_boxes(struct sna_damage *damage, BoxPtr *boxes)
        if (damage->dirty)
                __sna_damage_reduce(damage);
 
+       assert(!damage->dirty);
+       assert(damage->mode == DAMAGE_ADD);
+
        *boxes = region_rects(&damage->region);
        return region_num_rects(&damage->region);
 }
@@ -1541,6 +1548,10 @@ struct sna_damage *_sna_damage_reduce(struct sna_damage *damage)
        DBG(("%s\n", __FUNCTION__));
 
        __sna_damage_reduce(damage);
+
+       assert(!damage->dirty);
+       assert(damage->mode == DAMAGE_ADD);
+
        if (!pixman_region_not_empty(&damage->region)) {
                __sna_damage_destroy(damage);
                damage = NULL;