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>
This commit is contained in:
parent
cca31340b5
commit
be9d1ab171
|
@ -51,9 +51,12 @@ eglGetDisplay(NativeDisplayType nativeDisplay)
|
||||||
{
|
{
|
||||||
_EGLDisplay *dpy;
|
_EGLDisplay *dpy;
|
||||||
_eglInitGlobals();
|
_eglInitGlobals();
|
||||||
|
dpy = _eglFindDisplay(nativeDisplay);
|
||||||
|
if (!dpy) {
|
||||||
dpy = _eglNewDisplay(nativeDisplay);
|
dpy = _eglNewDisplay(nativeDisplay);
|
||||||
if (dpy)
|
if (dpy)
|
||||||
_eglLinkDisplay(dpy);
|
_eglLinkDisplay(dpy);
|
||||||
|
}
|
||||||
return _eglGetDisplayHandle(dpy);
|
return _eglGetDisplayHandle(dpy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,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
|
* Free all the data hanging of an _EGLDisplay object, but not
|
||||||
* the object itself.
|
* the object itself.
|
||||||
|
|
|
@ -52,6 +52,10 @@ extern _EGLDisplay *
|
||||||
_eglLookupDisplay(EGLDisplay dpy);
|
_eglLookupDisplay(EGLDisplay dpy);
|
||||||
|
|
||||||
|
|
||||||
|
extern _EGLDisplay *
|
||||||
|
_eglFindDisplay(NativeDisplayType nativeDisplay);
|
||||||
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_eglCleanupDisplay(_EGLDisplay *disp);
|
_eglCleanupDisplay(_EGLDisplay *disp);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue