Skip to contentSkip to conversation

Glide patches for IA-64

Linux-ia64 David Mosberger 1 participant 1 message Aug 15, 2000

lore
Share & tools
lore
#0 lore raw

As promised, here is the patch necessary to make Glide_V3 work on IA-64 Linux. I tested this with an AGP Vodoo 3 1000, though it should work with other cards, too. The patch is relative to Glide_V3-DRI-3.10-6.src.rpm available from 3dfx (sorry, I didn't bother checking out the CVS tree at sourceforge).

Caveat: the patch below may break backwards compatibility with 16-bit platforms. If anyone still cares about building on such a platform, you may want to scan the patch below for uses of "int" and use FxI32/FxU32 instead.

To develop this patch, my approach was to first build Glide using the "standlone" mode. I got a bunch of test programs to work that way (test00, test01, etc. up to about test08) and then I realized that something was seriously wrong with the buffer allocation code (beyond 64-bit problems), so I didn't bother to push it any further and switched to the DRI mode instead. In DRI mode, those buffer allocation problems do not exist and all works fine as far as I know.

In the patch, getting rid of some of the compiler warnings may seem pedantic, but I think it would have been a LOT harder to find some of the bad casts if the other warnings had been left unfixed. I'd strongly recommend to merge in those changes. A clean build with gcc -O -Wall" goes a long way towards 64-bit cleanliness.

On the DRI front: note that you'll still need a 64-bit cleanup patch (and IA-64) support for the X server before DRM/DRI works on IA-64. I plan to send that patch sometime tomorrow or on Wednesday.

Enjoy,

	--david

PS: If you're interested in seeing the IA-64 Linux Voodoo in action,
visit the HP booth at Linux World Expo in San Jose this week. ;-)

