diff options
author | Jonathan Gray <[email protected]> | 2016-04-19 12:31:20 +1000 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2016-04-21 14:41:41 +0100 |
commit | 5d09394fb119ba68e735750eaf4d8590b8a6fed6 (patch) | |
tree | 45402a02ae058ce176226694fba81e7cbebe5b91 /src/mesa/drivers | |
parent | 9bbf3737f9c96377bee65b947da3e63adaa58d58 (diff) |
i965/tiled_memcpy: don't unconditionally use __builtin_bswap32
Use the defines Mesa configure sets to indicate presence of the bswap32
builtins. This lets i965 work on OpenBSD again after the changes that
were made in 0a5d8d9af42fd77fce1492d55f958da97816961a.
Signed-off-by: Jonathan Gray <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_tiled_memcpy.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c b/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c index a549854dce6..c888e466eb7 100644 --- a/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c +++ b/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c @@ -64,6 +64,19 @@ ror(uint32_t n, uint32_t d) return (n >> d) | (n << (32 - d)); } +static inline uint32_t +bswap32(uint32_t n) +{ +#if defined(HAVE___BUILTIN_BSWAP32) + return __builtin_bswap32(n); +#else + return (n >> 24) | + ((n >> 8) & 0x0000ff00) | + ((n << 8) & 0x00ff0000) | + (n << 24); +#endif +} + /** * Copy RGBA to BGRA - swap R and B. */ @@ -76,7 +89,7 @@ rgba8_copy(void *dst, const void *src, size_t bytes) assert(bytes % 4 == 0); while (bytes >= 4) { - *d = ror(__builtin_bswap32(*s), 8); + *d = ror(bswap32(*s), 8); d += 1; s += 1; bytes -= 4; |