WebPlatformForEmbedded / WPEWebKit

WPE WebKit port (downstream)
211 stars 135 forks source link

Support for using external Wayland EGL Displays. #1224

Closed binuinbaraj closed 5 months ago

binuinbaraj commented 9 months ago

Pull Request Template

File a Bug

All changes should be associated with a bug. The WebKit project is currently using Bugzilla as our bug tracker. Note that multiple changes may be associated with a single bug.

Provided Tooling

The WebKit Project strongly recommends contributors use Tools/Scripts/git-webkit to generate pull requests. See Setup and Contributing Code for how to do this.

Template

If a contributor wishes to file a pull request manually, the template is below. Manually-filed pull requests should contain their commit message as the pull request description, and their commit message should be formatted like the template below.

Additionally, the pull request should be mentioned on Bugzilla, labels applied to the pull request matching the component and version of the Bugzilla associated with the pull request and the pull request assigned to its author.

< bug title >
https://bugs.webkit.org/show_bug.cgi?id=#####

Reviewed by NOBODY (OOPS!).

* path/changed.ext:
(function):
(class.function):

magomez commented 9 months ago

There are several changes on 2.38 related to this. I'll get the relevant ones and provide a patch for testing.

magomez commented 9 months ago

https://github.com/WebPlatformForEmbedded/WPEWebKit/commit/8f63eb86c0cdc55e4a0fc54a41c9ae7b7fad9225 and https://github.com/WebPlatformForEmbedded/WPEWebKit/commit/f74db4074defcdfa8f01f0d0704a90ed22b1d90e should fix the issue

magomez commented 9 months ago

Well, this is not as simple as it looks. For starters, the PR is not right. It's looking for PLATFORM(WAYLAND) when that's only defined for the GTK port. WPE doesn't use it. Then, the platform that's being used (Wayland or whatever) is decided by the the backend being used. By calling wpe_renderer_backend_egl_get_platform(m_backend) we can get the platform that the backend is using, and if that platform is not null, then we can look for eglGetPlatformDisplayEXT in order to use it. This is what is done with the commits that I linked, but none of the backends in wpebackend-rdk seems to be returning a wayland platform, so even adding those, they are not going to be used.

What I don't understand is how this is fixing anything on any platform, as PLATFORM(WAYLAND) should be always false for wpe.

gtrevers commented 9 months ago

For #if PLATFORM(WAYLAND) , this is used at the beginning of [PlatformDisplayLibWPE.cpp ...

if PLATFORM(WAYLAND)

// These includes need to be in this order because wayland-egl.h defines WL_EGL_PLATFORM // and eglplatform.h, included by egl.h, checks that to decide whether it's Wayland platform.

include

endif

... which is why I proposed wrapping the new code in it. However, if https://github.com/WebPlatformForEmbedded/WPEWebKit/commit/8f63eb86c0cdc55e4a0fc54a41c9ae7b7fad9225 and https://github.com/WebPlatformForEmbedded/WPEWebKit/commit/f74db4074defcdfa8f01f0d0704a90ed22b1d90e fix the issue then we should go with that.

magomez commented 9 months ago

There's something that needs

For #if PLATFORM(WAYLAND) , this is used at the beginning of [PlatformDisplayLibWPE.cpp ...

if PLATFORM(WAYLAND) // These includes need to be in this order because wayland-egl.h defines WL_EGL_PLATFORM // and eglplatform.h, included by egl.h, checks that to decide whether it's Wayland platform. #include #endif

... which is why I proposed wrapping the new code in it. However, if 8f63eb8 and f74db40 fix the issue then we should go with that.

Those commits are the way to go, but there's something else required besides that, which is that that the backend needs to return the platform code when wpe_renderer_backend_egl_get_platform() is called. In order to do so, the backend that you want to use needs to add a new function in its wpe_renderer_backend_egl_interface (after create, destroy and get_native_display), which corresponds to get_platform (you can check how this is done in wpebackend-fdo in https://github.com/Igalia/WPEBackend-fdo/blob/f2901c6ed7f720a578bfd5830d12426c979c0afa/src/renderer-backend-egl.cpp#L111).

I'm not sure which backend you are using. But if you add that get_platform function returning EGL_PLATFORM_WAYLAND_EXT, then the 2 wpe commits that I mentioned will fix the issue.

modeveci commented 5 months ago

After talking with @emutavchi, we can close this ticket as it is not needed for 2.38 and further releases.