summaryrefslogtreecommitdiff
path: root/src/egl/main/eglconfig.h
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2009-09-25 23:43:49 +0800
committerBrian Paul <brianp@vmware.com>2009-09-29 08:10:47 -0600
commit56822b0812cd500bd54bb7c4b573c54547efb657 (patch)
tree17d57d1c863c305801078c6b5ab4bb3ce0013485 /src/egl/main/eglconfig.h
parent95cdd697e7e72cec1d0fe79c59a8ba7b8cef8571 (diff)
egl: Rework config lookup.
Make it similiar to how contexts and surfaces are looked up. It should be slightly faster, and work better with multiple displays. Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Diffstat (limited to 'src/egl/main/eglconfig.h')
-rw-r--r--src/egl/main/eglconfig.h49
1 files changed, 43 insertions, 6 deletions
diff --git a/src/egl/main/eglconfig.h b/src/egl/main/eglconfig.h
index e09d58980d..6b8a259984 100644
--- a/src/egl/main/eglconfig.h
+++ b/src/egl/main/eglconfig.h
@@ -16,7 +16,7 @@
struct _egl_config
{
- EGLConfig Handle; /* the public/opaque handle which names this config */
+ _EGLDisplay *Display;
EGLint Storage[_EGL_CONFIG_STORAGE_SIZE];
};
@@ -96,15 +96,52 @@ _eglInitConfig(_EGLConfig *config, EGLint id);
extern EGLConfig
-_eglGetConfigHandle(_EGLConfig *config);
+_eglAddConfig(_EGLDisplay *dpy, _EGLConfig *conf);
-extern _EGLConfig *
-_eglLookupConfig(EGLConfig config, _EGLDisplay *dpy);
+#ifndef _EGL_SKIP_HANDLE_CHECK
-extern _EGLConfig *
-_eglAddConfig(_EGLDisplay *display, _EGLConfig *config);
+extern EGLBoolean
+_eglCheckConfigHandle(EGLConfig config, _EGLDisplay *dpy);
+
+
+#else
+
+
+static INLINE EGLBoolean
+_eglCheckConfigHandle(EGLConfig config, _EGLDisplay *dpy)
+{
+ _EGLConfig *conf = (_EGLConfig *) config;
+ return (dpy && conf && conf->Display == dpy);
+}
+
+
+#endif /* _EGL_SKIP_HANDLE_CHECK */
+
+
+/**
+ * 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 (!_eglCheckConfigHandle(config, dpy))
+ conf = NULL;
+ return conf;
+}
+
+
+/**
+ * Return the handle of a linked config, or NULL.
+ */
+static INLINE EGLConfig
+_eglGetConfigHandle(_EGLConfig *conf)
+{
+ return (EGLConfig) ((conf && conf->Display) ? conf : NULL);
+}
extern EGLBoolean