[Mesa-dev] [PATCH 04/28] r200: use preprocessor for big vs little endian checks
Dylan Baker
dylan at pnwbakers.com
Sat Nov 10 00:20:21 UTC 2018
Quoting Dylan Baker (2018-11-09 15:52:05)
> Quoting Timothy Arceri (2018-11-09 13:45:27)
> > On 10/11/18 5:39 am, Dylan Baker wrote:
> > > Instead of using a function at runtime we can just build the right code
> > > for the right platform.
> > > ---
> > > src/mesa/drivers/dri/r200/r200_blit.c | 76 ++++++++++-------------
> > > src/mesa/drivers/dri/r200/r200_texstate.c | 7 ++-
> > > 2 files changed, 38 insertions(+), 45 deletions(-)
> > >
> > > diff --git a/src/mesa/drivers/dri/r200/r200_blit.c b/src/mesa/drivers/dri/r200/r200_blit.c
> > > index d68a53e67f7..90a88bddff8 100644
> > > --- a/src/mesa/drivers/dri/r200/r200_blit.c
> > > +++ b/src/mesa/drivers/dri/r200/r200_blit.c
> > > @@ -42,41 +42,29 @@ static inline uint32_t cmdpacket0(struct radeon_screen *rscrn,
> > > unsigned r200_check_blit(mesa_format mesa_format, uint32_t dst_pitch)
> > > {
> > > /* XXX others? */
> > > - if (_mesa_little_endian()) {
> > > - switch (mesa_format) {
> > > - case MESA_FORMAT_B8G8R8A8_UNORM:
> > > - case MESA_FORMAT_B8G8R8X8_UNORM:
> > > - case MESA_FORMAT_B5G6R5_UNORM:
> > > - case MESA_FORMAT_B4G4R4A4_UNORM:
> > > - case MESA_FORMAT_B5G5R5A1_UNORM:
> > > - case MESA_FORMAT_A_UNORM8:
> > > - case MESA_FORMAT_L_UNORM8:
> > > - case MESA_FORMAT_I_UNORM8:
> > > - /* swizzled - probably can't happen with the disabled Choose8888TexFormat code */
> > > - case MESA_FORMAT_A8B8G8R8_UNORM:
> > > - case MESA_FORMAT_R8G8B8A8_UNORM:
> > > - break;
> > > - default:
> > > - return 0;
> > > - }
> > > - }
> > > - else {
> > > - switch (mesa_format) {
> > > - case MESA_FORMAT_A8R8G8B8_UNORM:
> > > - case MESA_FORMAT_X8R8G8B8_UNORM:
> > > - case MESA_FORMAT_R5G6B5_UNORM:
> > > - case MESA_FORMAT_A4R4G4B4_UNORM:
> > > - case MESA_FORMAT_A1R5G5B5_UNORM:
> > > - case MESA_FORMAT_A_UNORM8:
> > > - case MESA_FORMAT_L_UNORM8:
> > > - case MESA_FORMAT_I_UNORM8:
> > > - /* swizzled - probably can't happen with the disabled Choose8888TexFormat code */
> > > - case MESA_FORMAT_R8G8B8A8_UNORM:
> > > - case MESA_FORMAT_A8B8G8R8_UNORM:
> > > - break;
> > > - default:
> > > - return 0;
> > > - }
> > > + switch (mesa_format) {
> > > +#ifdef PIPE_ARCH_LITTLE_ENDIAN
> >
> > I know this is an existing thing but PIPE_ is a galliumisim. IMO we
> > should probably rename this before using it more generally:
> >
> > PIPE_ARCH_LITTLE_ENDIAN -> UTIL_ARCH_LITTLE_ENDIAN ???
>
> Honestly I don't know why we're using a header to figure out our endianness. GCC
> has a builtin declaration for this, and the build system should be able to fill
> it in otherwise.
>
> I think I'll just respin with that.
>
Changed my mind, that looks hard on android.mk (not hard with meson, scons, or
autotools though). I'll just rename it. Since u_endian was pulled into src/utils
by Dave in 2016 I'll just add that change as a new patch on the end.
Dylan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181109/86511ec2/attachment.sig>
More information about the mesa-dev
mailing list