ChangeLog +326 -0
diff -urN Glide_V3-DRI-3.10/ChangeLog Glide_V3-DRI-3.10-lia/ChangeLog
@@ -0,0 +1,326 @@
+2000-08-14  David Mosberger  <[email protected]>
+
+	* swlibs/texus/lib/util.c (txYABtoPal256): Change type of yabTable
+	from "long*" to "int*".  Declare Y, A, and B to be of type "int*"
+	instead of "long*".
+	(txNearestColor): Change ir, ig, and ib arguments from "long" to
+	"int".
+
+	* swlibs/texus/lib/texusint.h (txYABtoPal256): Change yabTable
+	argument from "long*" to "int*".
+	(txNearestColor): Change ir, ig, and ib arguments from "long" to
+	"int".
+
+	* swlibs/texus/lib/texus.h [__LP64__]: Define FxI32 as "signed
+	int" and FxU32 as "unsigned int".
+
+	* swlibs/texus/lib/rgt.c (swapShorts): Change type of "length"
+	from "long" to "int".
+	(swapLongs): Ditto.
+	(swapRGB): Ditto.
+	(_txReadRGTData): Change cast of info->width to "long".
+
+	* swlibs/texus/lib/quantize.c: Put braces around each sub-array
+	initializer to keep compiler happy.
+	(_txPixQuantize_RGB332): Change type of argb from "unsigned long"
+	to "unsigned int".
+	(_txPixQuantize_RGB332_D4x4): Ditto.
+	(_txPixQuantize_RGB332_DErr): Ditto.
+	(_txPixQuantize_RGB332_A8): Ditto.
+	(_txPixQuantize_RGB332_I8): Ditto.
+	(_txPixQuantize_RGB332_AI44): Ditto.
+	(_txPixQuantize_RGB332_AI44_D4x4): Ditto.
+	(_txPixQuantize_RGB332_AI44_DErr): Ditto.
+	(_txPixQuantize_RGB332_ARGB8332): Ditto.
+	(_txPixQuantize_RGB332_ARGB8332_D4x4): Ditto.
+	(_txPixQuantize_RGB332_ARGB8332_DErr): Ditto.
+	(_txPixQuantize_RGB565): Ditto.
+	(_txPixQuantize_RGB565_D4x4): Ditto.
+	(_txPixQuantize_RGB565_DErr): Ditto.
+	(_txPixQuantize_ARGB1555): Ditto.
+	(_txPixQuantize_ARGB1555_D4x4): Ditto.
+	(_txPixQuantize_ARGB1555_DErr): Ditto.
+	(_txPixQuantize_ARGB4444): Ditto.
+	(_txPixQuantize_ARGB4444_D4x4): Ditto.
+	(_txPixQuantize_ARGB4444_DErr): Ditto.
+	(_txPixQuantize_AI88): Ditto.
+	(_txImgQuantize): Change type of quantizer callback to have a
+	first argument of type "unsigned int" instead of "unsigned long".
+	Cast "src" pointer to "unsigned int*" instead of "unsigned long*".
+	
+	* swlibs/texus/lib/pal256.c (Box): Change type of mean, weight,
+	and freq from "ulong" to "uint".
+	(Histogram): Change element type from "ulong" to "uint".
+	(SumPixels): Ditto.
+	(ColormaxI): Ditto.
+	(QuantHistogram): Change type of "pixels" from "ulong*" to
+	"uint*".
+	(txMipPal256): Change return value cast of txMalloc from "ulong*"
+	to "uint *".
+	(txMipPal256): In calls to bzero(), multiply by sizeof(uint)
+	instead of sizeof(ulong).
+	(txMipPal256): In call to QuantHistogram, change cast from
+	"ulong*" to "uint*".
+	(txMipPal256): Declare r, g, and b as "uint" instead of "ulong"
+	and truncate results of expressions for these variables to this
+	type as well.  Change type of src from "ulong*" to "uint*".
+	(QuantHistogram): Change type of rf, gf, and bf from "ulong*" to
+	"uint *".
+	(FindCutpoint): Change type of optweight and curweight from
+	"ulong" to "uint".
+	(UpdateFrequencies): Change type of myfreq and 8 to "uint" and
+	"uint*", respectively.  In calls to bzero(), multiply by
+	sizeof(uint) instead of sizeof(ulong).
+
+	* swlibs/texus/lib/nccnnet.c (struct _weight): Change member types
+	from "long" to "int".
+	(struct _vector): Ditto.
+	(errR): Change type from "long" to "int".
+	(errG): Ditto.
+	(errB): Ditto.
+	(errMax): Ditto.
+	(totR): Ditto.
+	(totG): Ditto.
+	(totB): Ditto.
+	(_nn_modifyNeurons): Change type of arguments from "long" to
+	"int".  Change type of "d", "dr", "dg", and "db" from "long" to
+	"int".
+	(txMapPal256toYAB): Change type of "bstR", "bstG", "bstB",
+	"bstMax" na "dyab2pal[]" from "long" to "int". Remove superfluous
+	cast in call to txYABtoPal256().
+	(txMipNccNNet): Change type of "yabTable[]" from "long" to "int".
+	Remove superfluous cast in call to txYABtoPal256().
+
+	* swlibs/texus/lib/ncc.c: Put braces around each sub-array
+	initializer to keep compiler happy.
+	(_txImgNcc): Change type of idata from "unsigned long*" to
+	"unsigned int *".
+	(txMipNcc): Remove superfluous cast to "long*".
+
+	* swlibs/texus/lib/mipmap.c (_txImgHalve): Change type of "indata"
+	from "long*" to "int*".
+
+	* swlibs/texus/lib/dequant.c (_txImgDequantizeYIQ422): Change type
+	of yabTable from "long*" to FxU32*.  Remove superfluous type casts
+	when passing argument to txYABtoPal256.
+	(_txImgDequantizeAYIQ8422): Change type of yab from "long*" to
+	FxU32*.  Declare "pal[]" as array of type FxU32 instead of "long".
+	Remove superfluous type cast when passing pallete to
+	_txImgDequantizeYIQ422() and _txImgDequantizeAYIQ8422().
+
+	* swlibs/newpci/pcilib/pcilib.h (FxPlatformIOProces): Change type
+	of addrUnmap's linearAddr argument from FxU32 to "long*".  Change
+	type of addrSetPermission's addrBase argument from FxU32 to
+	"long*".
+
+	* swlibs/newpci/pcilib/fxpci.h (pciMapPhysicalToLinear): Change
+	type of linear_addr from FxU32* to "long*".
+	(pciMapPhysicalDeviceToLinear): Ditto.
+	(pciUnmapPhysical): Change type of linear_addr from FxU32 to
+	"long".
+	(pciLinearRangeSetPermission): Change type of addrBase from FxU32
+	to "long".
+	
+	* swlibs/newpci/pcilib/fxpci.c (pciMapCardMulti): Change type of
+	virtAddress from FxU32 to "long".
+	(pciMapCardMulti): Cast "length" to "long" before casting it
+	to a pointer to avoid compiler warning.
+	(pciMapPhysicalToLinear): Change type of linear_addr from FxU32*
+	to "long*".
+	(pciMapPhysicalDeviceToLinear): Ditto.
+	(pciUnmapPhysical): Change type of linear_addr from FxU32 to "long".
+	(pciLinearRangeSetPermission): change type of addrBase from FxU32
+	to "long".
+
+	* swlibs/newpci/pcilib/fxlinux.c (pciMapLinearLinux): Change
+	linear_addr argument from FxU32* to "long*" type.
+	(pciUnmapLinearLinux): Change linear_addr type from FxU32 to
+	"long".
+	(pciSetPermissionLinux): Ditto.
+	(pciMapLinearLinux): Cast return value of mmap() to "long" instead
+	of FxU32 to avoid truncating top 32 bits.
+
+	* swlibs/include/make/3dfx.mak (CNODEBUG): Don't use x86 specific
+	compiler option "-m486" and reduce optimization level to -O3.
+
+	* swlibs/fxmisc/linutil.c: Explicitly give "init_done" a type of "int"
+	to avoid compiler warning.
+
+	* swlibs/fxmisc/fxos.c (fxFopenPath): Explicitly compare result
+	of assignment against NULL to avoid compiler warning.
+
+	* swlibs/fxmisc/fximg.c (_imgGuessType): Don't use non-portable
+	multi-byte character constants.
+	(_imgWriteP6Header): Remove extraneous argument in fprintf() call.
+	(imgReadFile): Explicitly compare result of assignment against
+	NULL to avoid compiler warning.
+
+	* swlibs/fxmisc/3dfx.h [__LP64__]: Define FxI32 as "signed int"
+	and FxU32 as "unsigned int".
+
+	* set-for-standalone: New script to set source for standalone
+	compilation.
+	* set-for-dri: New script to set up source for compilation with
+	DRI.
+
+	* h3/minihwc/minihwc.h: Change type of linearAddress[] from FxU32
+	to "long".  Change type of ioMemBase, cmdAGPBase, waxBase, sstBase,
+	lfbBase, and rawLfbBase from FxU32 to "long".
+
+	* h3/minihwc/minihwc.c (hwcMapBoard): Do not cast return value of
+	pciMapCardMulti() to FxU32 to avoid truncating top 32 bits.
+
+	* h3/minihwc/linhwc.c.save (P6FENCE) [__ia64__]: Make P6FENCE
+	expand into "mf.a" instruction.
+	(loadEnvFile): Rename local "first" to "is_first" to avoid
+	collision with global "first" list head pointer.
+	(hwcInitRegisters): Cast pointers to "long" instead of FxU32.
+
+	* h3/minihwc/linhwc.c.dri (P6FENCE) [__ia64__]: Make P6FENCE
+	expand into "mf.a" instruction.
+	(loadEnvFile): Rename local "first" to "is_first" to avoid
+	collision with global "first" list head pointer.
+	(hwcMapBoard): Cast pointers to "long" instead of FxU32.
+	(_grImportFifo): Declare as external function.
+	(_grInvalidateAll): Ditto.
+	(_grExportFifo): Ditto.
+	(grDRIResetSAREA): Cast fifoPtr to (int *).
+
+	* h3/minihwc/hwcext.h (struct hwcExtLinearADdrRes_s): Change type
+	of baseAddresses[] from FxU32 to "long".
+
+	* h3/incsrc/h3regs.h (struct vertex_Rec): Declare members as
+	FxU32/FxI32 instead of "unsigned long"/"long" to guarantee 32-bit
+	width.
+	(struct sstregs): Ditto.
+
+	* h3/incsrc/h3info.h (FxU32) [__LP64__]: Define FxU32 as "unsigned
+	int".
+	* h3/incsrc/h3regs.h: Ditto.
+
+	* h3/incsrc/h3defs.h (FLOAT_ISNEG): Define more suitable version
+	for IA-64.
+	(ISIGN): Ditto.
+	(FSIGN): Ditto.
+	(SST_WRAP): Cast "sst" pointer to "long" instead of FxI32 before
+	doing arithmetic on it.
+	(SST_CHIP): Ditto.
+	(SST_TMU): Ditto.
+	(SST_BASE_ADDRESS): Ditto.
+	
+	* h3/incsrc/gdebug.h (GDBG_INFO) [__GNUC__]: Use GNU CPP varag
+	macros to avoid flood of compiler warnings due to useless
+	expressions.
+	(GDBG_INFO_MORE): Ditto.
+	(GDBG_PRINF): Ditto.
+	(GDBG_ERROR_SET_CALLBACK): Ditto.
+	(GDBG_ERROR_CLEAR_CALLBACK): Ditto.
+
+	* h3/glide3/src/makefile.linux (FX_GLIDE_CTRISETUP): Define as 1
+	to use C source code instead of assembly code (should be done only
+	on platforms that don't have assembly versions of the triangle
+	setup code).
+
+	* h3/glide3/src/gthread.c (setThreadValue): Change argument type
+	from FxU32 to "long".
+	(getThreadValueSlow): Change return value from FxU32 to "long".
+
+	* h3/glide3/src/gtexdl.c (_grTexDownloadPalette): Put parens around
+	logical AND to avoid compiler warning.
+
+	* h3/glide3/src/gsst.c.save (initGC): Cast pointers to "long"
+	before doing arithmetic on them.  Cast pointer to "long" before
+	using it as a thread value.
+	(grSstWinOpen): Cast pointers to "long" instead of FxU32 before
+	doing arithmetic on them.  Explicitly compare return value of
+	assignment against != 0 to avoid compiler warning.
+	(grSstWinClose): Cast pointer to "long" before using it as a
+	thread value.
+
+	* h3/glide3/src/gpci.c (_triSetupProcs): Explicitly cast
+	_trisetup_null to GrTriSetupProc to avoid compiler warning.
+	(DllMain): Cast pointer to "long" before using it as a thread value.
+
+	* h3/glide3/src/glide.h (GrContext_t): Change type from FxU32 to
+	"unsigned long".
+
+	* h3/glide3/src/glfb.c.dri (grLfbWriteRegion): Cast pointer to
+	(long) instead of (int) before doing arithmetic on it.
+	(grLfbReadRegion): Ditto.
+
+	* h3/glide3/src/gglide.c.save b(grGlideShutdown): Fix typo: replace
+	"readPtr0 != readPtr1" with "depth0 != depth1".  Cast "gc" to
+	"long" instead of FxU32.
+
+	* h3/glide3/src/gglide.c.dri (grDRIBufferSwap): Write 0xCC as
+	0xCCu to avoid compiler warning regarding implicit conversion of
+	constant from signed to unsigned int.
+	(grGlideShutdown): Fix typo: replace "readPtr0 != readPtr1" with
+	"depth0 != depth1".  Cast "gc" to "long" instead of FxU32.
+
+	* h3/glide3/src/gerror.c (_grAssert): Cast pointers to (long"
+	instead of (FxU32) before doing arithmetic on them.  *
+	h3/glide3/src/gglide.c.dri: Ditto.
+
+	* h3/glide3/src/gdraw.c (GR_ENTRY): Don't assume that function
+	parameters are being passed on the stack.  Instead, explicitly use
+	and initialize the new "vertices[]"" array with the "a" and "b"
+	pointers.
+	(DA_END): Cast pointers to "long" instead of FxU32 before doing
+	arithmetic on them.
+	(_grDrawPoints): If mode is not zero, initialize "stride" to the
+	number of floats that corresponds to the size of a pointer (1 on a
+	32-bit platform, 2 on a 64-bit platform).  This code works
+	properly as long as sizeof(void*)=N*sizeof(float) for some
+	integer constant N.
+	(_grDrawLineStrip): Ditto.
+	(_grDrawTriangles_Default): Ditto.
+	(_grDrawLineStrip): Cast &ADY and &DX to "int *" instead of "long *".
+
+	* h3/glide3/src/gaa.c (aaVpDrawArrayEdgeSense): Cast pointers to
+	"long" instead of "int" before doing arithmetic on them.
+	(_grAADrawPoints): Ditto.
+	(_grAADrawLineStrip): Ditto.
+	(aaDrawArrayEdgeSense): Ditto.
+
+	* h3/glide3/src/g3df.c: Include <ctype.h> to avoid warning due to
+	implicit declaration of "toupper".
+
+	* h3/glide3/src/fxglide.h (GR_TEX_FLUSH_WRITE): Cast pointers to
+	"long" instead of FxU32 before doing arithmetic on them.
+	(GrGC_s): Change type of "fifoRead", "lfbBuffers[]", and
+	"lockPtrs[]" from FxU32 to "long".
+	(P6FENCE) [__ia64__]: Make P6FENCE expand into "mf.a"
+	instruction.
+	(threadValueLinux): Change type from FxU32 to "long".
+	(setThreadValue): Change thread value type from FxU32 to "long".
+	(getThreadValueSLOW): Ditto.
+	(GR_ASSERT) [!GLIDE_SANITY_ASSERT && __GNUC__]: Define GR_ASSERT()
+	as no-op.
+	(FARRAY): Cast pointer to "long" before doing arithmetic on it.
+
+	* h3/glide3/src/fxcmd.h (REG_GROUP_END): Cast poitners to "long"
+	instead of FxU32 before doing arithmetic on them.
+	(TRI_END): Ditto.
+	(FIFO_LINEAR_WRITE_BEGIN): Ditto.
+	(FIFO_LINEAR_WRITE_END): Ditto.
+	(AA_TRI_VP_SETFS): Ditto.
+	(REG_GROUP_SETF_CLAMP): Remove trailing whitespace.
+
+	* h3/glide3/src/fifo.c (_grHwFifoPtr): Change return type from
+	FxU32 to "long".
+	* h3/glide3/src/distrip.c (GR_DIENTRY): Cast pointers to "long"
+	instead of FxU32 before doing arithmetic on them.  *
+	h3/glide3/src/fifo.c (GEN_INDEX): Ditto.
+	(_grCommandTransportMakeRoom): Comment out unused variable
+	"wrapAddr".
+
+	* h3/glide3/src/disst.c (GR_DIENTRY): Cast thread value to (long)
+	not FxU32.
+
+	* h3/glide3/src/diget.c (GR_DIENTRY): For GR_SURFACE_TEXTURE,
+	verify plength has the size of a "long" and return tBuffer address
+	as a "long".
+
+	* h3/glide3/src/cpudtect.S: Add (minimal) IA-64 suppot.
+
h3/glide3/src/cpudtect.S +15 -0
diff -urN Glide_V3-DRI-3.10/h3/glide3/src/cpudtect.S Glide_V3-DRI-3.10-lia/h3/glide3/src/cpudtect.S
@@ -49,6 +49,19 @@
 /*  Neutered mutiplatform multiheaded monster. */
 
 
+#ifdef __ia64__
+
+	.align 32
+	.global _cpu_detect_asm
+	.proc _cpu_detect_asm
+
+_cpu_detect_asm:
+	mov ret0=0
+	br.ret.sptk.few b0
+
+	.end _cpu_detect_asm
+
+#else /* !__ia64__ */
 
 .file "cpudtect.asm"
 
@@ -324,3 +337,5 @@
 .size double_precision_asm,.L_END_double_precision_asm-double_precision_asm
 
 .end
+
+#endif /* !__ia64__ */
h3/glide3/src/diget.c +2 -2
diff -urN Glide_V3-DRI-3.10/h3/glide3/src/diget.c Glide_V3-DRI-3.10-lia/h3/glide3/src/diget.c
@@ -615,10 +615,10 @@
     break;
 
   case GR_SURFACE_TEXTURE:
-    if (plength = 4) {
+    if (plength = sizeof(long)) {
       GR_DCL_GC;
 
-      *params = (FxU32) &gc->tBuffer;
+      *(long *)params = (long) &gc->tBuffer;
       retVal = plength;
     }
     break;
h3/glide3/src/disst.c +1 -1
diff -urN Glide_V3-DRI-3.10/h3/glide3/src/disst.c Glide_V3-DRI-3.10-lia/h3/glide3/src/disst.c
@@ -183,7 +183,7 @@
     GrErrorCallback( "grSstSelect:  non-existent SST", FXTRUE );
 
   _GlideRoot.current_sst = which;
-  setThreadValue( (FxU32)&_GlideRoot.GCs[_GlideRoot.current_sst] );
+  setThreadValue( (long)&_GlideRoot.GCs[_GlideRoot.current_sst] );
 
 #ifdef GLIDE_MULTIPLATFORM
   _GlideRoot.curGCFuncs = _GlideRoot.curGC->gcFuncs;
h3/glide3/src/distrip.c +3 -3
diff -urN Glide_V3-DRI-3.10/h3/glide3/src/distrip.c Glide_V3-DRI-3.10-lia/h3/glide3/src/distrip.c
@@ -544,10 +544,10 @@
     else {
       void *b_ptr, *c_ptr;
       while ((int)Count >= 3) {
-        b_ptr = (void *)((FxU32)pointers + stride);
-        c_ptr = (void *)((FxU32)pointers + stride*2);
+        b_ptr = (void *)((long)pointers + stride);
+        c_ptr = (void *)((long)pointers + stride*2);
         TRISETUP(pointers, b_ptr, c_ptr);
-        pointers = (void *)((FxU32)c_ptr + stride);
+        pointers = (void *)((long)c_ptr + stride);
         Count -= 3;
       }
     }
h3/glide3/src/fifo.c +11 -7
diff -urN Glide_V3-DRI-3.10/h3/glide3/src/fifo.c Glide_V3-DRI-3.10-lia/h3/glide3/src/fifo.c
@@ -475,7 +475,7 @@
 } ;
 
 
-#define GEN_INDEX(a) ((((FxU32) a) - ((FxU32) gc->reg_ptr)) >> 2)
+#define GEN_INDEX(a) ((((long) a) - ((long) gc->reg_ptr)) >> 2)
 
 void
 _grFifoWriteDebug(FxU32 addr, FxU32 val, FxU32 fifoPtr)
@@ -833,7 +833,9 @@
     gc->contextP = 1; 
 #endif
     if (gc->contextP) {
+#if 0
       FxU32 wrapAddr = 0x00UL;
+#endif
       FxU32 checks;
 
       GR_ASSERT(blockSize > 0);
@@ -973,7 +975,9 @@
           
         P6FENCE;
     
+#if 0
         wrapAddr = (FxU32)gc->cmdTransportInfo.fifoPtr;
+#endif
           
         /* Update roomXXX fields for the actual wrap */
         gc->cmdTransportInfo.roomToReadPtr -= gc->cmdTransportInfo.roomToEnd;
@@ -1047,10 +1051,10 @@
 }
 
 
-FxU32
+long
 _grHwFifoPtr(FxBool ignored)
 {
-  FxU32 rVal = 0;
+  long rVal = 0;
 
   FxU32 status, readPtrL1, readPtrL2;
   GR_DCL_GC;
@@ -1069,7 +1073,7 @@
 #endif      
       readPtrL2 = GET(gc->cRegs->cmdFifo0.readPtrL);
     } while (readPtrL1 != readPtrL2);
-    rVal = (((FxU32)gc->cmdTransportInfo.fifoStart) + 
+    rVal = (((long)gc->cmdTransportInfo.fifoStart) + 
             readPtrL2 - 
             (FxU32)gc->cmdTransportInfo.fifoOffset);
   }
@@ -1191,13 +1195,13 @@
   gcFifo=&gc->cmdTransportInfo;
   readPos=readPos-gcFifo->fifoOffset;
   gcFifo->fifoPtr = gcFifo->fifoStart + (readPos>>2);
-  gcFifo->fifoRead = (FxU32)gcFifo->fifoPtr;
+  gcFifo->fifoRead = (long)gcFifo->fifoPtr;
 #else
   gcFifo=&gc->cmdTransportInfo;
   gcFifo->fifoPtr = gc->rawLfb+(fifoPtr>>2);
   gcFifo->fifoRead = ((int)gc->rawLfb)+fifoRead;
 #endif
-  gcFifo->roomToReadPtr = gcFifo->fifoRead-((int)gcFifo->fifoPtr)-FIFO_END_ADJUST-sizeof(FxU32);
+  gcFifo->roomToReadPtr = gcFifo->fifoRead-((long)gcFifo->fifoPtr)-FIFO_END_ADJUST-sizeof(FxU32);
   if (gcFifo->roomToReadPtr<0) gcFifo->roomToReadPtr+=gcFifo->fifoSize;
   gcFifo->roomToEnd = gcFifo->fifoSize - 
     ((gcFifo->fifoPtr-gcFifo->fifoStart)<<2) -
@@ -1215,7 +1219,7 @@
   GR_DCL_GC;
   gcFifo=&gc->cmdTransportInfo;
   *fifoPtr=(gcFifo->fifoPtr-gc->rawLfb)<<2;
-  *fifoRead=(gcFifo->fifoRead-(int)gc->rawLfb);
+  *fifoRead=(gcFifo->fifoRead-(long)gc->rawLfb);
 }
 
 #endif
h3/glide3/src/fxcmd.h +11 -11
diff -urN Glide_V3-DRI-3.10/h3/glide3/src/fxcmd.h Glide_V3-DRI-3.10-lia/h3/glide3/src/fxcmd.h
@@ -182,7 +182,7 @@
 /* NB: This should be used sparingly because it does a 'real' hw read
  * which is *SLOW*.
  */
