From db086d02affe5109202dc9ee06c9e728a3ff0f3f Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 18 Oct 2013 17:30:18 +0100 Subject: sna: Do a quick pass on dirty damage before reduction Signed-off-by: Chris Wilson --- src/sna/sna_damage.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/sna/sna_damage.c b/src/sna/sna_damage.c index b921d940..5730a25d 100644 --- a/src/sna/sna_damage.c +++ b/src/sna/sna_damage.c @@ -1277,7 +1277,8 @@ fastcall struct sna_damage *_sna_damage_subtract_boxes(struct sna_damage *damage static int __sna_damage_contains_box(struct sna_damage *damage, const BoxRec *box) { - int ret; + const BoxRec *b; + int n, count, ret; if (!damage) return PIXMAN_REGION_OUT; @@ -1295,9 +1296,29 @@ static int __sna_damage_contains_box(struct sna_damage *damage, if (damage->mode == DAMAGE_ADD) { if (ret == PIXMAN_REGION_IN) return ret; + + count = damage->embedded_box.size; + if (list_is_empty(&damage->embedded_box.list)) + count -= damage->remain; + + b = damage->embedded_box.box; + for (n = 0; n < count; n++) { + if (box_contains(&b[n], box)) + return PIXMAN_REGION_IN; + } } else { if (ret == PIXMAN_REGION_OUT) return ret; + + count = damage->embedded_box.size; + if (list_is_empty(&damage->embedded_box.list)) + count -= damage->remain; + + b = damage->embedded_box.box; + for (n = 0; n < count; n++) { + if (box_contains(&b[n], box)) + return PIXMAN_REGION_OUT; + } } __sna_damage_reduce(damage); -- cgit v1.2.3