[Mesa-dev] [PATCH v3 2/4] r600g: set endianess of 16/32-bit buffers according to do_endian_swap

Marek Olšák maraeo at gmail.com
Fri Apr 22 19:13:37 UTC 2016


On Thu, Apr 21, 2016 at 4:39 PM, Oded Gabbay <oded.gabbay at gmail.com> wrote:
> This patch modifies r600_colorformat_endian_swap(), so for 16-bit and for
> 32-bit buffers, the endianess configuration will be determined not only
> by the color/texture format, but also by the do_endian_swap parameter.
>
> The only exception is for array formats, which are always set to not do
> swapping, because for them gallium sets an alias based on the machine's
> endianess.
>
> Signed-off-by: Oded Gabbay <oded.gabbay at gmail.com>
> ---
>  src/gallium/drivers/r600/r600_state_common.c | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
> index 2aea982..1d44ef0 100644
> --- a/src/gallium/drivers/r600/r600_state_common.c
> +++ b/src/gallium/drivers/r600/r600_state_common.c
> @@ -2691,17 +2691,25 @@ uint32_t r600_colorformat_endian_swap(uint32_t colorformat, bool do_endian_swap)
>                         return ENDIAN_NONE;
>
>                 /* 16-bit buffers. */
> +               case V_0280A0_COLOR_8_8:
> +                       /*
> +                        * No need to do endian swaps on array formats,
> +                        * as mesa<-->pipe formats conversion take into account
> +                        * the endianess
> +                        */
> +                       return ENDIAN_NONE;
> +
>                 case V_0280A0_COLOR_5_6_5:
>                 case V_0280A0_COLOR_1_5_5_5:
>                 case V_0280A0_COLOR_4_4_4_4:
>                 case V_0280A0_COLOR_16:
> -               case V_0280A0_COLOR_8_8:
> -                       return ENDIAN_8IN16;
> +                       return (do_endian_swap ? ENDIAN_8IN16 : ENDIAN_NONE);
>
>                 /* 32-bit buffers. */
>                 case V_0280A0_COLOR_8_8_8_8:
> +               case V_0280A0_COLOR_16_16:

I think 16_16 should set ENDIAN_8IN16 unless there is a bug in
src/mesa/. It's the same as 16 and 16_16_16_16, because the number of
components doesn't matter for array formats. The same applies to
FLOAT.

Marek


More information about the mesa-dev mailing list