-FxU32 _grHwFifoPtr(FxBool);
+long _grHwFifoPtr(FxBool);
 #define HW_FIFO_PTR(a) _grHwFifoPtr(a)
 
 #if FIFO_ASSERT_FULL
@@ -716,8 +716,8 @@
 
 #define REG_GROUP_END() \
   ASSERT(_checkP); \
-  ASSERT((((FxU32)_regGroupFifoPtr - (FxU32)gc->cmdTransportInfo.fifoPtr) >> 2) = _groupNum + 1); \
-  gc->cmdTransportInfo.fifoRoom -= ((FxU32)_regGroupFifoPtr - (FxU32)gc->cmdTransportInfo.fifoPtr); \
+  ASSERT((((long)_regGroupFifoPtr - (long)gc->cmdTransportInfo.fifoPtr) >> 2) = _groupNum + 1); \
+  gc->cmdTransportInfo.fifoRoom -= ((long)_regGroupFifoPtr - (long)gc->cmdTransportInfo.fifoPtr); \
   gc->cmdTransportInfo.fifoPtr = (FxU32*)_regGroupFifoPtr; \
   GDBG_INFO(gc->myLevel + 200, "\tGroupEnd: (0x%X : 0x%X)\n", \
             gc->cmdTransportInfo.fifoPtr, gc->cmdTransportInfo.fifoRoom); \
@@ -1028,7 +1028,7 @@
 
 #define TRI_END \
   TRI_ASSERT(); \
-  gc->cmdTransportInfo.fifoRoom -= ((FxU32)tPackPtr - (FxU32)gc->cmdTransportInfo.fifoPtr); \
+  gc->cmdTransportInfo.fifoRoom -= ((long)tPackPtr - (long)gc->cmdTransportInfo.fifoPtr); \
   gc->cmdTransportInfo.fifoPtr = tPackPtr; \
   GDBG_INFO(gc->myLevel + 200, "\tTriEnd: (0x%X : 0x%X)\n", tPackPtr, gc->cmdTransportInfo.fifoRoom); \
   FIFO_ASSERT(); \
@@ -1047,12 +1047,12 @@
   GR_CHECK_COMPATABILITY(FN_NAME, \
                          !gc->open, \
                          "Called before grSstWinOpen()"); \
-  GR_ASSERT(((FxU32)(packetPtr) & FIFO_ALIGN_MASK) = 0);        /* alignment */ \
+  GR_ASSERT(((long)(packetPtr) & FIFO_ALIGN_MASK) = 0);        /* alignment */ \
   GR_ASSERT((__numWords) > 0);                                   /* packet size */ \
   GR_ASSERT((__numWords) < ((0x01 << 19) - 2)); \
   GR_ASSERT((((FxU32)(__numWords) + 2) << 2) <= (FxU32)gc->cmdTransportInfo.fifoRoom); \
-  GR_ASSERT(((FxU32)packetPtr + (((__numWords) + 2) << 2)) < \
-            (FxU32)gc->cmdTransportInfo.fifoEnd); \
+  GR_ASSERT(((unsigned long)packetPtr + (((__numWords) + 2) << 2)) < \
+            (unsigned long)gc->cmdTransportInfo.fifoEnd); \
   GR_ASSERT((hdr2 & 0xE0000000UL) = 0x00UL); \
   GR_ASSERT(((__addr) & 0x03UL) = 0x00UL); \
   FIFO_ASSERT(); \
@@ -1097,8 +1097,8 @@
 
 #define FIFO_LINEAR_WRITE_END \
   DEBUGFIFODUMP_LINEAR(gc->cmdTransportInfo.fifoPtr); \
-  GR_ASSERT((((FxU32)packetPtr - (FxU32)gc->cmdTransportInfo.fifoPtr) >> 2) = __writeSize + 2); \
-  gc->cmdTransportInfo.fifoRoom -= ((FxU32)packetPtr - (FxU32)gc->cmdTransportInfo.fifoPtr); \
+  GR_ASSERT((((long)packetPtr - (long)gc->cmdTransportInfo.fifoPtr) >> 2) = __writeSize + 2); \
+  gc->cmdTransportInfo.fifoRoom -= ((long)packetPtr - (long)gc->cmdTransportInfo.fifoPtr); \
   gc->cmdTransportInfo.fifoPtr = packetPtr; \
   GDBG_INFO(gc->myLevel + 200, "\tLinearEnd: (0x%X : 0x%X)\n", \
             packetPtr, gc->cmdTransportInfo.fifoRoom); \
@@ -1312,7 +1312,7 @@
 #define REG_GROUP_SETF_CLAMP(__regBase, __regAddr, __val) \
 do { \
   const FxU32 fpClampVal = FP_FLOAT_CLAMP(__val); \
-  REG_GROUP_ASSERT(__regAddr, fpClampVal, FXTRUE); \  
+  REG_GROUP_ASSERT(__regAddr, fpClampVal, FXTRUE); \
   SET(((FxU32*)(__regBase))[offsetof(SstRegs, __regAddr) >> 2], fpClampVal); \
   GR_INC_SIZE(sizeof(FxU32)); \
 } while(0)
@@ -1512,7 +1512,7 @@
     } \
     else { \
       FxU32 argb; \
-      argb = *((FxU32 *)((int)_s + i)) & 0x00ffffff; \
+      argb = *((FxU32 *)((long)_s + i)) & 0x00ffffff; \
       TRI_SETF(*((float *)&argb)); \
       dataElem++; \
       i = gc->tsuDataList[dataElem]; \
h3/glide3/src/fxglide.h +16 -9
diff -urN Glide_V3-DRI-3.10/h3/glide3/src/fxglide.h Glide_V3-DRI-3.10-lia/h3/glide3/src/fxglide.h
@@ -1039,7 +1039,7 @@
           SET(*curFifoPtr++, *curPktData++); \
         } \
         GR_INC_SIZE((__writeCount) * sizeof(FxU32)); \
-        gc->cmdTransportInfo.fifoRoom -= ((FxU32)curFifoPtr - (FxU32)gc->cmdTransportInfo.fifoPtr); \
+        gc->cmdTransportInfo.fifoRoom -= ((long)curFifoPtr - (long)gc->cmdTransportInfo.fifoPtr); \
         gc->cmdTransportInfo.fifoPtr = curFifoPtr; \
       } \
       GR_CHECK_SIZE(); \
@@ -1158,7 +1158,7 @@
                           */
     
     FxU32* fifoPtr;      /* Current write pointer into fifo */
-    FxU32  fifoRead;     /* Last known hw read ptr. 
+    long   fifoRead;     /* Last known hw read ptr. 
                           * If on an sli enabled system this will be
                           * the 'closest' hw read ptr of the sli
                           * master and slave.
@@ -1244,11 +1244,12 @@
     curBuffer,
     frontBuffer,
     backBuffer,
-    buffers[4],
+    buffers[4];
+  long
     lfbBuffers[4];              /* Tile relative addresses of the color/aux
                                  * buffers for lfbReads.
                                  */  
-  FxU32 lockPtrs[2];        /* pointers to locked buffers */
+  long lockPtrs[2];        /* pointers to locked buffers */
   FxU32 fbStride;
 
   struct {
@@ -1475,6 +1476,8 @@
 #  define P6FENCE __eieio()
 #elif defined(__GNUC__) && defined(__i386__)
 #define P6FENCE asm("xchg %%eax, %0" : : "m" (_GlideRoot.p6Fencer) : "eax");
+#elif defined(__GNUC__) && defined(__ia64__)
+# define P6FENCE asm volatile ("mf.a" ::: "memory");
 #else  /* !defined ( P6FENCE ) */
 #  error "P6 Fencing code needs to be added for this compiler"
 #endif /* !defined ( P6FENCE ) */
@@ -1798,7 +1801,7 @@
 #endif
 
 #ifdef __linux__
-extern FxU32 threadValueLinux;
+extern long threadValueLinux;
 #define getThreadValueFast() threadValueLinux
 #endif
 
@@ -1813,9 +1816,9 @@
 initThreadStorage( void );
 
 void 
-setThreadValue( FxU32 value );
+setThreadValue( long value );
 
-FxU32
+long
 getThreadValueSLOW( void );
 
 void 
@@ -2093,7 +2096,11 @@
 #if defined(GLIDE_SANITY_ASSERT)
 #define GR_ASSERT(exp) ((void)((!(exp)) ? (_grAssert(#exp,  __FILE__, __LINE__),0) : 0xFFFFFFFF))
 #else
-#define GR_ASSERT(exp) ((void)(0 && ((FxU32)(exp))))
+# ifdef __GNUC__
+#  define GR_ASSERT(exp)	((void) 0)
+# else
+#  define GR_ASSERT(exp) ((void)(0 && ((FxU32)(exp))))
+# endif
 #endif
 
 #define INTERNAL_CHECK(__name, __cond, __msg, __fatalP) \
@@ -2163,7 +2170,7 @@
 #define HW_TEX_PTR(__b)        ((FxU32*)(((FxU32)(__b)) + HW_TEXTURE_OFFSET))   
 
 /* access a floating point array with a byte index */
-#define FARRAY(p,i)    (*(float *)((i)+(int)(p)))
+#define FARRAY(p,i)    (*(float *)((i)+(long)(p)))
 #define ArraySize(__a) (sizeof(__a) / sizeof((__a)[0]))
 
 #if GDBG_INFO_ON
h3/glide3/src/g3df.c +1 -0
diff -urN Glide_V3-DRI-3.10/h3/glide3/src/g3df.c Glide_V3-DRI-3.10-lia/h3/glide3/src/g3df.c
@@ -70,6 +70,7 @@
  * Added GR_DIENTRY for di glide functions
 **
 */
+#include <ctype.h>
 #include <stdio.h>
 #include <string.h>
 #include <3dfx.h>
h3/glide3/src/gaa.c +7 -7
diff -urN Glide_V3-DRI-3.10/h3/glide3/src/gaa.c Glide_V3-DRI-3.10-lia/h3/glide3/src/gaa.c
@@ -378,8 +378,8 @@
   }
   else {
     ia = gc->state.vData.pargbInfo.offset;
-    *((FxU32 *)&v1a)=*((FxU32 *)((int)a + ia))&0x00ffffff;
-    *((FxU32 *)&v2a)=*((FxU32 *)((int)b + ia))&0x00ffffff;
+    *((FxU32 *)&v1a)=*((FxU32 *)((long)a + ia))&0x00ffffff;
+    *((FxU32 *)&v2a)=*((FxU32 *)((long)b + ia))&0x00ffffff;
   }
 
   {
@@ -678,7 +678,7 @@
               FxU32 argb;
               
               if (i = ia) {
-                argb = *((FxU32 *)((int)e + i)) & 0x00ffffff;
+                argb = *((FxU32 *)((long)e + i)) & 0x00ffffff;
                 TRI_SETF(*((float *)&argb));
               }
               else {
@@ -855,8 +855,8 @@
         ady = -ady;
       
       if (gc->state.vData.colorType != GR_FLOAT) {
-        *((FxU32 *)&v1a)=*((FxU32 *)((int)v1 + ia))&0x00ffffff;
-        *((FxU32 *)&v2a)=*((FxU32 *)((int)v2 + ia))&0x00ffffff;
+        *((FxU32 *)&v1a)=*((FxU32 *)((long)v1 + ia))&0x00ffffff;
+        *((FxU32 *)&v2a)=*((FxU32 *)((long)v2 + ia))&0x00ffffff;
       }
       
       if (adx >= ady) {           /* X major line */
@@ -1255,8 +1255,8 @@
   }
   else {
     ia = gc->state.vData.pargbInfo.offset;
-    *((FxU32 *)&v1a)=*((FxU32 *)((int)a + ia))&0x00ffffff;
-    *((FxU32 *)&v2a)=*((FxU32 *)((int)b + ia))&0x00ffffff;
+    *((FxU32 *)&v1a)=*((FxU32 *)((long)a + ia))&0x00ffffff;
+    *((FxU32 *)&v2a)=*((FxU32 *)((long)b + ia))&0x00ffffff;
   }
 
   {
h3/glide3/src/gdraw.c +24 -16
diff -urN Glide_V3-DRI-3.10/h3/glide3/src/gdraw.c Glide_V3-DRI-3.10-lia/h3/glide3/src/gdraw.c
@@ -233,13 +233,15 @@
 GR_ENTRY(grDrawLine, void, (const void *a, const void *b))
 {
 #define FN_NAME "grDrawLine"
+  const void *vertices[2] = {a, b};
+
   GR_BEGIN_NOFIFOCHECK(FN_NAME, 91);
   GDBG_INFO_MORE(gc->myLevel, "(a = 0x%x, b = 0x%x)\n", a, b);
 
   if (gc->state.grEnableArgs.primitive_smooth_mode & GR_AA_ORDERED_LINES_MASK)
-    _grAADrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, (void *)&a);
+    _grAADrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, vertices);
   else
-    _grDrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, (void *)&a);
+    _grDrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, vertices);
 #undef FN_NAME
 } /* grDrawLine */
 
