Index: extras/Mesa/include/GL/internal/dri_interface.h =================================================================== RCS file: /cvs/xorg/xc/extras/Mesa/include/GL/internal/dri_interface.h,v retrieving revision 1.1.1.5 diff -u -p -r1.1.1.5 dri_interface.h --- extras/Mesa/include/GL/internal/dri_interface.h 18 Oct 2005 02:51:49 -0000 1.1.1.5 +++ extras/Mesa/include/GL/internal/dri_interface.h 14 Nov 2005 17:11:38 -0000 @@ -39,7 +39,6 @@ #define DRI_INTERFACE_H #include -#include #include /** Index: extras/Mesa/src/mesa/drivers/dri/common/dri_util.c =================================================================== RCS file: /cvs/xorg/xc/extras/Mesa/src/mesa/drivers/dri/common/dri_util.c,v retrieving revision 1.5 diff -u -p -r1.5 dri_util.c --- extras/Mesa/src/mesa/drivers/dri/common/dri_util.c 18 Oct 2005 03:10:14 -0000 1.5 +++ extras/Mesa/src/mesa/drivers/dri/common/dri_util.c 14 Nov 2005 17:11:38 -0000 @@ -131,9 +131,8 @@ static void __driGarbageCollectDrawables __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)pdraw->private; dpy = pdp->driScreenPriv->display; if (! (*dri_interface->windowExists)(dpy, draw)) { - /* Destroy the local drawable data in the hash table, if the - drawable no longer exists in the Xserver */ - drmHashDelete(drawHash, draw); + /* Destroy the local drawable data, if the drawable no + longer exists in the Xserver */ (*pdraw->destroyDrawable)(dpy, pdraw->private); _mesa_free(pdraw); } @@ -664,6 +663,7 @@ static void driDestroyDrawable(__DRInati (*psp->DriverAPI.DestroyBuffer)(pdp); if ((*dri_interface->windowExists)(dpy, pdp->draw)) (void)(*dri_interface->destroyDrawable)(dpy, scrn, pdp->draw); + drmHashDelete(psp->drawHash, pdp->draw); if (pdp->pClipRects) { _mesa_free(pdp->pClipRects); pdp->pClipRects = NULL; Index: extras/Mesa/src/mesa/drivers/dri/common/dri_util.h =================================================================== RCS file: /cvs/xorg/xc/extras/Mesa/src/mesa/drivers/dri/common/dri_util.h,v retrieving revision 1.1.1.4 diff -u -p -r1.1.1.4 dri_util.h --- extras/Mesa/src/mesa/drivers/dri/common/dri_util.h 31 Jul 2005 16:47:10 -0000 1.1.1.4 +++ extras/Mesa/src/mesa/drivers/dri/common/dri_util.h 14 Nov 2005 17:11:38 -0000 @@ -54,6 +54,7 @@ #include #include "drm.h" #include "drm_sarea.h" +#include "xf86drm.h" #include "GL/internal/glcore.h" #include "GL/internal/dri_interface.h" Index: extras/Mesa/src/mesa/drivers/dri/common/glcontextmodes.c =================================================================== RCS file: /cvs/xorg/xc/extras/Mesa/src/mesa/drivers/dri/common/glcontextmodes.c,v retrieving revision 1.1.1.3 diff -u -p -r1.1.1.3 glcontextmodes.c --- extras/Mesa/src/mesa/drivers/dri/common/glcontextmodes.c 18 Oct 2005 02:51:57 -0000 1.1.1.3 +++ extras/Mesa/src/mesa/drivers/dri/common/glcontextmodes.c 14 Nov 2005 17:11:39 -0000 @@ -157,8 +157,8 @@ _gl_copy_visual_to_context_mode( __GLcon mode->greenMask = config->greenMask; mode->blueMask = config->blueMask; mode->alphaMask = config->alphaMask; - mode->rgbBits = config->bufferSize; - mode->indexBits = config->bufferSize; + mode->rgbBits = mode->rgbMode ? config->bufferSize : 0; + mode->indexBits = mode->colorIndexMode ? config->bufferSize : 0; mode->accumRedBits = config->accumRedSize; mode->accumGreenBits = config->accumGreenSize; Index: programs/Xserver/Imakefile =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/Imakefile,v retrieving revision 1.34 diff -u -p -r1.34 Imakefile --- programs/Xserver/Imakefile 11 Jul 2005 20:30:31 -0000 1.34 +++ programs/Xserver/Imakefile 14 Nov 2005 17:11:43 -0000 @@ -66,24 +66,17 @@ INSTPGMFLAGS = DRILIB = # endif # if GlxUseSGISI - GLXLIB = GL/glx/ModuleLibraryTargetName(glx) \ - GL/sgi-si/ModuleLibraryTargetName(GLcore) \ - $(DRILIB) + GLXLIB = GL/glx/ModuleLibraryTargetName(glx) $(DRILIB) # else # if defined(GlxUseWindows) && GlxUseWindows - XWin_GL.exe.GLXLIB = GL/glx/ModuleLibraryTargetName(glx_stdcall) \ - GL/windows/ModuleLibraryTargetName(GLcore) + XWin_GL.exe.GLXLIB = GL/glx/ModuleLibraryTargetName(glx_stdcall) # endif /* GlxUseWindows */ # if defined(Win32Architecture) && defined(GlxUseWindows) && GlxUseWindows - GLXLIB = GL/glx/ModuleLibraryTargetName(glx_stdcall) \ - GL/windows/ModuleLibraryTargetName(GLcore) + GLXLIB = GL/glx/ModuleLibraryTargetName(glx_stdcall) # elif DoLoadableServer - GLXLIB = GL/glx/ModuleLibraryTargetName(glx) \ - GL/mesa/GLcore/ModuleLibraryTargetName(GLcore) + GLXLIB = GL/glx/ModuleLibraryTargetName(glx) # else - GLXLIB = GL/glx/ModuleLibraryTargetName(glx) \ - GL/mesa/GLcore/ModuleLibraryTargetName(GLcore) \ - $(DRILIB) + GLXLIB = GL/glx/ModuleLibraryTargetName(glx) $(DRILIB) # endif # endif GLXDIR = GL @@ -1160,18 +1153,16 @@ BundleProgramTarget(fullscreen,XDarwinAp * GLX bundles for Quartz * (installed in their own bundles inside XDarwin's) */ -BundleProgramTarget(glxAGL,XDarwinApp,GL,GL/glx/glxext.o,GL/glx/libglx.a \ - GL/apple/libAGLcore.a, \ +BundleProgramTarget(glxAGL,XDarwinApp,GL,GL/glx/glxext.o,GL/glx/libglx.a, \ -framework AGL -framework OpenGL,$(XDARWINAPPDIR)/Resources) #if BuildAppleDRI -BundleProgramTarget(glxCGL,XDarwinApp,GL,GL/glx/glxext.o,GL/glx/libglx.a \ - GL/apple/libCGLcore.a, \ +BundleProgramTarget(glxCGL,XDarwinApp,GL,GL/glx/glxext.o,GL/glx/libglx.a, \ -framework OpenGL $(XPLUGINLIB),$(XDARWINAPPDIR)/Resources) #endif -BundleProgramTarget(glxMesa,XDarwinApp,GL,GL/glx/glxext.o,GL/glx/libglx.a \ - GL/mesa/GLcore/libGLcore.a,NullParameter,$(XDARWINAPPDIR)/Resources) +BundleProgramTarget(glxMesa,XDarwinApp,GL,GL/glx/glxext.o,GL/glx/libglx.a, \ + NullParameter,$(XDARWINAPPDIR)/Resources) #else /* !DarwinQuartzSupport */ Index: programs/Xserver/GL/Imakefile =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/GL/Imakefile,v retrieving revision 1.6 diff -u -p -r1.6 Imakefile --- programs/Xserver/GL/Imakefile 15 Nov 2004 15:06:46 -0000 1.6 +++ programs/Xserver/GL/Imakefile 14 Nov 2005 17:11:43 -0000 @@ -5,24 +5,12 @@ XCOMM $XFree86: xc/programs/Xserver/GL/I #define IHaveSubdirs -#if GlxUseSGISI - CORE_SUBDIR = /* opengl */ -#elif defined(DarwinArchitecture) && DarwinQuartzSupport - CORE_SUBDIR = apple mesa -#elif defined(cygwinArchitecture) && GlxUseWindows - CORE_SUBDIR = windows mesa -#elif defined(Win32Architecture) && GlxUseWindows - CORE_SUBDIR = windows -#else - CORE_SUBDIR = mesa -#endif - #if BuildXF86DRI && ((defined(XF86Server) && XF86Server) \ || (defined(XorgServer) && XorgServer)) DRI_SUBDIR = dri #endif -SUBDIRS = glx $(DRI_SUBDIR) $(CORE_SUBDIR) +SUBDIRS = glx $(DRI_SUBDIR) #if DoLoadableServer MSRCS = glxmodule.c Index: programs/Xserver/GL/glxmodule.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/GL/glxmodule.c,v retrieving revision 1.6 diff -u -p -r1.6 glxmodule.c --- programs/Xserver/GL/glxmodule.c 28 Sep 2005 03:37:22 -0000 1.6 +++ programs/Xserver/GL/glxmodule.c 14 Nov 2005 17:11:43 -0000 @@ -45,7 +45,6 @@ static MODULESETUPPROTO(glxSetup); extern void GlxExtensionInit(INITARGS); extern void GlxWrapInitVisuals(miInitVisualsProcPtr *); -extern void InitGlxWrapInitVisuals(void (*f)(miInitVisualsProcPtr *)); static const char *initdeps[] = { "DOUBLE-BUFFER", NULL }; @@ -58,1168 +57,6 @@ ExtensionModule GLXExt = initdeps }; -static const char *glcoreSymbols[] = { - "__glCallLists_size", - "__glColorTableParameterfv_size", - "__glColorTableParameteriv_size", - "__glConvolutionParameterfv_size", - "__glConvolutionParameteriv_size", - "__glDDXExtensionInfo", - "__glDDXScreenInfo", - "__glFloorLog2", - "__glFogfv_size", - "__glFogiv_size", - "__glGetBooleanv_size", - "__glGetColorTableParameterfv_size", - "__glGetColorTableParameteriv_size", - "__glGetConvolutionParameterfv_size", - "__glGetConvolutionParameteriv_size", - "__glGetDoublev_size", - "__glGetFloatv_size", - "__glGetHistogramParameterfv_size", - "__glGetHistogramParameteriv_size", - "__glGetIntegerv_size", - "__glGetLightfv_size", - "__glGetLightiv_size", - "__glGetMapdv_size", - "__glGetMapfv_size", - "__glGetMapiv_size", - "__glGetMaterialfv_size", - "__glGetMaterialiv_size", - "__glGetMinmaxParameterfv_size", - "__glGetMinmaxParameteriv_size", - "__glGetPixelMapfv_size", - "__glGetPixelMapuiv_size", - "__glGetPixelMapusv_size", - "__glGetTexEnvfv_size", - "__glGetTexEnviv_size", - "__glGetTexGendv_size", - "__glGetTexGenfv_size", - "__glGetTexGeniv_size", - "__glGetTexImage_size", - "__glGetTexLevelParameterfv_size", - "__glGetTexLevelParameteriv_size", - "__glGetTexParameterfv_size", - "__glGetTexParameteriv_size", - "__glLightModelfv_size", - "__glLightModeliv_size", - "__glLightfv_size", - "__glLightiv_size", - "__glMaterialfv_size", - "__glMaterialiv_size", - "__glPointParameterfvARB_size", - "__glReadPixels_size", - "__glTexEnvfv_size", - "__glTexEnviv_size", - "__glTexGendv_size", - "__glTexGenfv_size", - "__glTexGeniv_size", - "__glTexParameterfv_size", - "__glTexParameteriv_size", - "__glXglDDXExtensionInfo", - "__glXglDDXScreenInfo", - "__glXActiveScreens", - "__glXAssociateContext", - "__glXBadContext", - "__glXBadContextState", - "__glXBadContextTag", - "__glXBadCurrentWindow", - "__glXBadDrawable", - "__glXBadLargeRequest", - "__glXBadPixmap", - "__glXBadRenderRequest", - "__glXBitmapReqSize", - "__glXCacheDrawableSize", - "__glXCallListsReqSize", - "__glXClearErrorOccured", - "__glXClientInfo", - "__glXClientRes", - "__glXClients", - "__glXColorSubTableReqSize", - "__glXColorTableParameterfvReqSize", - "__glXColorTableParameterivReqSize", - "__glXColorTableReqSize", - "__glXContextRes", - "__glXConvolutionFilter1DReqSize", - "__glXConvolutionFilter2DReqSize", - "__glXConvolutionParameterfvReqSize", - "__glXConvolutionParameterivReqSize", - "__glXCopyContext", - "__glXCoreType", - "__glXCreateContext", - "__glXCreateGLXPixmap", - "__glXDeassociateContext", - "__glXDestroyContext", - "__glXDestroyGLXPixmap", - "__glXDispSwap_Accum", - "__glXDispSwap_ActiveStencilFaceEXT", - "__glXDispSwap_ActiveTextureARB", - "__glXDispSwap_AlphaFunc", - "__glXDispSwap_AreTexturesResident", - "__glXDispSwap_AreTexturesResidentEXT", - "__glXDispSwap_Begin", - "__glXDispSwap_BindTexture", - "__glXDispSwap_Bitmap", - "__glXDispSwap_BlendColor", - "__glXDispSwap_BlendEquation", - "__glXDispSwap_BlendFunc", - "__glXDispSwap_CallList", - "__glXDispSwap_CallLists", - "__glXDispSwap_Clear", - "__glXDispSwap_ClearAccum", - "__glXDispSwap_ClearColor", - "__glXDispSwap_ClearDepth", - "__glXDispSwap_ClearIndex", - "__glXDispSwap_ClearStencil", - "__glXDispSwap_ClipPlane", - "__glXDispSwap_Color3bv", - "__glXDispSwap_Color3dv", - "__glXDispSwap_Color3fv", - "__glXDispSwap_Color3iv", - "__glXDispSwap_Color3sv", - "__glXDispSwap_Color3ubv", - "__glXDispSwap_Color3uiv", - "__glXDispSwap_Color3usv", - "__glXDispSwap_Color4bv", - "__glXDispSwap_Color4dv", - "__glXDispSwap_Color4fv", - "__glXDispSwap_Color4iv", - "__glXDispSwap_Color4sv", - "__glXDispSwap_Color4ubv", - "__glXDispSwap_Color4uiv", - "__glXDispSwap_Color4usv", - "__glXDispSwap_ColorMask", - "__glXDispSwap_ColorMaterial", - "__glXDispSwap_ColorSubTable", - "__glXDispSwap_ColorTable", - "__glXDispSwap_ColorTableParameterfv", - "__glXDispSwap_ColorTableParameteriv", - "__glXDispSwap_ConvolutionFilter1D", - "__glXDispSwap_ConvolutionFilter2D", - "__glXDispSwap_ConvolutionParameterf", - "__glXDispSwap_ConvolutionParameterfv", - "__glXDispSwap_ConvolutionParameteri", - "__glXDispSwap_ConvolutionParameteriv", - "__glXDispSwap_CopyColorSubTable", - "__glXDispSwap_CopyColorTable", - "__glXDispSwap_CopyConvolutionFilter1D", - "__glXDispSwap_CopyConvolutionFilter2D", - "__glXDispSwap_CopyPixels", - "__glXDispSwap_CopyTexImage1D", - "__glXDispSwap_CopyTexImage2D", - "__glXDispSwap_CopyTexSubImage1D", - "__glXDispSwap_CopyTexSubImage2D", - "__glXDispSwap_CopyTexSubImage3D", - "__glXDispSwap_CullFace", - "__glXDispSwap_DeleteLists", - "__glXDispSwap_DeleteTextures", - "__glXDispSwap_DeleteTexturesEXT", - "__glXDispSwap_DepthFunc", - "__glXDispSwap_DepthMask", - "__glXDispSwap_DepthRange", - "__glXDispSwap_Disable", - "__glXDispSwap_DrawArrays", - "__glXDispSwap_DrawArraysEXT", - "__glXDispSwap_DrawBuffer", - "__glXDispSwap_DrawPixels", - "__glXDispSwap_EdgeFlagv", - "__glXDispSwap_Enable", - "__glXDispSwap_End", - "__glXDispSwap_EndList", - "__glXDispSwap_EvalCoord1dv", - "__glXDispSwap_EvalCoord1fv", - "__glXDispSwap_EvalCoord2dv", - "__glXDispSwap_EvalCoord2fv", - "__glXDispSwap_EvalMesh1", - "__glXDispSwap_EvalMesh2", - "__glXDispSwap_EvalPoint1", - "__glXDispSwap_EvalPoint2", - "__glXDispSwap_FeedbackBuffer", - "__glXDispSwap_Finish", - "__glXDispSwap_Flush", - "__glXDispSwap_Fogf", - "__glXDispSwap_Fogfv", - "__glXDispSwap_Fogi", - "__glXDispSwap_Fogiv", - "__glXDispSwap_FrontFace", - "__glXDispSwap_Frustum", - "__glXDispSwap_GenLists", - "__glXDispSwap_GenTextures", - "__glXDispSwap_GenTexturesEXT", - "__glXDispSwap_GetBooleanv", - "__glXDispSwap_GetClipPlane", - "__glXDispSwap_GetColorTable", - "__glXDispSwap_GetColorTableParameterfv", - "__glXDispSwap_GetColorTableParameteriv", - "__glXDispSwap_GetConvolutionFilter", - "__glXDispSwap_GetConvolutionParameterfv", - "__glXDispSwap_GetConvolutionParameteriv", - "__glXDispSwap_GetDoublev", - "__glXDispSwap_GetError", - "__glXDispSwap_GetFloatv", - "__glXDispSwap_GetHistogram", - "__glXDispSwap_GetHistogramParameterfv", - "__glXDispSwap_GetHistogramParameteriv", - "__glXDispSwap_GetIntegerv", - "__glXDispSwap_GetLightfv", - "__glXDispSwap_GetLightiv", - "__glXDispSwap_GetMapdv", - "__glXDispSwap_GetMapfv", - "__glXDispSwap_GetMapiv", - "__glXDispSwap_GetMaterialfv", - "__glXDispSwap_GetMaterialiv", - "__glXDispSwap_GetMinmax", - "__glXDispSwap_GetMinmaxParameterfv", - "__glXDispSwap_GetMinmaxParameteriv", - "__glXDispSwap_GetPixelMapfv", - "__glXDispSwap_GetPixelMapuiv", - "__glXDispSwap_GetPixelMapusv", - "__glXDispSwap_GetPolygonStipple", - "__glXDispSwap_GetSeparableFilter", - "__glXDispSwap_GetString", - "__glXDispSwap_GetTexEnvfv", - "__glXDispSwap_GetTexEnviv", - "__glXDispSwap_GetTexGendv", - "__glXDispSwap_GetTexGenfv", - "__glXDispSwap_GetTexGeniv", - "__glXDispSwap_GetTexImage", - "__glXDispSwap_GetTexLevelParameterfv", - "__glXDispSwap_GetTexLevelParameteriv", - "__glXDispSwap_GetTexParameterfv", - "__glXDispSwap_GetTexParameteriv", - "__glXDispSwap_Hint", - "__glXDispSwap_Histogram", - "__glXDispSwap_IndexMask", - "__glXDispSwap_Indexdv", - "__glXDispSwap_Indexfv", - "__glXDispSwap_Indexiv", - "__glXDispSwap_Indexsv", - "__glXDispSwap_Indexubv", - "__glXDispSwap_InitNames", - "__glXDispSwap_IsEnabled", - "__glXDispSwap_IsList", - "__glXDispSwap_IsTexture", - "__glXDispSwap_IsTextureEXT", - "__glXDispSwap_LightModelf", - "__glXDispSwap_LightModelfv", - "__glXDispSwap_LightModeli", - "__glXDispSwap_LightModeliv", - "__glXDispSwap_Lightf", - "__glXDispSwap_Lightfv", - "__glXDispSwap_Lighti", - "__glXDispSwap_Lightiv", - "__glXDispSwap_LineStipple", - "__glXDispSwap_LineWidth", - "__glXDispSwap_ListBase", - "__glXDispSwap_LoadIdentity", - "__glXDispSwap_LoadMatrixd", - "__glXDispSwap_LoadMatrixf", - "__glXDispSwap_LoadName", - "__glXDispSwap_LogicOp", - "__glXDispSwap_Map1d", - "__glXDispSwap_Map1f", - "__glXDispSwap_Map2d", - "__glXDispSwap_Map2f", - "__glXDispSwap_MapGrid1d", - "__glXDispSwap_MapGrid1f", - "__glXDispSwap_MapGrid2d", - "__glXDispSwap_MapGrid2f", - "__glXDispSwap_Materialf", - "__glXDispSwap_Materialfv", - "__glXDispSwap_Materiali", - "__glXDispSwap_Materialiv", - "__glXDispSwap_MatrixMode", - "__glXDispSwap_Minmax", - "__glXDispSwap_MultMatrixd", - "__glXDispSwap_MultMatrixf", - "__glXDispSwap_MultiTexCoord1dvARB", - "__glXDispSwap_MultiTexCoord1fvARB", - "__glXDispSwap_MultiTexCoord1ivARB", - "__glXDispSwap_MultiTexCoord1svARB", - "__glXDispSwap_MultiTexCoord2dvARB", - "__glXDispSwap_MultiTexCoord2fvARB", - "__glXDispSwap_MultiTexCoord2ivARB", - "__glXDispSwap_MultiTexCoord2svARB", - "__glXDispSwap_MultiTexCoord3dvARB", - "__glXDispSwap_MultiTexCoord3fvARB", - "__glXDispSwap_MultiTexCoord3ivARB", - "__glXDispSwap_MultiTexCoord3svARB", - "__glXDispSwap_MultiTexCoord4dvARB", - "__glXDispSwap_MultiTexCoord4fvARB", - "__glXDispSwap_MultiTexCoord4ivARB", - "__glXDispSwap_MultiTexCoord4svARB", - "__glXDispSwap_NewList", - "__glXDispSwap_Normal3bv", - "__glXDispSwap_Normal3dv", - "__glXDispSwap_Normal3fv", - "__glXDispSwap_Normal3iv", - "__glXDispSwap_Normal3sv", - "__glXDispSwap_Ortho", - "__glXDispSwap_PassThrough", - "__glXDispSwap_PixelMapfv", - "__glXDispSwap_PixelMapuiv", - "__glXDispSwap_PixelMapusv", - "__glXDispSwap_PixelStoref", - "__glXDispSwap_PixelStorei", - "__glXDispSwap_PixelTransferf", - "__glXDispSwap_PixelTransferi", - "__glXDispSwap_PixelZoom", - "__glXDispSwap_PointParameterfARB", - "__glXDispSwap_PointParameterfvARB", - "__glXDispSwap_PointSize", - "__glXDispSwap_PolygonMode", - "__glXDispSwap_PolygonOffset", - "__glXDispSwap_PolygonStipple", - "__glXDispSwap_PopAttrib", - "__glXDispSwap_PopMatrix", - "__glXDispSwap_PopName", - "__glXDispSwap_PrioritizeTextures", - "__glXDispSwap_PushAttrib", - "__glXDispSwap_PushMatrix", - "__glXDispSwap_PushName", - "__glXDispSwap_RasterPos2dv", - "__glXDispSwap_RasterPos2fv", - "__glXDispSwap_RasterPos2iv", - "__glXDispSwap_RasterPos2sv", - "__glXDispSwap_RasterPos3dv", - "__glXDispSwap_RasterPos3fv", - "__glXDispSwap_RasterPos3iv", - "__glXDispSwap_RasterPos3sv", - "__glXDispSwap_RasterPos4dv", - "__glXDispSwap_RasterPos4fv", - "__glXDispSwap_RasterPos4iv", - "__glXDispSwap_RasterPos4sv", - "__glXDispSwap_ReadBuffer", - "__glXDispSwap_ReadPixels", - "__glXDispSwap_Rectdv", - "__glXDispSwap_Rectfv", - "__glXDispSwap_Rectiv", - "__glXDispSwap_Rectsv", - "__glXDispSwap_RenderMode", - "__glXDispSwap_ResetHistogram", - "__glXDispSwap_ResetMinmax", - "__glXDispSwap_Rotated", - "__glXDispSwap_Rotatef", - "__glXDispSwap_Scaled", - "__glXDispSwap_Scalef", - "__glXDispSwap_Scissor", - "__glXDispSwap_SelectBuffer", - "__glXDispSwap_SeparableFilter2D", - "__glXDispSwap_ShadeModel", - "__glXDispSwap_StencilFunc", - "__glXDispSwap_StencilMask", - "__glXDispSwap_StencilOp", - "__glXDispSwap_TexCoord1dv", - "__glXDispSwap_TexCoord1fv", - "__glXDispSwap_TexCoord1iv", - "__glXDispSwap_TexCoord1sv", - "__glXDispSwap_TexCoord2dv", - "__glXDispSwap_TexCoord2fv", - "__glXDispSwap_TexCoord2iv", - "__glXDispSwap_TexCoord2sv", - "__glXDispSwap_TexCoord3dv", - "__glXDispSwap_TexCoord3fv", - "__glXDispSwap_TexCoord3iv", - "__glXDispSwap_TexCoord3sv", - "__glXDispSwap_TexCoord4dv", - "__glXDispSwap_TexCoord4fv", - "__glXDispSwap_TexCoord4iv", - "__glXDispSwap_TexCoord4sv", - "__glXDispSwap_TexEnvf", - "__glXDispSwap_TexEnvfv", - "__glXDispSwap_TexEnvi", - "__glXDispSwap_TexEnviv", - "__glXDispSwap_TexGend", - "__glXDispSwap_TexGendv", - "__glXDispSwap_TexGenf", - "__glXDispSwap_TexGenfv", - "__glXDispSwap_TexGeni", - "__glXDispSwap_TexGeniv", - "__glXDispSwap_TexImage1D", - "__glXDispSwap_TexImage2D", - "__glXDispSwap_TexImage3D", - "__glXDispSwap_TexParameterf", - "__glXDispSwap_TexParameterfv", - "__glXDispSwap_TexParameteri", - "__glXDispSwap_TexParameteriv", - "__glXDispSwap_TexSubImage1D", - "__glXDispSwap_TexSubImage2D", - "__glXDispSwap_TexSubImage3D", - "__glXDispSwap_Translated", - "__glXDispSwap_Translatef", - "__glXDispSwap_Vertex2dv", - "__glXDispSwap_Vertex2fv", - "__glXDispSwap_Vertex2iv", - "__glXDispSwap_Vertex2sv", - "__glXDispSwap_Vertex3dv", - "__glXDispSwap_Vertex3fv", - "__glXDispSwap_Vertex3iv", - "__glXDispSwap_Vertex3sv", - "__glXDispSwap_Vertex4dv", - "__glXDispSwap_Vertex4fv", - "__glXDispSwap_Vertex4iv", - "__glXDispSwap_Vertex4sv", - "__glXDispSwap_Viewport", - "__glXDispSwap_WindowPos3fARB", - "__glXDisp_Accum", - "__glXDisp_ActiveStencilFaceEXT", - "__glXDisp_ActiveTextureARB", - "__glXDisp_AlphaFunc", - "__glXDisp_AreTexturesResident", - "__glXDisp_AreTexturesResidentEXT", - "__glXDisp_Begin", - "__glXDisp_BindTexture", - "__glXDisp_Bitmap", - "__glXDisp_BlendColor", - "__glXDisp_BlendEquation", - "__glXDisp_BlendFunc", - "__glXDisp_CallList", - "__glXDisp_CallLists", - "__glXDisp_Clear", - "__glXDisp_ClearAccum", - "__glXDisp_ClearColor", - "__glXDisp_ClearDepth", - "__glXDisp_ClearIndex", - "__glXDisp_ClearStencil", - "__glXDisp_ClipPlane", - "__glXDisp_Color3bv", - "__glXDisp_Color3dv", - "__glXDisp_Color3fv", - "__glXDisp_Color3iv", - "__glXDisp_Color3sv", - "__glXDisp_Color3ubv", - "__glXDisp_Color3uiv", - "__glXDisp_Color3usv", - "__glXDisp_Color4bv", - "__glXDisp_Color4dv", - "__glXDisp_Color4fv", - "__glXDisp_Color4iv", - "__glXDisp_Color4sv", - "__glXDisp_Color4ubv", - "__glXDisp_Color4uiv", - "__glXDisp_Color4usv", - "__glXDisp_ColorMask", - "__glXDisp_ColorMaterial", - "__glXDisp_ColorSubTable", - "__glXDisp_ColorTable", - "__glXDisp_ColorTableParameterfv", - "__glXDisp_ColorTableParameteriv", - "__glXDisp_ConvolutionFilter1D", - "__glXDisp_ConvolutionFilter2D", - "__glXDisp_ConvolutionParameterf", - "__glXDisp_ConvolutionParameterfv", - "__glXDisp_ConvolutionParameteri", - "__glXDisp_ConvolutionParameteriv", - "__glXDisp_CopyColorSubTable", - "__glXDisp_CopyColorTable", - "__glXDisp_CopyConvolutionFilter1D", - "__glXDisp_CopyConvolutionFilter2D", - "__glXDisp_CopyPixels", - "__glXDisp_CopyTexImage1D", - "__glXDisp_CopyTexImage2D", - "__glXDisp_CopyTexSubImage1D", - "__glXDisp_CopyTexSubImage2D", - "__glXDisp_CopyTexSubImage3D", - "__glXDisp_CullFace", - "__glXDisp_DeleteLists", - "__glXDisp_DeleteTextures", - "__glXDisp_DeleteTexturesEXT", - "__glXDisp_DepthFunc", - "__glXDisp_DepthMask", - "__glXDisp_DepthRange", - "__glXDisp_Disable", - "__glXDisp_DrawArrays", - "__glXDisp_DrawArraysEXT", - "__glXDisp_DrawBuffer", - "__glXDisp_DrawPixels", - "__glXDisp_EdgeFlagv", - "__glXDisp_Enable", - "__glXDisp_End", - "__glXDisp_EndList", - "__glXDisp_EvalCoord1dv", - "__glXDisp_EvalCoord1fv", - "__glXDisp_EvalCoord2dv", - "__glXDisp_EvalCoord2fv", - "__glXDisp_EvalMesh1", - "__glXDisp_EvalMesh2", - "__glXDisp_EvalPoint1", - "__glXDisp_EvalPoint2", - "__glXDisp_FeedbackBuffer", - "__glXDisp_Finish", - "__glXDisp_Flush", - "__glXDisp_Fogf", - "__glXDisp_Fogfv", - "__glXDisp_Fogi", - "__glXDisp_Fogiv", - "__glXDisp_FrontFace", - "__glXDisp_Frustum", - "__glXDisp_GenLists", - "__glXDisp_GenTextures", - "__glXDisp_GenTexturesEXT", - "__glXDisp_GetBooleanv", - "__glXDisp_GetClipPlane", - "__glXDisp_GetColorTable", - "__glXDisp_GetColorTableParameterfv", - "__glXDisp_GetColorTableParameteriv", - "__glXDisp_GetConvolutionFilter", - "__glXDisp_GetConvolutionParameterfv", - "__glXDisp_GetConvolutionParameteriv", - "__glXDisp_GetDoublev", - "__glXDisp_GetError", - "__glXDisp_GetFloatv", - "__glXDisp_GetHistogram", - "__glXDisp_GetHistogramParameterfv", - "__glXDisp_GetHistogramParameteriv", - "__glXDisp_GetIntegerv", - "__glXDisp_GetLightfv", - "__glXDisp_GetLightiv", - "__glXDisp_GetMapdv", - "__glXDisp_GetMapfv", - "__glXDisp_GetMapiv", - "__glXDisp_GetMaterialfv", - "__glXDisp_GetMaterialiv", - "__glXDisp_GetMinmax", - "__glXDisp_GetMinmaxParameterfv", - "__glXDisp_GetMinmaxParameteriv", - "__glXDisp_GetPixelMapfv", - "__glXDisp_GetPixelMapuiv", - "__glXDisp_GetPixelMapusv", - "__glXDisp_GetPolygonStipple", - "__glXDisp_GetSeparableFilter", - "__glXDisp_GetString", - "__glXDisp_GetTexEnvfv", - "__glXDisp_GetTexEnviv", - "__glXDisp_GetTexGendv", - "__glXDisp_GetTexGenfv", - "__glXDisp_GetTexGeniv", - "__glXDisp_GetTexImage", - "__glXDisp_GetTexLevelParameterfv", - "__glXDisp_GetTexLevelParameteriv", - "__glXDisp_GetTexParameterfv", - "__glXDisp_GetTexParameteriv", - "__glXDisp_Hint", - "__glXDisp_Histogram", - "__glXDisp_IndexMask", - "__glXDisp_Indexdv", - "__glXDisp_Indexfv", - "__glXDisp_Indexiv", - "__glXDisp_Indexsv", - "__glXDisp_Indexubv", - "__glXDisp_InitNames", - "__glXDisp_IsEnabled", - "__glXDisp_IsList", - "__glXDisp_IsTexture", - "__glXDisp_IsTextureEXT", - "__glXDisp_LightModelf", - "__glXDisp_LightModelfv", - "__glXDisp_LightModeli", - "__glXDisp_LightModeliv", - "__glXDisp_Lightf", - "__glXDisp_Lightfv", - "__glXDisp_Lighti", - "__glXDisp_Lightiv", - "__glXDisp_LineStipple", - "__glXDisp_LineWidth", - "__glXDisp_ListBase", - "__glXDisp_LoadIdentity", - "__glXDisp_LoadMatrixd", - "__glXDisp_LoadMatrixf", - "__glXDisp_LoadName", - "__glXDisp_LogicOp", - "__glXDisp_Map1d", - "__glXDisp_Map1f", - "__glXDisp_Map2d", - "__glXDisp_Map2f", - "__glXDisp_MapGrid1d", - "__glXDisp_MapGrid1f", - "__glXDisp_MapGrid2d", - "__glXDisp_MapGrid2f", - "__glXDisp_Materialf", - "__glXDisp_Materialfv", - "__glXDisp_Materiali", - "__glXDisp_Materialiv", - "__glXDisp_MatrixMode", - "__glXDisp_Minmax", - "__glXDisp_MultMatrixd", - "__glXDisp_MultMatrixf", - "__glXDisp_MultiTexCoord1dvARB", - "__glXDisp_MultiTexCoord1fvARB", - "__glXDisp_MultiTexCoord1ivARB", - "__glXDisp_MultiTexCoord1svARB", - "__glXDisp_MultiTexCoord2dvARB", - "__glXDisp_MultiTexCoord2fvARB", - "__glXDisp_MultiTexCoord2ivARB", - "__glXDisp_MultiTexCoord2svARB", - "__glXDisp_MultiTexCoord3dvARB", - "__glXDisp_MultiTexCoord3fvARB", - "__glXDisp_MultiTexCoord3ivARB", - "__glXDisp_MultiTexCoord3svARB", - "__glXDisp_MultiTexCoord4dvARB", - "__glXDisp_MultiTexCoord4fvARB", - "__glXDisp_MultiTexCoord4ivARB", - "__glXDisp_MultiTexCoord4svARB", - "__glXDisp_NewList", - "__glXDisp_Normal3bv", - "__glXDisp_Normal3dv", - "__glXDisp_Normal3fv", - "__glXDisp_Normal3iv", - "__glXDisp_Normal3sv", - "__glXDisp_Ortho", - "__glXDisp_PassThrough", - "__glXDisp_PixelMapfv", - "__glXDisp_PixelMapuiv", - "__glXDisp_PixelMapusv", - "__glXDisp_PixelStoref", - "__glXDisp_PixelStorei", - "__glXDisp_PixelTransferf", - "__glXDisp_PixelTransferi", - "__glXDisp_PixelZoom", - "__glXDisp_PointParameterfARB", - "__glXDisp_PointParameterfvARB", - "__glXDisp_PointSize", - "__glXDisp_PolygonMode", - "__glXDisp_PolygonOffset", - "__glXDisp_PolygonStipple", - "__glXDisp_PopAttrib", - "__glXDisp_PopMatrix", - "__glXDisp_PopName", - "__glXDisp_PrioritizeTextures", - "__glXDisp_PushAttrib", - "__glXDisp_PushMatrix", - "__glXDisp_PushName", - "__glXDisp_RasterPos2dv", - "__glXDisp_RasterPos2fv", - "__glXDisp_RasterPos2iv", - "__glXDisp_RasterPos2sv", - "__glXDisp_RasterPos3dv", - "__glXDisp_RasterPos3fv", - "__glXDisp_RasterPos3iv", - "__glXDisp_RasterPos3sv", - "__glXDisp_RasterPos4dv", - "__glXDisp_RasterPos4fv", - "__glXDisp_RasterPos4iv", - "__glXDisp_RasterPos4sv", - "__glXDisp_ReadBuffer", - "__glXDisp_ReadPixels", - "__glXDisp_Rectdv", - "__glXDisp_Rectfv", - "__glXDisp_Rectiv", - "__glXDisp_Rectsv", - "__glXDisp_RenderMode", - "__glXDisp_ResetHistogram", - "__glXDisp_ResetMinmax", - "__glXDisp_Rotated", - "__glXDisp_Rotatef", - "__glXDisp_Scaled", - "__glXDisp_Scalef", - "__glXDisp_Scissor", - "__glXDisp_SelectBuffer", - "__glXDisp_SeparableFilter2D", - "__glXDisp_ShadeModel", - "__glXDisp_StencilFunc", - "__glXDisp_StencilMask", - "__glXDisp_StencilOp", - "__glXDisp_TexCoord1dv", - "__glXDisp_TexCoord1fv", - "__glXDisp_TexCoord1iv", - "__glXDisp_TexCoord1sv", - "__glXDisp_TexCoord2dv", - "__glXDisp_TexCoord2fv", - "__glXDisp_TexCoord2iv", - "__glXDisp_TexCoord2sv", - "__glXDisp_TexCoord3dv", - "__glXDisp_TexCoord3fv", - "__glXDisp_TexCoord3iv", - "__glXDisp_TexCoord3sv", - "__glXDisp_TexCoord4dv", - "__glXDisp_TexCoord4fv", - "__glXDisp_TexCoord4iv", - "__glXDisp_TexCoord4sv", - "__glXDisp_TexEnvf", - "__glXDisp_TexEnvfv", - "__glXDisp_TexEnvi", - "__glXDisp_TexEnviv", - "__glXDisp_TexGend", - "__glXDisp_TexGendv", - "__glXDisp_TexGenf", - "__glXDisp_TexGenfv", - "__glXDisp_TexGeni", - "__glXDisp_TexGeniv", - "__glXDisp_TexImage1D", - "__glXDisp_TexImage2D", - "__glXDisp_TexImage3D", - "__glXDisp_TexParameterf", - "__glXDisp_TexParameterfv", - "__glXDisp_TexParameteri", - "__glXDisp_TexParameteriv", - "__glXDisp_TexSubImage1D", - "__glXDisp_TexSubImage2D", - "__glXDisp_TexSubImage3D", - "__glXDisp_Translated", - "__glXDisp_Translatef", - "__glXDisp_Vertex2dv", - "__glXDisp_Vertex2fv", - "__glXDisp_Vertex2iv", - "__glXDisp_Vertex2sv", - "__glXDisp_Vertex3dv", - "__glXDisp_Vertex3fv", - "__glXDisp_Vertex3iv", - "__glXDisp_Vertex3sv", - "__glXDisp_Vertex4dv", - "__glXDisp_Vertex4fv", - "__glXDisp_Vertex4iv", - "__glXDisp_Vertex4sv", - "__glXDisp_Viewport", - "__glXDisp_WindowPos3fARB", - "__glXDrawArraysSize", - "__glXDrawPixelsReqSize", - "__glXDrawableRes", - "__glXErrorOccured", - "__glXFBInitDrawable", - "__glXFBMemSwapBuffers", - "__glXFindDrawablePrivate", - "__glXFogfvReqSize", - "__glXFogivReqSize", - "__glXForceCurrent", - "__glXFree", - "__glXFreeBuffers", - "__glXFreeContext", - "__glXGetDrawablePrivate", - "__glXGetVisualConfigs", - "__glXImageSize", - "__glXImpAtoi", - "__glXImpCalloc", - "__glXImpFatal", - "__glXImpFclose", - "__glXImpFopen", - "__glXImpFprintf", - "__glXImpFree", - "__glXImpGetDrawablePrivate", - "__glXImpGetenv", - "__glXImpMalloc", - "__glXImpRealloc", - "__glXImpSprintf", - "__glXImpWarning", - "__glXInitFB", - "__glXInitMem", - "__glXInitPix", - "__glXIsDirect", - "__glXLastContext", - "__glXLightModelfvReqSize", - "__glXLightModelivReqSize", - "__glXLightfvReqSize", - "__glXLightivReqSize", - "__glXLookupContextByTag", - "__glXMakeCurrent", - "__glXMalloc", - "__glXMap1dReqSize", - "__glXMap1fReqSize", - "__glXMap2dReqSize", - "__glXMap2fReqSize", - "__glXMaterialfvReqSize", - "__glXMaterialivReqSize", - "__glXNoSuchRenderOpcode", - "__glXNoSuchSingleOpcode", - "__glXNop", - "__glXPixInitDrawable", - "__glXPixelMapfvReqSize", - "__glXPixelMapuivReqSize", - "__glXPixelMapusvReqSize", - "__glXPixmapRes", - "__glXPrioritizeTexturesReqSize", - "__glXQueryContextInfoEXT", - "__glXQueryExtensionsString", - "__glXQueryServerString", - "__glXQueryVersion", - "__glXRealloc", - "__glXRender", - "__glXRenderLarge", - "__glXRenderSizeTable", - "__glXRenderSizeTable_EXT", - "__glXRenderTable", - "__glXRenderTable_EXT", - "__glXReply", - "__glXResetLargeCommandStatus", - "__glXResizeBuffers", - "__glXResizeDrawableBuffers", - "__glXScreenInit", - "__glXScreenReset", - "__glXSeparableFilter2DReqSize", - "__glXSingleTable", - "__glXSwapBuffers", - "__glXSwapClientInfo", - "__glXSwapCopyContext", - "__glXSwapCreateContext", - "__glXSwapCreateGLXPixmap", - "__glXSwapDestroyContext", - "__glXSwapDestroyGLXPixmap", - "__glXSwapGetVisualConfigs", - "__glXSwapIsDirect", - "__glXSwapIsDirectReply", - "__glXSwapMakeCurrent", - "__glXSwapMakeCurrentReply", - "__glXSwapQueryContextInfoEXTReply", - "__glXSwapQueryExtensionsString", - "__glXSwapQueryServerString", - "__glXSwapQueryVersion", - "__glXSwapQueryVersionReply", - "__glXSwapRender", - "__glXSwapRenderLarge", - "__glXSwapRenderTable", - "__glXSwapRenderTable_EXT", - "__glXSwapSingleTable", - "__glXSwapSwapBuffers", - "__glXSwapUseXFont", - "__glXSwapVendorPrivTable_EXT", - "__glXSwapVendorPrivate", - "__glXSwapVendorPrivateWithReply", - "__glXSwapWaitGL", - "__glXSwapWaitX", - "__glXTexEnvfvReqSize", - "__glXTexEnvivReqSize", - "__glXTexGendvReqSize", - "__glXTexGenfvReqSize", - "__glXTexGenivReqSize", - "__glXTexImage1DReqSize", - "__glXTexImage2DReqSize", - "__glXTexImage3DReqSize", - "__glXTexParameterfvReqSize", - "__glXTexParameterivReqSize", - "__glXTexSubImage1DReqSize", - "__glXTexSubImage2DReqSize", - "__glXTexSubImage3DReqSize", - "__glXTypeSize", - "__glXUnrefDrawablePrivate", - "__glXUnsupportedPrivateRequest", - "__glXUseXFont", - "__glXVendorPrivTable_EXT", - "__glXVendorPrivate", - "__glXVendorPrivateWithReply", - "__glXWaitGL", - "__glXWaitX", - "__glXcombine_strings", - "glAccum", - "glActiveStencilFaceEXT", - "glActiveTextureARB", - "glAlphaFunc", - "glAreTexturesResident", - "glAreTexturesResidentEXT", - "glBegin", - "glBindTexture", - "glBitmap", - "glBlendColor", - "glBlendEquation", - "glBlendFunc", - "glCallList", - "glCallLists", - "glClear", - "glClearAccum", - "glClearColor", - "glClearDepth", - "glClearIndex", - "glClearStencil", - "glClipPlane", - "glColor3bv", - "glColor3dv", - "glColor3fv", - "glColor3iv", - "glColor3sv", - "glColor3ubv", - "glColor3uiv", - "glColor3usv", - "glColor4bv", - "glColor4dv", - "glColor4fv", - "glColor4iv", - "glColor4sv", - "glColor4ubv", - "glColor4uiv", - "glColor4usv", - "glColorMask", - "glColorMaterial", - "glColorPointer", - "glColorSubTable", - "glColorTable", - "glColorTableParameterfv", - "glColorTableParameteriv", - "glConvolutionFilter1D", - "glConvolutionFilter2D", - "glConvolutionParameterf", - "glConvolutionParameterfv", - "glConvolutionParameteri", - "glConvolutionParameteriv", - "glCopyColorSubTable", - "glCopyColorTable", - "glCopyConvolutionFilter1D", - "glCopyConvolutionFilter2D", - "glCopyPixels", - "glCopyTexImage1D", - "glCopyTexImage2D", - "glCopyTexSubImage1D", - "glCopyTexSubImage2D", - "glCopyTexSubImage3D", - "glCullFace", - "glDeleteLists", - "glDeleteTextures", - "glDeleteTexturesEXT", - "glDepthFunc", - "glDepthMask", - "glDepthRange", - "glDisable", - "glDisableClientState", - "glDrawArrays", - "glDrawBuffer", - "glDrawPixels", - "glEdgeFlagPointer", - "glEdgeFlagv", - "glEnable", - "glEnableClientState", - "glEnd", - "glEndList", - "glEvalCoord1dv", - "glEvalCoord1fv", - "glEvalCoord2dv", - "glEvalCoord2fv", - "glEvalMesh1", - "glEvalMesh2", - "glEvalPoint1", - "glEvalPoint2", - "glFeedbackBuffer", - "glFinish", - "glFlush", - "glFogf", - "glFogfv", - "glFogi", - "glFogiv", - "glFrontFace", - "glFrustum", - "glGenLists", - "glGenTextures", - "glGenTexturesEXT", - "glGetBooleanv", - "glGetClipPlane", - "glGetColorTable", - "glGetColorTableParameterfv", - "glGetColorTableParameteriv", - "glGetConvolutionFilter", - "glGetConvolutionParameterfv", - "glGetConvolutionParameteriv", - "glGetDoublev", - "glGetError", - "glGetFloatv", - "glGetHistogram", - "glGetHistogramParameterfv", - "glGetHistogramParameteriv", - "glGetIntegerv", - "glGetLightfv", - "glGetLightiv", - "glGetMapdv", - "glGetMapfv", - "glGetMapiv", - "glGetMaterialfv", - "glGetMaterialiv", - "glGetMinmax", - "glGetMinmaxParameterfv", - "glGetMinmaxParameteriv", - "glGetPixelMapfv", - "glGetPixelMapuiv", - "glGetPixelMapusv", - "glGetPolygonStipple", - "glGetSeparableFilter", - "glGetString", - "glGetTexEnvfv", - "glGetTexEnviv", - "glGetTexGendv", - "glGetTexGenfv", - "glGetTexGeniv", - "glGetTexImage", - "glGetTexLevelParameterfv", - "glGetTexLevelParameteriv", - "glGetTexParameterfv", - "glGetTexParameteriv", - "glHint", - "glHistogram", - "glIndexMask", - "glIndexPointer", - "glIndexdv", - "glIndexfv", - "glIndexiv", - "glIndexsv", - "glIndexubv", - "glInitNames", - "glIsEnabled", - "glIsList", - "glIsTexture", - "glIsTextureEXT", - "glLightModelf", - "glLightModelfv", - "glLightModeli", - "glLightModeliv", - "glLightf", - "glLightfv", - "glLighti", - "glLightiv", - "glLineStipple", - "glLineWidth", - "glListBase", - "glLoadIdentity", - "glLoadMatrixd", - "glLoadMatrixf", - "glLoadName", - "glLogicOp", - "glMap1d", - "glMap1f", - "glMap2d", - "glMap2f", - "glMapGrid1d", - "glMapGrid1f", - "glMapGrid2d", - "glMapGrid2f", - "glMaterialf", - "glMaterialfv", - "glMateriali", - "glMaterialiv", - "glMatrixMode", - "glMinmax", - "glMultMatrixd", - "glMultMatrixf", - "glMultiTexCoord1dvARB", - "glMultiTexCoord1fvARB", - "glMultiTexCoord1ivARB", - "glMultiTexCoord1svARB", - "glMultiTexCoord2dvARB", - "glMultiTexCoord2fvARB", - "glMultiTexCoord2ivARB", - "glMultiTexCoord2svARB", - "glMultiTexCoord3dvARB", - "glMultiTexCoord3fvARB", - "glMultiTexCoord3ivARB", - "glMultiTexCoord3svARB", - "glMultiTexCoord4dvARB", - "glMultiTexCoord4fvARB", - "glMultiTexCoord4ivARB", - "glMultiTexCoord4svARB", - "glNewList", - "glNormal3bv", - "glNormal3dv", - "glNormal3fv", - "glNormal3iv", - "glNormal3sv", - "glNormalPointer", - "glOrtho", - "glPassThrough", - "glPixelMapfv", - "glPixelMapuiv", - "glPixelMapusv", - "glPixelStoref", - "glPixelStorei", - "glPixelTransferf", - "glPixelTransferi", - "glPixelZoom", - "glPointParameterfARB", - "glPointParameterfvARB", - "glPointSize", - "glPolygonMode", - "glPolygonOffset", - "glPolygonStipple", - "glPopAttrib", - "glPopMatrix", - "glPopName", - "glPrioritizeTextures", - "glPushAttrib", - "glPushMatrix", - "glPushName", - "glRasterPos2dv", - "glRasterPos2fv", - "glRasterPos2iv", - "glRasterPos2sv", - "glRasterPos3dv", - "glRasterPos3fv", - "glRasterPos3iv", - "glRasterPos3sv", - "glRasterPos4dv", - "glRasterPos4fv", - "glRasterPos4iv", - "glRasterPos4sv", - "glReadBuffer", - "glReadPixels", - "glRectdv", - "glRectfv", - "glRectiv", - "glRectsv", - "glRenderMode", - "glResetHistogram", - "glResetMinmax", - "glRotated", - "glRotatef", - "glScaled", - "glScalef", - "glScissor", - "glSelectBuffer", - "glSeparableFilter2D", - "glShadeModel", - "glStencilFunc", - "glStencilMask", - "glStencilOp", - "glTexCoord1dv", - "glTexCoord1fv", - "glTexCoord1iv", - "glTexCoord1sv", - "glTexCoord2dv", - "glTexCoord2fv", - "glTexCoord2iv", - "glTexCoord2sv", - "glTexCoord3dv", - "glTexCoord3fv", - "glTexCoord3iv", - "glTexCoord3sv", - "glTexCoord4dv", - "glTexCoord4fv", - "glTexCoord4iv", - "glTexCoord4sv", - "glTexCoordPointer", - "glTexEnvf", - "glTexEnvfv", - "glTexEnvi", - "glTexEnviv", - "glTexGend", - "glTexGendv", - "glTexGenf", - "glTexGenfv", - "glTexGeni", - "glTexGeniv", - "glTexImage1D", - "glTexImage2D", - "glTexImage3D", - "glTexParameterf", - "glTexParameterfv", - "glTexParameteri", - "glTexParameteriv", - "glTexSubImage1D", - "glTexSubImage2D", - "glTexSubImage3D", - "glTranslated", - "glTranslatef", - "glVertex2dv", - "glVertex2fv", - "glVertex2iv", - "glVertex2sv", - "glVertex3dv", - "glVertex3fv", - "glVertex3iv", - "glVertex3sv", - "glVertex4dv", - "glVertex4fv", - "glVertex4iv", - "glVertex4sv", - "glVertexPointer", - "glViewport", - "glWindowPos3fARB", - "glxSwapQueryExtensionsStringReply", - "glxSwapQueryServerStringReply", - NULL -}; - static XF86ModuleVersionInfo VersRec = { "glx", @@ -1240,31 +77,19 @@ static pointer glxSetup(pointer module, pointer opts, int *errmaj, int *errmin) { static Bool setupDone = FALSE; - pointer GLcore = NULL; -#ifdef GLX_USE_SGI_SI - char GLcoreName[] = "GL"; -#else - char GLcoreName[] = "GLcore"; -#endif if (!setupDone) { setupDone = TRUE; - GLcore = LoadSubModule(module, GLcoreName, NULL, NULL, NULL, NULL, - errmaj, errmin); - if (!GLcore) { - if (errmaj) *errmaj = LDR_NOSUBENT; - } else { - LoaderReqSymLists(glcoreSymbols, NULL); - LoadExtension(&GLXExt, FALSE); - /* Wrap the init visuals routine in micmap.c */ - GlxWrapInitVisuals(&miInitVisualsProc); - /* Make sure this gets wrapped each time InitVisualWrap is called */ - miHookInitVisuals(NULL, GlxWrapInitVisuals); - } + LoadExtension(&GLXExt, FALSE); + /* Wrap the init visuals routine in micmap.c */ + GlxWrapInitVisuals(&miInitVisualsProc); + /* Make sure this gets wrapped each time InitVisualWrap is called */ + miHookInitVisuals(NULL, GlxWrapInitVisuals); } else { if (errmaj) *errmaj = LDR_ONCEONLY; } + /* Need a non-NULL return value to indicate success */ - return GLcore; + return module; } Index: programs/Xserver/GL/dri/dri.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/GL/dri/dri.c,v retrieving revision 1.16 diff -u -p -r1.16 dri.c --- programs/Xserver/GL/dri/dri.c 24 Sep 2005 18:45:45 -0000 1.16 +++ programs/Xserver/GL/dri/dri.c 14 Nov 2005 17:11:43 -0000 @@ -43,6 +43,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN #include "xf86_ansic.h" #else #include +#include #include #endif @@ -1057,6 +1058,11 @@ DRIDestroyDrawable(ScreenPtr pScreen, Dr if (pDrawable->type == DRAWABLE_WINDOW) { pWin = (WindowPtr)pDrawable; pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); + /* Workaround to handle the case where both the DRI resource + * cleanup and the glx resource clean up calls this + * function. */ + if (pDRIDrawablePriv == NULL) + return TRUE; pDRIDrawablePriv->refCount--; if (pDRIDrawablePriv->refCount <= 0) { /* This calls back DRIDrawablePrivDelete which frees private area */ @@ -1924,6 +1930,44 @@ DRIUnlock(ScreenPtr pScreen) DRM_UNLOCK(pDRIPriv->drmFD, pDRIPriv->pSAREA, pDRIPriv->myContext); } +void +DRIUnlockedCallback(ScreenPtr pScreen, int flags, + DRICallback callback, void *data) +{ + DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); + int blocked; + + blocked = xf86BlockSIGIO(); + + if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) { + /* hide X context by swapping 2D component here */ + (*pDRIPriv->pDriverInfo->SwapContext)(pScreen, + DRI_2D_SYNC, + DRI_NO_CONTEXT, + NULL, + DRI_2D_CONTEXT, + pDRIPriv->partial3DContextStore); + } + + DRIUnlock(pScreen); + + callback(data); + + DRILock(pScreen, 0); + + if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) { + /* hide X context by swapping 2D component here */ + (*pDRIPriv->pDriverInfo->SwapContext)(pScreen, + DRI_3D_SYNC, + DRI_2D_CONTEXT, + pDRIPriv->partial3DContextStore, + DRI_2D_CONTEXT, + pDRIPriv->hiddenContextStore); + } + + xf86UnblockSIGIO(blocked); +} + void * DRIGetSAREAPrivate(ScreenPtr pScreen) { Index: programs/Xserver/GL/dri/dri.h =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/GL/dri/dri.h,v retrieving revision 1.8 diff -u -p -r1.8 dri.h --- programs/Xserver/GL/dri/dri.h 24 Sep 2005 18:45:45 -0000 1.8 +++ programs/Xserver/GL/dri/dri.h 14 Nov 2005 17:11:43 -0000 @@ -37,7 +37,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN #ifndef _DRI_H_ #include "scrnintstr.h" -#include "xf86dri.h" +#include "drm.h" typedef int DRISyncType; @@ -306,6 +306,10 @@ extern void DRILock(ScreenPtr pScreen, i extern void DRIUnlock(ScreenPtr pScreen); +typedef void (*DRICallback)(void *); +extern void DRIUnlockedCallback(ScreenPtr pScreen, int flags, + DRICallback callback, void *data); + extern DRIWrappedFuncsRec *DRIGetWrappedFuncs(ScreenPtr pScreen); extern void *DRIGetSAREAPrivate(ScreenPtr pScreen); Index: programs/Xserver/GL/glx/Imakefile =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/GL/glx/Imakefile,v retrieving revision 1.8.2.1 diff -u -p -r1.8.2.1 Imakefile --- programs/Xserver/GL/glx/Imakefile 3 Nov 2005 17:19:08 -0000 1.8.2.1 +++ programs/Xserver/GL/glx/Imakefile 14 Nov 2005 17:11:43 -0000 @@ -23,9 +23,9 @@ LinkSourceFile(indirect_size.h, $(MESASR LinkSourceFile(glapi.c, $(MESASRCDIR)/src/mesa/glapi) LinkSourceFile(glthread.c, $(MESASRCDIR)/src/mesa/glapi) - SRCS = global.c glxbuf.c glxcmds.c glxcmdsswap.c glxext.c \ - glxfb.c glximports.c glxmem.c glxpix.c glxscreens.c \ - glxutil.c render2.c render2swap.c renderpix.c \ + SRCS = global.c glxcmds.c glxcmdsswap.c glxext.c \ + glxvisuals.c glxloader.c \ + glxscreens.c glxutil.c render2.c render2swap.c renderpix.c \ renderpixswap.c rensize.c rensizetab.c single2.c \ single2swap.c singlepix.c singlepixswap.c \ singlesize.c xfont.c g_disptab.c g_disptab_EXT.c \ @@ -36,12 +36,15 @@ LinkSourceFile(glthread.c, $(MESASRCDIR) OBJS = $(SRCS:.c=.o) - INCLUDES = -I$(SERVERSRC)/GL/glx -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/include -I$(INCLUDESRC) -I$(MESASRCDIR)/include \ + INCLUDES = -I$(SERVERSRC)/GL/glx -I$(SERVERSRC)/GL/include \ + -I$(SERVERSRC)/include -I$(INCLUDESRC) \ + -I$(MESASRCDIR)/include \ -I$(MESASRCDIR)/src/mesa/glapi \ -I$(MESASRCDIR)/src/mesa/main \ -I$(XINCLUDESRC) -I$(SERVERSRC)/mi \ -I$(EXTINCSRC) -I$(FONTINCSRC) -I$(LIBSRC)/GL/include \ - -I$(XF86SRC) + -I$(XF86OSSRC) -I$(XF86SRC) -I$(XF86COMSRC) \ + -I$(DRMSRCDIR)/shared-core #if defined(DarwinArchitecture) && ((OSMajorVersion == 6 && OSMinorVersion < 3) || OSMajorVersion < 6) NO_EXT_DEFS = -DMISSING_GL_EXTS Index: programs/Xserver/GL/glx/glxcmds.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/GL/glx/glxcmds.c,v retrieving revision 1.8.2.1 diff -u -p -r1.8.2.1 glxcmds.c --- programs/Xserver/GL/glx/glxcmds.c 3 Nov 2005 17:19:09 -0000 1.8.2.1 +++ programs/Xserver/GL/glx/glxcmds.c 14 Nov 2005 17:11:43 -0000 @@ -47,7 +47,6 @@ #include #include #include "g_disptab_EXT.h" -#include "glximports.h" #include "glxutil.h" #include "glxext.h" #include "GL/glx_ansic.h" @@ -59,24 +58,6 @@ /************************************************************************/ -static __GLimports imports = { - __glXImpMalloc, - __glXImpCalloc, - __glXImpRealloc, - __glXImpFree, - __glXImpWarning, - __glXImpFatal, - __glXImpGetenv, - __glXImpAtoi, - __glXImpSprintf, - __glXImpFopen, - __glXImpFclose, - __glXImpFprintf, - __glXImpGetDrawablePrivate, - __glXImpGetReadablePrivate, - NULL -}; - static int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc); static int __glXCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc); static int __glXCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc); @@ -110,7 +91,7 @@ int DoCreateContext(__GLXclientState *cl __GLXcontext *glxc, *shareglxc; __GLcontextModes *modes; __GLXscreenInfo *pGlxScreen; - __GLinterface *shareGC; + void *share; GLint i; LEGAL_NEW_RESOURCE(gcId, client); @@ -165,7 +146,7 @@ int DoCreateContext(__GLXclientState *cl ** for multithreaded servers, we don't do this. */ if (shareList == None) { - shareGC = 0; + share = 0; } else { shareglxc = (__GLXcontext *) LookupIDByType(shareList, __glXContextRes); if (!shareglxc) { @@ -191,7 +172,7 @@ int DoCreateContext(__GLXclientState *cl */ isDirect = GL_FALSE; } - shareGC = shareglxc->gc; + share = shareglxc->driContext.private; } /* @@ -213,13 +194,11 @@ int DoCreateContext(__GLXclientState *cl glxc->modes = modes; if (!isDirect) { - - /* - ** Allocate a GL context - */ - imports.other = (void *)glxc; - glxc->gc = (*pGlxScreen->createContext)(&imports, glxc->modes, shareGC); - if (!glxc->gc) { + glxc->driContext.private = + (*pGlxScreen->driScreen.createNewContext)(NULL, modes, 0, + share, + &glxc->driContext); + if (glxc->driContext.private == NULL) { __glXFree(glxc); client->errorValue = gcId; return BadAlloc; @@ -228,14 +207,15 @@ int DoCreateContext(__GLXclientState *cl /* ** Don't need local GL context for a direct context. */ - glxc->gc = 0; + glxc->driContext.private = NULL; } /* ** Register this context as a resource. */ if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) { if (!isDirect) { - (*glxc->gc->exports.destroyContext)((__GLcontext *)glxc->gc); + (*glxc->driContext.destroyContext)(NULL, screen, + glxc->driContext.private); } __glXFree(glxc); client->errorValue = gcId; @@ -518,7 +498,6 @@ int DoMakeCurrent( __GLXclientState *cl, __GLXpixmap *drawPixmap = NULL; __GLXpixmap *readPixmap = NULL; __GLXcontext *glxc, *prevglxc; - __GLinterface *gc, *prevgc; __GLXdrawablePrivate *drawPriv = NULL; __GLXdrawablePrivate *readPriv = NULL; GLint error; @@ -552,10 +531,8 @@ int DoMakeCurrent( __GLXclientState *cl, client->errorValue = prevglxc->id; return __glXBadContextState; } - prevgc = prevglxc->gc; } else { prevglxc = 0; - prevgc = 0; } /* @@ -573,8 +550,6 @@ int DoMakeCurrent( __GLXclientState *cl, /* Context is current to somebody else */ return BadAccess; } - gc = glxc->gc; - assert( drawId != None ); assert( readId != None ); @@ -616,7 +591,6 @@ int DoMakeCurrent( __GLXclientState *cl, } else { /* Switching to no context. Ignore new drawable. */ glxc = 0; - gc = 0; pDraw = 0; pRead = 0; } @@ -638,7 +612,14 @@ int DoMakeCurrent( __GLXclientState *cl, /* ** Make the previous context not current. */ - if (!(*prevgc->exports.loseCurrent)((__GLcontext *)prevgc)) { + + /* FIXME-KRH: this is where we need the looseContext function + * in the DRIcontext interface. */ + + if (!(*prevglxc->driContext.unbindContext)(NULL, pDraw->pScreen->myNum, + 0, /* prev draw */ + 0, /* prev read */ + &prevglxc->driContext)) { return __glXBadContext; } __glXDeassociateContext(prevglxc); @@ -649,25 +630,19 @@ int DoMakeCurrent( __GLXclientState *cl, glxc->drawPriv = drawPriv; glxc->readPriv = readPriv; - __glXCacheDrawableSize(drawPriv); /* make the context current */ - if (!(*gc->exports.makeCurrent)((__GLcontext *)gc)) { - glxc->drawPriv = NULL; - glxc->readPriv = NULL; - return __glXBadContext; - } - - /* resize the buffers */ - if (!__glXResizeDrawableBuffers(drawPriv)) { - /* could not do initial resize. make current failed */ - (*gc->exports.loseCurrent)((__GLcontext *)gc); + if (!(*glxc->driContext.bindContext)(NULL, pDraw->pScreen->myNum, + drawId, readId, + &glxc->driContext)) { glxc->drawPriv = NULL; glxc->readPriv = NULL; return __glXBadContext; } glxc->isCurrent = GL_TRUE; + /* FIXME: Is this assignment ok? Why wasn't it here already? */ + __glXLastContext = glxc; __glXAssociateContext(glxc); assert(drawPriv->drawGlxc == glxc); assert(readPriv->readGlxc == glxc); @@ -906,6 +881,11 @@ int __glXCopyContext(__GLXclientState *c return error; } } + +#if 0 + /* FIXME: We probably need to add DRIcontext::copyContext for + * this. */ + /* ** Issue copy. The only reason for failure is a bad mask. */ @@ -915,6 +895,8 @@ int __glXCopyContext(__GLXclientState *c client->errorValue = mask; return BadValue; } +#endif + return Success; } @@ -1353,9 +1335,7 @@ int __glXSwapBuffers(__GLXclientState *c } } - if ((*glxPriv->swapBuffers)(glxPriv) == GL_FALSE) { - return __glXBadDrawable; - } + (*glxPriv->driDrawable.swapBuffers)(NULL, glxPriv->driDrawable.private); } return Success; Index: programs/Xserver/GL/glx/glxcontext.h =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/GL/glx/glxcontext.h,v retrieving revision 1.4 diff -u -p -r1.4 glxcontext.h --- programs/Xserver/GL/glx/glxcontext.h 3 Jul 2005 07:01:02 -0000 1.4 +++ programs/Xserver/GL/glx/glxcontext.h 14 Nov 2005 17:11:43 -0000 @@ -47,6 +47,7 @@ typedef struct __GLXcontextRec __GLXcont #define CAPI #include "GL/internal/glcore.h" +#include "GL/internal/dri_interface.h" struct __GLXcontextRec { /* @@ -62,11 +63,9 @@ struct __GLXcontextRec { struct __GLXcontextRec *nextReadPriv; /* - ** Opaque pointer the context object created by the GL that the - ** server is bound with. Never dereferenced by this code, but used - ** as a handle to feed to the routines in the screen info struct. + ** The DRI context initialized by the DRI driver. */ - __GLinterface *gc; + __DRIcontext driContext; /* ** mode struct for this context @@ -121,11 +120,6 @@ struct __GLXcontextRec { GLboolean isDirect; /* - ** Window pending state - */ - GLuint pendingState; - - /* ** This flag keeps track of whether there are unflushed GL commands. */ GLboolean hasUnflushedCommands; Index: programs/Xserver/GL/glx/glxdrawable.h =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/GL/glx/glxdrawable.h,v retrieving revision 1.4 diff -u -p -r1.4 glxdrawable.h --- programs/Xserver/GL/glx/glxdrawable.h 3 Jul 2005 07:01:02 -0000 1.4 +++ programs/Xserver/GL/glx/glxdrawable.h 14 Nov 2005 17:11:43 -0000 @@ -76,13 +76,6 @@ struct __GLXdrawablePrivateRec { __GLcontextModes *modes; /* - ** cached drawable size and origin - */ - - GLint xorigin, yorigin; - GLint width, height; - - /* ** Lists of contexts bound to this drawable. There are two lists here. ** One list is of the contexts that have this drawable bound for drawing, ** and the other is the list of contexts that have this drawable bound @@ -91,17 +84,7 @@ struct __GLXdrawablePrivateRec { struct __GLXcontextRec *drawGlxc; struct __GLXcontextRec *readGlxc; - /* - ** "methods" that the drawble should be able to respond to. - */ - void (*freeBuffers)(struct __GLXdrawablePrivateRec *); - void (*updatePalette)(struct __GLXdrawablePrivateRec *); - GLboolean (*swapBuffers)(struct __GLXdrawablePrivateRec *); - - /* - ** The GL drawable (information shared between GLX and the GL core) - */ - __GLdrawablePrivate glPriv; + __DRIdrawable driDrawable; /* ** reference count Index: programs/Xserver/GL/glx/glxext.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/GL/glx/glxext.c,v retrieving revision 1.6 diff -u -p -r1.6 glxext.c --- programs/Xserver/GL/glx/glxext.c 5 Oct 2005 22:39:41 -0000 1.6 +++ programs/Xserver/GL/glx/glxext.c 14 Nov 2005 17:11:43 -0000 @@ -33,12 +33,13 @@ #include "glxext.h" #include "micmap.h" +#include "glapi.h" +#include "glthread.h" +#include "dispatch.h" -void GlxWrapInitVisuals(miInitVisualsProcPtr *); -void GlxSetVisualConfigs(int nconfigs, - __GLXvisualConfig *configs, void **privates); +#include "xf86.h" +#include "../dri/dri.h" -static __GLXextensionInfo *__glXExt /* = &__glDDXExtensionInfo */; /* ** Forward declarations. @@ -46,13 +47,15 @@ static __GLXextensionInfo *__glXExt /* = static int __glXSwapDispatch(ClientPtr); static int __glXDispatch(ClientPtr); +void __glXVisualsReset(void); + /* ** Called when the extension is reset. */ static void ResetExtension(ExtensionEntry* extEntry) { __glXFlushContextCache(); - (*__glXExt->resetExtension)(); + __glXVisualsReset(); __glXScreenReset(); } @@ -166,9 +169,8 @@ GLboolean __glXFreeContext(__GLXcontext if (cx->idExists || cx->isCurrent) return GL_FALSE; if (!cx->isDirect) { - if ((*cx->gc->exports.destroyContext)((__GLcontext *)cx->gc) == GL_FALSE) { - return GL_FALSE; - } + (*cx->driContext.destroyContext)(NULL, cx->screen, + cx->driContext.private); } if (cx->feedbackBuf) __glXFree(cx->feedbackBuf); if (cx->selectBuf) __glXFree(cx->selectBuf); @@ -232,6 +234,7 @@ GLboolean __glXErrorOccured(void) /* ** Initialize the GLX extension. */ + void GlxExtensionInit(void) { ExtensionEntry *extEntry; @@ -287,46 +290,8 @@ void GlxExtensionInit(void) Bool __glXCoreType(void) { - return __glXExt->type; -} - -/************************************************************************/ - -void GlxSetVisualConfigs(int nconfigs, - __GLXvisualConfig *configs, void **privates) -{ - (*__glXExt->setVisualConfigs)(nconfigs, configs, privates); -} - -static miInitVisualsProcPtr saveInitVisualsProc; - -Bool GlxInitVisuals(VisualPtr *visualp, DepthPtr *depthp, - int *nvisualp, int *ndepthp, - int *rootDepthp, VisualID *defaultVisp, - unsigned long sizes, int bitsPerRGB, - int preferredVis) -{ - Bool ret; - - if (saveInitVisualsProc) { - ret = saveInitVisualsProc(visualp, depthp, nvisualp, ndepthp, - rootDepthp, defaultVisp, sizes, bitsPerRGB, - preferredVis); - if (!ret) - return False; - } - (*__glXExt->initVisuals)(visualp, depthp, nvisualp, ndepthp, rootDepthp, - defaultVisp, sizes, bitsPerRGB); - return True; -} - -void -GlxWrapInitVisuals(miInitVisualsProcPtr *initVisProc) -{ - saveInitVisualsProc = *initVisProc; - *initVisProc = GlxInitVisuals; - /* HACK: this shouldn't be done here but it's the earliest time */ - __glXExt = __glXglDDXExtensionInfo(); /* from GLcore */ + /* This can't be right... what is this used for anyway? */ + return GL_CORE_MESA; } /************************************************************************/ @@ -375,21 +340,44 @@ __GLXcontext *__glXForceCurrent(__GLXcli return cx; } + /* FIXME: A better solution would be to expose the forceCurrent + * from the underlying __GLcontext in the DRIcontext. According + * to idr, this is much faster for this purpose. */ /* Make this context the current one for the GL. */ + if (!cx->isDirect) { - if (!(*cx->gc->exports.forceCurrent)((__GLcontext *)cx->gc)) { + if (!(*cx->driContext.bindContext)(NULL, cx->drawPriv->pDraw->pScreen->myNum, + cx->drawPriv->drawId, + cx->readPriv->drawId, + &cx->driContext)) { /* Bind failed, and set the error code. Bummer */ cl->client->errorValue = cx->id; *error = __glXBadContextState; return 0; } } + __glXLastContext = cx; return cx; } /************************************************************************/ +typedef struct { + int (*proc)(__GLXclientState *cl, GLbyte *pc); + __GLXclientState *clientState; + GLbyte *stuff; + int retval; +} __GLXdispatchData; + +static void __glXCallDispatch(void *data) +{ + __GLXdispatchData *dispatchData = data; + + dispatchData->retval = + (*dispatchData->proc)(dispatchData->clientState, dispatchData->stuff); +} + /* ** Top level dispatcher; all commands are executed from here down. */ @@ -397,8 +385,9 @@ static int __glXDispatch(ClientPtr clien { REQUEST(xGLXSingleReq); CARD8 opcode; - int (*proc)(__GLXclientState *cl, GLbyte *pc); __GLXclientState *cl; + __GLXdispatchData dispatchData; + ScreenPtr pScreen; opcode = stuff->glxCode; cl = __glXClients[client->index]; @@ -443,16 +432,24 @@ static int __glXDispatch(ClientPtr clien /* ** Use the opcode to index into the procedure table. */ - proc = __glXSingleTable[opcode]; - return (*proc)(cl, (GLbyte *) stuff); + dispatchData.proc = __glXSingleTable[opcode]; + dispatchData.clientState = cl; + dispatchData.stuff = (GLbyte *) stuff; + + pScreen = screenInfo.screens[0]; + + DRIUnlockedCallback(pScreen, 0, __glXCallDispatch, &dispatchData); + + return dispatchData.retval; } static int __glXSwapDispatch(ClientPtr client) { REQUEST(xGLXSingleReq); CARD8 opcode; - int (*proc)(__GLXclientState *cl, GLbyte *pc); __GLXclientState *cl; + __GLXdispatchData dispatchData; + ScreenPtr pScreen; opcode = stuff->glxCode; cl = __glXClients[client->index]; @@ -489,8 +486,15 @@ static int __glXSwapDispatch(ClientPtr c /* ** Use the opcode to index into the procedure table. */ - proc = __glXSwapSingleTable[opcode]; - return (*proc)(cl, (GLbyte *) stuff); + dispatchData.proc = __glXSwapSingleTable[opcode]; + dispatchData.clientState = cl; + dispatchData.stuff = (GLbyte *) stuff; + + pScreen = screenInfo.screens[0]; + + DRIUnlockedCallback(pScreen, 0, __glXCallDispatch, &dispatchData); + + return dispatchData.retval; } int __glXNoSuchSingleOpcode(__GLXclientState *cl, GLbyte *pc) Index: programs/Xserver/GL/glx/glxscreens.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/GL/glx/glxscreens.c,v retrieving revision 1.8 diff -u -p -r1.8 glxscreens.c --- programs/Xserver/GL/glx/glxscreens.c 5 Oct 2005 22:39:41 -0000 1.8 +++ programs/Xserver/GL/glx/glxscreens.c 14 Nov 2005 17:11:43 -0000 @@ -48,8 +48,10 @@ #include #include "glxserver.h" +#include "glxvisuals.h" #include "glxutil.h" #include "glxext.h" +#include "glxloader.h" const char GLServerVersion[] = "1.2"; static const char GLServerExtensions[] = @@ -142,18 +144,6 @@ static char GLXServerExtensions[] = "GLX_SGIX_fbconfig " ; -/* - * __glDDXScreenInfo comes from GLcore, so we can't resolve this symbol at - * module open time. Leave a placeholder, and fill this in when we first - * need it (in __glXScreenInit). XXX Why make this an array? - */ -static __GLXscreenInfo *__glXScreens[] = { - NULL /* &__glDDXScreenInfo */ , -}; - -static GLint __glXNumStaticScreens = - (sizeof __glXScreens / sizeof __glXScreens[0]); - __GLXscreenInfo *__glXActiveScreens; GLint __glXNumActiveScreens; @@ -175,111 +165,12 @@ __GLXscreenInfo *__glXgetActiveScreen(in */ static Bool DrawableGone(__GLXdrawablePrivate *glxPriv, XID xid) { - __GLXcontext *cx, *cx1; - - /* - ** Use glxPriv->type to figure out what kind of drawable this is. Don't - ** use glxPriv->pDraw->type because by the time this routine is called, - ** the pDraw might already have been freed. - */ - if (glxPriv->type == DRAWABLE_WINDOW) { - /* - ** When a window is destroyed, notify all context bound to - ** it, that there are no longer bound to anything. - */ - for (cx = glxPriv->drawGlxc; cx; cx = cx1) { - cx1 = cx->nextDrawPriv; - cx->pendingState |= __GLX_PENDING_DESTROY; - } - - for (cx = glxPriv->readGlxc; cx; cx = cx1) { - cx1 = cx->nextReadPriv; - cx->pendingState |= __GLX_PENDING_DESTROY; - } - } - - /* - ** set the size to 0, so that context that may still be using this - ** drawable not do anything harmful - */ - glxPriv->xorigin = 0; - glxPriv->yorigin = 0; - glxPriv->width = 0; - glxPriv->height = 0; - __glXUnrefDrawablePrivate(glxPriv); return True; } /* -** This hook gets called when a window moves or changes size. -*/ -static Bool PositionWindow(WindowPtr pWin, int x, int y) -{ - ScreenPtr pScreen; - __GLXcontext *glxc; - __GLXdrawablePrivate *glxPriv; - Bool ret; - - /* - ** Call wrapped position window routine - */ - pScreen = pWin->drawable.pScreen; - pScreen->PositionWindow = - __glXActiveScreens[pScreen->myNum].WrappedPositionWindow; - ret = (*pScreen->PositionWindow)(pWin, x, y); - pScreen->PositionWindow = PositionWindow; - - /* - ** Tell all contexts rendering into this window that the window size - ** has changed. - */ - glxPriv = (__GLXdrawablePrivate *) LookupIDByType(pWin->drawable.id, - __glXDrawableRes); - if (glxPriv == NULL) { - /* - ** This window is not being used by the OpenGL. - */ - return ret; - } - - /* - ** resize the drawable - */ - /* first change the drawable size */ - if (__glXResizeDrawableBuffers(glxPriv) == GL_FALSE) { - /* resize failed! */ - /* XXX: what can we possibly do here? */ - ret = False; - } - - /* mark contexts as needing resize */ - - for (glxc = glxPriv->drawGlxc; glxc; glxc = glxc->nextDrawPriv) { - glxc->pendingState |= __GLX_PENDING_RESIZE; - } - - for (glxc = glxPriv->readGlxc; glxc; glxc = glxc->nextReadPriv) { - glxc->pendingState |= __GLX_PENDING_RESIZE; - } - - return ret; -} - -/* -** Wrap our own PositionWindow routine around the server's, so we can -** be notified when a window changes size -*/ -static void wrapPositionWindow(int screen) -{ - ScreenPtr pScreen = screenInfo.screens[screen]; - - __glXActiveScreens[screen].WrappedPositionWindow = pScreen->PositionWindow; - pScreen->PositionWindow = PositionWindow; -} - -/* * If your DDX driver wants to register support for swap barriers or hyperpipe * topology, it should call __glXHyperpipeInit() or __glXSwapBarrierInit() * with a dispatch table of functions to handle the requests. In the XFree86 @@ -324,9 +215,7 @@ void __glXSwapBarrierInit(int screen, __ void __glXScreenInit(GLint numscreens) { - GLint i,j; - - __glXScreens[0] = __glXglDDXScreenInfo(); /* from GLcore */ + GLint i; /* ** This alloc has to work or else the server might as well core dump. @@ -334,24 +223,16 @@ void __glXScreenInit(GLint numscreens) __glXActiveScreens = (__GLXscreenInfo *) __glXMalloc(sizeof(__GLXscreenInfo) * numscreens); - for (i=0; i < numscreens; i++) { - /* - ** Probe each static screen to see which exists. - */ - for (j=0; j < __glXNumStaticScreens; j++) { - if ((*__glXScreens[j]->screenProbe)(i)) { - __glXActiveScreens[i] = *__glXScreens[j]; - - __glXActiveScreens[i].numUsableVisuals = __glXActiveScreens[i].numVisuals; - __glXActiveScreens[i].GLextensions = __glXStrdup(GLServerExtensions); - __glXActiveScreens[i].GLXvendor = __glXStrdup(GLXServerVendorName); - __glXActiveScreens[i].GLXversion = __glXStrdup(GLXServerVersion); - __glXActiveScreens[i].GLXextensions = __glXStrdup(GLXServerExtensions); - - __glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone); - wrapPositionWindow(i); - } - } + for (i = 0; i < numscreens; i++) { + __glXVisualsInitScreen(&__glXActiveScreens[i], i); + __glXActiveScreens[i].GLextensions = __glXStrdup(GLServerExtensions); + __glXActiveScreens[i].GLXvendor = __glXStrdup(GLXServerVendorName); + __glXActiveScreens[i].GLXversion = __glXStrdup(GLXServerVersion); + __glXActiveScreens[i].GLXextensions = __glXStrdup(GLXServerExtensions); + + __glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone); + + __glXLoaderInitScreen(i); } __glXNumActiveScreens = numscreens; } Index: programs/Xserver/GL/glx/glxscreens.h =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/GL/glx/glxscreens.h,v retrieving revision 1.4 diff -u -p -r1.4 glxscreens.h --- programs/Xserver/GL/glx/glxscreens.h 3 Jul 2005 07:01:02 -0000 1.4 +++ programs/Xserver/GL/glx/glxscreens.h 14 Nov 2005 17:11:43 -0000 @@ -44,7 +44,9 @@ /* XXX: should be defined somewhere globally */ #define CAPI +#include #include "GL/internal/glcore.h" +#include "GL/internal/dri_interface.h" /* ** Screen dependent data. These methods are the interface between the DIX @@ -52,28 +54,6 @@ ** interface for context management on a screen. */ typedef struct { - /* - ** Probe the screen and see if it supports GL rendering. It will - ** return GL_FALSE if it doesn't, GL_TRUE otherwise. - */ - Bool (*screenProbe)(int screen); - - /* - ** Create a context using configuration information from modes. - ** Use imports as callbacks back to the OS. Return an opaque handle - ** on the context (NULL if failure). - */ - __GLinterface *(*createContext)(__GLimports *imports, - __GLcontextModes *modes, - __GLinterface *shareGC); - - /* - ** Create a buffer using information from glxPriv. This routine - ** sets up any wrappers necessary to resize, swap or destroy the - ** buffer. - */ - void (*createBuffer)(__GLXdrawablePrivate *glxPriv); - /** * Linked list of valid context modes for this screen. */ @@ -89,6 +69,9 @@ typedef struct { char *GLXversion; char *GLXextensions; + void *driver; + __DRIscreen driScreen; + /* ** Things that are not statically set. */ Index: programs/Xserver/GL/glx/glxserver.h =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/GL/glx/glxserver.h,v retrieving revision 1.5.2.1 diff -u -p -r1.5.2.1 glxserver.h --- programs/Xserver/GL/glx/glxserver.h 3 Nov 2005 17:19:09 -0000 1.5.2.1 +++ programs/Xserver/GL/glx/glxserver.h 14 Nov 2005 17:11:43 -0000 @@ -52,6 +52,7 @@ #include #include #include "GL/glx_ansic.h" +#include /* @@ -64,6 +65,7 @@ #include #include #include +#include /* For glxscreens.h */ typedef struct __GLXdrawablePrivateRec __GLXdrawablePrivate; Index: programs/Xserver/GL/glx/glxutil.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/GL/glx/glxutil.c,v retrieving revision 1.4 diff -u -p -r1.4 glxutil.c --- programs/Xserver/GL/glx/glxutil.c 3 Jul 2005 07:01:02 -0000 1.4 +++ programs/Xserver/GL/glx/glxutil.c 14 Nov 2005 17:11:43 -0000 @@ -195,84 +195,6 @@ __glXDeassociateContext(__GLXcontext *gl } } -/************************************************************************/ - -void -__glXGetDrawableSize(__GLdrawablePrivate *glPriv, - GLint *x, GLint *y, GLuint *width, GLuint *height) -{ - __GLXdrawablePrivate *glxPriv = (__GLXdrawablePrivate *)glPriv->other; - - if (glxPriv) { - *x = glxPriv->xorigin; - *y = glxPriv->yorigin; - *width = glxPriv->width; - *height = glxPriv->height; - } else { - *x = *y = *width = *height = 0; - } -} - -GLboolean -__glXResizeDrawable(__GLdrawablePrivate *glPriv) -{ - /* nothing to be done here */ - return GL_TRUE; -} - - -/*****************************************************************************/ -/* accessing the drawable private */ - -static void -LockDP(__GLdrawablePrivate *glPriv, __GLcontext *gc) -{ - __GLinterface *glci = (__GLinterface *) gc; - __GLXcontext *glxc = (__GLXcontext *) glci->imports.other; - - /* quick exit test */ - if ((glxc->pendingState & - (__GLX_PENDING_RESIZE | - __GLX_PENDING_DESTROY | - __GLX_PENDING_SWAP)) == 0x0) - return; - - /* some pending state. Deal with it */ - if (glxc->pendingState & __GLX_PENDING_RESIZE) { - glxc->pendingState &= ~__GLX_PENDING_RESIZE; - - (*glci->exports.notifyResize)(gc); - assert((glxc->pendingState & __GLX_PENDING_RESIZE) == 0x0); - } - if (glxc->pendingState & __GLX_PENDING_DESTROY) { - glxc->pendingState &= ~__GLX_PENDING_DESTROY; - - assert(glxc->drawPriv->xorigin == 0); - assert(glxc->drawPriv->yorigin == 0); - assert(glxc->drawPriv->width == 0); - assert(glxc->drawPriv->height == 0); - assert(glxc->readPriv->xorigin == 0); - assert(glxc->readPriv->yorigin == 0); - assert(glxc->readPriv->width == 0); - assert(glxc->readPriv->height == 0); - (*glci->exports.notifyDestroy)(gc); - __glXDeassociateContext(glxc); - assert((glxc->pendingState & __GLX_PENDING_DESTROY) == 0x0); - } - if (glxc->pendingState & __GLX_PENDING_SWAP) { - - glxc->pendingState &= ~__GLX_PENDING_SWAP; - - (*glci->exports.notifySwapBuffers)(gc); - assert((glxc->pendingState & __GLX_PENDING_SWAP) == 0x0); - } -} - -static void -UnlockDP(__GLdrawablePrivate *glPriv) -{ -} - /*****************************************************************************/ /* Drawable private stuff */ @@ -296,7 +218,6 @@ __glXCreateDrawablePrivate(DrawablePtr p __GLcontextModes *modes) { __GLXdrawablePrivate *glxPriv; - __GLdrawablePrivate *glPriv; __GLXscreenInfo *pGlxScreen; glxPriv = (__GLXdrawablePrivate *) __glXMalloc(sizeof(*glxPriv)); @@ -316,44 +237,17 @@ __glXCreateDrawablePrivate(DrawablePtr p return NULL; } - /* fill up glPriv */ - glPriv = &glxPriv->glPriv; - glPriv->modes = (__GLcontextModes *) __glXMalloc(sizeof(__GLcontextModes)); - *glPriv->modes = *modes; - glPriv->malloc = __glXMalloc; - glPriv->calloc = __glXCalloc; - glPriv->realloc = __glXRealloc; - glPriv->free = __glXFree; - glPriv->addSwapRect = NULL; - glPriv->setClipRect = (void (*)(__GLdrawablePrivate *, GLint, GLint, GLsizei, GLsizei)) __glXNop; - glPriv->lockDP = LockDP; - glPriv->unlockDP = UnlockDP; - glPriv->getDrawableSize = __glXGetDrawableSize; - glPriv->resize = __glXResizeDrawable; - glPriv->other = glxPriv; - - /* allocate a one-rect ownership region */ - glPriv->ownershipRegion.rects = - (__GLregionRect *)__glXCalloc(1, sizeof(__GLregionRect)); - glPriv->ownershipRegion.numRects = 1; - - glxPriv->freeBuffers = __glXFreeBuffers; - glxPriv->updatePalette = (void (*)(__GLXdrawablePrivate *)) __glXNop; - pGlxScreen = &__glXActiveScreens[pDraw->pScreen->myNum]; - if (glxPriv->type == DRAWABLE_WINDOW) { - VisualID vid = wVisual((WindowPtr)pDraw); + /* The last argument is 'attrs', which is used with pbuffers which + * we currently don't support. */ - glxPriv->modes = _gl_context_modes_find_visual( pGlxScreen->modes, vid ); - __glXFBInitDrawable(glxPriv, modes); - } else { - glxPriv->modes = glxPriv->pGlxPixmap->modes; - __glXPixInitDrawable(glxPriv, modes); - } - - /* initialize the core's private buffer information */ - (*pGlxScreen->createBuffer)(glxPriv); + glxPriv->driDrawable.private = + (pGlxScreen->driScreen.createNewDrawable)(NULL, modes, + drawId, + &glxPriv->driDrawable, + 0, + NULL); return glxPriv; } @@ -361,24 +255,13 @@ __glXCreateDrawablePrivate(DrawablePtr p GLboolean __glXDestroyDrawablePrivate(__GLXdrawablePrivate *glxPriv) { - __GLdrawablePrivate *glPriv = &glxPriv->glPriv; - /* remove the drawable from the drawable list */ FreeResourceByType(glxPriv->drawId, __glXDrawableRes, FALSE); - /* Have the core free any memory it may have attached to the drawable */ - if (glPriv->freePrivate) { - (*glPriv->freePrivate)(glPriv); - } - - /* Free any framebuffer memory attached to the drawable */ - if (glxPriv->freeBuffers) { - (*glxPriv->freeBuffers)(glxPriv); - } + (*glxPriv->driDrawable.destroyDrawable)(NULL, + glxPriv->driDrawable.private); /* Free the drawable Private */ - __glXFree(glxPriv->glPriv.modes); - __glXFree(glxPriv->glPriv.ownershipRegion.rects); __glXFree(glxPriv); return GL_TRUE; @@ -411,97 +294,3 @@ __glXGetDrawablePrivate(DrawablePtr pDra return glxPriv; } - -void -__glXCacheDrawableSize(__GLXdrawablePrivate *glxPriv) -{ - if (glxPriv) { - if (glxPriv->pDraw) { - glxPriv->xorigin = glxPriv->pDraw->x; - glxPriv->yorigin = glxPriv->pDraw->y; - glxPriv->width = glxPriv->pDraw->width; - glxPriv->height = glxPriv->pDraw->height; - } - } -} - -/* -** resize/move the drawable. Called during the actual resize callback -** to update the drawable side of the buffers -*/ -GLboolean -__glXResizeDrawableBuffers(__GLXdrawablePrivate *glxPriv) -{ - __GLdrawablePrivate *glPriv = &glxPriv->glPriv; - GLint x, y; - GLuint w, h; -#if defined(__GL_ALIGNED_BUFFERS) - GLint xAlignment, yAlignment; - GLint xOffset, yOffset; - GLint xStart, xEnd; - GLint yStart, yEnd; - GLuint xAlignedMask, yAlignedMask; -#endif - GLboolean status = GL_TRUE; - - __glXCacheDrawableSize(glxPriv); - - w = glxPriv->width; - h = glxPriv->height; - x = glxPriv->xorigin; - y = glxPriv->yorigin; - -#if defined(__GL_ALIGNED_BUFFERS) - xAlignment = glPriv->xAlignment; - yAlignment = glPriv->yAlignment; - - xOffset = x & (xAlignment-1); - yOffset = y & (yAlignment-1); - - xAlignedMask = ~(xAlignment-1); - yAlignedMask = ~(yAlignment-1); - - xStart = x; xEnd = x+w; - yStart = y; yEnd = y+h; - - xStart &= xAlignedMask; - if (xEnd & ~xAlignedMask) { - xEnd = (xEnd&xAlignedMask) + xAlignment; - } - yStart &= yAlignedMask; - if (yEnd & ~yAlignedMask) { - yEnd = (yEnd&yAlignedMask) + yAlignment; - } - - x = xStart; y = yStart; - w = xEnd-xStart; h = yEnd-yStart; -#endif - - if ((x != glPriv->xOrigin) || - (y != glPriv->yOrigin) || -#if defined(__GL_ALIGNED_BUFFERS) - (xOffset != glPriv->xOffset) || - (yOffset != glPriv->yOffset) || -#endif - (w != glPriv->width) || - (h != glPriv->height) || - (!w && !h)) { - /* set up the glPriv info */ - glPriv->width = w; - glPriv->height = h; - glPriv->xOrigin = x; - glPriv->yOrigin = y; -#if defined(__GL_ALIGNED_BUFFERS) - glPriv->xOffset = xOffset; - glPriv->yOffset = yOffset; -#endif - - /* notify the buffers */ - status = __glXResizeBuffers(glPriv, x, y, w, h); - } - - return status; -} - -/************************************************************************/ - Index: programs/Xserver/hw/xfree86/drivers/ati/r128.h =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v retrieving revision 1.5 diff -u -p -r1.5 r128.h --- programs/Xserver/hw/xfree86/drivers/ati/r128.h 19 Dec 2004 19:49:33 -0000 1.5 +++ programs/Xserver/hw/xfree86/drivers/ati/r128.h 14 Nov 2005 17:11:46 -0000 @@ -39,6 +39,7 @@ #define _R128_H_ #include "xf86str.h" +#include "xf86drm.h" /* PCI support */ #include "xf86Pci.h" --- /dev/null 2005-11-12 14:20:58.444402750 -0500 +++ programs/Xserver/GL/glx/glxvisuals.c 2005-11-06 11:17:06.000000000 -0500 @@ -0,0 +1,519 @@ +/* + * Copyright © 2005 Red Hat, Inc. + * (C) Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * RED HAT, INC, OR PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT + * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * Brian Paul + * Kristian Høgsberg + * + */ + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void GlxWrapInitVisuals(miInitVisualsProcPtr *); + +#include "glcontextmodes.h" + +struct ScreenVisualsRec { + int num_vis; + void *private; + __GLcontextModes *modes; +}; +typedef struct ScreenVisualsRec ScreenVisuals; + +static ScreenVisuals screenVisuals[MAXSCREENS]; + +static int numConfigs = 0; +static __GLXvisualConfig *visualConfigs = NULL; +static void **visualPrivates = NULL; + +static int count_bits(unsigned int n) +{ + int bits = 0; + + while (n > 0) { + if (n & 1) bits++; + n >>= 1; + } + return bits; +} + +/* + * In the case the driver defines no GLX visuals we'll use these. + * Note that for TrueColor and DirectColor visuals, bufferSize is the + * sum of redSize, greenSize, blueSize and alphaSize, which may be larger + * than the nplanes/rootDepth of the server's X11 visuals + */ +#define NUM_FALLBACK_CONFIGS 5 +static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = { + /* [0] = RGB, double buffered, Z */ + { + -1, /* vid */ + -1, /* class */ + True, /* rgba */ + -1, -1, -1, 0, /* rgba sizes */ + -1, -1, -1, 0, /* rgba masks */ + 0, 0, 0, 0, /* rgba accum sizes */ + True, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 0, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, + /* [1] = RGB, double buffered, Z, stencil, accum */ + { + -1, /* vid */ + -1, /* class */ + True, /* rgba */ + -1, -1, -1, 0, /* rgba sizes */ + -1, -1, -1, 0, /* rgba masks */ + 16, 16, 16, 0, /* rgba accum sizes */ + True, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 8, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, + /* [2] = RGB+Alpha, double buffered, Z, stencil, accum */ + { + -1, /* vid */ + -1, /* class */ + True, /* rgba */ + -1, -1, -1, 8, /* rgba sizes */ + -1, -1, -1, -1, /* rgba masks */ + 16, 16, 16, 16, /* rgba accum sizes */ + True, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 8, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, + /* [3] = RGB+Alpha, single buffered, Z, stencil, accum */ + { + -1, /* vid */ + -1, /* class */ + True, /* rgba */ + -1, -1, -1, 8, /* rgba sizes */ + -1, -1, -1, -1, /* rgba masks */ + 16, 16, 16, 16, /* rgba accum sizes */ + False, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 8, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, + /* [4] = CI, double buffered, Z */ + { + -1, /* vid */ + -1, /* class */ + False, /* rgba? (false = color index) */ + -1, -1, -1, 0, /* rgba sizes */ + -1, -1, -1, 0, /* rgba masks */ + 0, 0, 0, 0, /* rgba accum sizes */ + True, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 0, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, +}; + + +static Bool init_visuals(int *nvisualp, VisualPtr *visualp, + VisualID *defaultVisp, + int ndepth, DepthPtr pdepth, + int rootDepth) +{ + int numRGBconfigs; + int numCIconfigs; + int numVisuals = *nvisualp; + int numNewVisuals; + int numNewConfigs; + VisualPtr pVisual = *visualp; + VisualPtr pVisualNew = NULL; + VisualID *orig_vid = NULL; + __GLcontextModes *modes; + __GLXvisualConfig *pNewVisualConfigs = NULL; + void **glXVisualPriv; + void **pNewVisualPriv; + int found_default; + int i, j, k; + + if (numConfigs > 0) + numNewConfigs = numConfigs; + else + numNewConfigs = NUM_FALLBACK_CONFIGS; + + /* Alloc space for the list of new GLX visuals */ + pNewVisualConfigs = (__GLXvisualConfig *) + __glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig)); + if (!pNewVisualConfigs) { + return FALSE; + } + + /* Alloc space for the list of new GLX visual privates */ + pNewVisualPriv = (void **) __glXMalloc(numNewConfigs * sizeof(void *)); + if (!pNewVisualPriv) { + __glXFree(pNewVisualConfigs); + return FALSE; + } + + /* + ** If SetVisualConfigs was not called, then use default GLX + ** visual configs. + */ + if (numConfigs == 0) { + memcpy(pNewVisualConfigs, FallbackConfigs, + NUM_FALLBACK_CONFIGS * sizeof(__GLXvisualConfig)); + memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *)); + } + else { + /* copy driver's visual config info */ + for (i = 0; i < numConfigs; i++) { + pNewVisualConfigs[i] = visualConfigs[i]; + pNewVisualPriv[i] = visualPrivates[i]; + } + } + + /* Count the number of RGB and CI visual configs */ + numRGBconfigs = 0; + numCIconfigs = 0; + for (i = 0; i < numNewConfigs; i++) { + if (pNewVisualConfigs[i].rgba) + numRGBconfigs++; + else + numCIconfigs++; + } + + /* Count the total number of visuals to compute */ + numNewVisuals = 0; + for (i = 0; i < numVisuals; i++) { + numNewVisuals += + (pVisual[i].class == TrueColor || pVisual[i].class == DirectColor) + ? numRGBconfigs : numCIconfigs; + } + + /* Reset variables for use with the next screen/driver's visual configs */ + visualConfigs = NULL; + numConfigs = 0; + + /* Alloc temp space for the list of orig VisualIDs for each new visual */ + orig_vid = (VisualID *)__glXMalloc(numNewVisuals * sizeof(VisualID)); + if (!orig_vid) { + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); + return FALSE; + } + + /* Alloc space for the list of glXVisuals */ + modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes)); + if (modes == NULL) { + __glXFree(orig_vid); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); + return FALSE; + } + + /* Alloc space for the list of glXVisualPrivates */ + glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *)); + if (!glXVisualPriv) { + _gl_context_modes_destroy( modes ); + __glXFree(orig_vid); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); + return FALSE; + } + + /* Alloc space for the new list of the X server's visuals */ + pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec)); + if (!pVisualNew) { + __glXFree(glXVisualPriv); + _gl_context_modes_destroy( modes ); + __glXFree(orig_vid); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); + return FALSE; + } + + /* Initialize the new visuals */ + found_default = FALSE; + screenVisuals[screenInfo.numScreens-1].modes = modes; + for (i = j = 0; i < numVisuals; i++) { + int is_rgb = (pVisual[i].class == TrueColor || + pVisual[i].class == DirectColor); + + for (k = 0; k < numNewConfigs; k++) { + if (pNewVisualConfigs[k].rgba != is_rgb) + continue; + + assert( modes != NULL ); + + /* Initialize the new visual */ + pVisualNew[j] = pVisual[i]; + pVisualNew[j].vid = FakeClientID(0); + + /* Check for the default visual */ + if (!found_default && pVisual[i].vid == *defaultVisp) { + *defaultVisp = pVisualNew[j].vid; + found_default = TRUE; + } + + /* Save the old VisualID */ + orig_vid[j] = pVisual[i].vid; + + /* Initialize the glXVisual */ + _gl_copy_visual_to_context_mode( modes, & pNewVisualConfigs[k] ); + modes->visualID = pVisualNew[j].vid; + if (modes->fbconfigID == GLX_DONT_CARE) + modes->fbconfigID = modes->visualID; + + /* + * If the class is -1, then assume the X visual information + * is identical to what GLX needs, and take them from the X + * visual. NOTE: if class != -1, then all other fields MUST + * be initialized. + */ + if (modes->visualType == GLX_NONE) { + modes->visualType = _gl_convert_from_x_visual_type( pVisual[i].class ); + modes->redBits = count_bits(pVisual[i].redMask); + modes->greenBits = count_bits(pVisual[i].greenMask); + modes->blueBits = count_bits(pVisual[i].blueMask); + modes->alphaBits = modes->alphaBits; + modes->redMask = pVisual[i].redMask; + modes->greenMask = pVisual[i].greenMask; + modes->blueMask = pVisual[i].blueMask; + modes->alphaMask = modes->alphaMask; + modes->rgbBits = (is_rgb) + ? (modes->redBits + modes->greenBits + + modes->blueBits + modes->alphaBits) + : rootDepth; + } + + /* Save the device-dependent private for this visual */ + glXVisualPriv[j] = pNewVisualPriv[k]; + + j++; + modes = modes->next; + } + } + + assert(j <= numNewVisuals); + + /* Save the GLX visuals in the screen structure */ + screenVisuals[screenInfo.numScreens-1].num_vis = numNewVisuals; + screenVisuals[screenInfo.numScreens-1].private = glXVisualPriv; + + /* Set up depth's VisualIDs */ + for (i = 0; i < ndepth; i++) { + int numVids = 0; + VisualID *pVids = NULL; + int k, n = 0; + + /* Count the new number of VisualIDs at this depth */ + for (j = 0; j < pdepth[i].numVids; j++) + for (k = 0; k < numNewVisuals; k++) + if (pdepth[i].vids[j] == orig_vid[k]) + numVids++; + + /* Allocate a new list of VisualIDs for this depth */ + pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID)); + + /* Initialize the new list of VisualIDs for this depth */ + for (j = 0; j < pdepth[i].numVids; j++) + for (k = 0; k < numNewVisuals; k++) + if (pdepth[i].vids[j] == orig_vid[k]) + pVids[n++] = pVisualNew[k].vid; + + /* Update this depth's list of VisualIDs */ + __glXFree(pdepth[i].vids); + pdepth[i].vids = pVids; + pdepth[i].numVids = numVids; + } + + /* Update the X server's visuals */ + *nvisualp = numNewVisuals; + *visualp = pVisualNew; + + /* Free the old list of the X server's visuals */ + __glXFree(pVisual); + + /* Clean up temporary allocations */ + __glXFree(orig_vid); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); + + /* Free the private list created by DDX HW driver */ + if (visualPrivates) + xfree(visualPrivates); + visualPrivates = NULL; + + return TRUE; +} + +void GlxSetVisualConfigs(int nconfigs, + __GLXvisualConfig *configs, void **privates) +{ + numConfigs = nconfigs; + visualConfigs = configs; + visualPrivates = privates; +} + +static miInitVisualsProcPtr saveInitVisualsProc; + +static Bool __glXInitVisuals(VisualPtr *visualp, DepthPtr *depthp, + int *nvisualp, int *ndepthp, + int *rootDepthp, VisualID *defaultVisp, + unsigned long sizes, int bitsPerRGB, + int preferredVis) +{ + Bool ret; + + if (saveInitVisualsProc) { + ret = saveInitVisualsProc(visualp, depthp, nvisualp, ndepthp, + rootDepthp, defaultVisp, sizes, bitsPerRGB, + preferredVis); + if (!ret) + return False; + } + + /* + * Setup the visuals supported by this particular screen. + */ + return init_visuals(nvisualp, visualp, defaultVisp, + *ndepthp, *depthp, *rootDepthp); +} + +void +GlxWrapInitVisuals(miInitVisualsProcPtr *initVisProc) +{ + saveInitVisualsProc = *initVisProc; + *initVisProc = __glXInitVisuals; +} + +static void fixup_visuals(int screen) +{ + ScreenPtr pScreen = screenInfo.screens[screen]; + ScreenVisuals *psv = &screenVisuals[screen]; + int j; + __GLcontextModes *modes; + + for ( modes = psv->modes ; modes != NULL ; modes = modes->next ) { + const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); + const int nplanes = (modes->rgbBits - modes->alphaBits); + const VisualPtr pVis = pScreen->visuals; + + /* Find a visual that matches the GLX visual's class and size */ + for (j = 0; j < pScreen->numVisuals; j++) { + if (pVis[j].class == vis_class && + pVis[j].nplanes == nplanes) { + + /* Fixup the masks */ + modes->redMask = pVis[j].redMask; + modes->greenMask = pVis[j].greenMask; + modes->blueMask = pVis[j].blueMask; + + /* Recalc the sizes */ + modes->redBits = count_bits(modes->redMask); + modes->greenBits = count_bits(modes->greenMask); + modes->blueBits = count_bits(modes->blueMask); + } + } + } +} + +void __glXVisualsInitScreen(__GLXscreenInfo *info, int screen) +{ + info->modes = screenVisuals[screen].modes; + info->pVisualPriv = screenVisuals[screen].private; + info->numVisuals = screenVisuals[screen].num_vis; + info->numUsableVisuals = screenVisuals[screen].num_vis; + fixup_visuals(screen); + + return TRUE; +} + + +void __glXVisualsReset(void) +{ + int i, j; + + for (i = 0; i < screenInfo.numScreens; i++) { + _gl_context_modes_destroy(screenVisuals[i].modes ); + screenVisuals[i].modes = NULL; + __glXFree(screenVisuals[i].private); + screenVisuals[i].private = NULL; + screenVisuals[i].num_vis = 0; + } +} --- /dev/null 2005-11-12 14:20:58.444402750 -0500 +++ programs/Xserver/GL/glx/glxvisuals.h 2005-11-06 08:22:42.000000000 -0500 @@ -0,0 +1,33 @@ +/* + * Copyright © 2005 Red Hat, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * RED HAT, INC, AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef __GLX_VISUALS_H__ +#define __GLX_VISUALS_H__ + +void __glXVisualsInitScreen(__GLXscreenInfo *info, int screen); + +void GlxSetVisualConfigs(int nconfigs, + __GLXvisualConfig *configs, void **privates); + +#endif /* __GLX_VISUALS_H__ */ --- /dev/null 2005-11-12 14:20:58.444402750 -0500 +++ programs/Xserver/GL/glx/glxloader.c 2005-11-11 14:57:34.000000000 -0500 @@ -0,0 +1,791 @@ +/* + * Copyright © 2005 Red Hat, Inc. + * (C) Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * RED HAT, INC, OR PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT + * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * Brian Paul + * Kristian Høgsberg + * + */ + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#define _XF86DRI_SERVER_ +#include "../dri/xf86dristr.h" +#include "../dri/dri.h" + +#define DRI_NEW_INTERFACE_ONLY +#include "glxserver.h" +#include "glxutil.h" +#include "glxloader.h" +#include "glcontextmodes.h" + +#ifndef DEFAULT_DRIVER_DIR +/* this is normally defined in the Imakefile */ +#define DEFAULT_DRIVER_DIR "/usr/X11R6/lib/modules/dri" +#endif + +/* +** We keep a linked list of these structures, one per DRI device driver. +*/ + +/* Not sure if the DRIdriver struct is really necessary... We could + * just dlopen() the driver for every screen. This won't cause the + * library to be loaded again, and the libraries are ref-counted so + * dlclose()'ing the driver for one screen won't close it for + * another. /KRH */ + +struct __DRIdriverRec { + const char *name; + void *handle; + PFNCREATENEWSCREENFUNC createNewScreenFunc; + struct __DRIdriverRec *next; +}; + +static __DRIdriver *Drivers = NULL; + + + +/** + * Extract the ith directory path out of a colon-separated list of paths. No + * more than \c dirLen characters, including the terminating \c NUL, will be + * written to \c dir. + * + * \param index Index of path to extract (starting at zero) + * \param paths The colon-separated list of paths + * \param dirLen Maximum length of result to store in \c dir + * \param dir Buffer to hold the extracted directory path + * + * \returns + * The number of characters that would have been written to \c dir had there + * been enough room. This does not include the terminating \c NUL. When + * extraction fails, zero will be returned. + * + * \todo + * It seems like this function could be rewritten to use \c strchr. + */ +static size_t +ExtractDir(int index, const char *paths, int dirLen, char *dir) +{ + int i, len; + const char *start, *end; + + /* find ith colon */ + start = paths; + i = 0; + while (i < index) { + if (*start == ':') { + i++; + start++; + } + else if (*start == 0) { + /* end of string and couldn't find ith colon */ + dir[0] = 0; + return 0; + } + else { + start++; + } + } + + while (*start == ':') + start++; + + /* find next colon, or end of string */ + end = start + 1; + while (*end != ':' && *end != 0) { + end++; + } + + /* copy string between and into result string */ + len = end - start; + if (len > dirLen - 1) + len = dirLen - 1; + strncpy(dir, start, len); + dir[len] = 0; + + return( end - start ); +} + + +/** + * Versioned name of the expected \c __driCreateNewScreen function. + * + * The version of the last incompatible loader/driver inteface change is + * appended to the name of the \c __driCreateNewScreen function. This + * prevents loaders from trying to load drivers that are too old. + * + * \todo + * Create a macro or something so that this is automatically updated. + */ +static const char createNewScreenName[] = "__driCreateNewScreen_20050727"; + + +/** + * Try to \c dlopen the named driver. + * + * This function adds the "_dri.so" suffix to the driver name and searches the + * directories specified by the \c LIBGL_DRIVERS_PATH environment variable in + * order to find the driver. + * + * \param driverName - a name like "tdfx", "i810", "mga", etc. + * + * \returns + * A handle from \c dlopen, or \c NULL if driver file not found. + */ +static __DRIdriver *OpenDriver(const char *driverName, ScreenPtr pScreen) +{ + char *libPaths = NULL; + char libDir[1000]; + int i; + __DRIdriver *driver; + + /* First, search Drivers list to see if we've already opened this driver */ + for (driver = Drivers; driver; driver = driver->next) { + if (strcmp(driver->name, driverName) == 0) { + /* found it */ + return driver; + } + } + + /* We probably want to control this similar to how we handle the + * -modulepath cmd line option. For now, this is convenient + * though. */ + libPaths = getenv("LIBGL_DRIVERS_PATH"); + if (!libPaths) + libPaths = getenv("LIBGL_DRIVERS_DIR"); /* deprecated */ + if (!libPaths) + libPaths = DEFAULT_DRIVER_DIR; + + for ( i = 0 ; ExtractDir(i, libPaths, sizeof libDir, libDir) != 0 ; i++ ) { + char realDriverName[200]; + void *handle = NULL; + + snprintf(realDriverName, sizeof realDriverName, + "%s/%s_dri.so", libDir, driverName); + + xf86DrvMsg(pScreen->myNum, X_INFO, + "OpenDriver: trying %s\n", realDriverName); + handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL); + + if ( handle != NULL ) { + /* allocate __DRIdriver struct */ + driver = (__DRIdriver *) __glXMalloc(sizeof(__DRIdriver)); + if (!driver) + return NULL; /* out of memory! */ + /* init the struct */ + driver->name = Xstrdup(driverName); + if (!driver->name) { + Xfree(driver); + return NULL; /* out of memory! */ + } + + driver->createNewScreenFunc = (PFNCREATENEWSCREENFUNC) + dlsym(handle, createNewScreenName); + + if ( driver->createNewScreenFunc == NULL ) { + /* If the driver doesn't have this symbol then something's + * really, really wrong. + */ + xf86DrvMsg(pScreen->myNum, X_ERROR, + "%s not defined in %s_dri.so!\n" + "Your driver may be too old for this GLX module.\n", + createNewScreenName, driverName); + Xfree(driver); + dlclose(handle); + continue; + } + driver->handle = handle; + /* put at head of linked list */ + driver->next = Drivers; + Drivers = driver; + + return driver; + } + else { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "dlopen %s failed (%s)\n", realDriverName, dlerror()); + } + } + + xf86DrvMsg(pScreen->myNum, X_ERROR, + "unable to find driver: %s_dri.so\n", driverName); + + return NULL; +} + + +/* + * Given a display pointer and screen number, determine the name of + * the DRI driver for the screen. (I.e. "r128", "tdfx", etc). + * Return True for success, False for failure. + */ +static Bool GetDriverName(ScreenPtr pScreen, char **driverName) +{ + int directCapable; + Bool b; + int driverMajor, driverMinor, driverPatch; + + *driverName = NULL; + + if (!DRIQueryDirectRenderingCapable(pScreen, &directCapable)) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "DRIQueryDirectRenderingCapable failed\n"); + return False; + } + if (!directCapable) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "DRIQueryDirectRenderingCapable returned false\n"); + return False; + } + + b = DRIGetClientDriverName(pScreen, &driverMajor, &driverMinor, + &driverPatch, driverName); + if (!b) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "Cannot determine driver name for screen %d\n", + pScreen->myNum); + return False; + } + + xf86DrvMsg(pScreen->myNum, X_INFO, + "DRIGetClientDriverName: %d.%d.%d %s (screen %d)\n", + driverMajor, driverMinor, driverPatch, + *driverName, pScreen->myNum); + + return True; +} + + +/* + * Given a display pointer and screen number, return a __DRIdriver handle. + * Return NULL if anything goes wrong. + */ +static __DRIdriver *driGetDriver(ScreenPtr pScreen) +{ + char *driverName; + + if (GetDriverName(pScreen, &driverName)) { + __DRIdriver *ret; + ret = OpenDriver(driverName, pScreen); + + return ret; + } + + return NULL; +} + +static unsigned +filter_modes(__GLcontextModes **server_modes, + const __GLcontextModes *driver_modes) +{ + __GLcontextModes * m; + __GLcontextModes ** prev_next; + const __GLcontextModes * check; + unsigned modes_count = 0; + + if ( driver_modes == NULL ) { + fprintf(stderr, "libGL warning: 3D driver returned no fbconfigs.\n"); + return 0; + } + + /* For each mode in server_modes, check to see if a matching mode exists + * in driver_modes. If not, then the mode is not available. + */ + + prev_next = server_modes; + for ( m = *prev_next ; m != NULL ; m = *prev_next ) { + GLboolean do_delete = GL_TRUE; + + for ( check = driver_modes ; check != NULL ; check = check->next ) { + if ( _gl_context_modes_are_same( m, check ) ) { + do_delete = GL_FALSE; + break; + } + } + + /* The 3D has to support all the modes that match the GLX visuals + * sent from the X server. + */ + if ( do_delete && (m->visualID != 0) ) { + do_delete = GL_FALSE; + + fprintf(stderr, "libGL warning: 3D driver claims to not support " + "visual 0x%02x\n", m->visualID); + } + + if ( do_delete ) { + *prev_next = m->next; + + m->next = NULL; + _gl_context_modes_destroy( m ); + } + else { + modes_count++; + prev_next = & m->next; + } + } + + return modes_count; +} + + +static __DRIfuncPtr getProcAddress(const char *proc_name) +{ + return NULL; +} + +static __DRIscreen *findScreen(__DRInativeDisplay *dpy, int scrn) +{ + return &__glXActiveScreens[scrn].driScreen; +} + +static GLboolean windowExists(__DRInativeDisplay *dpy, __DRIid draw) +{ + WindowPtr pWin = (WindowPtr) LookupIDByType(draw, RT_WINDOW); + + return pWin == NULL ? GL_FALSE : GL_TRUE; +} + +static GLboolean createContext(__DRInativeDisplay *dpy, int screen, + int configID, void *contextID, + drm_context_t *hw_context) +{ + XID fakeID; + VisualPtr visual; + int i; + ScreenPtr pScreen; + + pScreen = screenInfo.screens[screen]; + + /* Find the requested X visual */ + visual = pScreen->visuals; + for (i = 0; i < pScreen->numVisuals; i++, visual++) + if (visual->vid == configID) + break; + if (i == pScreen->numVisuals) + return GL_FALSE; + + fakeID = FakeClientID(0); + *(XID *) contextID = fakeID; + + return DRICreateContext(pScreen, visual, fakeID, hw_context); +} + +static GLboolean destroyContext(__DRInativeDisplay *dpy, int screen, + __DRIid context) +{ + return DRIDestroyContext(screenInfo.screens[screen], context); +} + +static GLboolean +createDrawable(__DRInativeDisplay *dpy, int screen, + __DRIid drawable, drm_drawable_t *hHWDrawable) +{ + DrawablePtr pDrawable; + + pDrawable = (DrawablePtr) LookupIDByClass(drawable, RC_DRAWABLE); + if (!pDrawable) + return GL_FALSE; + + return DRICreateDrawable(screenInfo.screens[screen], + drawable, + pDrawable, + hHWDrawable); +} + +static GLboolean +destroyDrawable(__DRInativeDisplay *dpy, int screen, __DRIid drawable) +{ + DrawablePtr pDrawable; + + pDrawable = (DrawablePtr) LookupIDByClass(drawable, RC_DRAWABLE); + if (!pDrawable) + return GL_FALSE; + + return DRIDestroyDrawable(screenInfo.screens[screen], + drawable, + pDrawable); +} + +static GLboolean +getDrawableInfo(__DRInativeDisplay *dpy, int screen, + __DRIid drawable, unsigned int *index, unsigned int *stamp, + int *x, int *y, int *width, int *height, + int *numClipRects, drm_clip_rect_t **ppClipRects, + int *backX, int *backY, + int *numBackClipRects, drm_clip_rect_t **ppBackClipRects) +{ + DrawablePtr pDrawable; + drm_clip_rect_t *pClipRects, *pBackClipRects; + GLboolean retval; + size_t size; + + pDrawable = (DrawablePtr) LookupIDByClass(drawable, RC_DRAWABLE); + if (!pDrawable) + return GL_FALSE; + + retval = DRIGetDrawableInfo(screenInfo.screens[screen], + pDrawable, index, stamp, + x, y, width, height, + numClipRects, &pClipRects, + backX, backY, + numBackClipRects, &pBackClipRects); + + if (*numClipRects > 0) { + size = sizeof (drm_clip_rect_t) * *numClipRects; + *ppClipRects = __glXMalloc (size); + if (*ppClipRects != NULL) + memcpy (*ppClipRects, pClipRects, size); + } + + if (*numBackClipRects > 0) { + size = sizeof (drm_clip_rect_t) * *numBackClipRects; + *ppBackClipRects = __glXMalloc (size); + if (*ppBackClipRects != NULL) + memcpy (*ppBackClipRects, pBackClipRects, size); + } + + return GL_TRUE; +} + +/* Table of functions exported by the loader to the driver. */ +static const __DRIinterfaceMethods interface_methods = { + getProcAddress, + + _gl_context_modes_create, + _gl_context_modes_destroy, + + findScreen, + windowExists, + + createContext, + destroyContext, + + createDrawable, + destroyDrawable, + getDrawableInfo, + + NULL, /* __glXGetUST, */ + NULL, /* glXGetMscRateOML, */ +}; + +/** + * Retrieves the verion of the internal libGL API in YYYYMMDD format. This + * might be used by the DRI drivers to determine how new libGL is at runtime. + * Drivers should not call this function directly. They should instead use + * \c glXGetProcAddress to obtain a pointer to the function. + * + * \returns An 8-digit decimal number representing the internal libGL API in + * YYYYMMDD format. + * + * \sa glXGetProcAddress, PFNGLXGETINTERNALVERSIONPROC + * + * \since Internal API version 20021121. + */ +static int __glXGetInternalVersion(void) +{ + /* History: + * 20021121 - Initial version + * 20021128 - Added __glXWindowExists() function + * 20021207 - Added support for dynamic GLX extensions, + * GLX_SGI_swap_control, GLX_SGI_video_sync, + * GLX_OML_sync_control, and GLX_MESA_swap_control. + * Never officially released. Do NOT test against + * this version. Use 20030317 instead. + * 20030317 - Added support GLX_SGIX_fbconfig, + * GLX_MESA_swap_frame_usage, GLX_OML_swap_method, + * GLX_{ARB,SGIS}_multisample, and + * GLX_SGIX_visual_select_group. + * 20030606 - Added support for GLX_SGI_make_current_read. + * 20030813 - Made support for dynamic extensions multi-head aware. + * 20030818 - Added support for GLX_MESA_allocate_memory in place of the + * deprecated GLX_NV_vertex_array_range & GLX_MESA_agp_offset + * interfaces. + * 20031201 - Added support for the first round of DRI interface changes. + * Do NOT test against this version! It has binary + * compatibility bugs, use 20040317 instead. + * 20040317 - Added the 'mode' field to __DRIcontextRec. + * 20040415 - Added support for bindContext3 and unbindContext3. + * 20040602 - Add __glXGetDrawableInfo. I though that was there + * months ago. :( + * 20050727 - Gut all the old interfaces. This breaks compatability with + * any DRI driver built to any previous version. + */ + return 20050727; +} + +/** + * Perform the required libGL-side initialization and call the client-side + * driver's \c __driCreateNewScreen function. + * + * \param dpy Display pointer. + * \param scrn Screen number on the display. + * \param psc DRI screen information. + * \param driDpy DRI display information. + * \param createNewScreen Pointer to the client-side driver's + * \c __driCreateNewScreen function. + * \returns A pointer to the \c __DRIscreenPrivate structure returned by + * the client-side driver on success, or \c NULL on failure. + * + * \todo This function needs to be modified to remove context-modes from the + * list stored in the \c __GLXscreenConfigsRec to match the list + * returned by the client-side driver. + */ +static void * +CallCreateNewScreen(ScreenPtr pScreen, __DRIscreen *psc, + PFNCREATENEWSCREENFUNC createNewScreen) +{ + drm_handle_t hSAREA; + drmAddress pSAREA = MAP_FAILED; + char *BusID; + __DRIversion ddx_version; + __DRIversion dri_version; + __DRIversion drm_version; + __DRIframebuffer framebuffer; + int fd = -1; + int status; + const char * err_msg; + const char * err_extra = NULL; + int api_ver = __glXGetInternalVersion(); + drm_magic_t magic; + drmVersionPtr version; + char *driverName; + drm_handle_t hFB; + int junk; + __GLcontextModes * driver_modes; + __GLXscreenInfo *pGlxScreen; + + /* DRI protocol version. */ + dri_version.major = XF86DRI_MAJOR_VERSION; + dri_version.minor = XF86DRI_MINOR_VERSION; + dri_version.patch = XF86DRI_PATCH_VERSION; + + framebuffer.base = MAP_FAILED; + framebuffer.dev_priv = NULL; + + if (!DRIOpenConnection(pScreen, &hSAREA, &BusID)) { + err_msg = "DRIOpenConnection"; + err_extra = NULL; + goto handle_error; + } + + fd = drmOpen(NULL, BusID); + Xfree(BusID); /* No longer needed */ + + if (fd < 0) { + err_msg = "open DRM"; + err_extra = strerror( -fd ); + goto handle_error; + } + + if (drmGetMagic(fd, &magic)) { + err_msg = "drmGetMagic"; + err_extra = NULL; + goto handle_error; + } + + version = drmGetVersion(fd); + if (version) { + drm_version.major = version->version_major; + drm_version.minor = version->version_minor; + drm_version.patch = version->version_patchlevel; + drmFreeVersion(version); + } + else { + drm_version.major = -1; + drm_version.minor = -1; + drm_version.patch = -1; + } + + if (!DRIAuthConnection(pScreen, magic)) { + err_msg = "DRIAuthConnection"; + goto handle_error; + } + + /* Get device name (like "tdfx") and the ddx version numbers. + * We'll check the version in each DRI driver's "createNewScreen" + * function. */ + if (!DRIGetClientDriverName(pScreen, + &ddx_version.major, + &ddx_version.minor, + &ddx_version.patch, + &driverName)) { + err_msg = "DRIGetClientDriverName"; + goto handle_error; + } + + /* + * Get device-specific info. pDevPriv will point to a struct + * (such as DRIRADEONRec in xfree86/driver/ati/radeon_dri.h) that + * has information about the screen size, depth, pitch, ancilliary + * buffers, DRM mmap handles, etc. + */ + if (!DRIGetDeviceInfo(pScreen, &hFB, &junk, + &framebuffer.size, &framebuffer.stride, + &framebuffer.dev_priv_size, &framebuffer.dev_priv)) { + err_msg = "XF86DRIGetDeviceInfo"; + goto handle_error; + } + + framebuffer.width = pScreen->width; + framebuffer.height = pScreen->height; + + /* Map the framebuffer region. */ + status = drmMap(fd, hFB, framebuffer.size, + (drmAddressPtr)&framebuffer.base); + if (status != 0) { + err_msg = "drmMap of framebuffer"; + err_extra = strerror( -status ); + goto handle_error; + } + + /* Map the SAREA region. Further mmap regions may be setup in + * each DRI driver's "createNewScreen" function. + */ + status = drmMap(fd, hSAREA, SAREA_MAX, &pSAREA); + if (status != 0) { + err_msg = "drmMap of sarea"; + err_extra = strerror( -status ); + goto handle_error; + } + + driver_modes = NULL; + + pGlxScreen = &__glXActiveScreens[pScreen->myNum]; + + __glXActiveScreens[pScreen->myNum].driScreen.private = + (*createNewScreen)(NULL, pScreen->myNum, + &__glXActiveScreens[pScreen->myNum].driScreen, + pGlxScreen->modes, + &ddx_version, + &dri_version, + &drm_version, + &framebuffer, + pSAREA, + fd, + api_ver, + &interface_methods, + &driver_modes); + + if (__glXActiveScreens[pScreen->myNum].driScreen.private == NULL) { + err_msg = "InitDriver"; + err_extra = NULL; + goto handle_error; + } + + filter_modes(&pGlxScreen->modes, driver_modes); + _gl_context_modes_destroy(driver_modes); + + return __glXActiveScreens[pScreen->myNum].driScreen.private; + + handle_error: + if (pSAREA != MAP_FAILED) + drmUnmap(pSAREA, SAREA_MAX); + + if (framebuffer.base != MAP_FAILED) + drmUnmap((drmAddress)framebuffer.base, framebuffer.size); + + if (framebuffer.dev_priv != NULL) + Xfree(framebuffer.dev_priv); + + if (fd >= 0) + drmClose(fd); + + DRICloseConnection(pScreen); + + if (err_extra != NULL) + fprintf(stderr, "libGL error: %s failed (%s)\n", err_msg, + err_extra); + else + fprintf(stderr, "libGL error: %s failed\n", err_msg ); + + fprintf(stderr, "libGL error: reverting to (slow) indirect rendering\n"); + + return NULL; +} + +#if 0 +/* This function isn't currently used. + */ +static void driDestroyDisplay(Display *dpy, void *private) +{ + __DRIdisplayPrivate *pdpyp = (__DRIdisplayPrivate *)private; + + if (pdpyp) { + const int numScreens = ScreenCount(dpy); + int i; + for (i = 0; i < numScreens; i++) { + if (pdpyp->libraryHandles[i]) + dlclose(pdpyp->libraryHandles[i]); + } + Xfree(pdpyp->libraryHandles); + Xfree(pdpyp); + } +} +#endif + +void __glXLoaderInitScreen(int screen) +{ + ScreenPtr pScreen; + __DRIdriver *driver; + + /* dynamically discover DRI drivers for all screens, saving each + * driver's "__driCreateScreen" function pointer. That's the bootstrap + * entrypoint for all DRI drivers. + */ + pScreen = screenInfo.screens[screen]; + driver = driGetDriver(pScreen); + + if (driver) { + __glXActiveScreens[screen].driver = driver; + + CallCreateNewScreen(pScreen, + &__glXActiveScreens[screen].driScreen, + driver->createNewScreenFunc); + __glXActiveScreens[screen].driScreen.screenConfigs = + &__glXActiveScreens[screen]; + } + else { + /* FIXME: Fall back to loading sw dri driver here. */ + } +} --- /dev/null 2005-11-12 14:20:58.444402750 -0500 +++ programs/Xserver/GL/glx/glxloader.h 2005-11-06 09:37:00.000000000 -0500 @@ -0,0 +1,30 @@ +/* + * Copyright © 2005 Red Hat, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * RED HAT, INC, AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef __GLX_LOADER_H__ +#define __GLX_LOADER_H__ + +void __glXLoaderInitScreen(int screen); + +#endif /* __GLX_LOADER_H__ */