glx: Don't use __glXInitialize() when we might be holding __glXLock()
[mesa.git] / src / glx / glxclient.h
index 958e1526c94ea6c3ea20814ca961fd9f5252e6a4..207908f7e25925c1d219f2bcefb3f769c72d2c30 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>
@@ -123,8 +121,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 +151,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 +173,8 @@ struct __GLXDRIdrawableRec
    XID drawable;
    __GLXscreenConfigs *psc;
    GLenum textureTarget;
-   __DRIdrawable *driDrawable;
    GLenum textureFormat;        /* EXT_texture_from_pixmap support */
+   unsigned long eventMask;
 };
 
 /*
@@ -249,6 +246,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.
@@ -457,6 +462,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,19 +518,20 @@ 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;
 
@@ -533,30 +541,6 @@ struct __GLXscreenConfigsRec
    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
 
     /**
@@ -620,7 +604,7 @@ 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)
     /**
@@ -632,6 +616,12 @@ struct __GLXdisplayPrivateRec
 #endif
 };
 
+extern int
+glx_screen_init(__GLXscreenConfigs *psc,
+               int screen, __GLXdisplayPrivate * priv);
+
+extern __GLXDRIdrawable *
+dri2GetGlxDrawableFromXDrawableId(Display *dpy, XID id);
 
 extern GLubyte *__glXFlushRenderBuffer(__GLXcontext *, GLubyte *);