glx: Use _Xglobal_lock for protecting extension display list
[mesa.git] / src / glx / glxclient.h
index 958e1526c94ea6c3ea20814ca961fd9f5252e6a4..4f833057ffc304fa3caf4e4490e05abcc1f09c02 100644 (file)
@@ -37,8 +37,6 @@
 
 #ifndef _GLX_client_h_
 #define _GLX_client_h_
-#define NEED_REPLIES
-#define NEED_EVENTS
 #include <X11/Xproto.h>
 #include <X11/Xlibint.h>
 #include <X11/extensions/extutil.h>
@@ -103,8 +101,6 @@ extern void DRI_glXUseXFont(Font font, int first, int count, int listbase);
 
 #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
 
-#include <GL/internal/dri_interface.h>
-
 /**
  * Display dependent methods.  This structure is initialized during the
  * \c driCreateDisplay call.
@@ -123,8 +119,7 @@ struct __GLXDRIdisplayRec
      */
    void (*destroyDisplay) (__GLXDRIdisplay * display);
 
-   __GLXDRIscreen *(*createScreen) (__GLXscreenConfigs * psc, int screen,
-                                    __GLXdisplayPrivate * priv);
+   __GLXscreenConfigs *(*createScreen)(int screen, __GLXdisplayPrivate * priv);
 };
 
 struct __GLXDRIscreenRec {
@@ -154,7 +149,7 @@ struct __GLXDRIscreenRec {
                     int64_t *msc, int64_t *sbc);
    int (*waitForSBC)(__GLXDRIdrawable *pdraw, int64_t target_sbc, int64_t *ust,
                     int64_t *msc, int64_t *sbc);
-   void (*setSwapInterval)(__GLXDRIdrawable *pdraw, int interval);
+   int (*setSwapInterval)(__GLXDRIdrawable *pdraw, int interval);
    int (*getSwapInterval)(__GLXDRIdrawable *pdraw);
 };
 
@@ -176,8 +171,8 @@ struct __GLXDRIdrawableRec
    XID drawable;
    __GLXscreenConfigs *psc;
    GLenum textureTarget;
-   __DRIdrawable *driDrawable;
    GLenum textureFormat;        /* EXT_texture_from_pixmap support */
+   unsigned long eventMask;
 };
 
 /*
@@ -249,6 +244,14 @@ typedef struct __GLXattributeMachineRec
    __GLXattribute **stackPointer;
 } __GLXattributeMachine;
 
+struct glx_context_vtable {
+   void (*bind_tex_image)(Display * dpy,
+                         GLXDrawable drawable,
+                         int buffer, const int *attrib_list);
+   void (*release_tex_image)(Display * dpy, GLXDrawable drawable, int buffer);
+   
+};
+
 /**
  * GLX state that needs to be kept on the client.  One of these records
  * exist for each context that has been made current by this client.
@@ -413,7 +416,6 @@ struct __GLXcontextRec
    Bool do_destroy;
 #else
    __GLXDRIcontext *driContext;
-   __DRIcontext *__driContext;
 #endif
 #endif
 
@@ -457,6 +459,8 @@ struct __GLXcontextRec
    unsigned long thread_id;
 
    char gl_extension_bits[__GL_EXT_BYTES];
+
+   const struct glx_context_vtable *vtable;
 };
 
 #define __glXSetError(gc,code)  \
@@ -511,52 +515,21 @@ struct __GLXscreenConfigsRec
      */
    char *effectiveGLXexts;
 
+   /**
+    * Context vtable to use for direct contexts on this screen
+    */
+   const struct glx_context_vtable *direct_context_vtable;
+
+   __GLXdisplayPrivate *display;
+
 #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
     /**
      * Per screen direct rendering interface functions and data.
      */
-   __DRIscreen *__driScreen;
-   const __DRIcoreExtension *core;
-   const __DRIlegacyExtension *legacy;
-   const __DRIswrastExtension *swrast;
-   const __DRIdri2Extension *dri2;
-   __glxHashTable *drawHash;
    Display *dpy;
-   int scr, fd;
-   void *driver;
+   int scr;
 
    __GLXDRIscreen *driScreen;
-
-   const __DRIconfig **driver_configs;
-
-#ifdef __DRI_COPY_SUB_BUFFER
-   const __DRIcopySubBufferExtension *driCopySubBuffer;
-#endif
-
-#ifdef __DRI_SWAP_CONTROL
-   const __DRIswapControlExtension *swapControl;
-#endif
-
-#ifdef __DRI_ALLOCATE
-   const __DRIallocateExtension *allocate;
-#endif
-
-#ifdef __DRI_FRAME_TRACKING
-   const __DRIframeTrackingExtension *frameTracking;
-#endif
-
-#ifdef __DRI_MEDIA_STREAM_COUNTER
-   const __DRImediaStreamCounterExtension *msc;
-#endif
-
-#ifdef __DRI_TEX_BUFFER
-   const __DRItexBufferExtension *texBuffer;
-#endif
-
-#ifdef __DRI2_FLUSH
-   const __DRI2flushExtension *f;
-#endif
-
 #endif
 
     /**
@@ -584,6 +557,10 @@ struct __GLXscreenConfigsRec
  */
 struct __GLXdisplayPrivateRec
 {
+   /* The extension protocol codes */
+   XExtCodes *codes;
+   struct __GLXdisplayPrivateRec *next;
+
     /**
      * Back pointer to the display
      */
@@ -620,9 +597,11 @@ struct __GLXdisplayPrivateRec
      * Also, per screen data which now includes the server \c GLX_EXTENSION
      * string.
      */
-   __GLXscreenConfigs *screenConfigs;
+   __GLXscreenConfigs **screenConfigs;
 
 #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
+   __glxHashTable *drawHash;
+
     /**
      * Per display direct rendering interface functions and data.
      */
@@ -632,6 +611,14 @@ struct __GLXdisplayPrivateRec
 #endif
 };
 
+extern int
+glx_screen_init(__GLXscreenConfigs *psc,
+               int screen, __GLXdisplayPrivate * priv);
+
+#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
+extern __GLXDRIdrawable *
+dri2GetGlxDrawableFromXDrawableId(Display *dpy, XID id);
+#endif
 
 extern GLubyte *__glXFlushRenderBuffer(__GLXcontext *, GLubyte *);
 
@@ -801,9 +788,9 @@ extern GLboolean __glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
                                     int32_t * denominator);
 
 #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
-GLboolean
-__driGetMscRateOML(__DRIdrawable * draw,
-                   int32_t * numerator, int32_t * denominator, void *private);
+extern GLboolean
+__glxGetMscRate(__GLXDRIdrawable *glxDraw,
+               int32_t * numerator, int32_t * denominator);
 
 /* So that dri2.c:DRI2WireToEvent() can access
  * glx_info->codes->first_event */