[waffle] [PATCH 7/7] egl: Use eglGetPlatformDisplay when possible

Chad Versace chadversary at chromium.org
Wed Oct 19 21:52:05 UTC 2016


On Wed 19 Oct 2016, Emil Velikov wrote:
> On 18 October 2016 at 17:58, Chad Versace <chadversary at chromium.org> wrote:
> > Tested against Mesa master at 8c78fdb with `ninja check-func` on Linux.
> > ---
> >  src/waffle/egl/wegl_display.c  | 22 ++++++++++++++++++----
> >  src/waffle/egl/wegl_platform.c | 35 +++++++++++++++++++++++++++++++++--
> >  src/waffle/egl/wegl_platform.h |  8 ++++++++
> >  3 files changed, 59 insertions(+), 6 deletions(-)
> >
> > diff --git a/src/waffle/egl/wegl_display.c b/src/waffle/egl/wegl_display.c
> > index 7a7986c..c924f2a 100644
> > --- a/src/waffle/egl/wegl_display.c
> > +++ b/src/waffle/egl/wegl_display.c
> > @@ -104,10 +104,24 @@ wegl_display_init(struct wegl_display *dpy,
> >      if (!ok)
> >          goto fail;
> >
> > -    dpy->egl = plat->eglGetDisplay((EGLNativeDisplayType) native_display);
> > -    if (!dpy->egl) {
> > -        wegl_emit_error(plat, "eglGetDisplay");
> > -        goto fail;
> > +    if (wegl_platform_can_use_eglGetPlatformDisplay(plat)) {
> > +        void *fixed_native_dpy = native_display;
> > +        if (plat->egl_platform == EGL_PLATFORM_X11_KHR)
> > +            fixed_native_dpy = &native_display;
> > +

> Silly question: wasn't the fixup applicable only for the window/pixmap surface ?

Thanks! You're right.

> > +        dpy->egl = plat->eglGetPlatformDisplay(plat->egl_platform,
> > +                                               fixed_native_dpy,
> > +                                               NULL);
> > +        if (!dpy->egl) {
> > +            wegl_emit_error(plat, "eglGetPlatformDisplay");
> > +            goto fail;
> > +        }

> Wondering if falling back to eglGetDisplay() is a smart idea in this case?
> How about EGL_EXT_platform_base/eglGetPlatformDisplayEXT (admittedly
> there's no support for it atm, but it's trivial to do so) ?

I want to keep the old eglGetDisplay behavior. Otherwise, upgrading
Waffle would regress functionality on systems with old Mesa (thinking
about Ubunut LTS). And it's a no-no for upgrades to cause a gross
regression like that.

I agree that the fallback path should include eglGetPlatformDisplayEXT.
But the lack of eglGetPlatformDisplayEXT doesn't make the patch
incorrect. That can be done as a simple follow-up patch.

I'll submit a v2 in-reply-to. (But not now. I'll be off of work until
Monday).


More information about the waffle mailing list