glx: indent -br -i3 -npcs --no-tabs dri2_glx.c
[mesa.git] / src / glx / x11 / glxclient.h
index 5fd64209df50ff94509d0f55bcecbd11613cd124..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,7 +54,7 @@
 #include "GL/glxint.h"
 #include "GL/glxproto.h"
 #include "GL/internal/glcore.h"
-#include "glapitable.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
 
@@ -121,6 +136,8 @@ struct __GLXDRIscreenRec {
                                        XID drawable,
                                        GLXDrawable glxDrawable,
                                        const __GLcontextModes *modes);
+
+    void (*swapBuffers)(__GLXDRIdrawable *pdraw);
 };
 
 struct __GLXDRIcontextRec {
@@ -139,14 +156,15 @@ struct __GLXDRIdrawableRec {
     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);
 
@@ -160,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
 
 /************************************************************************/
@@ -467,6 +483,8 @@ struct __GLXscreenConfigsRec {
     __DRIscreen *__driScreen;
     const __DRIcoreExtension *core;
     const __DRIlegacyExtension *legacy;
+    const __DRIswrastExtension *swrast;
+    const __DRIdri2Extension *dri2;
     __glxHashTable *drawHash;
     Display *dpy;
     int scr, fd;
@@ -566,14 +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, 
@@ -586,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;
@@ -616,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
@@ -690,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