glx: indent -br -i3 -npcs --no-tabs dri2_glx.c
[mesa.git] / src / glx / x11 / glxclient.h
index 730caf73024b1dccb551b5e494600c9772f841b4..2d530eabdb94bb3fef4058987f168587713cfec5 100644 (file)
@@ -1,37 +1,33 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
 /*
-** License Applicability. Except to the extent portions of this file are
-** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
-** file are subject only to the provisions of the License. You may not use
-** this file except in compliance with the License. You may obtain a copy
-** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
-** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
-** 
-** http://oss.sgi.com/projects/FreeB
-** 
-** Note that, as provided in the License, the Software is distributed on an
-** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
-** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
-** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
-** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
-** 
-** Original Code. The Original Code is: OpenGL Sample Implementation,
-** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
-** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
-** Copyright in any portions created by third parties is as indicated
-** elsewhere herein. All Rights Reserved.
-** 
-** Additional Notice Provisions: The application programming interfaces
-** established by SGI in conjunction with the Original Code are The
-** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
-** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
-** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
-** Window System(R) (Version 1.3), released October 19, 1998. This software
-** was created using the OpenGL(R) version 1.2.1 Sample Implementation
-** published by SGI, but has not been independently verified as being
-** compliant with the OpenGL(R) version 1.2.1 Specification.
-*/
-/* $XFree86: xc/lib/GL/glx/glxclient.h,v 1.21 2004/02/09 23:46:31 alanh Exp $ */
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, 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, sublicense,
+ * 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 including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * 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 NONINFRINGEMENT. IN NO EVENT SHALL
+ * SILICON GRAPHICS, INC. 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.
+ *
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
 
 /**
  * \file glxclient.h
@@ -58,8 +54,7 @@
 #include "GL/glxint.h"
 #include "GL/glxproto.h"
 #include "GL/internal/glcore.h"
-#include "glapitable.h"
-#include "glxextensions.h"
+#include "glapi/glapitable.h"
 #include "glxhash.h"
 #if defined( USE_XTHREADS )
 # include <X11/Xthreads.h>
 # include <pthread.h>
 #endif
 
+#include "glxextensions.h"
+
+
+/* If we build the library with gcc's -fvisibility=hidden flag, we'll
+ * use the PUBLIC macro to mark functions that are to be exported.
+ *
+ * We also need to define a USED attribute, so the optimizer doesn't 
+ * inline a static function that we later use in an alias. - ajax
+ */
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
+#  define PUBLIC __attribute__((visibility("default")))
+#  define USED __attribute__((used))
+#else
+#  define PUBLIC
+#  define USED
+#endif
+
+
+
 #define GLX_MAJOR_VERSION      1       /* current version numbers */
 #define GLX_MINOR_VERSION      4
 
@@ -97,6 +111,8 @@ typedef struct __GLXDRIscreenRec __GLXDRIscreen;
 typedef struct __GLXDRIdrawableRec __GLXDRIdrawable;
 typedef struct __GLXDRIcontextRec __GLXDRIcontext;
 
