summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-03-10 00:47:02 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2017-03-10 00:51:16 +0000
commit999a4dd5db1b94dc6edf74a9c094ce4b9ee0524b (patch)
tree72dcd9ab212326aee60a4020730492cf6593c241
parent57daa3742ef7a46d77d8f9deafb93f3b144f96d2 (diff)
sna: Assert that PolySegment boxes are not empty
There is no point in passing an empty box to the hardware, or to damage tracking, so we assert if we find such degenerate boxes later. Add an assertion to check that the generates boxes for PolySegment are not empty. References: https://bugs.gentoo.org/show_bug.cgi?id=611926 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 99b0def4..11beb906 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -10465,8 +10465,11 @@ sna_poly_zero_segment_blt(DrawablePtr drawable,
}
b->x2++;
b->y2++;
- if (oc1 | oc2)
- box_intersect(b, extents);
+
+ if ((oc1 | oc2) && !box_intersect(b, extents))
+ continue;
+
+ assert(!box_empty(b));
if (++b == last_box) {
ret = &&rectangle_continue;
goto *jump;
@@ -10529,6 +10532,7 @@ rectangle_continue:
__FUNCTION__, x1, y1,
b->x1, b->y1, b->x2, b->y2));
+ assert(!box_empty(b));
if (++b == last_box) {
ret = &&X_continue;
goto *jump;
@@ -10553,6 +10557,7 @@ X_continue:
b->x2 = x1 + 1;
b->y2 = b->y1 + 1;
+ assert(!box_empty(b));
if (++b == last_box) {
ret = &&X2_continue;
goto *jump;
@@ -10614,6 +10619,7 @@ X2_continue:
b->y2 = y1 + 1;
b->x2 = x1 + 1;
+ assert(!box_empty(b));
if (++b == last_box) {
ret = &&Y_continue;
goto *jump;
@@ -10637,6 +10643,7 @@ Y_continue:
b->y2 = y1 + 1;
b->x2 = x1 + 1;
+ assert(!box_empty(b));
if (++b == last_box) {
ret = &&Y2_continue;
goto *jump;