xf86-video-intel: src/sna/sna_accel.c src/sna/sna.h
Chris Wilson
ickle at kemper.freedesktop.org
Sun Mar 1 08:28:39 PST 2015
src/sna/sna.h | 8 ++++++--
src/sna/sna_accel.c | 29 ++++++++++-------------------
2 files changed, 16 insertions(+), 21 deletions(-)
New commits:
commit f6ba71ac194a19c80aa64f4769f76a47ebb7bd16
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun Mar 1 15:47:50 2015 +0000
sna: Unrecurse clip box search
Unwind the trivial tail recursion from the clip box bisection and add a
couple of assertions on the inlined fast-paths.
References: https://bugs.freedesktop.org/show_bug.cgi?id=89295
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna.h b/src/sna/sna.h
index 04875b8..ff1c9c1 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -1207,10 +1207,14 @@ find_clip_box_for_y(const BoxRec *begin, const BoxRec *end, int16_t y)
return end;
/* Quick test if scanline is within range of clip boxes */
- if (begin->y2 > y)
+ if (begin->y2 > y) {
+ assert(__find_clip_box_for_y(begin, end, y) == begin);
return begin;
- if (y > end[-1].y2)
+ }
+ if (y >= end[-1].y2) {
+ assert(__find_clip_box_for_y(begin, end, y) == end);
return end;
+ }
/* Otherwise bisect to find the first box crossing y */
return __find_clip_box_for_y(begin, end, y);
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 7c7c734..29bf6c4 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -7165,27 +7165,18 @@ sna_copy_area(DrawablePtr src, DrawablePtr dst, GCPtr gc,
const BoxRec *
__find_clip_box_for_y(const BoxRec *begin, const BoxRec *end, int16_t y)
{
- const BoxRec *mid;
-
- if (end == begin)
- return end;
-
- if (end - begin == 1) {
+ assert(begin != end);
+ while (end > begin + 1) {
+ const BoxRec *mid = begin + (end - begin) / 2;
+ if (mid->y2 > y)
+ end = mid;
+ else
+ begin = mid;
+ }
if (begin->y2 > y)
- return begin;
+ return begin;
else
- return end;
- }
-
- mid = begin + (end - begin) / 2;
- if (mid->y2 > y)
- /* If no box is found in [begin, mid], the function
- * will return @mid, which is then known to be the
- * correct answer.
- */
- return __find_clip_box_for_y(begin, mid, y);
- else
- return __find_clip_box_for_y(mid, end, y);
+ return end;
}
struct sna_fill_spans {
More information about the xorg-commit
mailing list