complete fixes for DRI/DRM
The patch below is a superset of what I just sent to the [email protected] list. It include the config changes necessary to get the GL/DRI/TDFX support built.
The way this config is setup, you'll get the DRI drivers built into libGl instead of having them as separate modules. I didn't try building them as modules, though I hope it would work just fine.
--david
xc/config/cf/host.def +1 -1
@@ -9,5 +9,5 @@ #define BuildPexExt YES #define BuildHtmlManPages NO #define MakeDllModules YES -#define GlxStubLib YES +#define GlxStubLib NO #define UseInternalMalloc NO
xc/config/cf/linux.cf +10 -6
@@ -161,7 +161,7 @@ #ifndef XF86INT10_BUILD # ifdef i386Architecture # define XF86INT10_BUILD X86VM -# elif defined(ia64Architecture) +# elif 0/*defined(ia64Architecture)*/ # define UseX86Emu NO # define XF86INT10_BUILD XF86INT10_STUB # elif defined(X86EMU_LIBPATH)
@@ -172,7 +172,7 @@ /* The DRM module requires kernel services that appeared in late 2.1.x kernels and are known to be present in 2.2.x kernels. */ #ifndef BuildXF86DRI -# ifdef i386Architecture +# if defined(i386Architecture) || defined(ia64Architecture) # if OSMajorVersion > 2 || (OSMajorVersion = 2 && OSMinorVersion >= 2) # define BuildXF86DRI YES # else
@@ -189,7 +189,7 @@ kernel revisions. So, we'll only build the module for kernels that are known to be supported by the module. */ #ifndef BuildXF86DRM -# ifdef i386Architecture +# if defined(i386Architecture) || defined(ia64Architecture) # if OSMajorVersion = 2 /* Only tested for Linux 2.2.0 through 2.2.12 */ # if OSMinorVersion = 2 && OSTeenyVersion <= 12
@@ -199,8 +199,12 @@ # if OSMinorVersion = 3 && OSTeenyVersion <= 18 # define BuildXF86DRM YES # else - /* Note: add more conditions when 2.4.x and 2.5.x are released */ -# define BuildXF86DRM NO +# if OSMinorVersion = 4 +# define BuildXF86DRM NO +# else + /* Note: add more conditions when 2.5.x is released */ +# define BuildXF86DRM NO +# endif # endif # endif # else
@@ -213,7 +217,7 @@ #endif #ifndef HasAgpGart -# ifdef i386Architecture +# if defined(i386Architecture) || defined(ia64Architecture) /* The AGPGART header file is included in os-support/linux, which allows all drivers that depend on AGP to build properly. */ # define HasAgpGart YES
xc/config/cf/xf86site.def +1 -1
@@ -680,7 +680,7 @@ * If your system doesn't support vm86() mode and you have * libx86emu set library path here * -#define X86EMU_LIBPATH /usr/local/lib */ +#define X86EMU_LIBPATH /usr/local/lib
xc/config/cf/xfree86.cf +2 -2
@@ -234,7 +234,7 @@ /* Pure PCI drivers should go first */ # ifndef XF86CardDrivers -# define XF86CardDrivers mga vga +# define XF86CardDrivers mga vga GlideDriver tdfx r128 AgpGartDrivers XF86ExtraCardDrivers # endif #endif
@@ -549,7 +549,7 @@ # define GlxBuiltInMesa NO # endif # ifndef GlxBuiltInTdfx -# define GlxBuiltInTdfx NO +# define GlxBuiltInTdfx YES # endif # if GlxBuiltInTdfx
xc/extras/Mesa/src/FX/fxddspan.c +1 -1
@@ -396,7 +396,7 @@ {fxMesaContext fxMesa=(fxMesaContext )ctx->DriverCtx;GLuint i; -GLint bottom=fxMesa->y_delta-1 ; +GLint bottom=fxMesa->height+fxMesa->y_offset-1 ;if (MESA_VERBOSE &VERBOSE_DRIVER ) {fprintf (stderr,"fxmesa: fxDDReadRGBAPixels(...)\n" );
xc/extras/x86emu/src/x86emu/makefile.lia64 +60 -0
60 lines not on this page · raw message
xc/lib/GL/Imakefile +13 -6
@@ -79,11 +79,18 @@ TDFXPOBJS = mesa/src/drv/tdfx/profiled/?*.o TDFXDONES = mesa/src/drv/tdfx/DONE - MESAOBJS = mesa/src/?*.o mesa/src/X86/?*.o - MESAUOBJS = mesa/src/unshared/?*.o mesa/src/X86/unshared/?*.o - MESADOBJS = mesa/src/debugger/?*.o mesa/src/X86/debugger/?*.o - MESAPOBJS = mesa/src/profiled/?*.o mesa/src/X86/profiled/?*.o - MESADONES = mesa/src/DONE mesa/src/X86/DONE +#ifdef i386Architecture + MESAOBJSARCH = mesa/src/X86/?*.o + MESAUOBJSARCH = mesa/src/X86/unshared/?*.o + MESADOBJSARCH = mesa/src/X86/debugger/?*.o + MESAPOBJSARCH = mesa/src/X86/profiled/?*.o + MESADONESARCH = mesa/src/X86/DONE +#endif + MESAOBJS = mesa/src/?*.o $(MESAOBJSARCH) + MESAUOBJS = mesa/src/unshared/?*.o $(MESAUOBJSARCH) + MESADOBJS = mesa/src/debugger/?*.o $(MESADOBJSARCH) + MESAPOBJS = mesa/src/profiled/?*.o $(MESAPOBJSARCH) + MESADONES = mesa/src/DONE $(MESADONEARCH) DRIMESAOBJS = mesa/dri/?*.o DRIMESAUOBJS = mesa/dri/unshared/?*.o
@@ -97,7 +104,7 @@ DRVPOBJS = $(TDFXPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) $(DRMPOBJS) DRVDONES = $(TDFXDONES) $(MESADONES) $(DRIMESADONES) $(DRMDONES) - REQUIREDLIBS += -lglide3x + REQUIREDLIBS += -L/usr/local/lib -lglide3x #elif GlxBuiltInMesa #ifndef GlxDriverUsesMesa DRVOBJS = mesa/src/?*.o mesa/src/X/?*.o
xc/lib/GL/dri/XF86dri.c +3 -3
@@ -427,7 +427,7 @@_XEatData (dpy, rep.length);return False; } -_XRead32 (dpy, *pClipRects, rep.length); +_XRead (dpy, (char *) *pClipRects, rep.length); }else { *pClipRects =NULL ; }
@@ -466,7 +466,7 @@ *hFrameBuffer = rep.hFrameBufferLow;#ifdef LONG64 - *hFrameBuffer = ((drmHandle )rep.hFrameBufferHigh) <<32 ; + *hFrameBuffer |= ((drmHandle )rep.hFrameBufferHigh) <<32 ;#endif *fbOrigin = rep.framebufferOrigin;
@@ -479,7 +479,7 @@_XEatData (dpy, ((rep.length+3 ) & ~3 ));return False; } -_XRead32 (dpy, *pDevPrivate, rep.length); +_XRead (dpy, *pDevPrivate, rep.length); }else { *pDevPrivate =NULL ; }
xc/lib/GL/glx/packsingle.h +1 -1
@@ -85,7 +85,7 @@ *((FLOAT32 *) (pc + offset)) = a#else -#define __GLX_SINGLE_PUT_SHORT (offset,a) \ +#define __GLX_SINGLE_PUT_SHORT (offset,a) \ { GLubyte *cp = (pc+offset); \ int shift = (64-16) - ((int)(cp) >> (64-6)); \ *(int *)cp = (*(int *)cp & ~(0xffff << shift)) | ((a & 0xffff) << shift); }
xc/lib/GL/mesa/src/Imakefile +9 -2
@@ -354,7 +354,9 @@ # We have to go into X to make the xmesaP.h symbolic link MESASUBDIRS = X +#ifdef i386Architecture ASMSUBDIRS = X86 +#endif #include <Library.tmpl>
@@ -374,8 +376,13 @@ #if !GlxUseBuiltInDRIDriver && !GlxDriverUsesMesa LIBNAME = mesa_dri.so -ALL_OBJS = $(CORE_OBJS) X/?*.o X86/?*.o -ALL_DEPS = $(SUBDIRS) DONE X/DONE X86/DONE +#ifdef i386Architecture + ALL_OBJS = $(CORE_OBJS) X/?*.o X86/?*.o + ALL_DEPS = $(SUBDIRS) DONE X/DONE X86/DONE +#else + ALL_OBJS = $(CORE_OBJS) X/?*.o + ALL_DEPS = $(SUBDIRS) DONE X/DONE +#endif SharedDepModuleTarget($(LIBNAME),$(ALL_DEPS),$(ALL_OBJS)) InstallDynamicModule($(LIBNAME),$(MODULEDIR)/dri,.)
xc/lib/Xxf86vm/XF86VMode.c +8 -8
@@ -278,7 +278,7 @@Xfree (modeline->private);return False; } -_XRead32 (dpy, modeline->private, rep.privsize *sizeof (INT32 )); +_XRead (dpy, (char *) modeline->private, rep.privsize *sizeof (INT32 )); }else { modeline->private =NULL ; }
@@ -354,7 +354,7 @@for (i =0 ; i < rep.modecount; i++) { modelines[i] = mdinfptr++;if (majorVersion <2 ) { -_XRead32 (dpy, &oldxmdline,sizeof (xXF86OldVidModeModeInfo)); +_XRead (dpy, (char *) &oldxmdline,sizeof (xXF86OldVidModeModeInfo)); modelines[i]->dotclock = oldxmdline.dotclock; modelines[i]->hdisplay = oldxmdline.hdisplay; modelines[i]->hsyncstart = oldxmdline.hsyncstart;
@@ -377,7 +377,7 @@_XEatData (dpy, (oldxmdline.privsize) *sizeof (INT32 ));Xfree (modelines[i]->private); }else { -_XRead32 (dpy, modelines[i]->private, +_XRead (dpy, (char *) modelines[i]->private, oldxmdline.privsize *sizeof (INT32 )); } }else {
@@ -385,7 +385,7 @@ } } }else { -_XRead32 (dpy, &xmdline,sizeof (xXF86VidModeModeInfo)); +_XRead (dpy, (char *) &xmdline,sizeof (xXF86VidModeModeInfo)); modelines[i]->dotclock = xmdline.dotclock; modelines[i]->hdisplay = xmdline.hdisplay; modelines[i]->hsyncstart = xmdline.hsyncstart;
@@ -408,7 +408,7 @@_XEatData (dpy, (xmdline.privsize) *sizeof (INT32 ));Xfree (modelines[i]->private); }else { -_XRead32 (dpy, modelines[i]->private, +_XRead (dpy, (char *) modelines[i]->private, xmdline.privsize *sizeof (INT32 )); } }else {
@@ -962,12 +962,12 @@return False; }for (i =0 ; i < rep.nhsync; i++) { -_XRead32 (dpy, (long *)&syncrange,4 ); +_XRead (dpy, (char *)&syncrange,4 ); monitor->hsync[i].lo = (float )(syncrange &0xFFFF ) /100.0 ; monitor->hsync[i].hi = (float )(syncrange >>16 ) /100.0 ; }for (i =0 ; i < rep.nvsync; i++) { -_XRead32 (dpy, (long *)&syncrange,4 ); +_XRead (dpy, (char *)&syncrange,4 ); monitor->vsync[i].lo = (float )(syncrange &0xFFFF ) /100.0 ; monitor->vsync[i].hi = (float )(syncrange >>16 ) /100.0 ; }
@@ -1100,7 +1100,7 @@ }for (i =0 ; i < rep.clocks; i++) { -_XRead32 (dpy, &dotclk,4 ); +_XRead (dpy, (char *) &dotclk,4 ); dotclocks[i] = dotclk; } *clocksPtr = dotclocks;
xc/programs/Xserver/GL/mesa/src/X/xf86glx.c +3 -0
@@ -62,6 +62,9 @@#include <GL/internal/glcore.h> #endif +/* Avoid cyclic dependency between libglx and libGLcore due +to this symbol and glDDXExtensionInfo. --davidm 00/08/08 */ +__GLXcontext *__glXLastContext;/* * This structure is statically allocated in the __glXScreens[]
xc/programs/Xserver/hw/xfree86/common/compiler.h +57 -6
71 lines not on this page · raw message
xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile +10 -1
@@ -44,7 +44,7 @@ PCIDRVRSRC = freebsdPci.c PCIDRVROBJ = freebsdPci.o -#elif defined(i386Architecture) || defined(ia64Architecture) +#elif defined(i386Architecture) XCOMM ix86 PCI driver
@@ -52,6 +52,15 @@ PCIDRVROBJ = ix86Pci.o XCOMM PCIDRVRSRC = linuxPci.c XCOMM PCIDRVROBJ = linuxPci.o + +#elif defined(ia64Architecture) + +XCOMM Not a typo, just a misnomer. For Linux/ia64 provides the same +XCOMM PCI config read/write syscalls as Linux/alpha, so why not use +XCOMM them? + +PCIDRVRSRC = axpPci.c +PCIDRVROBJ = axpPci.o #else XCOMM no PCI driver -- shouldn't get here
xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h +3 -2
@@ -85,7 +85,7 @@*/ #define MAX_PCI_DEVICES 64/* Max number of devices accomodated */ /* by xf86scanpci */ -#define MAX_PCI_BUSES 32/* Max number of PCI buses */ +#define MAX_PCI_BUSES 256/* Max number of PCI buses */ #define PCI_NOT_FOUND 0xffffffff
@@ -106,6 +106,7 @@* Debug Macros/Definitions */ /* #define DEBUGPCI 2 */ /* Disable/enable trace in PCI code */ +#define ErrorF printf#if defined(DEBUGPCI )
@@ -146,7 +147,7 @@# endif #elif defined(__sparc__) && defined(linux)# define ARCH_PCI_INIT sparcPciInit -#elif defined(__alpha__) && defined(linux) +#elif (defined(__alpha__) || defined(__ia64__)) && defined(linux)# define ARCH_PCI_INIT axpPciInit# define INCLUDE_XF86_MAP_PCI_MEM #elif defined(__alpha__) && defined(__FreeBSD__)
xc/programs/Xserver/hw/xfree86/os-support/bus/axpPci.c +21 -0
@@ -61,6 +61,7 @@void axpPciCfgWrite (PCITAG ,int off,CARD32 val);void axpPciCfgSetBits (PCITAG tag,int off,CARD32 mask,CARD32 bits); +#if 0 pciBusInfo_t axpPci0 = {/* configMech */ PCI_CFG_MECH_OTHER , /* numDevices */ 32,
@@ -77,12 +78,32 @@ },/* pciBusPriv */ NULL }; +#else +pciBusInfo_t axpPci[MAX_PCI_BUSES ]; +#endif void axpPciInit () { +#if 0 pciNumBuses =1 ; pciBusInfo[0 ] = &axpPci0; +#else +int i; + + pciNumBuses =MAX_PCI_BUSES ; +memset (&axpPci,0 ,sizeof (axpPci)); +for (i =0 ; i <MAX_PCI_BUSES ; ++i) { + axpPci[i].configMech =PCI_CFG_MECH_OTHER ; + axpPci[i].numDevices =32 ; + axpPci[i].funcs.pciReadLong = axpPciCfgRead; + axpPci[i].funcs.pciWriteLong = axpPciCfgWrite; + axpPci[i].funcs.pciSetBitsLong = axpPciCfgSetBits; + axpPci[i].funcs.pciAddrHostToBus = pciAddrNOOP; + axpPci[i].funcs.pciAddrBusToHost = pciAddrNOOP; + pciBusInfo[i] = axpPci + i; + } +#endif pciFindFirstFP = pciGenFindFirst; pciFindNextFP = pciGenFindNext; }
xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c +8 -0
@@ -497,7 +497,15 @@ drmSize size, drmAddressPtr address) { +static unsigned long pagesize_mask =0 ; +if (fd <0 )return -EINVAL ; + +if (!pagesize_mask) + pagesize_mask =getpagesize () -1 ; + + size = (size + pagesize_mask) & ~pagesize_mask; + *address =mmap (0 , size,PROT_READ |PROT_WRITE ,MAP_SHARED , fd, handle);if (*address =MAP_FAILED )return -errno;return 0 ;
xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c +2 -0
@@ -143,7 +143,9 @@/* For xf86getpagesize() */ #if defined(linux) +#if 0 #include <asm/page.h> +#endif #define HAS_SC_PAGESIZE #define HAS_GETPAGESIZE #elif defined(CSRG_BASED )
xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h +33 -2
@@ -179,7 +179,8 @@#define DRM_LOCK_HELD 0x80000000/* Hardware lock is held */ #define DRM_LOCK_CONT 0x40000000/* Hardware lock is contended */ -#if __GNUC__ >=2 && defined(__i386) +#if __GNUC__ >=2 +# if defined(__i386)/* Reflect changes here to drmP.h */ #define DRM_CAS (lock,old,new,__ret) \ do { \
@@ -193,10 +194,40 @@ : "2" (old), \ "r" (new)); \ } while (0) + +# elif defined (__ia64__) + +#if 0 +/* this currently generates bad code (missing stop bits)... */ +#include <ia64intrin.h> + +#define DRM_CAS (lock,old,new,__ret) \ + do { \ + __ret = (__sync_val_compare_and_swap(&__drm_dummy_lock(lock), \ + (old), (new)) \ + != (old)); \ + } while (0) + +#else +#define DRM_CAS (lock,old,new,__ret) \ + do { \ + unsigned int __result, __old = (old); \ + __asm__ __volatile__( \ + "mf\n" \ + "mov ar.ccv=%2\n" \ + ";;\n" \ + "cmpxchg4.acq %0=%1,%3,ar.ccv" \ + : "=r" (__result), "=m" (__drm_dummy_lock(lock)) \ + : "r" (__old), "r" (new) \ + : "memory"); \ + __ret = (__result) != (__old); \ + } while (0)#endif +# endif /* __ia64__ */ +#endif /* __GNUC__ >= 2 */ #ifndef DRM_CAS -#define DRM_CAS (lock,old,new,ret)/* FAST LOCK FAILS */ +#define DRM_CAS (lock,old,new,ret)/* FAST LOCK FAILS */ THIS IS BROKEN!!!#endif #define DRM_LIGHT_LOCK (fd,lock,context) \