summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-03-30 19:09:30 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-03-30 19:09:30 +0100
commitee075ced844350785685a0f93f88f1dc310bcc73 (patch)
tree273b271e6f67685614d48717a2fbb09154844018
parentfde8a010b3d9406c2f65ee99978360a6ca54e006 (diff)
sna/traps: Align the pointer not the indices
Magnus found that inplace_row was still crashing on his setup when it tried to perform an 8-byte aligned write to an unaligned pointer. This time it looks like the row pointer itself was not 8-byte aligned, so instead of assuming that and fixing up the indices, ensure that the (index+row) results in an 8-byte aligned value. Reported-by: Magnus Kessler <Magnus.Kessler@gmx.net> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47418 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_trapezoids.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c
index 4067757f..b6c5b653 100644
--- a/src/sna/sna_trapezoids.c
+++ b/src/sna/sna_trapezoids.c
@@ -1496,17 +1496,17 @@ inplace_row(struct active_list *active, uint8_t *row, int width)
else
memset(row+lix, 0xff, rix);
#else
- if (lix & 1 && rix) {
+ if ((uintptr_t)row & 1 && rix) {
row[lix] = 0xff;
lix++;
rix--;
}
- if (lix & 2 && rix >= 2) {
+ if ((uintptr_t)row & 2 && rix >= 2) {
*(uint16_t *)(row+lix) = 0xffff;
lix += 2;
rix -= 2;
}
- if (lix & 4 && rix >= 4) {
+ if ((uintptr_t)row & 4 && rix >= 4) {
*(uint32_t *)(row+lix) = 0xffffffff;
lix += 4;
rix -= 4;