Bug 182490 - [GTK] WaylandCompositor misusing eglGetProcAddress
Summary: [GTK] WaylandCompositor misusing eglGetProcAddress
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P3 Normal
Assignee: Miguel Gomez
URL:
Keywords: Gtk
: 183289 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-02-05 09:33 PST by Daniel Stone
Modified: 2018-03-28 09:30 PDT (History)
6 users (show)

See Also:


Attachments
Patch (4.90 KB, patch)
2018-02-07 08:09 PST, Miguel Gomez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Stone 2018-02-05 09:33:39 PST
In WaylandCompositor.cpp's initializeEGL(), eglBindWaylandDisplayWL() is called if eglGetProcAddress() returns any value for it. This causes a crash on newer Mesa when using software rendering: swrast drivers do not provide BindWaylandDisplay (as they rely on wl_shm instead of Mesa extensions), and newer Mesa asserts that the extension is enabled when the entrypoint is called.

The trivial fix would be to check for the extension's presence and fail initializeEGL() if they are not there.

The Mesa bug is here: https://bugs.freedesktop.org/show_bug.cgi?id=104949
Comment 1 Michael Catanzaro 2018-02-05 10:27:40 PST
Mesa devs say "[WebKit] seems to be doing the most common and silly mistakes - uses the function pointers w/o checking for the extension string" in the upstream bug. We need to make sure we get this right everywhere, not just WaylandCompositor.cpp.
Comment 2 Miguel Gomez 2018-02-07 08:09:21 PST
Created attachment 333283 [details]
Patch
Comment 3 Miguel Gomez 2018-02-07 08:11:35 PST
(In reply to Michael Catanzaro from comment #1)
> Mesa devs say "[WebKit] seems to be doing the most common and silly mistakes
> - uses the function pointers w/o checking for the extension string" in the
> upstream bug. We need to make sure we get this right everywhere, not just
> WaylandCompositor.cpp.

I've fixed WaylandCompositor.cpp. The rest of the places calling eglGetProcAddress seem to be properly checking for the required extensions.
Comment 4 Michael Catanzaro 2018-02-07 08:35:36 PST
Comment on attachment 333283 [details]
Patch

Thanks
Comment 5 Daniel Stone 2018-02-07 08:41:48 PST
Don't think my r+ etc counts here, but LGTM anyway!
Comment 6 WebKit Commit Bot 2018-02-08 06:05:17 PST
Comment on attachment 333283 [details]
Patch

Clearing flags on attachment: 333283

Committed r228272: <https://trac.webkit.org/changeset/228272>
Comment 7 WebKit Commit Bot 2018-02-08 06:05:18 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Michael Catanzaro 2018-03-02 08:26:10 PST
*** Bug 183289 has been marked as a duplicate of this bug. ***