@@ -323,7 +325,7 @@
   GR_INC_SIZE(sizeof(FxU32))
 
 #define DA_END \
-  gc->cmdTransportInfo.fifoRoom -= ((FxU32)packetPtr - (FxU32)gc->cmdTransportInfo.fifoPtr); \
+  gc->cmdTransportInfo.fifoRoom -= ((long)packetPtr - (long)gc->cmdTransportInfo.fifoPtr); \
   gc->cmdTransportInfo.fifoPtr = packetPtr; \
   FIFO_ASSERT(); \
 }
@@ -348,7 +350,7 @@
    * except the data set up is from the pointer array and 
    * its data layout
    */
-  FxI32 stride = mode;
+  FxI32 stride;
 
   /* we snap to an integer by adding a large enough number that it
    * shoves all fraction bits off the right side of the mantissa.
@@ -382,8 +384,10 @@
    */
 #define POINTS_BUFFER  100
 
-  if (stride = 0)
+  if (mode = 0)
     stride = gc->state.vData.vStride;
+  else
+    stride = sizeof(float *) / sizeof (float);
 
   if (gc->state.grCoordinateSpaceArgs.coordinate_space_mode = GR_WINDOW_COORDS) {
     while (count > 0) {
@@ -573,7 +577,7 @@
   int j;
   FxI32 sCount;
   FxU32 vertexParamOffset;
-  FxI32 stride = mode;
+  FxI32 stride;
 
 #define  DX gc->pool.ftemp1
 #define ADY gc->pool.ftemp2
@@ -589,8 +593,11 @@
 
 #define LINES_BUFFER  100
 
-  if (stride = 0)
+  if (mode = 0)
     stride = gc->state.vData.vStride;
+  else
+    stride = sizeof(float *) / sizeof (float);
+
   if (ltype = GR_LINES)
     sCount = count >> 1; /* line list */
   else
@@ -618,16 +625,16 @@
         ** compute absolute deltas and draw from low Y to high Y
         */
         ADY = FARRAY(b, gc->state.vData.vertexInfo.offset+4) - FARRAY(a, gc->state.vData.vertexInfo.offset+4);
-        i = *(long *)&ADY;
+        i = *(int *)&ADY;
         if (i < 0) {
           float *tv;
           tv = a; a = b; b = tv;
           i ^= 0x80000000;            /* ady = -ady; */
-          (*(long *)&ADY) = i;
+          (*(int *)&ADY) = i;
         }
         
         DX = FARRAY(b, gc->state.vData.vertexInfo.offset) - FARRAY(a, gc->state.vData.vertexInfo.offset);
-        j = *(long *)&DX;
+        j = *(int *)&DX;
         if (j < 0) {
           j ^= 0x80000000;            /* adx = -adx; */
         }
@@ -797,7 +804,7 @@
         ** compute absolute deltas and draw from low Y to high Y
         */
         ADY = tmp2 - tmp1;
-        i = *(long *)&ADY;
+        i = *(int *)&ADY;
         if (i < 0) {
           float *tv;          
           owa = oowb; owb = oowa;
@@ -805,7 +812,7 @@
           fby = tmp1;
           tv = a; a = b; b = tv;
           i ^= 0x80000000;            /* ady = -ady; */
-          (*(long *)&ADY) = i;
+          (*(int *)&ADY) = i;
         }
         fax = FARRAY(a, gc->state.vData.vertexInfo.offset)
           *owa*gc->state.Viewport.hwidth+gc->state.Viewport.ox;
@@ -813,7 +820,7 @@
           *owb*gc->state.Viewport.hwidth+gc->state.Viewport.ox;
         
         DX = fbx - fax;
-        j = *(long *)&DX;
+        j = *(int *)&DX;
         if (j < 0) {
           j ^= 0x80000000;            /* adx = -adx; */
         }
@@ -901,7 +908,7 @@
     vSize,
 #endif
     k;
-  FxI32 stride = mode;
+  FxI32 stride;
   float *vPtr;
 
   GR_BEGIN_NOFIFOCHECK(FN_NAME, 90);
@@ -917,9 +924,10 @@
   GDBG_INFO(110, "%s:  paramMask = 0x%x\n", FN_NAME, gc->cmdTransportInfo.paramMask);
 #endif
 
-  if (stride = 0)
+  if (mode = 0)
     stride = gc->state.vData.vStride;
-
+  else
+    stride = sizeof(float *) / sizeof (float);
 
   gc->stats.trisProcessed+=(count/3);
 
h3/glide3/src/gerror.c +2 -2
diff -urN Glide_V3-DRI-3.10/h3/glide3/src/gerror.c Glide_V3-DRI-3.10-lia/h3/glide3/src/gerror.c
@@ -280,7 +280,7 @@
     
     gdbg_printf("Command Fifo:\n");
     gdbg_printf("\tSoftware:\n");
-    gdbg_printf("\t\tfifoPtr:           0x%X\n", (FxU32)gc->cmdTransportInfo.fifoPtr - (FxU32) gc->rawLfb);
+    gdbg_printf("\t\tfifoPtr:           0x%X\n", (long)gc->cmdTransportInfo.fifoPtr - (long) gc->rawLfb);
     gdbg_printf("\t\tfifoOffset:        0x%X\n", gc->cmdTransportInfo.fifoOffset); 
     gdbg_printf("\t\tfifoEnd:           0x%X\n", gc->cmdTransportInfo.fifoEnd - gc->rawLfb);
     gdbg_printf("\t\tfifoSize:          0x%X\n", gc->cmdTransportInfo.fifoSize); 
@@ -290,7 +290,7 @@
 
     if ( !gc->windowed ) {
       gdbg_printf("\tHardware:\n");
-      gdbg_printf("\t\treadPtrL:          0x%X\n", HW_FIFO_PTR(FXTRUE) - (FxU32)gc->rawLfb);
+      gdbg_printf("\t\treadPtrL:          0x%X\n", HW_FIFO_PTR(FXTRUE) - (long)gc->rawLfb);
       gdbg_printf("\t\tdepth:             0x%X\n", GR_CAGP_GET(depth));
       gdbg_printf("\t\tholeCount:         0x%X\n", GR_CAGP_GET(holeCount));
       gdbg_printf("\t\tbaseAddrL:         0x%X\n", GR_CAGP_GET(baseAddrL));
h3/glide3/src/gglide.c +5 -4
diff -urN Glide_V3-DRI-3.10/h3/glide3/src/gglide.c Glide_V3-DRI-3.10-lia/h3/glide3/src/gglide.c
@@ -1179,8 +1179,8 @@
     for ( i = 0; i < MAX_BUFF_PENDING && j = -1; i++) {
       if (gc->bufferSwaps[i] = 0xffffffff) {
         gc->bufferSwaps[i] -          (FxU32) gc->cmdTransportInfo.fifoPtr -
-          (FxU32) gc->cmdTransportInfo.fifoStart; 
+          (long) gc->cmdTransportInfo.fifoPtr -
+          (long) gc->cmdTransportInfo.fifoStart; 
         j = i;
       }
     }
@@ -1222,7 +1222,7 @@
       REG_GROUP_SET_WAX(hw, srcXY, x | ((driInfo.y+(y-driInfo.y))<<16));
       REG_GROUP_SET_WAX(hw, dstSize, (w&0x1FFF)|((h&0x1FFF)<<16));
       REG_GROUP_SET_WAX(hw, dstXY, (x&0x1FFF) | ((y&0x1FFF)<<16));
-      REG_GROUP_SET_WAX(hw, command, (0xCC<<24) | 0x1 | BIT(8));
+      REG_GROUP_SET_WAX(hw, command, (0xCCu<<24) | 0x1 | BIT(8));
       REG_GROUP_END();
     } while (cnt);
 
@@ -1315,7 +1315,7 @@
     do {
       depth0 = GET(gc->cRegs->cmdFifo0.depth);
       depth1 = GET(gc->cRegs->cmdFifo0.depth);
-    } while (readPtr0 != readPtr1);
+    } while (depth0 != depth1);
 
     if (depth0 = 0) {
       for (i = 0; i < MAX_BUFF_PENDING; i++)
@@ -2114,7 +2114,7 @@
            * continuing so that any internal glide calls have a valid
            * gc from tls via GR_DCL_GC. F*ck this up at your own peril.
            */
-          setThreadValue((FxU32)gc);
+          setThreadValue((long)gc);
 #if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
           /* Flush any remaining commands and cleanup any per gc state */
           grSurfaceReleaseContext((GrContext_t)gc);
h3/glide3/src/gglide.c.dri +5 -4
diff -urN Glide_V3-DRI-3.10/h3/glide3/src/gglide.c.dri Glide_V3-DRI-3.10-lia/h3/glide3/src/gglide.c.dri
@@ -1179,8 +1179,8 @@
     for ( i = 0; i < MAX_BUFF_PENDING && j = -1; i++) {
       if (gc->bufferSwaps[i] = 0xffffffff) {
         gc->bufferSwaps[i] -          (FxU32) gc->cmdTransportInfo.fifoPtr -
-          (FxU32) gc->cmdTransportInfo.fifoStart; 
+          (long) gc->cmdTransportInfo.fifoPtr -
+          (long) gc->cmdTransportInfo.fifoStart; 
         j = i;
       }
     }
@@ -1222,7 +1222,7 @@
       REG_GROUP_SET_WAX(hw, srcXY, x | ((driInfo.y+(y-driInfo.y))<<16));
       REG_GROUP_SET_WAX(hw, dstSize, (w&0x1FFF)|((h&0x1FFF)<<16));
       REG_GROUP_SET_WAX(hw, dstXY, (x&0x1FFF) | ((y&0x1FFF)<<16));
-      REG_GROUP_SET_WAX(hw, command, (0xCC<<24) | 0x1 | BIT(8));
+      REG_GROUP_SET_WAX(hw, command, (0xCCu<<24) | 0x1 | BIT(8));
       REG_GROUP_END();
     } while (cnt);
 
@@ -1315,7 +1315,7 @@
     do {
       depth0 = GET(gc->cRegs->cmdFifo0.depth);
       depth1 = GET(gc->cRegs->cmdFifo0.depth);
-    } while (readPtr0 != readPtr1);
+    } while (depth0 != depth1);
 
     if (depth0 = 0) {
       for (i = 0; i < MAX_BUFF_PENDING; i++)
@@ -2114,7 +2114,7 @@
            * continuing so that any internal glide calls have a valid
            * gc from tls via GR_DCL_GC. F*ck this up at your own peril.
            */
-          setThreadValue((FxU32)gc);
+          setThreadValue((long)gc);
 #if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
           /* Flush any remaining commands and cleanup any per gc state */
           grSurfaceReleaseContext((GrContext_t)gc);
h3/glide3/src/gglide.c.save +2 -2
diff -urN Glide_V3-DRI-3.10/h3/glide3/src/gglide.c.save Glide_V3-DRI-3.10-lia/h3/glide3/src/gglide.c.save
@@ -1163,7 +1163,7 @@
     do {
       depth0 = GET(gc->cRegs->cmdFifo0.depth);
       depth1 = GET(gc->cRegs->cmdFifo0.depth);
-    } while (readPtr0 != readPtr1);
+    } while (depth0 != depth1);
 
     if (depth0 = 0) {
       for (i = 0; i < MAX_BUFF_PENDING; i++)
@@ -1962,7 +1962,7 @@
            * continuing so that any internal glide calls have a valid
            * gc from tls via GR_DCL_GC. F*ck this up at your own peril.
            */
-          setThreadValue((FxU32)gc);
+          setThreadValue(gc);
 #if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
           /* Flush any remaining commands and cleanup any per gc state */
           grSurfaceReleaseContext((GrContext_t)gc);
h3/glide3/src/glfb.c +2 -2
diff -urN Glide_V3-DRI-3.10/h3/glide3/src/glfb.c Glide_V3-DRI-3.10-lia/h3/glide3/src/glfb.c
@@ -712,7 +712,7 @@
     case GR_LFB_SRC_FMT_ZA16:
       dstData = (FxU32*)(((FxU16*)dstData) + dst_x);
       length  = src_width * 2;
-      aligned = !((int)dstData&0x2);
+      aligned = !((long)dstData&0x2);
       srcJump = src_stride - length;
       dstJump = info.strideInBytes - length;
       if (aligned) {
@@ -917,7 +917,7 @@
     length   = src_width * 2;
     dstJump  = dst_stride - length;
     srcJump  = info.strideInBytes - length;
-    aligned  = !((int)srcData&0x2);
+    aligned  = !((long)srcData&0x2);
     odd      = (src_y+src_height) & 0x1;
     
     if (aligned) {
h3/glide3/src/glfb.c.dri +2 -2
diff -urN Glide_V3-DRI-3.10/h3/glide3/src/glfb.c.dri Glide_V3-DRI-3.10-lia/h3/glide3/src/glfb.c.dri
@@ -712,7 +712,7 @@
     case GR_LFB_SRC_FMT_ZA16:
       dstData = (FxU32*)(((FxU16*)dstData) + dst_x);
       length  = src_width * 2;
-      aligned = !((int)dstData&0x2);
+      aligned = !((long)dstData&0x2);
       srcJump = src_stride - length;
       dstJump = info.strideInBytes - length;
       if (aligned) {
@@ -917,7 +917,7 @@
     length   = src_width * 2;
     dstJump  = dst_stride - length;
     srcJump  = info.strideInBytes - length;
-    aligned  = !((int)srcData&0x2);
+    aligned  = !((long)srcData&0x2);
     odd      = (src_y+src_height) & 0x1;
     
     if (aligned) {
h3/glide3/src/glide.h +1 -1
diff -urN Glide_V3-DRI-3.10/h3/glide3/src/glide.h Glide_V3-DRI-3.10-lia/h3/glide3/src/glide.h
@@ -53,7 +53,7 @@
 typedef FxU8  GrAlpha_t;
 typedef FxU32 GrMipMapId_t;
 typedef FxU8  GrFog_t;
-typedef FxU32 GrContext_t;
+typedef unsigned long GrContext_t;
 typedef int (FX_CALL *GrProc)();
 
 /*
h3/glide3/src/gpci.c +5 -5
diff -urN Glide_V3-DRI-3.10/h3/glide3/src/gpci.c Glide_V3-DRI-3.10-lia/h3/glide3/src/gpci.c
@@ -418,14 +418,14 @@
   {
     /* Window coords */
     {
-      { _trisetup_null, _trisetup_null },
-      { _trisetup_null, _trisetup_null },
+      { (GrTriSetupProc) _trisetup_null, (GrTriSetupProc) _trisetup_null },
+      { (GrTriSetupProc) _trisetup_null, (GrTriSetupProc) _trisetup_null },
     },
 
     /* Clip coordinates */
     {
-      { _trisetup_null, _trisetup_null },
-      { _trisetup_null, _trisetup_null },
+      { (GrTriSetupProc) _trisetup_null, (GrTriSetupProc) _trisetup_null },
+      { (GrTriSetupProc) _trisetup_null, (GrTriSetupProc) _trisetup_null },
     },
   },
 };
@@ -1024,7 +1024,7 @@
       GR_DCL_GC;
 
       /* If there is no current gc in tls then set the current context. */
-      if (gc = NULL) setThreadValue((FxU32)&_GlideRoot.GCs[_GlideRoot.current_sst]);
+      if (gc = NULL) setThreadValue((long)&_GlideRoot.GCs[_GlideRoot.current_sst]);
     }
     break;
   case DLL_THREAD_DETACH:
h3/glide3/src/gsst.c +36 -33

121 lines not on this page · raw message

h3/glide3/src/gsst.c.dri +36 -33

121 lines not on this page · raw message

h3/glide3/src/gsst.c.save +4 -4
diff -urN Glide_V3-DRI-3.10/h3/glide3/src/gsst.c.save Glide_V3-DRI-3.10-lia/h3/glide3/src/gsst.c.save
@@ -937,7 +937,7 @@
    * current gc. This gc is valid for all threads in the fullscreen
    * context.
    */
-  setThreadValue( (FxU32)&_GlideRoot.GCs[_GlideRoot.current_sst] );
+  setThreadValue( (long)&_GlideRoot.GCs[_GlideRoot.current_sst] );
   
   {
     /* Partial Argument Validation */
@@ -1056,12 +1056,12 @@
     for (buffer = 0; buffer < nColBuffers; buffer++) {
       gc->buffers[buffer] = bufInfo->colBuffStart[buffer];
       GDBG_INFO(80, "Buffer %d:  Start: 0x%x\n", buffer, gc->buffers[buffer]);
-      gc->lfbBuffers[buffer] = (FxU32)gc->rawLfb + bufInfo->lfbBuffAddr[buffer];
+      gc->lfbBuffers[buffer] = (long)gc->rawLfb + bufInfo->lfbBuffAddr[buffer];
     }
     if (nAuxBuffers != 0) {
       gc->buffers[buffer] = bufInfo->auxBuffStart;
       GDBG_INFO(80, "Aux Buffer:  Start: 0x%x\n", gc->buffers[buffer]);
-      gc->lfbBuffers[buffer] = (FxU32)gc->rawLfb + bufInfo->lfbBuffAddr[buffer];
+      gc->lfbBuffers[buffer] = (long)gc->rawLfb + bufInfo->lfbBuffAddr[buffer];
     }
   
     vInfo->hWnd     = gc->grHwnd;
@@ -1552,7 +1552,7 @@
    * the tls gc explicitly otherwise other whacky-ness (read 'random
    * crashes' will ensue). 
    */
-  setThreadValue((FxU32)gc);
+  setThreadValue((long)gc);
   if ((gc != NULL) && gc->open) grFlush();
 
   /* Make sure that the user specified gc is not whacked */
h3/glide3/src/gtexdl.c +3 -3
diff -urN Glide_V3-DRI-3.10/h3/glide3/src/gtexdl.c Glide_V3-DRI-3.10-lia/h3/glide3/src/gtexdl.c
@@ -417,7 +417,7 @@
         while(i < start + slopCount) {
           FxU32 entry;
           
-          entry = (0x80000000 | ((i & 0xFE) << 23) | pal->data[i] & 0xFFFFFF);
+          entry = (0x80000000 | ((i & 0xFE) << 23) | (pal->data[i] & 0xFFFFFF));
           
           gc->state.shadow.paletteRow[i>>3].data[i&7] = entry;
           REG_GROUP_SET(hw, nccTable0[4 + (i & 0x07)], entry );
@@ -435,7 +435,7 @@
         while(i < endIndex) {
           FxU32 entry;
           
-          entry = (0x80000000 | ((i & 0xFE) << 23) | pal->data[i] & 0xFFFFFF);
+          entry = (0x80000000 | ((i & 0xFE) << 23) | (pal->data[i] & 0xFFFFFF));
           
           gc->state.shadow.paletteRow[i>>3].data[i&7] = entry;
           REG_GROUP_SET(hw, nccTable0[4 + (i & 0x07)], entry );
@@ -454,7 +454,7 @@
         while(i <= end) {
           FxU32 entry;
           
-          entry = (0x80000000 | ((i & 0xFE) << 23) | pal->data[i] & 0xFFFFFF);
+          entry = (0x80000000 | ((i & 0xFE) << 23) | (pal->data[i] & 0xFFFFFF));
           
           gc->state.shadow.paletteRow[i>>3].data[i&7] = entry;
           REG_GROUP_SET(hw, nccTable0[4 + (i & 0x07)], entry );
h3/glide3/src/gthread.c +6 -6
diff -urN Glide_V3-DRI-3.10/h3/glide3/src/gthread.c Glide_V3-DRI-3.10-lia/h3/glide3/src/gthread.c
@@ -63,13 +63,13 @@
 
 } /* initThreadStorage */
 
-void setThreadValue( FxU32 value ) {
+void setThreadValue( long value ) {
     GR_CHECK_F( "setThreadValue", !threadInit, "Thread storage not initialized\n" );
     TlsSetValue( _GlideRoot.tlsIndex, (void*)value );
 }
 
 #pragma warning (4:4035)        /* No return value */
-FxU32 getThreadValueSLOW( void ) {
+long getThreadValueSLOW( void ) {
     GR_CHECK_F( "getThreadValue", !threadInit, "Thread storage not initialized\n" );
 
 #if 0
@@ -122,7 +122,7 @@
 {
 }
 
-void setThreadValue( FxU32 value )
+void setThreadValue( long value )
 {
 	_threadValueMacOS = value;
 }
@@ -157,18 +157,18 @@
 #include "fxglide.h"
 #include "fxcmd.h"
 
-FxU32 threadValueLinux;
+long threadValueLinux;
 
 void initThreadStorage(void)
 {
 }
 
-void setThreadValue( FxU32 value )
+void setThreadValue( long value )
 {
 	threadValueLinux = value;
 }
 
-FxU32 getThreadValueSLOW( void )
+long getThreadValueSLOW( void )
 {
 	return threadValueLinux;
 }
h3/glide3/src/makefile.linux +1 -1
diff -urN Glide_V3-DRI-3.10/h3/glide3/src/makefile.linux Glide_V3-DRI-3.10-lia/h3/glide3/src/makefile.linux
@@ -43,7 +43,7 @@
 
 FX_GLIDE_REAL_HW=       1
 FX_GLIDE_NO_FIFO=       1
-FX_GLIDE_CTRISETUP =    0
+FX_GLIDE_CTRISETUP =    1
 
 HWSPEC          =       fifo.c
 LCDEFS          +=      -DH3 $(CMDXPORTDEFS)
h3/glide3/tests/.gdbinit +3 -0
diff -urN Glide_V3-DRI-3.10/h3/glide3/tests/.gdbinit Glide_V3-DRI-3.10-lia/h3/glide3/tests/.gdbinit
@@ -0,0 +1,3 @@
+dir /r/erikson/usr/src/redhat/BUILD/Glide_V3-DRI-3.10/h3/glide3/src:/r/erikson/usr/src/redhat/BUILD/Glide_V3-DRI-3.10/h3/minihwc:/r/erikson/usr/src/redhat/BUILD/XFree86-4.0/xc/lib/Xxf86vm
+set gdbg_debuglevel[80]%5
+set gdbg_debuglevel[280]%5
h3/incsrc/gdebug.h +14 -5
diff -urN Glide_V3-DRI-3.10/h3/incsrc/gdebug.h Glide_V3-DRI-3.10-lia/h3/incsrc/gdebug.h
@@ -67,12 +67,21 @@
 #pragma disable_message (111, 201, 302)
 #endif /* defined(__WATCOMC__) || defined(__WATCOM_CPLUSPLUS__) */
 
-#define GDBG_INFO      0 && (unsigned long)
-#define GDBG_INFO_MORE 0 && (unsigned long)
-#define GDBG_PRINTF    0 && (unsigned long)
+#ifdef __GNUC__
+# define GDBG_INFO(x...)
+# define GDBG_INFO_MORE(x...)
+# define GDBG_PRINTF(x...)
 
-#define GDBG_ERROR_SET_CALLBACK   0 && (unsigned long)
-#define GDBG_ERROR_CLEAR_CALLBACK 0 && (unsigned long)
+# define GDBG_ERROR_SET_CALLBACK(x...)
+# define GDBG_ERROR_CLEAR_CALLBACK(x...)
+#else
+# define GDBG_INFO      0 && (unsigned long)
+# define GDBG_INFO_MORE 0 && (unsigned long)
+# define GDBG_PRINTF    0 && (unsigned long)
+
+# define GDBG_ERROR_SET_CALLBACK   0 && (unsigned long)
+# define GDBG_ERROR_CLEAR_CALLBACK 0 && (unsigned long)
+#endif
 
 #define GDBG_GET_DEBUGLEVEL(x) 0
 #define GDBG_SET_DEBUGLEVEL(a,b)
h3/incsrc/h3defs.h +17 -7
diff -urN Glide_V3-DRI-3.10/h3/incsrc/h3defs.h Glide_V3-DRI-3.10-lia/h3/incsrc/h3defs.h
@@ -56,11 +56,21 @@
 
 // this crazy macro tests the sign bit of a float by loading it into
 // an integer register and then testing the sign bit of the integer
-#define FLOAT_ISNEG(f) ((*(int *)(&(f))) < 0)
+#ifdef __ia64__
+  /* On IA-64, it's faster to do this the obvious way... --davidm 00/08/09 */
+# define FLOAT_ISNEG(f)	((f) < 0.0)
+#else
+# define FLOAT_ISNEG(f) ((*(int *)(&(f))) < 0)
+#endif
 
 // these crazy macros returns the sign of a number (1 if >= 0; -1 if < 0)
-#define ISIGN(x) (((x) | 0x40000000L) >> 30)
-#define FSIGN(f) ISIGN(*(long *)&f)
+#ifdef __ia64__
+# define ISIGN(x) ((x) >= 0 ? 1 : -1)
+# define FSIGN(f) ((f) >= 0.0 ? 1 : -1)
+#else
+# define ISIGN(x) (((x) | 0x40000000L) >> 30)
+# define FSIGN(f) ISIGN(*(long *)&f)
+#endif
 
 #define BIT(n)  (1UL<<(n))
 #define SST_MASK(n) (0xFFFFFFFFL >> (32-(n)))
@@ -1257,9 +1267,9 @@
 
 //----------------- useful addressing macros -----------------------
 // return pointer to SST at specified WRAP, CHIP, or TREX
-#define SST_WRAP(sst,n) ((SstRegs *)((n)*0x4000+(FxI32)(sst)))
-#define SST_CHIP(sst,n) ((SstRegs *)((n)*0x400+(FxI32)(sst)))
-#define SST_TMU(sst,n)  ((SstRegs *)((0x800<<(n))+(FxI32)(sst)))
+#define SST_WRAP(sst,n) ((SstRegs *)((n)*0x4000+(long)(sst)))
+#define SST_CHIP(sst,n) ((SstRegs *)((n)*0x400+(long)(sst)))
+#define SST_TMU(sst,n)  ((SstRegs *)((0x800<<(n))+(long)(sst)))
 #define SST_TREX(sst,n) SST_TMU(sst,n)
 
 // offsets from the base of memBaseAddr0
@@ -1304,7 +1314,7 @@
 
 #define SST_IS_REGISTER_ADDR(a)  ( (a) >= SST_IO_OFFSET       && (a) < SST_TEX_OFFSET )
 
-#define SST_BASE_ADDRESS(sst)   ((FxI32)(sst)-SST_3D_OFFSET)
+#define SST_BASE_ADDRESS(sst)   ((long)(sst)-SST_3D_OFFSET)
 #define SST_IO_ADDRESS(sst)     (SST_IO_OFFSET+SST_BASE_ADDRESS(sst))
 #define SST_CMDAGP_ADDRESS(sst) (SST_CMDAGP_OFFSET+SST_BASE_ADDRESS(sst))
 #define SST_GUI_ADDRESS(sst)    (SST_2D_OFFSET+SST_BASE_ADDRESS(sst))
h3/incsrc/h3info.h +5 -1
diff -urN Glide_V3-DRI-3.10/h3/incsrc/h3info.h Glide_V3-DRI-3.10-lia/h3/incsrc/h3info.h
@@ -28,7 +28,11 @@
 // basic data types
 #define FxU8  unsigned char
 #define FxU16 unsigned short
-#define FxU32 unsigned long
+# ifdef __LP64__
+#  define FxU32 unsigned int
+# else
+#  define FxU32 unsigned long
+# endif
 #define FxBool int
 // defn of registers not reqd, treat (SstRegs *) as (void *)
 typedef void SstRegs;
h3/incsrc/h3regs.h +121 -117

281 lines not on this page · raw message

h3/minihwc/hwcext.h +2 -3
diff -urN Glide_V3-DRI-3.10/h3/minihwc/hwcext.h Glide_V3-DRI-3.10-lia/h3/minihwc/hwcext.h
@@ -192,9 +192,8 @@
 
 /* Returned from HWCEXT_GETLINEARADDR */
 typedef struct hwcExtLinearAddrRes_s {
-  FxU32
-    numBaseAddrs,               /* # base addresses */
-    baseAddresses[HWCEXT_MAX_BASEADDR]; /* linear Addresses  */
+  FxU32 numBaseAddrs;               /* # base addresses */
+  long baseAddresses[HWCEXT_MAX_BASEADDR]; /* linear Addresses  */
 } hwcExtLinearAddrRes_t;
 
 /*
h3/minihwc/linhwc.c +15 -7
diff -urN Glide_V3-DRI-3.10/h3/minihwc/linhwc.c Glide_V3-DRI-3.10-lia/h3/minihwc/linhwc.c
@@ -67,7 +67,11 @@
 #include "lindri.h"
 
 static FxU32 fenceVar;
-#define P6FENCE asm("xchg %%eax, %0" : : "m" (fenceVar) : "eax");
+#ifdef __ia64__
+# define P6FENCE asm volatile("mf.a" ::: "memory");
+#else
+# define P6FENCE asm("xchg %%eax, %0" : : "m" (fenceVar) : "eax");
+#endif
 
 #define MAXFIFOSIZE     0x40000
 #define FIFOPAD         0x0000
@@ -144,7 +148,7 @@
   char data[128];
   char *env, *val;
   envitem *item;
-  int first=1;
+  int is_first=1;
 
   if (envinit) return;
   envinit=1;
@@ -156,9 +160,9 @@
     if (*data='\n') continue;
     val=strchr(data, '=');
     if (!val) {
-      if (first) {
+      if (is_first) {
 	fprintf(stderr, "In config file /etc/conf.3dfx/voodoo3:\n");
-	first=0;
+	is_first=0;
       }
       fprintf(stderr, "Malformed line: %s\n", data);
       continue;
@@ -231,8 +235,8 @@
   }
 
   bInfo->linearInfo.initialized = FXTRUE;
-  bInfo->linearInfo.linearAddress[0]=(FxU32)driInfo.pRegs;
-  bInfo->linearInfo.linearAddress[1]=(FxU32)driInfo.pFB;
+  bInfo->linearInfo.linearAddress[0]=(long)driInfo.pRegs;
+  bInfo->linearInfo.linearAddress[1]=(long)driInfo.pFB;
   return FXTRUE;
 }
 
@@ -745,6 +749,10 @@
 #undef FN_NAME
 } /* hwcResolutionSupported */
 
+extern void _grImportFifo (int, int);
+extern void _grInvalidateAll (void);
+extern void _grExportFifo (int *, int *);
+
 void grDRIImportFifo(int fifoPtr, int fifoRead)
 {
   _grImportFifo(fifoPtr, fifoRead);
@@ -756,5 +764,5 @@
 
 void grDRIResetSAREA()
 {
-  _grExportFifo(driInfo.fifoPtr, driInfo.fifoRead);
+  _grExportFifo((int *) driInfo.fifoPtr, (int *) driInfo.fifoRead);
 }
h3/minihwc/linhwc.c.dri +15 -7
diff -urN Glide_V3-DRI-3.10/h3/minihwc/linhwc.c.dri Glide_V3-DRI-3.10-lia/h3/minihwc/linhwc.c.dri
@@ -67,7 +67,11 @@
 #include "lindri.h"
 
 static FxU32 fenceVar;
-#define P6FENCE asm("xchg %%eax, %0" : : "m" (fenceVar) : "eax");
+#ifdef __ia64__
+# define P6FENCE asm volatile("mf.a" ::: "memory");
+#else
+# define P6FENCE asm("xchg %%eax, %0" : : "m" (fenceVar) : "eax");
+#endif
 
 #define MAXFIFOSIZE     0x40000
 #define FIFOPAD         0x0000
@@ -144,7 +148,7 @@
   char data[128];
   char *env, *val;
   envitem *item;
-  int first=1;
+  int is_first=1;
 
   if (envinit) return;
   envinit=1;
@@ -156,9 +160,9 @@
     if (*data='\n') continue;
     val=strchr(data, '=');
     if (!val) {
-      if (first) {
+      if (is_first) {
 	fprintf(stderr, "In config file /etc/conf.3dfx/voodoo3:\n");
-	first=0;
+	is_first=0;
       }
       fprintf(stderr, "Malformed line: %s\n", data);
       continue;
@@ -231,8 +235,8 @@
   }
 
   bInfo->linearInfo.initialized = FXTRUE;
-  bInfo->linearInfo.linearAddress[0]=(FxU32)driInfo.pRegs;
-  bInfo->linearInfo.linearAddress[1]=(FxU32)driInfo.pFB;
+  bInfo->linearInfo.linearAddress[0]=(long)driInfo.pRegs;
+  bInfo->linearInfo.linearAddress[1]=(long)driInfo.pFB;
   return FXTRUE;
 }
 
@@ -745,6 +749,10 @@
 #undef FN_NAME
 } /* hwcResolutionSupported */
 
+extern void _grImportFifo (int, int);
+extern void _grInvalidateAll (void);
+extern void _grExportFifo (int *, int *);
+
 void grDRIImportFifo(int fifoPtr, int fifoRead)
 {
   _grImportFifo(fifoPtr, fifoRead);
@@ -756,5 +764,5 @@
 
 void grDRIResetSAREA()
 {
-  _grExportFifo(driInfo.fifoPtr, driInfo.fifoRead);
+  _grExportFifo((int *) driInfo.fifoPtr, (int *) driInfo.fifoRead);
 }
h3/minihwc/linhwc.c.save +9 -5
diff -urN Glide_V3-DRI-3.10/h3/minihwc/linhwc.c.save Glide_V3-DRI-3.10-lia/h3/minihwc/linhwc.c.save
@@ -64,7 +64,11 @@
 #include <X11/extensions/xf86vmode.h>
 
 static FxU32 fenceVar;
-#define P6FENCE asm("xchg %%eax, %0" : : "m" (fenceVar) : "eax");
+#ifdef __ia64__
+# define P6FENCE asm volatile ("mf.a" ::: "memory");
+#else
+# define P6FENCE asm("xchg %%eax, %0" : : "m" (fenceVar) : "eax");
+#endif
 
 #define MAXFIFOSIZE     0x40000
 #define MAXFIFOSIZE_16MB   0xff000
@@ -114,7 +118,7 @@
   char data[128];
   char *env, *val;
   envitem *item;
-  int first=1;
+  int is_first=1;
 
   if (envinit) return;
   envinit=1;
@@ -126,9 +130,9 @@
     if (*data='\n') continue;
     val=strchr(data, '=');
     if (!val) {
-      if (first) {
+      if (is_first) {
 	fprintf(stderr, "In config file /etc/conf.3dfx/voodoo3:\n");
-	first=0;
+	is_first=0;
       }
       fprintf(stderr, "Malformed line: %s\n", data);
       continue;
@@ -269,7 +273,7 @@
 
   for (bAddr = 0; bAddr < HWC_NUM_BASE_ADDR; bAddr++) {
     if ((bAddrMask >> bAddr) & 0x1) {
-      bInfo->linearInfo.linearAddress[bAddr] = (FxU32) 
+      bInfo->linearInfo.linearAddress[bAddr] = (long)
 	pciMapCardMulti(bInfo->pciInfo.vendorID, bInfo->pciInfo.deviceID,
 			0x2000000, &bInfo->deviceNum, bInfo->boardNum, bAddr);
     }
h3/minihwc/minihwc.c +3 -3
diff -urN Glide_V3-DRI-3.10/h3/minihwc/minihwc.c Glide_V3-DRI-3.10-lia/h3/minihwc/minihwc.c
@@ -1078,7 +1078,7 @@
     for (bAddr = 0; bAddr < 2; bAddr++) {
       if ((bAddrMask & (0x01UL << bAddr)) != 0x00UL) {
         bInfo->linearInfo.linearAddress[bAddr] = 
-          (FxU32)pciMapCardMulti(bInfo->pciInfo.vendorID, bInfo->pciInfo.deviceID,
+          pciMapCardMulti(bInfo->pciInfo.vendorID, bInfo->pciInfo.deviceID,
                                  0x1000000, &bInfo->deviceNum, bInfo->boardNum, bAddr);
       }
     }
@@ -1087,13 +1087,13 @@
      * unconditionally
      */
     bInfo->linearInfo.linearAddress[2] = 
-      (FxU32)pciMapCardMulti(bInfo->pciInfo.vendorID, bInfo->pciInfo.deviceID,
+      pciMapCardMulti(bInfo->pciInfo.vendorID, bInfo->pciInfo.deviceID,
                              0x1000000, &bInfo->deviceNum, bInfo->boardNum, 2);
 
     /* Does the caller want the rom bios? */
     if ((bAddrMask & 0x08UL) != 0x00UL) {
       bInfo->linearInfo.linearAddress[3] = 
-        (FxU32)pciMapCardMulti(bInfo->pciInfo.vendorID, bInfo->pciInfo.deviceID,
+        pciMapCardMulti(bInfo->pciInfo.vendorID, bInfo->pciInfo.deviceID,
                                0x1000000, &bInfo->deviceNum, bInfo->boardNum, 3);
     }
   }
h3/minihwc/minihwc.h +9 -10
diff -urN Glide_V3-DRI-3.10/h3/minihwc/minihwc.h Glide_V3-DRI-3.10-lia/h3/minihwc/minihwc.h
@@ -238,22 +238,21 @@
 typedef struct hwcLinearInfo_s {
   FxBool
     initialized;
-  FxU32
-    linearAddress[HWC_NUM_BASE_ADDR];
+  long linearAddress[HWC_NUM_BASE_ADDR];
 } hwcLinearInfo;
 
 typedef struct hwcRegInfo_s {
   FxBool
     initialized;
-  volatile FxU32
-    ioMemBase,                  /* mem base for I/O aliases */
-    cmdAGPBase,                 /* CMD/AGP register base */
-    waxBase,                    /* 2D register base */
-    sstBase,                    /* 3D register base */
-    lfbBase,                    /* 3D lfb base */
-    rawLfbBase;                 /* Raw LFB base (base address 1) */
+  volatile long
+    ioMemBase,                 /* mem base for I/O aliases */
+    cmdAGPBase,                /* CMD/AGP register base */
+    waxBase,                   /* 2D register base */
+    sstBase,                   /* 3D register base */
+    lfbBase,                   /* 3D lfb base */
+    rawLfbBase;                /* Raw LFB base (base address 1) */
 #if __POWERPC__
-  ioPortBase;                   /* PPC does I/O via a 32-bit address */
+  FxU32 ioPortBase;             /* PPC does I/O via a 32-bit address */
 #else       
   volatile FxU16
     ioPortBase,                 /* I/O base address */
set-for-dri +7 -0
diff -urN Glide_V3-DRI-3.10/set-for-dri Glide_V3-DRI-3.10-lia/set-for-dri
@@ -0,0 +1,7 @@
+for n in ./h3/glide3/src/gglide.c ./h3/glide3/src/glfb.c ./h3/glide3/src/gsst.c ./h3/minihwc/linhwc.c
+do
+	rn=$(basename $n).dri
+	echo ln -sf $rn $n
+	ln -sf $rn $n
+done
+
set-for-standalone +7 -0
diff -urN Glide_V3-DRI-3.10/set-for-standalone Glide_V3-DRI-3.10-lia/set-for-standalone
@@ -0,0 +1,7 @@
+for n in ./h3/glide3/src/gglide.c ./h3/glide3/src/glfb.c ./h3/glide3/src/gsst.c ./h3/minihwc/linhwc.c
+do
+	rn=$(basename $n).save
+	echo ln -sf $rn $n
+	ln -sf $rn $n
+done
+
swlibs/fxmisc/3dfx.h +5 -0
diff -urN Glide_V3-DRI-3.10/swlibs/fxmisc/3dfx.h Glide_V3-DRI-3.10-lia/swlibs/fxmisc/3dfx.h
@@ -30,8 +30,13 @@
 typedef signed   char   FxI8;
 typedef unsigned short  FxU16;
 typedef signed   short  FxI16;
+#ifdef __LP64__
+typedef signed   int    FxI32;
+typedef unsigned int    FxU32;
+#else
 typedef signed   long   FxI32;
 typedef unsigned long   FxU32;
+#endif
 typedef int             FxBool;
 typedef float           FxFloat;
 typedef double          FxDouble;
swlibs/fxmisc/fximg.c +4 -4
diff -urN Glide_V3-DRI-3.10/swlibs/fxmisc/fximg.c Glide_V3-DRI-3.10-lia/swlibs/fxmisc/fximg.c
@@ -197,7 +197,7 @@
       	case 0xDA01:
 			*type = IMG_RGT;
 			break;
-      	case 'EL':
+      	case (('E'<<8) | 'L'):
 	  cookie = 0;
 	  if ( ( c = fgetc( stream ) ) = EOF )
 	    {
@@ -211,7 +211,7 @@
 	      return FXFALSE;
 	    }
 	  cookie = (cookie << 8) | c;
-	  if (cookie = 'RS')
+	  if (cookie = (('R'<<8)|'S'))
 	    *type = IMG_SRLE;
 	  break;
       	default: // Might Be TGA
@@ -1470,7 +1470,7 @@
 {
 	imgErrorString = "Image write error.";
 	if ( 0 > fprintf( stream, "P6\n" ) ) return FXFALSE;
-	if ( 0 > fprintf( stream, "# PPM Comment\n", info->width ) ) return FXFALSE;
+	if ( 0 > fprintf( stream, "# PPM Comment\n" ) ) return FXFALSE;
 	if ( 0 > fprintf( stream, "%d ", info->width ) ) return FXFALSE;
 	if ( 0 > fprintf( stream, "%d\n", info->height ) ) return FXFALSE;
 	if ( 0 > fprintf( stream, "255\n" ) ) return FXFALSE;
@@ -1878,7 +1878,7 @@
 	if (prefix) {					// if there's a path prefix
 	    char buf[1024], *p;
 	    strcpy(buf,prefix);			// copy and replace semicolon
-	    if (p = strchr(buf,';')) *p = '\0';
+	    if ((p = strchr(buf,';')) != NULL) *p = '\0';
 	    fprintf(stderr,buf);
 	    fprintf(stderr,"/");
 	}
swlibs/fxmisc/fxos.c +2 -2
diff -urN Glide_V3-DRI-3.10/swlibs/fxmisc/fxos.c Glide_V3-DRI-3.10-lia/swlibs/fxmisc/fxos.c
@@ -97,7 +97,7 @@
 
     // first try and open up the file in the current directory
     if (pprefix) *pprefix = NULL;
-    if (file = fopen(filename,mode))
+    if ((file = fopen(filename,mode)) != NULL)
         return file;
     if (path = NULL)
         return NULL;
@@ -114,7 +114,7 @@
         strcat(nameWithPath,"/");               // add directory separator
         strcat(nameWithPath,filename);          // add filename
         if (pprefix) *pprefix = path;           // save the prefix
-        if (file = fopen(nameWithPath,mode))
+        if ((file = fopen(nameWithPath,mode)) != NULL)
             return file;
         path = psemi;                           // advance to next path element
         if (path)
swlibs/fxmisc/linutil.c +1 -1
diff -urN Glide_V3-DRI-3.10/swlibs/fxmisc/linutil.c Glide_V3-DRI-3.10-lia/swlibs/fxmisc/linutil.c
@@ -28,7 +28,7 @@
 #include <string.h>
 #include "linutil.h"
 
-static init_done=0;
+static int init_done=0;
 static struct termios save_termdata;
 
 static void reset_term() {
swlibs/include/make/3dfx.mak +5 -1
diff -urN Glide_V3-DRI-3.10/swlibs/include/make/3dfx.mak Glide_V3-DRI-3.10-lia/swlibs/include/make/3dfx.mak
@@ -84,8 +84,12 @@
 # assembly language in grDrawTriangle. Larger optimization removes
 # an extra push in the calling sequence.
 #
+#if 0
 CNODEBUG       = -O6 -m486 -fomit-frame-pointer -funroll-loops \
 	-fexpensive-optimizations -ffast-math -DBIG_OPT
+#else
+CNODEBUG       = -g -O3 -fomit-frame-pointer -fexpensive-optimizations -ffast-math -DBIG_OPT
+#endif
 
 CDEBUG	       = -g -O
 # Profiling
@@ -112,7 +116,7 @@
 
 # if we are not debugging then replace debug flags with nodebug flags
 
-# DEBUG = xx
+#DEBUG = xx
 
 ifdef DEBUG
 CDEBUG   += $(DEBUGDEFS)
swlibs/newpci/pcilib/fxlinux.c +8 -8
diff -urN Glide_V3-DRI-3.10/swlibs/newpci/pcilib/fxlinux.c Glide_V3-DRI-3.10-lia/swlibs/newpci/pcilib/fxlinux.c
@@ -47,10 +47,10 @@
 static FxBool pciOutputStringLinux(const char *msg);
 static FxBool pciInitializeLinux(void);
 static FxBool pciShutdownLinux(void);
-static FxBool pciMapLinearLinux(FxU32, FxU32 physical_addr, FxU32 *linear_addr,
+static FxBool pciMapLinearLinux(FxU32, FxU32 physical_addr, long *linear_addr,
 				FxU32 *length);
-static FxBool pciUnmapLinearLinux(FxU32 linear_addr, FxU32 length);
-static FxBool pciSetPermissionLinux(const FxU32, const FxU32, const FxBool);
+static FxBool pciUnmapLinearLinux(long linear_addr, FxU32 length);
+static FxBool pciSetPermissionLinux(const long, const FxU32, const FxBool);
 static FxU8 pciPortInByteLinux(unsigned short port);
 static FxU16 pciPortInWordLinux(unsigned short port);
 static FxU32 pciPortInLongLinux(unsigned short port);
@@ -216,7 +216,7 @@
 
 static FxBool 
 pciMapLinearLinux(FxU32 bus, FxU32 physical_addr,
-		  FxU32 *linear_addr, FxU32 *length) 
+		  long *linear_addr, FxU32 *length) 
 {
   int fd;
   if (linuxDevFd!=-1) {
@@ -227,7 +227,7 @@
       return FXFALSE;
     }
   }
-  if (((*linear_addr)=(FxU32)mmap(0, *length, PROT_READ|PROT_WRITE,
+  if (((*linear_addr)=(long)mmap(0, *length, PROT_READ|PROT_WRITE,
 				  MAP_SHARED, fd, physical_addr))<0) {
     if (fd!=linuxDevFd) close(fd);
     return FXFALSE;
@@ -237,14 +237,14 @@
 }
 
 static FxBool
-pciUnmapLinearLinux(FxU32 linear_addr, FxU32 length) 
+pciUnmapLinearLinux(long linear_addr, FxU32 length) 
 {
-  munmap((void*)linear_addr, length);
+  munmap((void *) linear_addr, length);
   return FXTRUE;
 }
 
 static FxBool
-pciSetPermissionLinux(const FxU32 addrBase, const FxU32 addrLen, 
+pciSetPermissionLinux(const long addrBase, const FxU32 addrLen, 
 		      const FxBool writePermP)
 {
   return FXTRUE;
swlibs/newpci/pcilib/fxpci.c +7 -8
diff -urN Glide_V3-DRI-3.10/swlibs/newpci/pcilib/fxpci.c Glide_V3-DRI-3.10-lia/swlibs/newpci/pcilib/fxpci.c
@@ -692,9 +692,8 @@
                 FxU32 *devNum,
                 FxU32 cardNum, FxU32 addressNum)
 {
-  FxU32 
-    physAddress, 
-    virtAddress;
+  FxU32 physAddress;
+  long virtAddress;
   
   /* 1) open the PCI device and scan it for devices
    * 2) scan the existing devices for a match
@@ -704,7 +703,7 @@
 
   /* 3) find the current physcial address of the card */
   pciGetConfigData( baseAddresses[addressNum], *devNum, &physAddress );
-  if (length <= 0) return (FxU32*)length;
+  if (length <= 0) return (FxU32*)(long)length;
 
   /* Mask the memory type information bits off.
    *   [0]: Memory type indicator (0 memory/1 i/o)
@@ -753,7 +752,7 @@
 } /* pciMapCard */
 
 FX_EXPORT FxBool FX_CSTYLE
-pciMapPhysicalToLinear( FxU32 *linear_addr, FxU32 physical_addr,
+pciMapPhysicalToLinear( long *linear_addr, FxU32 physical_addr,
                         FxU32 *length ) 
 { 
   return pciMapPhysicalDeviceToLinear(linear_addr, 
@@ -762,7 +761,7 @@
 } /* pciMapPhysicalToLinear */
 
 FX_ENTRY FxBool FX_CALL 
-pciMapPhysicalDeviceToLinear(FxU32 *linear_addr, 
+pciMapPhysicalDeviceToLinear(long *linear_addr, 
                              FxU32 busNumber, FxU32 physical_addr,
                              FxU32 *length)
 {
@@ -772,7 +771,7 @@
 
 
 FX_EXPORT void FX_CSTYLE
-pciUnmapPhysical( FxU32 linear_addr, FxU32 length ) 
+pciUnmapPhysical( long linear_addr, FxU32 length ) 
 {
   int i,j;
   
@@ -811,7 +810,7 @@
 }
 
 FX_EXPORT FxBool FX_CSTYLE
-pciLinearRangeSetPermission(const FxU32 addrBase, const FxU32 addrLen, const FxBool writeableP)
+pciLinearRangeSetPermission(const long addrBase, const FxU32 addrLen, const FxBool writeableP)
 {
   return pciLinearRangeSetPermissionDD(addrBase, addrLen, writeableP);
 }
swlibs/newpci/pcilib/fxpci.h +4 -4
diff -urN Glide_V3-DRI-3.10/swlibs/newpci/pcilib/fxpci.h Glide_V3-DRI-3.10-lia/swlibs/newpci/pcilib/fxpci.h
@@ -169,15 +169,15 @@
  * on bus0 which would not work across pci bridges or on agp devices.   
  */
 FX_ENTRY FxBool FX_CALL 
-pciMapPhysicalToLinear(FxU32 *linear_addr, FxU32 physical_addr,FxU32 *length);
+pciMapPhysicalToLinear(long *linear_addr, FxU32 physical_addr,FxU32 *length);
 
 FX_ENTRY FxBool FX_CALL 
-pciMapPhysicalDeviceToLinear(FxU32 *linear_addr, 
+pciMapPhysicalDeviceToLinear(long *linear_addr, 
                              FxU32 busNumber, FxU32 physical_addr,
                              FxU32 *length);
 
 FX_ENTRY void   FX_CALL 
-pciUnmapPhysical( FxU32 linear_addr, FxU32 length );
+pciUnmapPhysical( long linear_addr, FxU32 length );
 
 const char *
 pciGetVendorName( FxU16 vendor_id );
@@ -215,7 +215,7 @@
 pciOutputDebugString(const char* debugMsg);
 
 FX_ENTRY FxBool FX_CALL
-pciLinearRangeSetPermission(const FxU32 addrBase, const FxU32 addrLen, const FxBool writeableP);
+pciLinearRangeSetPermission(const long addrBase, const FxU32 addrLen, const FxBool writeableP);
 
 #define PCI_ERR_NOERR           0
 #define PCI_ERR_WINRTINIT       1
swlibs/newpci/pcilib/pcilib.h +3 -3
diff -urN Glide_V3-DRI-3.10/swlibs/newpci/pcilib/pcilib.h Glide_V3-DRI-3.10-lia/swlibs/newpci/pcilib/pcilib.h
@@ -74,13 +74,13 @@
 
   /* Platform device address management */
   FxBool (*addrMap)(FxU32 busNumber, FxU32 physAddr,
-                    FxU32* linearAddr, FxU32* length);
-  FxBool (*addrUnmap)(FxU32 linearAddr, FxU32 length);
+                    long* linearAddr, FxU32* length);
+  FxBool (*addrUnmap)(long linearAddr, FxU32 length);
 
   /* Optional things that a platform may or maynot support and clients
    * should not rely on the call to suceed.  
    */
-  FxBool (*addrSetPermission)(const FxU32 addrBase, const FxU32 addrLen,
+  FxBool (*addrSetPermission)(const long addrBase, const FxU32 addrLen,
                               const FxBool writePermP);
 
   FxBool (*msrGet)(MSRInfo* in, MSRInfo* out);
swlibs/texus/lib/dequant.c +6 -6
diff -urN Glide_V3-DRI-3.10/swlibs/texus/lib/dequant.c Glide_V3-DRI-3.10-lia/swlibs/texus/lib/dequant.c
@@ -160,12 +160,12 @@
 }
 
 static void
-_txImgDequantizeYIQ422(FxU32 *out, FxU8 *in, int w, int h, const long *yabTable)
+_txImgDequantizeYIQ422(FxU32 *out, FxU8 *in, int w, int h, const FxU32 *yabTable)
 {
     int                         n = w * h;
     FxU32                       pal[256];
 
-    txYABtoPal256((long *)pal, (long *)yabTable);
+    txYABtoPal256(pal, yabTable);
     out += n;
     in  += n;
     while (n--) *--out = pal[*--in] | 0xff000000;
@@ -223,10 +223,10 @@
 }
 
 static void
-_txImgDequantizeAYIQ8422(FxU32 *out, FxU16 *in, int w, int h, const long *yab)
+_txImgDequantizeAYIQ8422(FxU32 *out, FxU16 *in, int w, int h, const FxU32 *yab)
 {
     int         n = w * h;
-    long        pal[256];
+    FxU32       pal[256];
 
     txYABtoPal256(pal, yab);
     out += n;
@@ -348,7 +348,7 @@
         case GR_TEXFMT_RGB_332:         _txImgDequantizeRGB332(dst, src, w, h);         
                                                                 break;
         case GR_TEXFMT_YIQ_422:         _txImgDequantizeYIQ422(dst, src, w, h, 
-                                                                        (long *)pxMip->pal); break;
+                                                                        pxMip->pal); break;
         case GR_TEXFMT_A_8:                     _txImgDequantizeA8(dst, src, w, h);             
                                                                 break;
         case GR_TEXFMT_I_8:                     _txImgDequantizeI8(dst, src, w, h);             
@@ -361,7 +361,7 @@
         case GR_TEXFMT_ARGB_8332:       _txImgDequantizeARGB8332(dst, src, w, h);       
                                                                 break;
         case GR_TEXFMT_AYIQ_8422:       _txImgDequantizeAYIQ8422(dst, src, w, h, 
-                                                                        (long *)pxMip->pal); break;
+                                                                        pxMip->pal); break;
         case GR_TEXFMT_RGB_565:         _txImgDequantizeRGB565(dst, src, w, h); 
                                                                 break;
         case GR_TEXFMT_ARGB_1555:       _txImgDequantizeARGB1555(dst, src, w, h);       
swlibs/texus/lib/mipmap.c +1 -1
diff -urN Glide_V3-DRI-3.10/swlibs/texus/lib/mipmap.c Glide_V3-DRI-3.10-lia/swlibs/texus/lib/mipmap.c
@@ -35,7 +35,7 @@
 #define B3(x)   ((x>>0)&0xFF)
 
 static void
-_txImgHalve(long *outdata, int width, int height, long *indata)
+_txImgHalve(int *outdata, int width, int height, int *indata)
 {
     unsigned int i,j,k;
     unsigned int w,h, *p,sum,*q;
swlibs/texus/lib/ncc.c +6 -6
diff -urN Glide_V3-DRI-3.10/swlibs/texus/lib/ncc.c Glide_V3-DRI-3.10-lia/swlibs/texus/lib/ncc.c
@@ -29,10 +29,10 @@
 #include "texusint.h"
 
 static int 
-dithmat[4][4] = {       0,  8,  2, 10, 
-                           12,  4, 14,  6, 
-                            3, 11,  1,  9, 
-                           15,  7, 13,  5 };
+dithmat[4][4] = {      { 0,  8,  2, 10,    },
+                       {    12,  4, 14,  6 },
+                       {     3, 11,  1,  9 },
+                       {    15,  7, 13,  5 }  };
 
 static struct   {
     int yhist[256], ihist[256], qhist[256];
@@ -124,7 +124,7 @@
 }
 
 static void
-_txImgNcc(char *odata, unsigned long *idata, int w, int h, int format, 
+_txImgNcc(char *odata, unsigned int *idata, int w, int h, int format, 
     int dither)
 {
     int (*quantizer)(unsigned long argb, int x, int y, int w);
@@ -308,7 +308,7 @@
 
 
     if ((dither & TX_DITHER_MASK) = TX_DITHER_ERR) {
-        txYABtoPal256((long *)pxMip->pal, (long *) &ncc.y[0]);
+        txYABtoPal256(pxMip->pal, &ncc.y[0]);
         txDiffuseIndex(pxMip, txMip, pixsize, pxMip->pal, 256);
     }
     else {
swlibs/texus/lib/nccnnet.c +11 -11
diff -urN Glide_V3-DRI-3.10/swlibs/texus/lib/nccnnet.c Glide_V3-DRI-3.10-lia/swlibs/texus/lib/nccnnet.c
@@ -88,19 +88,19 @@
 #define MAX_NEURONS             256
 
 typedef struct  _weight {
-    long         r,  g,  b;                             // fixed point, SUBPIXEL precision bits
+    int          r,  g,  b;                             // fixed point, SUBPIXEL precision bits
     int         ir, ig, ib;                             // pure integers, maybe -256 to 255.
 } Weight;
 
 typedef struct  _vector {
     Weight      *py, *pa, *pb;
-    long         r,  g,  b;                             // pure integers, 0 to 255.
+    int         r,  g,  b;                             // pure integers, 0 to 255.
 } Neuron;
 
 static  Weight                  Y[16], A[4], B[4];
 static  Neuron                  N[MAX_NEURONS];
-static  long                    errR, errG, errB, errMax;
-static  long                    totR, totG, totB;
+static  int                     errR, errG, errB, errMax;
+static  int                     totR, totG, totB;
 
 
 #define SUBPIXEL                22
@@ -114,12 +114,12 @@
                                                 x = ((256 << SUBPIXEL) -1)
 
 static int
-_nn_modifyNeurons(long ir, long ig, long ib)
+_nn_modifyNeurons(int ir, int ig, int ib)
 {
     int         i; 
     int         d0, d1;                         // closest & next closest distance to input
     int         p0, p1;                         // index into the 256 color table.
-    long        d, dr, dg, db;
+    int         d, dr, dg, db;
     Weight      *py, *pa, *pb;
     Neuron      *n;
 
@@ -268,10 +268,10 @@
 txMapPal256toYAB(FxU32 *YAB, FxU8 *map, int nsamples, FxU32 *samples)
 {
     int         i;
-    long        bstR, bstG, bstB, bstMax;
+    int         bstR, bstG, bstB, bstMax;
     int         iterations;                     // track how many inputs have been fed to NN
     int         drySpells;                      // how many inputs since last best case.
-    long        yab2pal[256];
+    int         yab2pal[256];
 
     _nn_initTables();
     /* 
@@ -367,7 +367,7 @@
      * Replace MSB of samples with index to be used with YAB table.
      */
 
-    txYABtoPal256((long*)yab2pal, (long*)YAB);
+    txYABtoPal256(yab2pal, YAB);
 
     for (i=0; i<nsamples; i++) {
         int             ir, ig, ib;
@@ -388,7 +388,7 @@
     int         i, w, h;
     int         ncolors;
     int         pixsize = (pxMip->format = GR_TEXFMT_YIQ_422) ? 1 : 2;
-    long        yabTable[16+12+12];
+    int         yabTable[16+12+12];
     FxU8        map[256];
 
 
@@ -425,7 +425,7 @@
          * the 256 color palette generated from the YAB table. This will be 
          * useful for error diffusion dithering.
          */
-        txYABtoPal256((long *)pxMip->pal, (long *)yabTable);
+        txYABtoPal256(pxMip->pal, yabTable);
         txDiffuseIndex(pxMip, txMip, pixsize, pxMip->pal, 256);
     } 
     else {
swlibs/texus/lib/pal256.c +27 -27

134 lines not on this page · raw message

swlibs/texus/lib/quantize.c +28 -28

204 lines not on this page · raw message

swlibs/texus/lib/rgt.c +4 -4
diff -urN Glide_V3-DRI-3.10/swlibs/texus/lib/rgt.c Glide_V3-DRI-3.10-lia/swlibs/texus/lib/rgt.c
@@ -52,7 +52,7 @@
 
 
 
-static void swapShorts(unsigned short *array, long length)
+static void swapShorts(unsigned short *array, int length)
 {
     unsigned short s;
     while (length--) {
@@ -61,7 +61,7 @@
     }
 }
 
-static void swapLongs(unsigned int *array, long length)
+static void swapLongs(unsigned int *array, int length)
 {
     unsigned int s;
     while (length--) {
@@ -72,7 +72,7 @@
 }
 
 // just swap RGB into BGR (leave MSB undefined)
-static void swapRGB(unsigned int *array, long length)
+static void swapRGB(unsigned int *array, int length)
 {
     unsigned int s;
     while (length--) {
@@ -164,7 +164,7 @@
 
 #if 1
         if (swap) {
-            swapRGB((unsigned int *)data32, (long)info->width);
+            swapRGB((unsigned int *)data32, (int)info->width);
         }
 #endif
 
swlibs/texus/lib/texus.h +5 -0
diff -urN Glide_V3-DRI-3.10/swlibs/texus/lib/texus.h Glide_V3-DRI-3.10-lia/swlibs/texus/lib/texus.h
@@ -38,8 +38,13 @@
 typedef unsigned char   FxU8;
 typedef unsigned short  FxU16;
 typedef short           FxI16;
+#ifdef __LP64__
+typedef unsigned int    FxU32;
+typedef int             FxI32;
+#else
 typedef unsigned long   FxU32;
 typedef long            FxI32;
+#endif
 typedef int             FxBool;
 
 /*
swlibs/texus/lib/texusint.h +2 -2
diff -urN Glide_V3-DRI-3.10/swlibs/texus/lib/texusint.h Glide_V3-DRI-3.10-lia/swlibs/texus/lib/texusint.h
@@ -67,7 +67,7 @@
 int             txAspectRatio(int w, int h);
 void    txPanic(char *);
 void    txError(char *);
-void    txYABtoPal256(long *palette, const long* yabTable);
+void    txYABtoPal256(int *palette, const int* yabTable);
 void    txRectCopy(FxU8 *dst, int dstStride, const FxU8 *src, int srcStride,
                         int width, int height);
 FxBool  txMipAlloc(TxMip *txMip);
@@ -90,7 +90,7 @@
 
 void    txDiffuseIndex(TxMip *pxMip, TxMip *txMip, int pixsize, 
                 const FxU32 *palette, int       ncolors);
-int             txNearestColor(long ir, long ig, long ib, const FxU32 *pal, int npal);
+int             txNearestColor(int ir, int ig, int ib, const FxU32 *pal, int npal);
 
 FxBool _txReadTGAHeader( FILE *stream, FxU32 cookie, TxMip *info);
 FxBool _txReadTGAData( FILE *stream, TxMip *info);
swlibs/texus/lib/util.c +5 -5
diff -urN Glide_V3-DRI-3.10/swlibs/texus/lib/util.c Glide_V3-DRI-3.10-lia/swlibs/texus/lib/util.c
@@ -133,14 +133,14 @@
 }
 
 void
-txYABtoPal256(long *palette, const long* yabTable)
+txYABtoPal256(int *palette, const int* yabTable)
 {
         // Convert YAB table to a 256 color palette 
         // Assume yabTable[] has first 16Y's, 12 A's, 12 B's
 
-        const   long    *Y = yabTable;
-        const   long    *A = yabTable + 16;
-        const   long    *B = yabTable + 16 + 12;
+        const   int    *Y = yabTable;
+        const   int    *A = yabTable + 16;
+        const   int    *B = yabTable + 16 + 12;
         int             i;
 
         for (i=0; i<256; i++) {
@@ -265,7 +265,7 @@
 int  *explode3 = &_explode3[255];
 
 int
-txNearestColor(long ir, long ig, long ib, const FxU32 *pal, int ncolors)
+txNearestColor(int ir, int ig, int ib, const FxU32 *pal, int ncolors)
 {
         int             i, d; 
         int             mindist, minpos;                // closest distance to input