tech-x11 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

native Xorg on macppc



Hello,

I ran into a few compile time problems.
First one is in MesaLib's SIS support - it defines its own memory barrier macro, doesn't compiler.h provide one? Here's my kludge:

Index: sis_context.h
===================================================================
RCS file: /cvsroot/xsrc/external/mit/MesaLib/dist/src/mesa/drivers/dri/ sis/sis_context.h,v
retrieving revision 1.1.1.1
diff -u -w -r1.1.1.1 sis_context.h
--- sis_context.h       29 Jul 2008 05:10:11 -0000      1.1.1.1
+++ sis_context.h       10 Oct 2008 15:00:47 -0000
@@ -403,6 +403,8 @@

 #if defined(__i386__) || defined(__amd64__)
 #define MMIO_WMB()     __asm __volatile("" : : : "memory")
+#elif defined(__powerpc__)
+#define MMIO_WMB()     __asm __volatile("eieio; sync;")
 #else
 #error platform needs WMB
 #endif

... not that we're likely to encounter this particular family of graphics controllers in a Mac or any other PowerPC machine anyway.

The other one is the mach64 DRI module which I believe has been discussed here earlier. My patch:

Index: mach64_context.h
===================================================================
RCS file: /cvsroot/xsrc/external/mit/MesaLib/dist/src/mesa/drivers/dri/ mach64/mach64_context.h,v
retrieving revision 1.1.1.1
diff -u -w -r1.1.1.1 mach64_context.h
--- mach64_context.h    29 Jul 2008 05:09:48 -0000      1.1.1.1
+++ mach64_context.h    10 Oct 2008 15:08:01 -0000
@@ -295,6 +295,20 @@
 #define LE32_IN_FLOAT( x )     ( *(GLfloat *)(x) )
 #define LE32_OUT( x, y )       do { *(GLuint *)(x) = (y); } while (0)
 #define LE32_OUT_FLOAT( x, y ) do { *(GLfloat *)(x) = (y); } while (0)
+#elif defined(__NetBSD__)
+#define LE32_IN(x)     le32toh(*(GLuint *)(x))
+#define LE32_IN_FLOAT( x ) \ + ({ \ + GLuint __tmp = le32toh( *(GLuint *) (x) ); \ + *(GLfloat *)&__tmp; \
+})
+#define LE32_OUT( x, y ) do { *(GLuint *)(x) = htole32( y ); } while (0) +#define LE32_OUT_FLOAT( x, y ) \ +do { \ + GLuint __tmp; \ + *(GLfloat *)&__tmp = (y); \ + *(GLuint *)(x) = htole32( __tmp ); \
+} while (0)
 #else
 #include <byteswap.h>
 #define LE32_IN( x )           bswap_32( *(GLuint *)(x) )

Basically it replaces the apparently linux-specific bswap_whatever() with htole32() and le32toh() on NetBSD. This leaves one question - do we really want to byteswap floats? My gut feeling says we don't but I'm not sure.

have fun
Michael



Home | Main Index | Thread Index | Old Index