summaryrefslogtreecommitdiff
path: root/src/egl/main/egldisplay.c
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2009-07-16 21:21:56 -0700
committerBrian Paul <brianp@vmware.com>2009-07-17 11:53:39 -0600
commitbe9d1ab171b1b29108c781af84dd500707a12925 (patch)
treebdaf340d06688f7158f73eb50ead0a5013eaee86 /src/egl/main/egldisplay.c
parentcca31340b5a9c0b941946753a31236c7201ca87c (diff)
egl: Return the same EGL Display for the same native display.
The latest revision of the spec explicitly requires the same handle to be returned for the same native display. Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Diffstat (limited to 'src/egl/main/egldisplay.c')
-rw-r--r--src/egl/main/egldisplay.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index a30e810b4a..1f1f41ea71 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -97,6 +97,30 @@ _eglLookupDisplay(EGLDisplay dpy)
/**
+ * Find the display corresponding to the specified native display id in all
+ * linked displays.
+ */
+_EGLDisplay *
+_eglFindDisplay(NativeDisplayType nativeDisplay)
+{
+ EGLuint key = _eglHashFirstEntry(_eglGlobal.Displays);
+
+ /* Walk the hash table. Should switch to list if it is a problem. */
+ while (key) {
+ _EGLDisplay *dpy = (_EGLDisplay *)
+ _eglHashLookup(_eglGlobal.Displays, key);
+ assert(dpy);
+
+ if (dpy->NativeDisplay == nativeDisplay)
+ return dpy;
+ key = _eglHashNextEntry(_eglGlobal.Displays, key);
+ }
+
+ return NULL;
+}
+
+
+/**
* Free all the data hanging of an _EGLDisplay object, but not
* the object itself.
*/