sna/traps: Align indices for unrolled memset in row_inplace()
The compiler presumes that the uint64_t write is naturally aligned and so may emit code that crashes with an unaligned moved. To workaround this, make sure the write is so aligned. References: https://bugs.freedesktop.org/show_bug.cgi?id=47418 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
2b4e11923d
commit
e31d9dacaf
|
|
@ -1499,6 +1499,21 @@ inplace_row(struct active_list *active, uint8_t *row, int width)
|
|||
else
|
||||
memset(row+lix, 0xff, rix);
|
||||
#else
|
||||
if (lix & 1 && rix) {
|
||||
row[lix] = 0xff;
|
||||
lix++;
|
||||
rix--;
|
||||
}
|
||||
if (lix & 2 && rix >= 2) {
|
||||
*(uint16_t *)(row+lix) = 0xffff;
|
||||
lix += 2;
|
||||
rix -= 2;
|
||||
}
|
||||
if (lix & 4 && rix >= 4) {
|
||||
*(uint32_t *)(row+lix) = 0xffffffff;
|
||||
lix += 4;
|
||||
rix -= 4;
|
||||
}
|
||||
while (rix >= 8) {
|
||||
*(uint64_t *)(row+lix) = 0xffffffffffffffff;
|
||||
lix += 8;
|
||||
|
|
|
|||
Loading…
Reference in New Issue