summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-04-09 10:48:08 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-04-09 10:48:08 +0100
commit7f0bede3e7e3f92a637d1c886304b16afc0e34f2 (patch)
tree6b8d738293447f71de95ef6533852ad3df721330
parent2e4da00e3e03b873f5cad0cc5b1f6cc791852ca5 (diff)
sna/traps: Use a temporary variable for the write pointer
To avoid accumulating the write offset for wide spans, we need to reset the destination pointer between spans. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=48332 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_trapezoids.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c
index f7a21110..120e7550 100644
--- a/src/sna/sna_trapezoids.c
+++ b/src/sna/sna_trapezoids.c
@@ -1476,55 +1476,61 @@ inplace_row(struct active_list *active, uint8_t *row, int width)
} else
FAST_SAMPLES_X_TO_INT_FRAC(right->x.quo, rix, rfx);
if (lix == rix) {
- if (rfx != lfx)
+ if (rfx != lfx) {
+ assert(lix < width);
row[lix] += (rfx-lfx) * 256 / FAST_SAMPLES_X;
+ }
} else {
+ assert(lix < width);
if (lfx == 0)
row[lix] = 0xff;
else
row[lix] += 256 - lfx * 256 / FAST_SAMPLES_X;
- if (rfx)
+ assert(rix <= width);
+ if (rfx) {
+ assert(rix < width);
row[rix] += rfx * 256 / FAST_SAMPLES_X;
+ }
if (rix > ++lix) {
+ uint8_t *r = row + lix;
rix -= lix;
- row += lix;
#if 0
if (rix == 1)
*row = 0xff;
else
memset(row, 0xff, rix);
#else
- if ((uintptr_t)row & 1 && rix) {
- *row++ = 0xff;
+ if ((uintptr_t)r & 1 && rix) {
+ *r++ = 0xff;
rix--;
}
- if ((uintptr_t)row & 2 && rix >= 2) {
- *(uint16_t *)row = 0xffff;
- row += 2;
+ if ((uintptr_t)r & 2 && rix >= 2) {
+ *(uint16_t *)r = 0xffff;
+ r += 2;
rix -= 2;
}
- if ((uintptr_t)row & 4 && rix >= 4) {
- *(uint32_t *)row = 0xffffffff;
- row += 4;
+ if ((uintptr_t)r & 4 && rix >= 4) {
+ *(uint32_t *)r = 0xffffffff;
+ r += 4;
rix -= 4;
}
while (rix >= 8) {
- *(uint64_t *)row = 0xffffffffffffffff;
- row += 8;
+ *(uint64_t *)r = 0xffffffffffffffff;
+ r += 8;
rix -= 8;
}
if (rix & 4) {
- *(uint32_t *)row = 0xffffffff;
- row += 4;
+ *(uint32_t *)r = 0xffffffff;
+ r += 4;
}
if (rix & 2) {
- *(uint16_t *)row = 0xffff;
- row += 2;
+ *(uint16_t *)r = 0xffff;
+ r += 2;
}
if (rix & 1)
- *row = 0xff;
+ *r = 0xff;
#endif
}
}