Bug 163333 - Prefer eglGetPlatformDisplay to eglGetDisplay
Summary: Prefer eglGetPlatformDisplay to eglGetDisplay
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 161958
Blocks:
  Show dependency treegraph
 
Reported: 2016-10-12 08:59 PDT by ajax
Modified: 2016-10-20 09:00 PDT (History)
6 users (show)

See Also:


Attachments
eglGetPlatformDisplay.patch (3.57 KB, patch)
2016-10-12 08:59 PDT, ajax
mcatanzaro: review-
Details | Formatted Diff | Diff
Patch for landing (3.94 KB, patch)
2016-10-20 05:13 PDT, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ajax 2016-10-12 08:59:58 PDT
Created attachment 291358 [details]
eglGetPlatformDisplay.patch

eglGetDisplay forces the implementation to guess what kind of void* it's been handed. Different implementations do different things, in particular glvnd and Mesa behave differently.

Fortunately there exists API to tell EGL what kind of display it is, so let's use it. Patch is against webkitgtk since that's where I hit this first. Probably this should be made a single utility function somewhere instead, but I don't know the webkit source well enough to know where to put it.
Comment 1 Michael Catanzaro 2016-10-12 21:14:08 PDT
Comment on attachment 291358 [details]
eglGetPlatformDisplay.patch

View in context: https://bugs.webkit.org/attachment.cgi?id=291358&action=review

Hi, thanks for the patch. A couple of comments on submitting patches to WebKit in general:

 * Be sure to select the WebKit Gtk Bugzilla component, or us Linux folks may not notice your patch for a very long time. I found this by luck, because I happened to check the Fedora git repo to see if Tom had packaged 2.14.1 yet. :)
 * Also be sure to set the r? and cq? Bugzilla flags for patches if you want them to be reviewed or committed.
 * The patch requires a changelog entry ('Tools/Scripts/PrepareChangeLog -b 291358').
 * The patch must be prepared against a git checkout rather than a release tarball.
 * Easiest way to submit the patch is to use 'Tools/Scripts/webkit-patch upload --request-commit', it will pick the bug number automatically from your changelog entry

'webkit-patch upload' would have warned you about dozens of code style errors, including:

 * The pointer star always goes on the type, not the variable name. "const char* client_extensions" rather than "const char *client_extensions"
 * No space before opening parentheses in function calls. "eglQueryString(" not "eglQueryString ("
 * Use nullptr rather than NULL
 * Use C++ casts, never C style casts. Prefer static_cast and use reinterpret_cast when that fails.
 * Always indent four spaces, no tabs.

As for how to deduplicate the code, I think the best option would be to use a protected static function in PlatformDisplay. The child class would pass either EGL_PLATFORM_WAYLAND_KHR or EGL_PLATFORM_X11_KHR and get back a value that can be assigned to m_eglDisplay.

Lastly, we have another open bug #161958 about how strstr is not the correct way to check for EGL extensions; seems like now would be a good time to tighten that up.

> webkitgtk-2.14.0/Source/WebCore/platform/graphics/egl/GLContextEGL.h:27
> +#include <EGL/eglext.h>

Is this an accident? You don't change anything else in this file, so I presume this include was meant to be added to PlatformDisplayWayland.cpp instead. It's important to minimize the number of include statements in header files since they can dramatically increase build time.
Comment 2 Michael Catanzaro 2016-10-12 21:19:44 PDT
(In reply to comment #1)
>  * The patch requires a changelog entry ('Tools/Scripts/PrepareChangeLog -b
> 291358').

Whoops, it's late, that's supposed to be the bug number (163333) not the attachment number.
Comment 3 Carlos Garcia Campos 2016-10-20 05:13:29 PDT
Created attachment 292171 [details]
Patch for landing
Comment 4 WebKit Commit Bot 2016-10-20 06:20:53 PDT
Comment on attachment 292171 [details]
Patch for landing

Clearing flags on attachment: 292171

Committed r207616: <http://trac.webkit.org/changeset/207616>
Comment 5 WebKit Commit Bot 2016-10-20 06:20:56 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Carlos Alberto Lopez Perez 2016-10-20 09:00:16 PDT
Committed r207619: <http://trac.webkit.org/changeset/207619>
Comment 7 Csaba Osztrogonác 2016-10-20 09:00:53 PDT
(In reply to comment #4)
> Comment on attachment 292171 [details]
> Patch for landing
> 
> Clearing flags on attachment: 292171
> 
> Committed r207616: <http://trac.webkit.org/changeset/207616>

It broke the GTK build, see build.webkit.org for details.
It would be great to have same config on EWS and buildbots.