diff --git a/configure.ac b/configure.ac index 5abfe38..ce358b8 100644 --- a/configure.ac +++ b/configure.ac @@ -147,56 +147,6 @@ CPPFLAGS="$SAVE_CPPFLAGS" # if is found, assume it's the correct version AC_CHECK_HEADERS([byteswap.h]) -# if is found, have to check which version -AC_CHECK_HEADER([sys/endian.h], [HAVE_SYS_ENDIAN_H="yes"], [HAVE_SYS_ENDIAN_H="no"]) - -if test "x$HAVE_SYS_ENDIAN_H" = "xyes" ; then - AC_MSG_CHECKING([for __swap16 variant of byteswapping macros]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([ -#include -#include - ], [ -int a = 1, b; -b = __swap16(a); - ]) -], [SYS_ENDIAN__SWAP='yes'], [SYS_ENDIAN__SWAP='no']) - AC_MSG_RESULT([$SYS_ENDIAN__SWAP]) - - AC_MSG_CHECKING([for bswap16 variant of byteswapping macros]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([ -#include -#include - ], [ -int a = 1, b; -b = bswap16(a); - ]) -], [SYS_ENDIAN_BSWAP='yes'], [SYS_ENDIAN_BSWAP='no']) - AC_MSG_RESULT([$SYS_ENDIAN_BSWAP]) - - if test "$SYS_ENDIAN_BSWAP" = "yes" ; then - USE_SYS_ENDIAN_H=yes - BSWAP=bswap - else - if test "$SYS_ENDIAN__SWAP" = "yes" ; then - USE_SYS_ENDIAN_H=yes - BSWAP=__swap - else - USE_SYS_ENDIAN_H=no - fi - fi - - if test "$USE_SYS_ENDIAN_H" = "yes" ; then - AC_DEFINE([USE_SYS_ENDIAN_H], 1, - [Define to use byteswap macros from ]) - AC_DEFINE_UNQUOTED([bswap_16], ${BSWAP}16, - [Define to 16-bit byteswap macro]) - AC_DEFINE_UNQUOTED([bswap_32], ${BSWAP}32, - [Define to 32-bit byteswap macro]) - AC_DEFINE_UNQUOTED([bswap_64], ${BSWAP}64, - [Define to 64-bit byteswap macro]) - fi -fi - AC_SUBST([moduledir]) AC_CONFIG_FILES([ diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h index 73a0e74..7370725 100644 --- a/src/amdgpu_drv.h +++ b/src/amdgpu_drv.h @@ -95,34 +95,12 @@ struct _SyncFence; #define MIN(a,b) ((a)>(b)?(b):(a)) #endif -#if HAVE_BYTESWAP_H -#include -#elif defined(USE_SYS_ENDIAN_H) -#include -#else -#define bswap_16(value) \ - ((((value) & 0xff) << 8) | ((value) >> 8)) - -#define bswap_32(value) \ - (((uint32_t)bswap_16((uint16_t)((value) & 0xffff)) << 16) | \ - (uint32_t)bswap_16((uint16_t)((value) >> 16))) - -#define bswap_64(value) \ - (((uint64_t)bswap_32((uint32_t)((value) & 0xffffffff)) \ - << 32) | \ - (uint64_t)bswap_32((uint32_t)((value) >> 32))) -#endif - #if X_BYTE_ORDER == X_BIG_ENDIAN -#define le32_to_cpu(x) bswap_32(x) -#define le16_to_cpu(x) bswap_16(x) +#include "misc.h" +/* these are defined in the Xserver SDK headers (misc.h) */ #define cpu_to_le32(x) bswap_32(x) -#define cpu_to_le16(x) bswap_16(x) #else -#define le32_to_cpu(x) (x) -#define le16_to_cpu(x) (x) #define cpu_to_le32(x) (x) -#define cpu_to_le16(x) (x) #endif /* Provide substitutes for gcc's __FUNCTION__ on other compilers */