glx: Send DestroyContext protocol at the correct times
[mesa.git] / src / glx / glxclient.h
index b453e6dbd0404af4173fb0f1cb7df0df9a9e57a0..109206f6ba03fe12e9df7ae09c02b965be18c641 100644 (file)
@@ -89,8 +89,6 @@ typedef struct __GLXDRIdisplayRec __GLXDRIdisplay;
 typedef struct __GLXDRIscreenRec __GLXDRIscreen;
 typedef struct __GLXDRIdrawableRec __GLXDRIdrawable;
 
-#include "glxextensions.h"
-
 struct __GLXDRIdisplayRec
 {
     /**
@@ -140,6 +138,7 @@ struct __GLXDRIdrawableRec
    GLenum textureTarget;
    GLenum textureFormat;        /* EXT_texture_from_pixmap support */
    unsigned long eventMask;
+   int refcount;
 };
 
 /*
@@ -150,6 +149,7 @@ extern __GLXDRIdisplay *driswCreateDisplay(Display * dpy);
 extern __GLXDRIdisplay *driCreateDisplay(Display * dpy);
 extern __GLXDRIdisplay *dri2CreateDisplay(Display * dpy);
 extern void dri2InvalidateBuffers(Display *dpy, XID drawable);
+extern unsigned dri2GetSwapEventType(Display *dpy, XID drawable);
 
 
 /*
@@ -224,12 +224,9 @@ struct glx_context_vtable {
                          GLXDrawable drawable,
                          int buffer, const int *attrib_list);
    void (*release_tex_image)(Display * dpy, GLXDrawable drawable, int buffer);
-   
+   void * (*get_proc_address)(const char *symbol);
 };
 
-extern void
-glx_send_destroy_context(Display *dpy, XID xid);
-
 /**
  * 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.
@@ -310,14 +307,6 @@ struct glx_context
    GLuint *selectBuf;
    /*@} */
 
-    /**
-     * This is \c GL_TRUE if the pixel unpack modes are such that an image
-     * can be unpacked from the clients memory by just copying.  It may
-     * still be true that the server will have to do some work.  This
-     * just promises that a straight copy will fetch the correct bytes.
-     */
-   GLboolean fastImageUnpack;
-
     /**
      * Fill newImage with the unpacked form of \c oldImage getting it
      * ready for transport to the server.
@@ -342,6 +331,10 @@ struct glx_context
      */
    Bool isDirect;
 
+#if defined(GLX_DIRECT_RENDERING) && defined(GLX_USE_APPLEGL)
+   void *driContext;
+#endif
+
     /**
      * \c dpy of current display for this context.  Will be \c NULL if not
      * current to any display, or if this is the "dummy context".
@@ -420,9 +413,9 @@ struct glx_context
    /*@} */
 
    /**
-    * Thread ID we're currently current in. Zero if none.
+    * Number of threads we're currently current in.
     */
-   unsigned long thread_id;
+   unsigned long thread_refcount;
 
    char gl_extension_bits[__GL_EXT_BYTES];
 };
@@ -571,6 +564,8 @@ struct glx_display
      */
    struct glx_screen **screens;
 
+   __glxHashTable *glXDrawHash;
+
 #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
    __glxHashTable *drawHash;
 
@@ -583,9 +578,19 @@ struct glx_display
 #endif
 };
 
+struct glx_drawable {
+   XID xDrawable;
+   XID drawable;
+
+   uint32_t lastEventSbc;
+   int64_t eventSbcWrap;
+};
+
 extern int
 glx_screen_init(struct glx_screen *psc,
                int screen, struct glx_display * priv);
+extern void
+glx_screen_cleanup(struct glx_screen *psc);
 
 #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
 extern __GLXDRIdrawable *
@@ -771,9 +776,27 @@ GarbageCollectDRIDrawables(struct glx_screen *psc);
 
 extern __GLXDRIdrawable *
 GetGLXDRIDrawable(Display *dpy, GLXDrawable drawable);
+#endif
 
+#ifdef GLX_USE_APPLEGL
+extern struct glx_screen *
+applegl_create_screen(int screen, struct glx_display * priv);
+
+extern struct glx_context *
+applegl_create_context(struct glx_screen *psc,
+                       struct glx_config *mode,
+                       struct glx_context *shareList, int renderType);
+
+extern int
+applegl_create_display(struct glx_display *display);
 #endif
 
+
+extern struct glx_drawable *GetGLXDrawable(Display *dpy, GLXDrawable drawable);
+extern int InitGLXDrawable(Display *dpy, struct glx_drawable *glxDraw,
+                          XID xDrawable, GLXDrawable drawable);
+extern void DestroyGLXDrawable(Display *dpy, GLXDrawable drawable);
+
 extern struct glx_context dummyContext;
 
 extern struct glx_screen *