Bug 81456

Summary: [META][GTK] Wayland support
Product: WebKit Reporter: darxus
Component: WebKitGTKAssignee: José Dapena Paz <jdapena>
Status: RESOLVED FIXED    
Severity: Normal CC: cgarcia, changseok, clopez, gustavo, gyuyoung.kim, jana, jdapena, joone, kalyan.kondapally, kevin.cs.oh, mcatanzaro, mika.bostrom, mike.emmel, mike, mrobinson, phomes, rego, rudloff, slomo, thibaut.bethune, tomeu, zan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 77921, 115721, 115801, 115803, 116717, 118458, 120455, 120627, 121165, 126927, 142334, 142879, 144544, 145645, 145701, 146056, 146057, 146574, 147297, 147453, 157973, 158697, 160244    
Bug Blocks:    
Attachments:
Description Flags
Patch none

Description darxus 2012-03-17 12:45:48 PDT
Quoting http://wayland.freedesktop.org/gtk.html on porting applications to wayland:

* Ensure that your application uses gtk+-3.0 for its pkg-config request.
* Your application must not use any API in the gdk_x11_ namespace or any raw Xlib calls.
* Check the errata below for issues that might affect your application.

I believe lack of a web browser is the main reason I'm not using wayland as my primary display right now.
Comment 1 darxus 2012-04-08 07:30:50 PDT
Info on wraping gdk_x11* and xlib calls in build-time and run-time backend check instead of removing them:  http://developer.gnome.org/gtk3/3.3/ch24s02.html#id1502079
Comment 2 Mika Boström 2012-04-08 10:02:13 PDT
I would suspect the biggest problems come from the need to disable NPAPI. It appears to be unconditionally enabled for GTK bindings. So, you'll need to make ENABLE_NETSCAPE_PLUGIN_API=[0|1] a toggleable build flag .

Then, you need to include the empty NPAPI implementation. There are Plugin*None.cpp files in WebCore/plugins/ which you can use. Just hack the build to use those when NPAPI is not enabled. Remember to check that FrameLoaderClientGtk.cpp copes with the implementation; there might be some opportunistic uses of PluginView instance without checking whether it's valid.
Comment 3 Martin Robinson 2012-04-08 17:05:48 PDT
(In reply to comment #2)
> I would suspect the biggest problems come from the need to disable NPAPI. It appears to be unconditionally enabled for GTK bindings. So, you'll need to make ENABLE_NETSCAPE_PLUGIN_API=[0|1] a toggleable build flag .
> 
> Then, you need to include the empty NPAPI implementation. There are Plugin*None.cpp files in WebCore/plugins/ which you can use. Just hack the build to use those when NPAPI is not enabled. Remember to check that FrameLoaderClientGtk.cpp copes with the implementation; there might be some opportunistic uses of PluginView instance without checking whether it's valid.

I wonder if some windowless plugins could be supported by using the X11 headers and converting events to X11 events. I don't hold out much hope for this option, but it could get some plugins working.
Comment 4 José Dapena Paz 2012-10-04 07:26:23 PDT
I'm working on an implementation for this, and I'll start adding the implementation for this as the work progresses.

The initial issues with this were mostly related to build disabling NSAPI for X11. A solution for this would need to be thought independently (if anyone wills to do it).

But the main issues I'm facing are related to Accelerated Compositing and WebGL. In X11 we use XComposite for this. In Wayland it's a bit different. Though Wayland is a pure compositing protocol, it does not provide a way to share render buffers among clients, and also, it does not have the concept of a Window embedded in otehr Window. I've written some details here:
http://blogs.igalia.com/dape/2012/10/01/webkitgtk-accelerated-composition-on-wayland/

For WK1-GTK+, the main change I made is allowing TextureMapperGL to render to a texture. This texture is then painted to the WebKitWebView cairo context on demand. For WK2, I'll need a different solution, as I need to share a buffer between the UI and Web Process.

Adding also dependency on #77921 (add support for EGL). My Wayland support patch is done on top of the patch for that bug.
Comment 5 José Dapena Paz 2012-10-05 07:43:57 PDT
Created attachment 167328 [details]
Patch

First draft of Wayland support. This patch depends on current egl support fix for #77921
Comment 6 José Dapena Paz 2013-05-07 01:54:55 PDT
Converting this to a META bug. We'll coordinate the effort for implementing the fixes needed for wayland support using this.
Comment 7 José Dapena Paz 2013-05-07 01:59:20 PDT
Comment on attachment 167328 [details]
Patch

Obsoleting the patch. This was designed for static wayland support. As Gtk supports runtime detection of wayland or x11 backend, our implementation should do the same.
Comment 8 Martin Robinson 2015-05-07 16:31:26 PDT
*** Bug 18638 has been marked as a duplicate of this bug. ***
Comment 9 Carlos Garcia Campos 2016-09-15 00:44:39 PDT
All blocking bugs have been fixed now, so we can close this.