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

Emil Velikov emil.l.velikov at gmail.com
Fri Oct 21 17:14:19 UTC 2016


On 19 October 2016 at 22:52, Chad Versace <chadversary at chromium.org> wrote:
> 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.
>
Agreed.

It just hit me that current mesa does not advertise the KHR (EGL 1.5)
extensions so with this series one is still using the old
eglGetDisplay. Having a closer look at Mesa - advertising them won't
be able in the short term, if at all. That's due to the fact that we
depend on quering the dri module(s) in order to advertise some of the
EGL 1.5 requirements/extensions.

Regardless, this is not something we should worry about in waffle.
Emil


More information about the waffle mailing list