xf86-video-intel: 2 commits - src/sna/sna_accel.c
Chris Wilson
ickle at kemper.freedesktop.org
Sun Jul 15 04:10:46 PDT 2012
src/sna/sna_accel.c | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
New commits:
commit ef6d94a8444927941db108811e1a26357dc3f18e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun Jul 15 11:46:53 2012 +0100
sna: Simply reverse all the boxes if dx <= 0 and dy <= 0
In this fairly common case, avoid both the double pass and use a simpler
algorithm as we can simply reverse the order of the boxes.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index ad12615..92aca23 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -3699,7 +3699,17 @@ reorder_boxes(BoxPtr box, int n, int dx, int dy)
DBG(("%s x %d dx=%d, dy=%d\n", __FUNCTION__, n, dx, dy));
- if (dy < 0) {
+ if (dy <= 0 && dx <= 0) {
+ new = malloc(sizeof(BoxRec) * n);
+ if (new == NULL)
+ return NULL;
+
+ tmp = new;
+ next = box + n;
+ do {
+ *tmp++ = *--next;
+ } while (next != box);
+ } else if (dy < 0) {
new = malloc(sizeof(BoxRec) * n);
if (new == NULL)
return NULL;
@@ -3714,16 +3724,11 @@ reorder_boxes(BoxPtr box, int n, int dx, int dy)
base = next;
}
new -= n;
- box = new;
- }
-
- if (dx < 0) {
+ } else {
new = malloc(sizeof(BoxRec) * n);
- if (!new) {
- if (dy < 0)
- free(box);
+ if (!new)
return NULL;
- }
+
base = next = box;
while (base < box + n) {
while (next < box + n && next->y1 == base->y1)
@@ -3734,10 +3739,9 @@ reorder_boxes(BoxPtr box, int n, int dx, int dy)
base = next;
}
new -= n;
- box = new;
}
- return box;
+ return new;
}
static void
commit 6601a943ff968ac39ba198351c50dc883cb4232e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun Jul 15 11:39:56 2012 +0100
sna: Keep track of the base pointer for the reordered boxes
So that we avoid freeing an invalid pointer.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index d3787c1..ad12615 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -3814,6 +3814,7 @@ fallback:
FbBits *dst_bits, *src_bits;
int stride = pixmap->devKind;
int bpp = pixmap->drawable.bitsPerPixel;
+ int i;
dst_bits = (FbBits *)
((char *)pixmap->devPrivate.ptr +
@@ -3822,12 +3823,10 @@ fallback:
((char *)pixmap->devPrivate.ptr +
dy * stride + dx * bpp / 8);
- do {
+ for (i = 0; i < n; i++)
memmove_box(src_bits, dst_bits,
- bpp, stride, box,
+ bpp, stride, box+i,
dx, dy);
- box++;
- } while (--n);
} else {
if (gc && !sna_gc_move_to_cpu(gc, dst, region))
goto out;
More information about the xorg-commit
mailing list