#include "GL/internal/glcore.h"
#include "glapitable.h"
#include "glxextensions.h"
-#ifdef XTHREADS
-#include "Xthreads.h"
-#endif
-#ifdef GLX_BUILT_IN_XMESA
-#include "realglx.h" /* just silences prototype warnings */
+#if defined( USE_XTHREADS )
+# include <X11/Xthreads.h>
+#elif defined( PTHREADS )
+# include <pthread.h>
#endif
#define GLX_MAJOR_VERSION 1 /* current version numbers */
#include <GL/internal/dri_interface.h>
-typedef void *(*CreateScreenFunc)(Display *dpy, int scrn, __DRIscreen *psc,
- int numConfigs, __GLXvisualConfig *config);
-
-typedef void *(*CreateNewScreenFunc)(Display *dpy, int scrn, __DRIscreen *psc,
- const __GLcontextModes * modes, const __DRIversion * ddx_version,
- const __DRIversion * dri_version, const __DRIversion * drm_version,
- const __DRIframebuffer * frame_buffer, void * pSAREA,
- int fd, int internal_api_version, __GLcontextModes ** driver_modes);
-
/**
* Display dependent methods. This structure is initialized during the
*/
void (*destroyDisplay)(Display *dpy, void *displayPrivate);
- /**
- * Methods to create the private DRI screen data and initialize the
- * screen dependent methods.
- * This is an array [indexed by screen number] of function pointers.
- *
- * \deprecated This array of function pointers has been replaced by
- * \c __DRIdisplayRec::createNewScreen.
- * \sa __DRIdisplayRec::createNewScreen
- */
- CreateScreenFunc * createScreen;
-
/**
* Opaque pointer to private per display direct rendering data.
* \c NULL if direct rendering is not supported on this display.
/**
* Array of pointers to methods to create and initialize the private DRI
* screen data.
- *
- * \sa __DRIdisplayRec::createScreen
*/
- CreateNewScreenFunc * createNewScreen;
+ PFNCREATENEWSCREENFUNC * createNewScreen;
};
struct __DRIdriverRec {
const char *name;
void *handle;
- CreateScreenFunc createScreenFunc;
- CreateNewScreenFunc createNewScreenFunc;
+ PFNCREATENEWSCREENFUNC createNewScreenFunc;
struct __DRIdriverRec *next;
};
extern const char *glXGetDriverConfig (const char *driverName);
+extern Bool __glXWindowExists(Display *dpy, GLXDrawable draw);
+
#endif
/************************************************************************/
GLuint alignment;
} __GLXpixelStoreMode;
-/* The next 3 structures are deprecated. Client state is no longer tracked
- * using them. They only remain to maintain the layout / structure offset of
- * __GLXcontextRec. In XFree86 5.0 they will be removed altogether.
- */
-
-typedef struct __GLXvertexArrayPointerStateRecDEPRECATED {
- GLboolean enable;
- void (*proc)(const void *);
- const GLubyte *ptr;
- GLsizei skip;
- GLint size;
- GLenum type;
- GLsizei stride;
-} __GLXvertexArrayPointerStateDEPRECATED;
-
-typedef struct __GLXvertArrayStateRecDEPRECATED {
- __GLXvertexArrayPointerStateDEPRECATED vertex;
- __GLXvertexArrayPointerStateDEPRECATED normal;
- __GLXvertexArrayPointerStateDEPRECATED color;
- __GLXvertexArrayPointerStateDEPRECATED index;
- __GLXvertexArrayPointerStateDEPRECATED texCoord[__GLX_MAX_TEXTURE_UNITS];
- __GLXvertexArrayPointerStateDEPRECATED edgeFlag;
- GLint maxElementsVertices;
- GLint maxElementsIndices;
- GLint activeTexture;
-} __GLXvertArrayStateDEPRECATED;
-
-typedef struct __GLXattributeRecDEPRECATED {
- GLuint mask;
-
- /*
- ** Pixel storage state. Most of the pixel store mode state is kept
- ** here and used by the client code to manage the packing and
- ** unpacking of data sent to/received from the server.
- */
- __GLXpixelStoreMode storePack, storeUnpack;
-
- /*
- ** Vertex Array storage state. The vertex array component
- ** state is stored here and is used to manage the packing of
- ** DrawArrays data sent to the server.
- */
- __GLXvertArrayStateDEPRECATED vertArray;
-} __GLXattributeDEPRECATED;
-
typedef struct __GLXattributeRec {
GLuint mask;
GLenum, const GLvoid*, GLubyte*, GLubyte*);
/**
- * \name Client side attribs.
+ * Client side attribs.
*/
- /*@{*/
- __GLXattributeDEPRECATED stateDEPRECATED;
__GLXattributeMachine attributes;
- /*@}*/
/**
* Client side error code. This is set when client side gl API
* a pointer to the config data for that screen (if the screen supports GL).
*/
typedef struct __GLXscreenConfigsRec {
- /**
- * GLX visuals formated as \c __GLXvisualConfig structures.
- */
- /*@{*/
- __GLXvisualConfig * old_configs;
- int numOldConfigs;
- /*@}*/
-
/**
* GLX extension string reported by the X-server.
*/
#endif
/**
- * Linked list of configurations for this screen. This is intended to
- * be a superset of \c old_configs.
+ * Linked list of configurations for this screen.
*/
__GLcontextModes *configs;
+
/**
* Per-screen dynamic GLX extension tracking. The \c direct_support
* field only contains enough bits for 64 extensions. Should libGL
extern int __glXDebug;
/* This is per-thread storage in an MT environment */
-#if defined(GLX_DIRECT_RENDERING) && defined(XTHREADS)
-extern __GLXcontext *__glXGetCurrentContext(void);
+#if defined( USE_XTHREADS ) || defined( PTHREADS )
+
extern void __glXSetCurrentContext(__GLXcontext *c);
+
+# if defined( GLX_USE_TLS )
+
+extern __thread void * __glX_tls_Context
+ __attribute__((tls_model("initial-exec")));
+
+# define __glXGetCurrentContext() __glX_tls_Context
+
+# else
+
+extern __GLXcontext *__glXGetCurrentContext(void);
+
+# endif /* defined( GLX_USE_TLS ) */
+
#else
+
extern __GLXcontext *__glXcurrentContext;
#define __glXGetCurrentContext() __glXcurrentContext
#define __glXSetCurrentContext(gc) __glXcurrentContext = gc
-#endif
+
+#endif /* defined( USE_XTHREADS ) || defined( PTHREADS ) */
/*
** Global lock for all threads in this address space using the GLX
** extension
*/
-#if defined(GLX_DIRECT_RENDERING) && defined(XTHREADS)
+#if defined( USE_XTHREADS )
extern xmutex_rec __glXmutex;
#define __glXLock() xmutex_lock(&__glXmutex)
#define __glXUnlock() xmutex_unlock(&__glXmutex)
+#elif defined( PTHREADS )
+extern pthread_mutex_t __glXmutex;
+#define __glXLock() pthread_mutex_lock(&__glXmutex)
+#define __glXUnlock() pthread_mutex_unlock(&__glXmutex)
#else
#define __glXLock()
#define __glXUnlock()
#endif
-/*
-** GLX_BUILT_IN_XMESA controls whether libGL has a built-in verions of
-** Mesa that can render to non-GLX displays.
-*/
-#ifdef GLX_BUILT_IN_XMESA
-#define GLX_PREFIX(function) _real_##function
-#else
-#define GLX_PREFIX(function) function
-#endif
-
-
extern void __glXInitializeVisualConfigFromTags( __GLcontextModes *config,
int count, const INT32 *bp, Bool tagged_only, Bool fbconfig_style_tags );