On Tue, Feb 16, 2016 at 08:13:45PM +1100, Jonathan Gray wrote: > On Tue, Feb 16, 2016 at 10:37:47AM +0200, Oded Gabbay wrote: > > On Tue, Feb 16, 2016 at 9:23 AM, Jonathan Gray <j...@jsg.id.au> wrote: > > > On Fri, Feb 12, 2016 at 10:01:21AM +0100, Jochen Rollwagen wrote: > > >> Hi, > > >> > > >> i think i found & fixed a bug in mesa concerning tests for big-endian > > >> machines. The defines tested don't exist or are wrongly defined so the > > >> test > > >> (probably) never fires. The gcc defines on my machine concerning > > >> big-endian > > >> are > > >> > > >> jochen@mac-mini:~/sources/mesa$ gcc -dM -E - < /dev/null | grep BIG > > >> #define __BIGGEST_ALIGNMENT__ 16 > > >> #define __BIG_ENDIAN__ 1 > > >> #define __FLOAT_WORD_ORDER__ __ORDER_BIG_ENDIAN__ > > >> #define _BIG_ENDIAN 1 > > >> #define __ORDER_BIG_ENDIAN__ 4321 > > >> #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ > > >> > > >> The tested values in current mesa are quite different :-) > > >> > > >> The following patch fixes this. > > > > > > I think you have this backwards. > > > > > > On OpenBSD/sparc64 > > > $ gcc -dM -E - < /dev/null | grep BIG > > > $ > > > $ sysctl hw.byteorder > > > hw.byteorder=4321 > > > > > > endian.h defines BYTE_ORDER and it should be included to test it. > > > > > > I was under the impression the headers on linux had similiar defines. > > > > > > Look at how src/gallium/include/pipe/p_config.h does it. > > > _______________________________________________ > > > mesa-dev mailing list > > > mesa-dev@lists.freedesktop.org > > > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > > > > After looking at it last night, I also think a better solution will be > > to just include <endian.h> in compiler.h file > > > > Oded > > Right, I suspect it will end up looking something like the following > untested diff. > > It would be nice if this didn't have to be duplicated in two places > in Mesa though.
At least on OpenBSD/amd64 the only place where endian.h is not picked up indirectly when in matters seems to be shaderimage.c, otherwise BYTE_ORDER is defined and compiler.h somehow included. CPU_TO_LE32 isn't used, as for the others: src/mesa/drivers/dri/r200/radeon_queryobj.c: query->Base.Result += LE32_TO_CPU(result[i]); src/mesa/drivers/dri/r200/radeon_queryobj.c: radeon_print(RADEON_STATE, RADEON_TRACE, "result[%d] = %d\n", i, LE32_TO_CPU(result[i])); src/mesa/drivers/dri/radeon/radeon_queryobj.c: query->Base.Result += LE32_TO_CPU(result[i]); src/mesa/drivers/dri/radeon/radeon_queryobj.c: radeon_print(RADEON_STATE, RADEON_TRACE, "result[%d] = %d\n", i, LE32_TO_CPU(result[i])); src/mesa/drivers/dri/r200/r200_state_init.c:#ifdef MESA_BIG_ENDIAN src/mesa/drivers/dri/r200/r200_tcl.c:#ifdef MESA_BIG_ENDIAN src/mesa/drivers/dri/radeon/radeon_state_init.c:#ifdef MESA_BIG_ENDIAN src/mesa/drivers/dri/radeon/radeon_tcl.c:#ifdef MESA_BIG_ENDIAN src/mesa/main/shaderimage.c:#ifdef MESA_BIG_ENDIAN src/gallium/auxiliary/util/u_format_rgb9e5.h:#if defined(MESA_BIG_ENDIAN) || defined(PIPE_ARCH_BIG_ENDIAN) src/gallium/auxiliary/util/u_format_rgb9e5.h:#if defined(MESA_BIG_ENDIAN) || defined(PIPE_ARCH_BIG_ENDIAN) src/mesa/drivers/dri/r200/r200_swtcl.c:#if MESA_LITTLE_ENDIAN src/mesa/drivers/dri/r200/r200_swtcl.c:#if MESA_LITTLE_ENDIAN src/mesa/drivers/dri/radeon/radeon_swtcl.c:#if MESA_LITTLE_ENDIAN src/mesa/drivers/dri/radeon/radeon_swtcl.c:#if MESA_LITTLE_ENDIAN _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev