[PATCH 9/9] dix: Remove arch awareness from servermd.h (v2)
Adam Jackson
ajax at redhat.com
Mon Jul 21 07:06:53 PDT 2014
At this point we have no architectures where image byte order is
different from bitmap bit order, or where either of those two are not
also the native word endianness. Hooray, one more place where we don't
have to worry about enabling new CPU architectures.
v2: Rebase to master to handle the addition of ppc64le, arc, and xtensa,
and use autoconf's endianness detection instead of gcc predefines.
Signed-off-by: Adam Jackson <ajax at redhat.com>
---
configure.ac | 3 +-
include/dix-config.h.in | 3 +
include/servermd.h | 185 ++----------------------------------------------
3 files changed, 9 insertions(+), 182 deletions(-)
diff --git a/configure.ac b/configure.ac
index 4338dc5..0479fd5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -139,7 +139,8 @@ AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h dlfcn.h stropts.h \
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_TYPEOF
-AC_C_BIGENDIAN([ENDIAN="X_BIG_ENDIAN"], [ENDIAN="X_LITTLE_ENDIAN"])
+AC_C_BIGENDIAN(AC_DEFINE(X_BYTE_ORDER, X_BIG_ENDIAN, [byte order]),
+ AC_DEFINE(X_BYTE_ORDER, X_LITTLE_ENDIAN, [byte order]))
AC_CHECK_SIZEOF([unsigned long])
if test "$ac_cv_sizeof_unsigned_long" = 8; then
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index f980a3d..2203f82 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -493,4 +493,7 @@
/* Build glamor's GBM-based EGL support */
#undef GLAMOR_HAS_GBM
+/* byte order */
+#undef X_BYTE_ORDER
+
#endif /* _DIX_CONFIG_H_ */
diff --git a/include/servermd.h b/include/servermd.h
index dd1da7d..0132d67 100644
--- a/include/servermd.h
+++ b/include/servermd.h
@@ -47,195 +47,18 @@ SOFTWARE.
#ifndef SERVERMD_H
#define SERVERMD_H 1
-/*
- * Note: much of this is vestigial from mfb/cfb times. This should
- * really be simplified even further.
- */
-
-#ifdef __avr32__
-
-#define IMAGE_BYTE_ORDER MSBFirst
-#define BITMAP_BIT_ORDER MSBFirst
-
-#endif /* __avr32__ */
-
-#ifdef __arm32__
+#include "dix-config.h"
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
#define IMAGE_BYTE_ORDER LSBFirst
#define BITMAP_BIT_ORDER LSBFirst
-
-#endif /* __arm32__ */
-
-#if defined(__nds32__)
-
-#define IMAGE_BYTE_ORDER LSBFirst
-
-#endif /* __nds32__ */
-
-#if defined __hppa__
-
-#define IMAGE_BYTE_ORDER MSBFirst
-#define BITMAP_BIT_ORDER MSBFirst
-#endif /* hpux || __hppa__ */
-
-#if defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__)
-
-#if defined(__LITTLE_ENDIAN__)
-#define IMAGE_BYTE_ORDER LSBFirst
-#define BITMAP_BIT_ORDER LSBFirst
-#else
-#define IMAGE_BYTE_ORDER MSBFirst
-#define BITMAP_BIT_ORDER MSBFirst
-#endif
-
-#endif /* PowerPC */
-
-#if defined(__sh__)
-
-#if defined(__BIG_ENDIAN__)
-#define IMAGE_BYTE_ORDER MSBFirst
-#define BITMAP_BIT_ORDER MSBFirst
-#else
-#define IMAGE_BYTE_ORDER LSBFirst
-#define BITMAP_BIT_ORDER LSBFirst
-#endif
-
-#endif /* SuperH */
-
-#if defined(__m32r__)
-
-#if defined(__BIG_ENDIAN__)
-#define IMAGE_BYTE_ORDER MSBFirst
-#define BITMAP_BIT_ORDER MSBFirst
-#else
-#define IMAGE_BYTE_ORDER LSBFirst
-#define BITMAP_BIT_ORDER LSBFirst
-#endif
-
-#endif /* __m32r__ */
-
-#if defined(sun386) || defined(sun5)
-#define IMAGE_BYTE_ORDER LSBFirst /* Values for the SUN only */
-#define BITMAP_BIT_ORDER LSBFirst
-#else
-#define IMAGE_BYTE_ORDER MSBFirst /* Values for the SUN only */
-#define BITMAP_BIT_ORDER MSBFirst
-#endif
-
-#if (defined(mips) || defined(__mips))
-
-#if defined(MIPSEL) || defined(__MIPSEL__)
-#define IMAGE_BYTE_ORDER LSBFirst /* Values for the PMAX only */
-#define BITMAP_BIT_ORDER LSBFirst
-#else
-#define IMAGE_BYTE_ORDER MSBFirst /* Values for the MIPS only */
-#define BITMAP_BIT_ORDER MSBFirst
-#endif
-
-#endif /* mips */
-
-#if defined(__alpha) || defined(__alpha__)
-#define IMAGE_BYTE_ORDER LSBFirst /* Values for the Alpha only */
-#define BITMAP_BIT_ORDER LSBFirst
-#endif /* alpha */
-
-#if defined (linux) && defined (__s390__)
-
-#define IMAGE_BYTE_ORDER MSBFirst
-#define BITMAP_BIT_ORDER MSBFirst
-
-#endif /* linux/s390 */
-
-#if defined (linux) && defined (__s390x__)
-
-#define IMAGE_BYTE_ORDER MSBFirst
-#define BITMAP_BIT_ORDER MSBFirst
-
-#endif /* linux/s390x */
-
-#if defined(__ia64__) || defined(ia64)
-
-#define IMAGE_BYTE_ORDER LSBFirst
-#define BITMAP_BIT_ORDER LSBFirst
-
-#endif /* ia64 */
-
-#if defined(__amd64__) || defined(amd64) || defined(__amd64)
-#define IMAGE_BYTE_ORDER LSBFirst
-#define BITMAP_BIT_ORDER LSBFirst
-#endif /* AMD64 */
-
-#if defined(SVR4) && (defined(__i386__) || defined(__i386) ) || \
- defined(__alpha__) || defined(__alpha) || \
- defined(__i386__)
-
-#ifndef IMAGE_BYTE_ORDER
-#define IMAGE_BYTE_ORDER LSBFirst
-#endif
-
-#ifndef BITMAP_BIT_ORDER
-#define BITMAP_BIT_ORDER LSBFirst
-#endif
-
-#endif /* SVR4 / BSD / i386 */
-
-#if defined (linux) && defined (__mc68000__)
-
-#define IMAGE_BYTE_ORDER MSBFirst
-#define BITMAP_BIT_ORDER MSBFirst
-
-#endif /* linux/m68k */
-
-/* linux on ARM */
-#if defined(linux) && defined(__arm__)
-#define IMAGE_BYTE_ORDER LSBFirst
-#define BITMAP_BIT_ORDER LSBFirst
-#endif
-
-/* linux on IBM S/390 */
-#if defined (linux) && defined (__s390__)
-#define IMAGE_BYTE_ORDER MSBFirst
-#define BITMAP_BIT_ORDER MSBFirst
-#endif /* linux/s390 */
-
-#ifdef __aarch64__
-
-#ifdef __AARCH64EL__
-#define IMAGE_BYTE_ORDER LSBFirst
-#define BITMAP_BIT_ORDER LSBFirst
-#endif
-#ifdef __AARCH64EB__
+#elif X_BYTE_ORDER == X_BIG_ENDIAN
#define IMAGE_BYTE_ORDER MSBFirst
#define BITMAP_BIT_ORDER MSBFirst
-#endif
-
-#endif /* __aarch64__ */
-
-#if defined(__arc__)
-
-#if defined(__BIG_ENDIAN__)
-#define IMAGE_BYTE_ORDER MSBFirst
-#define BITMAP_BIT_ORDER MSBFirst
#else
-#define IMAGE_BYTE_ORDER LSBFirst
-#define BITMAP_BIT_ORDER LSBFirst
+#error "Too weird to live."
#endif
-#endif /* ARC */
-
-#ifdef __xtensa__
-
-#ifdef __XTENSA_EL__
-#define IMAGE_BYTE_ORDER LSBFirst
-#define BITMAP_BIT_ORDER LSBFirst
-#endif
-#ifdef __XTENSA_EB__
-#define IMAGE_BYTE_ORDER MSBFirst
-#define BITMAP_BIT_ORDER MSBFirst
-#endif
-
-#endif /* __xtensa__ */
-
#ifndef GLYPHPADBYTES
#define GLYPHPADBYTES 4
#endif
--
1.9.3
More information about the xorg-devel
mailing list