+#include "glxextensions.h"
+
 struct __GLXDRIdisplayRec {
     /**
      * Method to destroy the private DRI display data.
@@ -117,8 +133,11 @@ struct __GLXDRIscreenRec {
                                      GLXContext shareList, int renderType);
        
     __GLXDRIdrawable *(*createDrawable)(__GLXscreenConfigs *psc,
-                                       GLXDrawable drawable,
-                                       GLXContext gc);
+                                       XID drawable,
+                                       GLXDrawable glxDrawable,
+                                       const __GLcontextModes *modes);
+
+    void (*swapBuffers)(__GLXDRIdrawable *pdraw);
 };
 
 struct __GLXDRIcontextRec {
@@ -134,16 +153,20 @@ struct __GLXDRIcontextRec {
 struct __GLXDRIdrawableRec {
     void (*destroyDrawable)(__GLXDRIdrawable *drawable);
 
+    XID xDrawable;
     XID drawable;
     __GLXscreenConfigs *psc;
-    __DRIdrawable driDrawable;
+    GLenum textureTarget;
+    __DRIdrawable *driDrawable;
 };
 
 /*
 ** Function to create and DRI display data and initialize the display
 ** dependent methods.
 */
+extern __GLXDRIdisplay *driswCreateDisplay(Display *dpy);
 extern __GLXDRIdisplay *driCreateDisplay(Display *dpy);
+extern __GLXDRIdisplay *dri2CreateDisplay(Display *dpy);
 
 extern void DRI_glXUseXFont( Font font, int first, int count, int listbase );
 
@@ -155,8 +178,6 @@ extern const char *glXGetScreenDriver (Display *dpy, int scrNum);
 
 extern const char *glXGetDriverConfig (const char *driverName);
 
-extern Bool __glXWindowExists(Display *dpy, GLXDrawable draw);
-
 #endif
 
 /************************************************************************/
@@ -309,6 +330,11 @@ struct __GLXcontextRec {
      */
     GLenum error;
 
+    /**
+     * Whether this context does direct rendering.
+     */
+    Bool isDirect;
+
     /**
      * \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".
@@ -359,6 +385,7 @@ struct __GLXcontextRec {
 
 #ifdef GLX_DIRECT_RENDERING
     __GLXDRIcontext *driContext;
+    __DRIcontext *__driContext;
 #endif
 
     /**
@@ -453,32 +480,40 @@ struct __GLXscreenConfigsRec {
     /**
      * Per screen direct rendering interface functions and data.
      */
-    __DRIscreen __driScreen;
+    __DRIscreen *__driScreen;
+    const __DRIcoreExtension *core;
+    const __DRIlegacyExtension *legacy;
+    const __DRIswrastExtension *swrast;
+    const __DRIdri2Extension *dri2;
     __glxHashTable *drawHash;
     Display *dpy;
-    int scr;
+    int scr, fd;
     void *driver;
 
     __GLXDRIscreen *driScreen;
 
 #ifdef __DRI_COPY_SUB_BUFFER
-    __DRIcopySubBufferExtension *copySubBuffer;
+    const __DRIcopySubBufferExtension *copySubBuffer;
 #endif
 
 #ifdef __DRI_SWAP_CONTROL
-    __DRIswapControlExtension *swapControl;
+    const __DRIswapControlExtension *swapControl;
 #endif
 
 #ifdef __DRI_ALLOCATE
-    __DRIallocateExtension *allocate;
+    const __DRIallocateExtension *allocate;
 #endif
 
 #ifdef __DRI_FRAME_TRACKING
-    __DRIframeTrackingExtension *frameTracking;
+    const __DRIframeTrackingExtension *frameTracking;
 #endif
 
 #ifdef __DRI_MEDIA_STREAM_COUNTER
-    __DRImediaStreamCounterExtension *msc;
+    const __DRImediaStreamCounterExtension *msc;
+#endif
+
+#ifdef __DRI_TEX_BUFFER
+    const __DRItexBufferExtension *texBuffer;
 #endif
 
 #endif
@@ -549,13 +584,13 @@ struct __GLXdisplayPrivateRec {
     /**
      * Per display direct rendering interface functions and data.
      */
+    __GLXDRIdisplay *driswDisplay;
     __GLXDRIdisplay *driDisplay;
+    __GLXDRIdisplay *dri2Display;
 #endif
 };
 
 
-void __glXFreeContext(__GLXcontext*);
-
 extern GLubyte *__glXFlushRenderBuffer(__GLXcontext*, GLubyte*);
 
 extern void __glXSendLargeChunk(__GLXcontext *gc, GLint requestNumber, 
@@ -568,6 +603,8 @@ extern void __glXSendLargeCommand(__GLXcontext *, const GLvoid *, GLint,
 /* Initialize the GLX extension for dpy */
 extern __GLXdisplayPrivate *__glXInitialize(Display*);
 
+extern void __glXPreferEGL(int state);
+
 /************************************************************************/
 
 extern int __glXDebug;
@@ -598,6 +635,10 @@ extern __GLXcontext *__glXcurrentContext;
 
 #endif /* defined( USE_XTHREADS ) || defined( PTHREADS ) */
 
+extern void __glXSetCurrentContextNull(void);
+
+extern void __glXFreeContext(__GLXcontext*);
+
 
 /*
 ** Global lock for all threads in this address space using the GLX
@@ -672,9 +713,10 @@ extern void __glEmptyImage(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum,
 
 
 /*
-** Allocate and Initialize Vertex Array client state 
+** Allocate and Initialize Vertex Array client state, and free.
 */
-extern void __glXInitVertexArrayState(__GLXcontext*);
+extern void __glXInitVertexArrayState(__GLXcontext *);
+extern void __glXFreeVertexArrayState(__GLXcontext *);
 
 /*
 ** Inform the Server of the major and minor numbers and of the client
@@ -715,7 +757,8 @@ extern GLboolean __glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
 
 #ifdef GLX_DIRECT_RENDERING
 GLboolean
-__driGetMscRateOML(__DRIdrawable *draw, int32_t *numerator, int32_t *denominator);
+__driGetMscRateOML(__DRIdrawable *draw,
+                  int32_t *numerator, int32_t *denominator, void *private);
 #endif
 
 #endif /* !__GLX_client_h__ */