Merge branch 'xa_branch'
[mesa.git] / src / egl / main / eglconfig.h
index 0b6a0c2752192acf954023e597d0e3e20075c5ed..adab95cd6a3a14c3001ab834600b4f005a193144 100644 (file)
@@ -1,8 +1,39 @@
+/**************************************************************************
+ *
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
+ * Copyright 2010-2011 LunarG, 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, sub license, 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 and this permission notice (including the
+ * next paragraph) 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
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ **************************************************************************/
+
+
 #ifndef EGLCONFIG_INCLUDED
 #define EGLCONFIG_INCLUDED
 
 
 #include <assert.h>
+#include <stddef.h>
 #include "egltypedefs.h"
 
 
@@ -52,13 +83,6 @@ struct _egl_config
 };
 
 
-/**
- * Macros for source level compatibility.
- */
-#define SET_CONFIG_ATTRIB(CONF, ATTR, VAL) _eglSetConfigKey(CONF, ATTR, VAL)
-#define GET_CONFIG_ATTRIB(CONF, ATTR) _eglGetConfigKey(CONF, ATTR)
-
-
 /**
  * Map an EGL attribute enum to the offset of the member in _EGLConfig.
  */
@@ -143,34 +167,20 @@ _eglInitConfig(_EGLConfig *config, _EGLDisplay *dpy, EGLint id);
 
 
 PUBLIC EGLConfig
-_eglAddConfig(_EGLDisplay *dpy, _EGLConfig *conf);
-
+_eglLinkConfig(_EGLConfig *conf);
 
-extern EGLBoolean
-_eglCheckConfigHandle(EGLConfig config, _EGLDisplay *dpy);
 
-
-/**
- * Lookup a handle to find the linked config.
- * Return NULL if the handle has no corresponding linked config.
- */
-static INLINE _EGLConfig *
-_eglLookupConfig(EGLConfig config, _EGLDisplay *dpy)
-{
-   _EGLConfig *conf = (_EGLConfig *) config;
-   if (!dpy || !_eglCheckConfigHandle(config, dpy))
-      conf = NULL;
-   return conf;
-}
+extern _EGLConfig *
+_eglLookupConfig(EGLConfig config, _EGLDisplay *dpy);
 
 
 /**
- * Return the handle of a linked config, or NULL.
+ * Return the handle of a linked config.
  */
 static INLINE EGLConfig
 _eglGetConfigHandle(_EGLConfig *conf)
 {
-   return (EGLConfig) ((conf && conf->Display) ? conf : NULL);
+   return (EGLConfig) conf;
 }
 
 
@@ -183,7 +193,8 @@ _eglMatchConfig(const _EGLConfig *conf, const _EGLConfig *criteria);
 
 
 PUBLIC EGLBoolean
-_eglParseConfigAttribList(_EGLConfig *conf, const EGLint *attrib_list);
+_eglParseConfigAttribList(_EGLConfig *conf, _EGLDisplay *dpy,
+                          const EGLint *attrib_list);
 
 
 PUBLIC EGLint
@@ -191,11 +202,13 @@ _eglCompareConfigs(const _EGLConfig *conf1, const _EGLConfig *conf2,
                    const _EGLConfig *criteria, EGLBoolean compare_id);
 
 
-PUBLIC void
-_eglSortConfigs(const _EGLConfig **configs, EGLint count,
-                EGLint (*compare)(const _EGLConfig *, const _EGLConfig *,
-                                  void *),
-                void *priv_data);
+PUBLIC EGLBoolean
+_eglFilterConfigArray(_EGLArray *array, EGLConfig *configs,
+                      EGLint config_size, EGLint *num_configs,
+                      EGLBoolean (*match)(const _EGLConfig *, void *),
+                      EGLint (*compare)(const _EGLConfig *, const _EGLConfig *,
+                                        void *),
+                      void *filter_data);
 
 
 extern EGLBoolean