On Sun, 2002-04-28 at 00:00, Leif Delgass wrote:
> On 27 Apr 2002, Michel Dänzer wrote:
> 
> > On Sat, 2002-04-27 at 18:31, Leif Delgass wrote:
> > > 
> > > When we get the MMIO path working for ppc, I think we'll still have to 
> > > make some changes for DMA.  When filling the vertex buffers and setting up 
> > > the descriptor tables, won't we have to convert to little-endian?
> > 
> > Yes, unless the chip can byte-swap this stuff, but I doubt it as not
> > even the Rage128 can, only the Radeon.
> 
> I see that Rage128 swaps all writes to the ring buffer, but why doesn't it 
> also need to swap data when filling the vertex buffers in the Mesa driver?

It would have to. The r128 driver got broken on big endian by the update
to Mesa 3.5/4.x. I hadn't gotten around to fixing it and now I sold my
old PowerBook, but the basic fix is attached.


-- 
Earthling Michel Dänzer (MrCooper)/ Debian GNU/Linux (powerpc) developer
XFree86 and DRI project member   /  CS student, Free Software enthusiast
Index: lib/GL/mesa/src/drv/r128/r128_context.h
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/mesa/src/drv/r128/r128_context.h,v
retrieving revision 1.28
diff -u -r1.28 r128_context.h
--- lib/GL/mesa/src/drv/r128/r128_context.h	9 Apr 2002 21:54:51 -0000	1.28
+++ lib/GL/mesa/src/drv/r128/r128_context.h	26 Apr 2002 16:21:30 -0000
@@ -246,6 +246,25 @@
 extern GLboolean r128UnbindContext( __DRIcontextPrivate *driContextPriv );
 
 /* ================================================================
+ *  * Byte ordering
+ *   */
+#include "X11/Xarch.h"
+
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+#define LE32_OUT( x, y )        do { x = y; } while (0)
+#define LE32_OUT_FLOAT( x, y )  do { *(GLfloat *)&(x) = y; } while (0)
+#else
+#include <byteswap.h>
+#define LE32_OUT( x, y )	do { x = bswap_32( y ); } while (0)
+#define LE32_OUT_FLOAT( x, y )						\
+do {									\
+   GLuint __tmp;							\
+   *(GLfloat *)&__tmp = y;						\
+   x = bswap_32( __tmp );						\
+} while (0)
+#endif
+
+/* ================================================================
  * Debugging:
  */
 #define DO_DEBUG		0
Index: lib/GL/mesa/src/drv/r128/r128_tris.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/mesa/src/drv/r128/r128_tris.c,v
retrieving revision 1.16
diff -u -r1.16 r128_tris.c
--- lib/GL/mesa/src/drv/r128/r128_tris.c	14 Feb 2002 01:59:56 -0000	1.16
+++ lib/GL/mesa/src/drv/r128/r128_tris.c	26 Apr 2002 16:21:30 -0000
@@ -87,8 +87,12 @@
 #else
 #define COPY_DWORDS( j, vb, vertsize, v )				\
 do {									\
+   GLuint coloroffset = (rmesa->vertex_size == 4 ? 3 : 4);		\
    for ( j = 0 ; j < vertsize ; j++ )					\
-      vb[j] = ((GLuint *)v)[j];						\
+      if (j!=coloroffset)						\
+         LE32_OUT( vb[j], ((GLuint *)v)[j] );				\
+      else								\
+         vb[j] = ((GLuint *)v)[j];					\
    vb += vertsize;							\
 } while (0)
 #endif

Reply via email to