xf86-video-intel: 4 commits - src/sna/sna_accel.c
Chris Wilson
ickle at kemper.freedesktop.org
Thu May 10 03:48:40 PDT 2012
src/sna/sna_accel.c | 186 ++++++++++++++++------------------------------------
1 file changed, 60 insertions(+), 126 deletions(-)
New commits:
commit 9af651fdf93f6ccdbcb147cb16989f84c2d0ebdc
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu May 10 10:57:56 2012 +0100
sna: Include some DBG for segment drawing
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 636efdd..b8ca214 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -7188,8 +7188,8 @@ rectangle_continue:
b->y1 = y1;
dirty = false;
while (length--) {
- e += e1;
dirty = true;
+ e += e1;
if (e >= 0) {
e += e3;
@@ -7200,6 +7200,10 @@ rectangle_continue:
b->x2 = x1 + 1;
b->y2 = b->y1 + 1;
+ DBG(("%s: horizontal step: (%d, %d), box: (%d, %d), (%d, %d)\n",
+ __FUNCTION__, x1, y1,
+ b->x1, b->y1, b->x2, b->y2));
+
if (++b == last_box) {
ret = &&X_continue;
goto *jump;
@@ -7215,6 +7219,8 @@ X_continue:
}
if (dirty) {
x1 -= sdx;
+ DBG(("%s: horizontal tail: (%d, %d)\n",
+ __FUNCTION__, x1, y1));
if (sdx < 0) {
b->x2 = b->x1 + 1;
b->x1 = x1;
commit 3aa98289e3a2f59633ac5f1a5f64db4ee55609d9
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu May 10 10:31:03 2012 +0100
sna: Correct adjustment of LineCap for rectilinear segments
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 3233f8a..636efdd 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -6848,6 +6848,44 @@ sna_poly_line__cpu(DrawablePtr drawable, GCPtr gc,
fbPolyLine(drawable, gc, mode, n, pt);
}
+static inline void box_from_seg(BoxPtr b, xSegment *seg, GCPtr gc)
+{
+ if (seg->x1 == seg->x2) {
+ if (seg->y1 > seg->y2) {
+ b->y2 = seg->y1 + 1;
+ b->y1 = seg->y2 + 1;
+ if (gc->capStyle != CapNotLast)
+ b->y1--;
+ } else {
+ b->y1 = seg->y1;
+ b->y2 = seg->y2;
+ if (gc->capStyle != CapNotLast)
+ b->y2++;
+ }
+ b->x1 = seg->x1;
+ b->x2 = seg->x1 + 1;
+ } else {
+ if (seg->x1 > seg->x2) {
+ b->x2 = seg->x1 + 1;
+ b->x1 = seg->x2 + 1;
+ if (gc->capStyle != CapNotLast)
+ b->x1--;
+ } else {
+ b->x1 = seg->x1;
+ b->x2 = seg->x2;
+ if (gc->capStyle != CapNotLast)
+ b->x2++;
+ }
+ b->y1 = seg->y1;
+ b->y2 = seg->y1 + 1;
+ }
+
+ DBG(("%s: seg=(%d,%d),(%d,%d); box=(%d,%d),(%d,%d)\n",
+ __FUNCTION__,
+ seg->x1, seg->y1, seg->x2, seg->y2,
+ b->x1, b->y1, b->x2, b->y2));
+}
+
static Bool
sna_poly_segment_blt(DrawablePtr drawable,
struct kgem_bo *bo,
@@ -6880,35 +6918,7 @@ sna_poly_segment_blt(DrawablePtr drawable,
nbox = ARRAY_SIZE(boxes);
n -= nbox;
do {
- if (seg->x1 <= seg->x2) {
- b->x1 = seg->x1;
- b->x2 = seg->x2;
- } else {
- b->x1 = seg->x2;
- b->x2 = seg->x1;
- }
- b->x2++;
-
- if (seg->y1 <= seg->y2) {
- b->y1 = seg->y1;
- b->y2 = seg->y2;
- } else {
- b->y1 = seg->y2;
- b->y2 = seg->y1;
- }
- b->y2++;
-
- /* don't paint last pixel */
- if (gc->capStyle == CapNotLast) {
- if (seg->x1 == seg->x2)
- b->y2--;
- else
- b->x2--;
- }
-
- /* XXX does a degenerate segment
- * become a point?
- */
+ box_from_seg(b, seg, gc);
if (b->y2 > b->y1 && b->x2 > b->x1) {
b->x1 += dx;
b->x2 += dx;
@@ -6933,32 +6943,7 @@ sna_poly_segment_blt(DrawablePtr drawable,
nbox = ARRAY_SIZE(boxes);
n -= nbox;
do {
- if (seg->x1 <= seg->x2) {
- b->x1 = seg->x1;
- b->x2 = seg->x2;
- } else {
- b->x1 = seg->x2;
- b->x2 = seg->x1;
- }
- b->x2++;
-
- if (seg->y1 <= seg->y2) {
- b->y1 = seg->y1;
- b->y2 = seg->y2;
- } else {
- b->y1 = seg->y2;
- b->y2 = seg->y1;
- }
- b->y2++;
-
- /* don't paint last pixel */
- if (gc->capStyle == CapNotLast) {
- if (seg->x1 == seg->x2)
- b->y2--;
- else
- b->x2--;
- }
-
+ box_from_seg(b, seg, gc);
if (b->y2 > b->y1 && b->x2 > b->x1)
b++;
seg++;
@@ -6985,41 +6970,13 @@ sna_poly_segment_blt(DrawablePtr drawable,
const BoxRec * const clip_end = clip_start + clip.data->numRects;
const BoxRec *c;
do {
- int x, y, width, height;
BoxRec box;
- if (seg->x1 < seg->x2) {
- x = seg->x1;
- width = seg->x2;
- } else {
- x = seg->x2;
- width = seg->x1;
- }
- width -= x - 1;
-
- if (seg->y1 < seg->y2) {
- y = seg->y1;
- height = seg->y2;
- } else {
- y = seg->y2;
- height = seg->y1;
- }
- height -= y - 1;
-
- /* don't paint last pixel */
- if (gc->capStyle == CapNotLast) {
- if (width == 1)
- height--;
- else
- width--;
- }
-
- DBG(("%s: [%d] (%d, %d)x(%d, %d) + (%d, %d)\n", __FUNCTION__, n,
- x, y, width, height, dx+drawable->x, dy+drawable->y));
- box.x1 = x + drawable->x;
- box.x2 = box.x1 + width;
- box.y1 = y + drawable->y;
- box.y2 = box.y1 + height;
+ box_from_seg(b, seg, gc);
+ box.x1 += drawable->x;
+ box.x2 += drawable->x;
+ box.y1 += drawable->y;
+ box.y2 += drawable->y;
c = find_clip_box_for_y(clip_start,
clip_end,
box.y1);
@@ -7046,42 +7003,11 @@ sna_poly_segment_blt(DrawablePtr drawable,
} while (--n);
} else {
do {
- int x, y, width, height;
-
- if (seg->x1 < seg->x2) {
- x = seg->x1;
- width = seg->x2;
- } else {
- x = seg->x2;
- width = seg->x1;
- }
- width -= x - 1;
-
- if (seg->y1 < seg->y2) {
- y = seg->y1;
- height = seg->y2;
- } else {
- y = seg->y2;
- height = seg->y1;
- }
- height -= y - 1;
-
- /* don't paint last pixel */
- if (gc->capStyle == CapNotLast) {
- if (width == 1)
- height--;
- else
- width--;
- }
-
- DBG(("%s: [%d] (%d, %d)x(%d, %d) + (%d, %d)\n", __FUNCTION__, n,
- x, y, width, height, dx+drawable->x, dy+drawable->y));
-
- b->x1 = x + drawable->x;
- b->x2 = b->x1 + width;
- b->y1 = y + drawable->y;
- b->y2 = b->y1 + height;
-
+ box_from_seg(b, seg, gc);
+ b->x1 += drawable->x;
+ b->x2 += drawable->x;
+ b->y1 += drawable->y;
+ b->y2 += drawable->y;
if (box_intersect(b, &clip.extents)) {
b->x1 += dx;
b->x2 += dx;
commit ad69316ab1054c5e4b56c19b8eec87b9f86939e5
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu May 10 10:03:49 2012 +0100
sna: Include a small amount of timer-slack to avoid very short sleeps
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 3013e3d..3233f8a 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -12105,7 +12105,7 @@ static CARD32 sna_timeout(OsTimerPtr timer, CARD32 now, pointer arg)
int32_t delta = sna->timer_expire[i] - now;
DBG(("%s: timer[%d] expires in %d [%d]\n",
__FUNCTION__, i, delta, sna->timer_expire[i]));
- if (delta <= 0)
+ if (delta <= 3)
sna->timer_ready |= 1 << i;
else if (next == 0 || delta < next)
next = delta;
commit 29d1d409b259ba0c85947ef5eef903ea527aa118
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu May 10 09:54:53 2012 +0100
sna: Avoid doubling the final step of poly lines
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 5f4e74f..3013e3d 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -6103,6 +6103,7 @@ Y_continue:
}
if (dirty) {
+ y -= sdy;
if (sdy < 0) {
b->y2 = b->y1 + 1;
b->y1 = y;
@@ -7371,6 +7372,7 @@ Y_continue:
}
if (dirty) {
+ y1 -= sdy;
if (sdy < 0) {
b->y2 = b->y1 + 1;
b->y1 = y1;
More information about the xorg-commit
mailing list