Chia-I Wu wrote: > 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 <olva...@gmail.com> > --- > src/egl/main/eglapi.c | 9 ++++++--- > src/egl/main/egldisplay.c | 19 +++++++++++++++++++ > src/egl/main/egldisplay.h | 4 ++++ > 3 files changed, 29 insertions(+), 3 deletions(-) > > diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c > index 71fa43e..714d404 100644 > --- a/src/egl/main/eglapi.c > +++ b/src/egl/main/eglapi.c > @@ -51,9 +51,12 @@ eglGetDisplay(NativeDisplayType nativeDisplay) > { > _EGLDisplay *dpy; > _eglInitGlobals(); > - dpy = _eglNewDisplay(nativeDisplay); > - if (dpy) > - _eglLinkDisplay(dpy); > + dpy = _eglFindDisplay(nativeDisplay); > + if (!dpy) { > + dpy = _eglNewDisplay(nativeDisplay); > + if (dpy) > + _eglLinkDisplay(dpy); > + } > return _eglGetDisplayHandle(dpy); > } > > diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c > index 943912d..8c3dfda 100644 > --- a/src/egl/main/egldisplay.c > +++ b/src/egl/main/egldisplay.c > @@ -89,6 +89,25 @@ _eglLookupDisplay(EGLDisplay dpy) > } > > > +_EGLDisplay * > +_eglFindDisplay(NativeDisplayType nativeDisplay)
Put some comments on the function, please. > +{ > + EGLuint key = _eglHashFirstEntry(_eglGlobal.Displays); > + > + 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. > diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h > index c907df5..c5a7f08 100644 > --- a/src/egl/main/egldisplay.h > +++ b/src/egl/main/egldisplay.h > @@ -51,6 +51,10 @@ extern _EGLDisplay * > _eglLookupDisplay(EGLDisplay dpy); > > > +extern _EGLDisplay * > +_eglFindDisplay(NativeDisplayType nativeDisplay); > + > + > extern void > _eglCleanupDisplay(_EGLDisplay *disp); > ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev