[Mesa-dev] [PATCH] i965/tiled_memcpy: don't unconditionally use __builtin_bswap32

Emil Velikov emil.l.velikov at gmail.com
Tue Apr 19 17:53:02 UTC 2016


Cc-ing Matt, the author of the commit.

On 19 April 2016 at 03:31, Jonathan Gray <jsg at jsg.id.au> wrote:
> 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 <jsg at jsg.id.au>
> ---
>  src/mesa/drivers/dri/i965/intel_tiled_memcpy.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c b/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
> index a549854..c888e46 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
> +}
> +
Personally, I think it's fine to keep this local considering that i965
is the only classic piece of mesa that depends on it.
Hopefully the Intel folks will agree with me on that one.

But for the future we might want to move it to another/better place.

Fwiw
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>

-Emil


More information about the mesa-dev mailing list