Title: [245807] trunk
Revision
245807
Author
[email protected]
Date
2019-05-27 23:36:34 -0700 (Mon, 27 May 2019)

Log Message

[GTK] Use WPEBackend-fdo for accelerating compositing in Wayland instead of the nested compositor
https://bugs.webkit.org/show_bug.cgi?id=197944

Reviewed by Michael Catanzaro.

.:

Add USE_WPE_RENDERER option to use WPEBackend-fdo.

* Source/cmake/OptionsGTK.cmake:
* Source/cmake/OptionsPlayStation.cmake:
* Source/cmake/OptionsWPE.cmake:

Source/WebCore:

* PlatformGTK.cmake:
* SourcesGTK.txt:
* platform/graphics/GLContext.cpp:
(WebCore::GLContext::createContextForWindow): Check current display is X11 before trying to create a GLX context.
* platform/graphics/PlatformDisplay.cpp:
(WebCore::PlatformDisplay::createPlatformDisplay): Use USE(WPE_RENDERER) instead of USE(LIBWPE).
* platform/graphics/PlatformDisplay.h:
* platform/graphics/egl/GLContextEGL.cpp:
(WebCore::GLContextEGL::createWindowContext): Use USE(WPE_RENDERER) instead of PLATFORM(WPE).
(WebCore::GLContextEGL::createContext): Ditto.
(WebCore::GLContextEGL::createSharingContext): Ditto.
(WebCore::GLContextEGL::~GLContextEGL): Ditto.
* platform/graphics/egl/GLContextEGL.h:
* platform/graphics/egl/GLContextEGLLibWPE.cpp:
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext): Ditto.
* platform/graphics/libwpe/PlatformDisplayLibWPE.cpp:
(WebCore::PlatformDisplayLibWPE::PlatformDisplayLibWPE): In GTK port set the display as the shared one for compositing.
* platform/graphics/libwpe/PlatformDisplayLibWPE.h:

Source/WebKit:

The WPEBackend-fdo implementation is quite similar to our Wayland nested compositor, but more efficient (using
linux dmabuf, resource caching, etc.). This allows us to share even more code with WPE port too.

* PlatformGTK.cmake:
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::ThreadedCompositor::forceRepaint): WPE doesn't support force repaint yet.
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const): Use USE(WPE_RENDERER) instead of PLATFORM(WPE).
(WebKit::WebPageCreationParameters::decode): Ditto.
* Shared/WebPageCreationParameters.h:
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const): Ditto.
(WebKit::WebProcessCreationParameters::decode): Ditto.
* Shared/WebProcessCreationParameters.h:
* SourcesGTK.txt:
* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::hostFileDescriptor): Implement it when using WPE just calling webkitWebViewBaseRenderHostFileDescriptor().
* UIProcess/API/gtk/PageClientImpl.h:
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseCreateWebPage): Initialize the web page after the accelerated backing store is created, since
it's used now during intialization.
(webkitWebViewBaseRenderHostFileDescriptor): Return AcceleratedBackingStore::renderHostFileDescriptor()
* UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
* UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters): Use USE(WPE_RENDERER) instead of PLATFORM(WPE).
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::initializeNewWebProcess): Remove wayland display name initialization.
* UIProcess/glib/WebProcessPoolGLib.cpp:
(WebKit::WebProcessPool::platformInitializeWebProcess): Initialize wayland display name when not using WPE here
now. In case of using WPE, initialize hostClientFileDescriptor and implementationLibraryName.
* UIProcess/glib/WebProcessProxyGLib.cpp:
(WebKit::WebProcessProxy::platformGetLaunchOptions): Remove unused wayland socket command line process parameter.
* UIProcess/gtk/AcceleratedBackingStore.h:
(WebKit::AcceleratedBackingStore::renderHostFileDescriptor): Return -1 by default.
* UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
(WebKit::AcceleratedBackingStoreWayland::create): When using WPE call wpe_fdo_initialize_for_egl_display() and
check we have the required extensions.
(WebKit::AcceleratedBackingStoreWayland::AcceleratedBackingStoreWayland): When using WPE initialize the view backend.
(WebKit::AcceleratedBackingStoreWayland::~AcceleratedBackingStoreWayland): When using WPE release the EGL images
still in use and the view texture.
(WebKit::AcceleratedBackingStoreWayland::renderHostFileDescriptor): Call wpe_view_backend_get_renderer_host_fd().
(WebKit::AcceleratedBackingStoreWayland::displayBuffer): Create the view texture if needed, save the pending
image and schedule a redraw.
(WebKit::AcceleratedBackingStoreWayland::paint): When using WPE commit the pending image and use it as target of
the view texture.
* UIProcess/gtk/AcceleratedBackingStoreWayland.h:
* UIProcess/gtk/HardwareAccelerationManager.cpp:
(WebKit::HardwareAccelerationManager::HardwareAccelerationManager): When using WPE disable hardware acceleration
if wpe_fdo_initialize_for_egl_display() fails.
* UIProcess/gtk/WaylandCompositor.cpp:
* UIProcess/gtk/WaylandCompositor.h:
* WebProcess/WebPage/AcceleratedSurface.cpp:
(WebKit::AcceleratedSurface::create): Create an AcceleratedSurfaceLibWPE for GTK port when using WPE and shared
display is Wayland.
* WebProcess/WebPage/WebPage.cpp:
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.cpp:
(WebKit::AcceleratedSurfaceLibWPE::initialize): Use the shared display for compositing instead of shared display.
* WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.h:
* WebProcess/WebProcess.h:
* WebProcess/glib/WebProcessGLib.cpp:
(WebKit::WebProcess::platformInitializeWebProcess): Initialize the wpe display when using WPE.

Tools:

Add WPEBackend-fdo to jhbuild moduleset.

* gtk/jhbuild.modules:

Modified Paths

Diff

Modified: trunk/ChangeLog (245806 => 245807)


--- trunk/ChangeLog	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/ChangeLog	2019-05-28 06:36:34 UTC (rev 245807)
@@ -1,5 +1,18 @@
 2019-05-27  Carlos Garcia Campos  <[email protected]>
 
+        [GTK] Use WPEBackend-fdo for accelerating compositing in Wayland instead of the nested compositor
+        https://bugs.webkit.org/show_bug.cgi?id=197944
+
+        Reviewed by Michael Catanzaro.
+
+        Add USE_WPE_RENDERER option to use WPEBackend-fdo.
+
+        * Source/cmake/OptionsGTK.cmake:
+        * Source/cmake/OptionsPlayStation.cmake:
+        * Source/cmake/OptionsWPE.cmake:
+
+2019-05-27  Carlos Garcia Campos  <[email protected]>
+
         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.25.1 release
 
         * Source/cmake/OptionsGTK.cmake: Bump version numbers

Modified: trunk/Source/WebCore/ChangeLog (245806 => 245807)


--- trunk/Source/WebCore/ChangeLog	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebCore/ChangeLog	2019-05-28 06:36:34 UTC (rev 245807)
@@ -1,3 +1,30 @@
+2019-05-27  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Use WPEBackend-fdo for accelerating compositing in Wayland instead of the nested compositor
+        https://bugs.webkit.org/show_bug.cgi?id=197944
+
+        Reviewed by Michael Catanzaro.
+
+        * PlatformGTK.cmake:
+        * SourcesGTK.txt:
+        * platform/graphics/GLContext.cpp:
+        (WebCore::GLContext::createContextForWindow): Check current display is X11 before trying to create a GLX context.
+        * platform/graphics/PlatformDisplay.cpp:
+        (WebCore::PlatformDisplay::createPlatformDisplay): Use USE(WPE_RENDERER) instead of USE(LIBWPE).
+        * platform/graphics/PlatformDisplay.h:
+        * platform/graphics/egl/GLContextEGL.cpp:
+        (WebCore::GLContextEGL::createWindowContext): Use USE(WPE_RENDERER) instead of PLATFORM(WPE).
+        (WebCore::GLContextEGL::createContext): Ditto.
+        (WebCore::GLContextEGL::createSharingContext): Ditto.
+        (WebCore::GLContextEGL::~GLContextEGL): Ditto.
+        * platform/graphics/egl/GLContextEGL.h:
+        * platform/graphics/egl/GLContextEGLLibWPE.cpp:
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext): Ditto.
+        * platform/graphics/libwpe/PlatformDisplayLibWPE.cpp:
+        (WebCore::PlatformDisplayLibWPE::PlatformDisplayLibWPE): In GTK port set the display as the shared one for compositing.
+        * platform/graphics/libwpe/PlatformDisplayLibWPE.h:
+
 2019-05-27  Takashi Komori  <[email protected]>
 
         [CURL] Fix crashing SocketStreamHandle.

Modified: trunk/Source/WebCore/PlatformGTK.cmake (245806 => 245807)


--- trunk/Source/WebCore/PlatformGTK.cmake	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebCore/PlatformGTK.cmake	2019-05-28 06:36:34 UTC (rev 245807)
@@ -36,6 +36,12 @@
     "${WEBCORE_DIR}/platform/text/gtk"
 )
 
+if (USE_WPE_RENDERER)
+    list(APPEND WebCore_INCLUDE_DIRECTORIES
+        "${WEBCORE_DIR}/platform/graphics/libwpe"
+    )
+endif ()
+
 list(APPEND WebCorePlatformGTK_SOURCES
     editing/gtk/EditorGtk.cpp
 
@@ -120,6 +126,12 @@
     ${ZLIB_LIBRARIES}
 )
 
+if (USE_WPE_RENDERER)
+    list(APPEND WebCore_LIBRARIES
+        ${WPE_LIBRARIES}
+    )
+endif ()
+
 list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
     ${ATK_INCLUDE_DIRS}
     ${ENCHANT_INCLUDE_DIRS}
@@ -132,6 +144,12 @@
     ${ZLIB_INCLUDE_DIRS}
 )
 
+if (USE_WPE_RENDERER)
+    list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
+        ${WPE_INCLUDE_DIRS}
+    )
+endif ()
+
 if (USE_OPENGL_ES)
     list(APPEND WebCore_SOURCES
         platform/graphics/opengl/Extensions3DOpenGLES.cpp

Modified: trunk/Source/WebCore/SourcesGTK.txt (245806 => 245807)


--- trunk/Source/WebCore/SourcesGTK.txt	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebCore/SourcesGTK.txt	2019-05-28 06:36:34 UTC (rev 245807)
@@ -67,6 +67,7 @@
 platform/graphics/cairo/BackingStoreBackendCairoX11.cpp @no-unify
 
 platform/graphics/egl/GLContextEGL.cpp
+platform/graphics/egl/GLContextEGLLibWPE.cpp
 platform/graphics/egl/GLContextEGLWayland.cpp @no-unify
 platform/graphics/egl/GLContextEGLX11.cpp @no-unify
 
@@ -74,6 +75,8 @@
 
 platform/graphics/gstreamer/ImageGStreamerCairo.cpp
 
+platform/graphics/libwpe/PlatformDisplayLibWPE.cpp
+
 platform/graphics/opengl/Extensions3DOpenGLCommon.cpp
 platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
 platform/graphics/opengl/TemporaryOpenGLSetting.cpp

Modified: trunk/Source/WebCore/platform/graphics/GLContext.cpp (245806 => 245807)


--- trunk/Source/WebCore/platform/graphics/GLContext.cpp	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebCore/platform/graphics/GLContext.cpp	2019-05-28 06:36:34 UTC (rev 245807)
@@ -90,8 +90,10 @@
 #endif
 
 #if USE(GLX)
-    if (auto glxContext = GLContextGLX::createContext(windowHandle, display))
-        return glxContext;
+    if (display.type() == PlatformDisplay::Type::X11) {
+        if (auto glxContext = GLContextGLX::createContext(windowHandle, display))
+            return glxContext;
+    }
 #endif
 #if USE(EGL)
     if (auto eglContext = GLContextEGL::createContext(windowHandle, display))

Modified: trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp (245806 => 245807)


--- trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp	2019-05-28 06:36:34 UTC (rev 245807)
@@ -42,7 +42,7 @@
 #include "PlatformDisplayWin.h"
 #endif
 
-#if USE(LIBWPE)
+#if USE(WPE_RENDERER)
 #include "PlatformDisplayLibWPE.h"
 #endif
 
@@ -91,7 +91,7 @@
 #endif
 #endif // PLATFORM(GTK)
 
-#if USE(LIBWPE)
+#if USE(WPE_RENDERER)
     return PlatformDisplayLibWPE::create();
 #elif PLATFORM(WIN)
     return PlatformDisplayWin::create();

Modified: trunk/Source/WebCore/platform/graphics/PlatformDisplay.h (245806 => 245807)


--- trunk/Source/WebCore/platform/graphics/PlatformDisplay.h	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebCore/platform/graphics/PlatformDisplay.h	2019-05-28 06:36:34 UTC (rev 245807)
@@ -54,7 +54,7 @@
 #if PLATFORM(WIN)
         Windows,
 #endif
-#if USE(LIBWPE)
+#if USE(WPE_RENDERER)
         WPE,
 #endif
     };

Modified: trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp (245806 => 245807)


--- trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp	2019-05-28 06:36:34 UTC (rev 245807)
@@ -182,7 +182,9 @@
     if (platformDisplay.type() == PlatformDisplay::Type::Wayland)
         surface = createWindowSurfaceWayland(display, config, window);
 #endif
-#elif PLATFORM(WPE)
+#endif
+
+#if USE(WPE_RENDERER)
     if (platformDisplay.type() == PlatformDisplay::Type::WPE)
         surface = createWindowSurfaceWPE(display, config, window);
 #else
@@ -279,7 +281,7 @@
         if (platformDisplay.type() == PlatformDisplay::Type::Wayland)
             context = createWaylandContext(platformDisplay, eglSharingContext);
 #endif
-#if PLATFORM(WPE)
+#if USE(WPE_RENDERER)
         if (platformDisplay.type() == PlatformDisplay::Type::WPE)
             context = createWPEContext(platformDisplay, eglSharingContext);
 #endif
@@ -316,7 +318,7 @@
         if (platformDisplay.type() == PlatformDisplay::Type::Wayland)
             context = createWaylandContext(platformDisplay);
 #endif
-#if PLATFORM(WPE)
+#if USE(WPE_RENDERER)
         if (platformDisplay.type() == PlatformDisplay::Type::WPE)
             context = createWPEContext(platformDisplay);
 #endif
@@ -359,7 +361,7 @@
 #if PLATFORM(WAYLAND)
     destroyWaylandWindow();
 #endif
-#if PLATFORM(WPE)
+#if USE(WPE_RENDERER)
     destroyWPETarget();
 #endif
 }

Modified: trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.h (245806 => 245807)


--- trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.h	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.h	2019-05-28 06:36:34 UTC (rev 245807)
@@ -32,7 +32,7 @@
 struct wl_egl_window;
 #endif
 
-#if USE(LIBWPE)
+#if USE(WPE_RENDERER)
 struct wpe_renderer_backend_egl_offscreen_target;
 #endif
 
@@ -82,7 +82,7 @@
     GLContextEGL(PlatformDisplay&, EGLContext, EGLSurface, WlUniquePtr<struct wl_surface>&&, struct wl_egl_window*);
     void destroyWaylandWindow();
 #endif
-#if USE(LIBWPE)
+#if USE(WPE_RENDERER)
     GLContextEGL(PlatformDisplay&, EGLContext, EGLSurface, struct wpe_renderer_backend_egl_offscreen_target*);
     void destroyWPETarget();
 #endif
@@ -98,7 +98,7 @@
     static std::unique_ptr<GLContextEGL> createWaylandContext(PlatformDisplay&, EGLContext sharingContext = nullptr);
     static EGLSurface createWindowSurfaceWayland(EGLDisplay, EGLConfig, GLNativeWindowType);
 #endif
-#if USE(LIBWPE)
+#if USE(WPE_RENDERER)
     static std::unique_ptr<GLContextEGL> createWPEContext(PlatformDisplay&, EGLContext sharingContext = nullptr);
     static EGLSurface createWindowSurfaceWPE(EGLDisplay, EGLConfig, GLNativeWindowType);
 #endif
@@ -115,7 +115,7 @@
     WlUniquePtr<struct wl_surface> m_wlSurface;
     struct wl_egl_window* m_wlWindow { nullptr };
 #endif
-#if USE(LIBWPE)
+#if USE(WPE_RENDERER)
     struct wpe_renderer_backend_egl_offscreen_target* m_wpeTarget { nullptr };
 #endif
 #if USE(CAIRO)

Modified: trunk/Source/WebCore/platform/graphics/egl/GLContextEGLLibWPE.cpp (245806 => 245807)


--- trunk/Source/WebCore/platform/graphics/egl/GLContextEGLLibWPE.cpp	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebCore/platform/graphics/egl/GLContextEGLLibWPE.cpp	2019-05-28 06:36:34 UTC (rev 245807)
@@ -19,8 +19,7 @@
 #include "config.h"
 #include "GLContextEGL.h"
 
-#if USE(EGL) && USE(LIBWPE)
-
+#if USE(EGL) && USE(WPE_RENDERER)
 #include "PlatformDisplayLibWPE.h"
 
 #if USE(LIBEPOXY)
@@ -29,6 +28,11 @@
 #define __GBM__ 1
 #include "EpoxyEGL.h"
 #else
+#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 <wayland-egl.h>
+#endif
 #include <EGL/egl.h>
 #endif
 
@@ -96,4 +100,4 @@
 
 } // namespace WebCore
 
-#endif // USE(EGL) && USE(LIBWPE)
+#endif // USE(EGL) && USE(WPE_RENDERER)

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (245806 => 245807)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2019-05-28 06:36:34 UTC (rev 245807)
@@ -102,7 +102,9 @@
 
 #if PLATFORM(WAYLAND)
 #include "PlatformDisplayWayland.h"
-#elif PLATFORM(WPE)
+#endif
+
+#if USE(WPE_RENDERER)
 #include "PlatformDisplayLibWPE.h"
 #endif
 
@@ -448,7 +450,7 @@
         }
 #endif
 
-#if PLATFORM(WPE)
+#if USE(WPE_RENDERER)
         ASSERT(is<PlatformDisplayLibWPE>(sharedDisplay));
         GST_DEBUG_OBJECT(pipeline(), "Creating WPE shared EGL display");
         if (shouldAdoptRef)

Modified: trunk/Source/WebCore/platform/graphics/libwpe/PlatformDisplayLibWPE.cpp (245806 => 245807)


--- trunk/Source/WebCore/platform/graphics/libwpe/PlatformDisplayLibWPE.cpp	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebCore/platform/graphics/libwpe/PlatformDisplayLibWPE.cpp	2019-05-28 06:36:34 UTC (rev 245807)
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "PlatformDisplayLibWPE.h"
 
-#if USE(LIBWPE)
+#if USE(WPE_RENDERER)
 
 #include "GLContextEGL.h"
 
@@ -36,6 +36,11 @@
 #define __GBM__ 1
 #include "EpoxyEGL.h"
 #else
+#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 <wayland-egl.h>
+#endif
 #include <EGL/egl.h>
 #endif
 
@@ -51,6 +56,9 @@
 PlatformDisplayLibWPE::PlatformDisplayLibWPE()
     : PlatformDisplay(NativeDisplayOwned::No)
 {
+#if PLATFORM(GTK)
+    PlatformDisplay::setSharedDisplayForCompositing(*this);
+#endif
 }
 
 PlatformDisplayLibWPE::~PlatformDisplayLibWPE()
@@ -73,4 +81,4 @@
 
 } // namespace WebCore
 
-#endif // USE(LIBWPE)
+#endif // USE(WPE_RENDERER)

Modified: trunk/Source/WebCore/platform/graphics/libwpe/PlatformDisplayLibWPE.h (245806 => 245807)


--- trunk/Source/WebCore/platform/graphics/libwpe/PlatformDisplayLibWPE.h	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebCore/platform/graphics/libwpe/PlatformDisplayLibWPE.h	2019-05-28 06:36:34 UTC (rev 245807)
@@ -25,7 +25,7 @@
 
 #pragma once
 
-#if USE(LIBWPE)
+#if USE(WPE_RENDERER)
 
 #include "PlatformDisplay.h"
 
@@ -55,4 +55,4 @@
 
 SPECIALIZE_TYPE_TRAITS_PLATFORM_DISPLAY(PlatformDisplayLibWPE, WPE)
 
-#endif // USE(LIBWPE)
+#endif // USE(WPE_RENDERER)

Modified: trunk/Source/WebKit/ChangeLog (245806 => 245807)


--- trunk/Source/WebKit/ChangeLog	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/ChangeLog	2019-05-28 06:36:34 UTC (rev 245807)
@@ -1,3 +1,75 @@
+2019-05-27  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Use WPEBackend-fdo for accelerating compositing in Wayland instead of the nested compositor
+        https://bugs.webkit.org/show_bug.cgi?id=197944
+
+        Reviewed by Michael Catanzaro.
+
+        The WPEBackend-fdo implementation is quite similar to our Wayland nested compositor, but more efficient (using
+        linux dmabuf, resource caching, etc.). This allows us to share even more code with WPE port too.
+
+        * PlatformGTK.cmake:
+        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
+        (WebKit::ThreadedCompositor::forceRepaint): WPE doesn't support force repaint yet.
+        * Shared/WebPageCreationParameters.cpp:
+        (WebKit::WebPageCreationParameters::encode const): Use USE(WPE_RENDERER) instead of PLATFORM(WPE).
+        (WebKit::WebPageCreationParameters::decode): Ditto.
+        * Shared/WebPageCreationParameters.h:
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::encode const): Ditto.
+        (WebKit::WebProcessCreationParameters::decode): Ditto.
+        * Shared/WebProcessCreationParameters.h:
+        * SourcesGTK.txt:
+        * UIProcess/API/gtk/PageClientImpl.cpp:
+        (WebKit::PageClientImpl::hostFileDescriptor): Implement it when using WPE just calling webkitWebViewBaseRenderHostFileDescriptor().
+        * UIProcess/API/gtk/PageClientImpl.h:
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (webkitWebViewBaseCreateWebPage): Initialize the web page after the accelerated backing store is created, since
+        it's used now during intialization.
+        (webkitWebViewBaseRenderHostFileDescriptor): Return AcceleratedBackingStore::renderHostFileDescriptor()
+        * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
+        * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::creationParameters): Use USE(WPE_RENDERER) instead of PLATFORM(WPE).
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::initializeNewWebProcess): Remove wayland display name initialization.
+        * UIProcess/glib/WebProcessPoolGLib.cpp:
+        (WebKit::WebProcessPool::platformInitializeWebProcess): Initialize wayland display name when not using WPE here
+        now. In case of using WPE, initialize hostClientFileDescriptor and implementationLibraryName.
+        * UIProcess/glib/WebProcessProxyGLib.cpp:
+        (WebKit::WebProcessProxy::platformGetLaunchOptions): Remove unused wayland socket command line process parameter.
+        * UIProcess/gtk/AcceleratedBackingStore.h:
+        (WebKit::AcceleratedBackingStore::renderHostFileDescriptor): Return -1 by default.
+        * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
+        (WebKit::AcceleratedBackingStoreWayland::create): When using WPE call wpe_fdo_initialize_for_egl_display() and
+        check we have the required extensions.
+        (WebKit::AcceleratedBackingStoreWayland::AcceleratedBackingStoreWayland): When using WPE initialize the view backend.
+        (WebKit::AcceleratedBackingStoreWayland::~AcceleratedBackingStoreWayland): When using WPE release the EGL images
+        still in use and the view texture.
+        (WebKit::AcceleratedBackingStoreWayland::renderHostFileDescriptor): Call wpe_view_backend_get_renderer_host_fd().
+        (WebKit::AcceleratedBackingStoreWayland::displayBuffer): Create the view texture if needed, save the pending
+        image and schedule a redraw.
+        (WebKit::AcceleratedBackingStoreWayland::paint): When using WPE commit the pending image and use it as target of
+        the view texture.
+        * UIProcess/gtk/AcceleratedBackingStoreWayland.h:
+        * UIProcess/gtk/HardwareAccelerationManager.cpp:
+        (WebKit::HardwareAccelerationManager::HardwareAccelerationManager): When using WPE disable hardware acceleration
+        if wpe_fdo_initialize_for_egl_display() fails.
+        * UIProcess/gtk/WaylandCompositor.cpp:
+        * UIProcess/gtk/WaylandCompositor.h:
+        * WebProcess/WebPage/AcceleratedSurface.cpp:
+        (WebKit::AcceleratedSurface::create): Create an AcceleratedSurfaceLibWPE for GTK port when using WPE and shared
+        display is Wayland.
+        * WebProcess/WebPage/WebPage.cpp:
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.cpp:
+        (WebKit::AcceleratedSurfaceLibWPE::initialize): Use the shared display for compositing instead of shared display.
+        * WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.h:
+        * WebProcess/WebProcess.h:
+        * WebProcess/glib/WebProcessGLib.cpp:
+        (WebKit::WebProcess::platformInitializeWebProcess): Initialize the wpe display when using WPE.
+
 2019-05-27  Wenson Hsieh  <[email protected]>
 
         [iOS] Dropping in an editable element should result in a ranged selection

Modified: trunk/Source/WebKit/PlatformGTK.cmake (245806 => 245807)


--- trunk/Source/WebKit/PlatformGTK.cmake	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/PlatformGTK.cmake	2019-05-28 06:36:34 UTC (rev 245807)
@@ -428,6 +428,16 @@
     ${LIBSOUP_INCLUDE_DIRS}
 )
 
+if (USE_WPE_RENDERER)
+    list(APPEND WebKit_INCLUDE_DIRECTORIES
+        "${WEBKIT_DIR}/WebProcess/WebPage/libwpe"
+    )
+    list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES
+        ${WPE_INCLUDE_DIRS}
+        ${WPEBACKEND_FDO_INCLUDE_DIRS}
+    )
+endif ()
+
 if (USE_LIBNOTIFY)
 list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES
     ${LIBNOTIFY_INCLUDE_DIRS}
@@ -464,6 +474,13 @@
 # WebCore should be specifed before and after WebCorePlatformGTK
 list(APPEND WebKit_LIBRARIES PRIVATE WebCore)
 
+if (USE_WPE_RENDERER)
+    list(APPEND WebKit_LIBRARIES
+      ${WPE_LIBRARIES}
+      ${WPEBACKEND_FDO_LIBRARIES}
+    )
+endif ()
+
 if (LIBNOTIFY_FOUND)
 list(APPEND WebKit_LIBRARIES
     PRIVATE ${LIBNOTIFY_LIBRARIES}

Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp (245806 => 245807)


--- trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp	2019-05-28 06:36:34 UTC (rev 245807)
@@ -188,7 +188,7 @@
 {
     // FIXME: Enable this for WPE once it's possible to do these forced updates
     // in a way that doesn't starve out the underlying graphics buffers.
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && !USE(WPE_RENDERER)
     m_compositingRunLoop->performTaskSync([this, protectedThis = makeRef(*this)] {
         SetForScope<bool> change(m_inForceRepaint, true);
         renderLayerTree();

Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp (245806 => 245807)


--- trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp	2019-05-28 06:36:34 UTC (rev 245807)
@@ -103,7 +103,7 @@
     encoder << smartInsertDeleteEnabled;
     encoder << additionalSupportedImageTypes;
 #endif
-#if PLATFORM(WPE)
+#if USE(WPE_RENDERER)
     encoder << hostFileDescriptor;
 #endif
     encoder << appleMailPaginationQuirkEnabled;
@@ -302,7 +302,7 @@
         return WTF::nullopt;
 #endif
 
-#if PLATFORM(WPE)
+#if USE(WPE_RENDERER)
     if (!decoder.decode(parameters.hostFileDescriptor))
         return WTF::nullopt;
 #endif

Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.h (245806 => 245807)


--- trunk/Source/WebKit/Shared/WebPageCreationParameters.h	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.h	2019-05-28 06:36:34 UTC (rev 245807)
@@ -163,7 +163,7 @@
     bool smartInsertDeleteEnabled;
     Vector<String> additionalSupportedImageTypes;
 #endif
-#if PLATFORM(WPE)
+#if USE(WPE_RENDERER)
     IPC::Attachment hostFileDescriptor;
 #endif
     bool appleMailPaginationQuirkEnabled;

Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp (245806 => 245807)


--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp	2019-05-28 06:36:34 UTC (rev 245807)
@@ -151,7 +151,7 @@
     encoder << useOverlayScrollbars;
 #endif
 
-#if PLATFORM(WPE)
+#if USE(WPE_RENDERER)
     encoder << isServiceWorkerProcess;
     encoder << hostClientFileDescriptor;
     encoder << implementationLibraryName;
@@ -371,7 +371,7 @@
         return false;
 #endif
 
-#if PLATFORM(WPE)
+#if USE(WPE_RENDERER)
     if (!decoder.decode(parameters.isServiceWorkerProcess))
         return false;
     if (!decoder.decode(parameters.hostClientFileDescriptor))

Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.h (245806 => 245807)


--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.h	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.h	2019-05-28 06:36:34 UTC (rev 245807)
@@ -189,7 +189,7 @@
     bool useOverlayScrollbars { true };
 #endif
 
-#if PLATFORM(WPE)
+#if USE(WPE_RENDERER)
     bool isServiceWorkerProcess { false };
     IPC::Attachment hostClientFileDescriptor;
     CString implementationLibraryName;

Modified: trunk/Source/WebKit/SourcesGTK.txt (245806 => 245807)


--- trunk/Source/WebKit/SourcesGTK.txt	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/SourcesGTK.txt	2019-05-28 06:36:34 UTC (rev 245807)
@@ -420,6 +420,8 @@
 WebProcess/WebPage/gtk/WebPageGtk.cpp
 WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp
 
+WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.cpp
+
 WebProcess/glib/WebProcessGLib.cpp
 
 WebProcess/gtk/WaylandCompositorDisplay.cpp

Modified: trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp (245806 => 245807)


--- trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp	2019-05-28 06:36:34 UTC (rev 245807)
@@ -552,4 +552,11 @@
     return false;
 }
 
+#if USE(WPE_RENDERER)
+IPC::Attachment PageClientImpl::hostFileDescriptor()
+{
+    return webkitWebViewBaseRenderHostFileDescriptor(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
+}
+#endif
+
 } // namespace WebKit

Modified: trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h (245806 => 245807)


--- trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h	2019-05-28 06:36:34 UTC (rev 245807)
@@ -164,6 +164,10 @@
 
     bool effectiveAppearanceIsDark() const override;
 
+#if USE(WPE_RENDERER)
+    IPC::Attachment hostFileDescriptor() override;
+#endif
+
     // Members of PageClientImpl class
     GtkWidget* m_viewWidget;
     DefaultUndoController m_undoController;

Modified: trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp (245806 => 245807)


--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp	2019-05-28 06:36:34 UTC (rev 245807)
@@ -1459,10 +1459,9 @@
     WebKitWebViewBasePrivate* priv = webkitWebViewBase->priv;
     WebProcessPool* processPool = configuration->processPool();
     priv->pageProxy = processPool->createWebPage(*priv->pageClient, WTFMove(configuration));
+    priv->acceleratedBackingStore = AcceleratedBackingStore::create(*priv->pageProxy);
     priv->pageProxy->initializeWebPage();
 
-    priv->acceleratedBackingStore = AcceleratedBackingStore::create(*priv->pageProxy);
-
     priv->inputMethodFilter.setPage(priv->pageProxy.get());
 
 #if HAVE(GTK_SCALE_FACTOR)
@@ -1829,3 +1828,12 @@
     completionHandler(emptyString());
 #endif
 }
+
+#if USE(WPE_RENDERER)
+int webkitWebViewBaseRenderHostFileDescriptor(WebKitWebViewBase* webkitWebViewBase)
+{
+    if (webkitWebViewBase->priv->acceleratedBackingStore)
+        return webkitWebViewBase->priv->acceleratedBackingStore->renderHostFileDescriptor();
+    return -1;
+}
+#endif

Modified: trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h (245806 => 245807)


--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h	2019-05-28 06:36:34 UTC (rev 245807)
@@ -95,3 +95,7 @@
 void webkitWebViewBaseDidRestoreScrollPosition(WebKitWebViewBase*);
 
 void webkitWebViewBaseShowEmojiChooser(WebKitWebViewBase*, const WebCore::IntRect&, CompletionHandler<void(String)>&&);
+
+#if USE(WPE_RENDERER)
+int webkitWebViewBaseRenderHostFileDescriptor(WebKitWebViewBase*);
+#endif

Modified: trunk/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp (245806 => 245807)


--- trunk/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp	2019-05-28 06:36:34 UTC (rev 245807)
@@ -35,6 +35,7 @@
 #include "WebPageProxy.h"
 #include "WebPreferences.h"
 #include "WebProcessProxy.h"
+#include <WebCore/PlatformDisplay.h>
 #include <WebCore/Region.h>
 
 #if PLATFORM(GTK)
@@ -41,11 +42,6 @@
 #include <gtk/gtk.h>
 #endif
 
-#if PLATFORM(WAYLAND)
-#include "WaylandCompositor.h"
-#include <WebCore/PlatformDisplay.h>
-#endif
-
 #if USE(GLIB_EVENT_LOOP)
 #include <wtf/glib/RunLoopSourcePriority.h>
 #endif

Modified: trunk/Source/WebKit/UIProcess/PageClient.h (245806 => 245807)


--- trunk/Source/WebKit/UIProcess/PageClient.h	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/UIProcess/PageClient.h	2019-05-28 06:36:34 UTC (rev 245807)
@@ -505,7 +505,7 @@
     virtual WTF::Optional<unsigned> activeTouchIdentifierForGestureRecognizer(UIGestureRecognizer*) { return WTF::nullopt; }
 #endif
 
-#if PLATFORM(WPE)
+#if USE(WPE_RENDERER)
     virtual IPC::Attachment hostFileDescriptor() = 0;
 #endif
 };

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (245806 => 245807)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-05-28 06:36:34 UTC (rev 245807)
@@ -7182,7 +7182,7 @@
     parameters.overrideContentSecurityPolicy = m_overrideContentSecurityPolicy;
     parameters.cpuLimit = m_cpuLimit;
 
-#if PLATFORM(WPE)
+#if USE(WPE_RENDERER)
     parameters.hostFileDescriptor = pageClient().hostFileDescriptor();
 #endif
 

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (245806 => 245807)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2019-05-28 06:36:34 UTC (rev 245807)
@@ -117,11 +117,6 @@
 #include "MemoryPressureMonitor.h"
 #endif
 
-#if PLATFORM(WAYLAND)
-#include "WaylandCompositor.h"
-#include <WebCore/PlatformDisplay.h>
-#endif
-
 #if PLATFORM(COCOA)
 #include "VersionChecks.h"
 #endif
@@ -979,11 +974,6 @@
     parameters.shouldEnableMemoryPressureReliefLogging = true;
 #endif
 
-#if PLATFORM(WAYLAND) && USE(EGL)
-    if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::Wayland)
-        parameters.waylandCompositorDisplayName = WaylandCompositor::singleton().displayName();
-#endif
-
 #if ENABLE(MEDIA_STREAM)
     parameters.shouldCaptureAudioInUIProcess = m_configuration->shouldCaptureAudioInUIProcess();
     parameters.shouldCaptureVideoInUIProcess = m_configuration->shouldCaptureVideoInUIProcess();

Modified: trunk/Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp (245806 => 245807)


--- trunk/Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp	2019-05-28 06:36:34 UTC (rev 245807)
@@ -31,15 +31,23 @@
 #include "WebMemoryPressureHandler.h"
 #include "WebProcessCreationParameters.h"
 #include <_javascript_Core/RemoteInspectorServer.h>
+#include <WebCore/PlatformDisplay.h>
+#include <wtf/FileSystem.h>
+#include <wtf/glib/GUniquePtr.h>
 
 #if USE(GSTREAMER)
 #include <WebCore/GStreamerCommon.h>
 #endif
 
-#include <wtf/FileSystem.h>
-#include <wtf/glib/GUniquePtr.h>
+#if PLATFORM(WAYLAND)
+#if USE(WPE_RENDERER)
+#include <wpe/fdo-egl.h>
+#else
+#include "WaylandCompositor.h"
+#endif
+#endif
 
-#if PLATFORM(WPE)
+#if USE(WPE_RENDERER)
 #include <wpe/wpe.h>
 #endif
 
@@ -108,6 +116,20 @@
     }
 #endif
 
+#if PLATFORM(WAYLAND)
+    if (WebCore::PlatformDisplay::sharedDisplay().type() == WebCore::PlatformDisplay::Type::Wayland) {
+#if USE(WPE_RENDERER)
+        wpe_loader_init("libWPEBackend-fdo-1.0.so");
+        if (wpe_fdo_initialize_for_egl_display(WebCore::PlatformDisplay::sharedDisplay().eglDisplay())) {
+            parameters.hostClientFileDescriptor = wpe_renderer_host_create_client();
+            parameters.implementationLibraryName = FileSystem::fileSystemRepresentation(wpe_loader_get_loaded_implementation_library_name());
+        }
+#else
+        parameters.waylandCompositorDisplayName = WaylandCompositor::singleton().displayName();
+#endif
+    }
+#endif
+
     parameters.memoryCacheDisabled = m_memoryCacheDisabled || cacheModel() == CacheModel::DocumentViewer;
     parameters.proxySettings = m_networkProxySettings;
 

Modified: trunk/Source/WebKit/UIProcess/glib/WebProcessProxyGLib.cpp (245806 => 245807)


--- trunk/Source/WebKit/UIProcess/glib/WebProcessProxyGLib.cpp	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/UIProcess/glib/WebProcessProxyGLib.cpp	2019-05-28 06:36:34 UTC (rev 245807)
@@ -26,9 +26,6 @@
 #include "config.h"
 #include "WebProcessProxy.h"
 
-#if PLATFORM(WAYLAND) && USE(EGL)
-#include "WaylandCompositor.h"
-#endif
 #include "WebProcessPool.h"
 #include "WebsiteDataStore.h"
 #include <WebCore/PlatformDisplay.h>
@@ -47,15 +44,6 @@
     launchOptions.extraInitializationData.set("applicationCacheDirectory", websiteDataStore().resolvedApplicationCacheDirectory());
 
     launchOptions.extraWebProcessSandboxPaths = m_processPool->sandboxPaths();
-
-#if PLATFORM(WAYLAND) && USE(EGL)
-    if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::Wayland) {
-        String displayName = WaylandCompositor::singleton().displayName();
-        String runtimeDir(g_get_user_runtime_dir());
-        String waylandSocket = FileSystem::pathByAppendingComponent(runtimeDir, displayName);
-        launchOptions.extraInitializationData.set("waylandSocket", waylandSocket);
-    }
-#endif
 }
 
 };

Modified: trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.h (245806 => 245807)


--- trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.h	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.h	2019-05-28 06:36:34 UTC (rev 245807)
@@ -47,6 +47,7 @@
     virtual void update(const LayerTreeContext&) { }
     virtual bool paint(cairo_t*, const WebCore::IntRect&) = 0;
     virtual bool makeContextCurrent() { return false; }
+    virtual int renderHostFileDescriptor() { return -1; }
 
 protected:
     AcceleratedBackingStore(WebPageProxy&);

Modified: trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp (245806 => 245807)


--- trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp	2019-05-28 06:36:34 UTC (rev 245807)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Igalia S.L.
+ * Copyright (C) 2016, 2019 Igalia S.L.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -28,24 +28,72 @@
 
 #if PLATFORM(WAYLAND) && USE(EGL)
 
-#include "WaylandCompositor.h"
 #include "WebPageProxy.h"
+// 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 <gdk/gdkwayland.h>
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
 #include <WebCore/CairoUtilities.h>
 #include <WebCore/GLContext.h>
 
 #if USE(OPENGL_ES)
 #include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#include <WebCore/Extensions3DOpenGLES.h>
 #else
+#include <WebCore/Extensions3DOpenGL.h>
 #include <WebCore/OpenGLShims.h>
 #endif
 
+#if USE(WPE_RENDERER)
+#include <wpe/fdo-egl.h>
+#else
+#include "WaylandCompositor.h"
+#endif
+
+#if USE(WPE_RENDERER)
+#if !defined(PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)
+typedef void (*PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES);
+#endif
+
+static PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glImageTargetTexture2D;
+#endif
+
 namespace WebKit {
 using namespace WebCore;
 
 std::unique_ptr<AcceleratedBackingStoreWayland> AcceleratedBackingStoreWayland::create(WebPageProxy& webPage)
 {
+#if USE(WPE_RENDERER)
+    if (!glImageTargetTexture2D) {
+        if (!wpe_fdo_initialize_for_egl_display(PlatformDisplay::sharedDisplay().eglDisplay()))
+            return nullptr;
+
+        std::unique_ptr<WebCore::GLContext> eglContext = GLContext::createOffscreenContext();
+        if (!eglContext)
+            return nullptr;
+
+        if (!eglContext->makeContextCurrent())
+            return nullptr;
+
+#if USE(OPENGL_ES)
+        std::unique_ptr<Extensions3DOpenGLES> glExtensions = std::make_unique<Extensions3DOpenGLES>(nullptr,  false);
+#else
+        std::unique_ptr<Extensions3DOpenGL> glExtensions = std::make_unique<Extensions3DOpenGL>(nullptr, GLContext::current()->version() >= 320);
+#endif
+        if (glExtensions->supports("GL_OES_EGL_image") || glExtensions->supports("GL_OES_EGL_image_external"))
+            glImageTargetTexture2D = reinterpret_cast<PFNGLEGLIMAGETARGETTEXTURE2DOESPROC>(eglGetProcAddress("glEGLImageTargetTexture2DOES"));
+    }
+
+    if (!glImageTargetTexture2D) {
+        WTFLogAlways("AcceleratedBackingStoreWPE requires glEGLImageTargetTexture2D.");
+        return nullptr;
+    }
+#else
     if (!WaylandCompositor::singleton().isRunning())
         return nullptr;
+#endif
     return std::unique_ptr<AcceleratedBackingStoreWayland>(new AcceleratedBackingStoreWayland(webPage));
 }
 
@@ -52,12 +100,41 @@
 AcceleratedBackingStoreWayland::AcceleratedBackingStoreWayland(WebPageProxy& webPage)
     : AcceleratedBackingStore(webPage)
 {
+#if USE(WPE_RENDERER)
+    static struct wpe_view_backend_exportable_fdo_egl_client exportableClient = {
+        // export_egl_image
+        nullptr,
+        // export_fdo_egl_image
+        [](void* data, struct wpe_fdo_egl_exported_image* image)
+        {
+            static_cast<AcceleratedBackingStoreWayland*>(data)->displayBuffer(image);
+        },
+        // padding
+        nullptr, nullptr, nullptr
+    };
+
+    auto viewSize = webPage.viewSize();
+    m_exportable = wpe_view_backend_exportable_fdo_egl_create(&exportableClient, this, viewSize.width(), viewSize.height());
+    wpe_view_backend_initialize(wpe_view_backend_exportable_fdo_get_view_backend(m_exportable));
+#else
     WaylandCompositor::singleton().registerWebPage(m_webPage);
+#endif
 }
 
 AcceleratedBackingStoreWayland::~AcceleratedBackingStoreWayland()
 {
+#if USE(WPE_RENDERER)
+    if (m_pendingImage)
+        wpe_view_backend_exportable_fdo_egl_dispatch_release_exported_image(m_exportable, m_pendingImage);
+    if (m_committedImage)
+        wpe_view_backend_exportable_fdo_egl_dispatch_release_exported_image(m_exportable, m_committedImage);
+    if (m_viewTexture) {
+        if (makeContextCurrent())
+            glDeleteTextures(1, &m_viewTexture);
+    }
+#else
     WaylandCompositor::singleton().unregisterWebPage(m_webPage);
+#endif
 
 #if GTK_CHECK_VERSION(3, 16, 0)
     if (m_gdkGLContext && m_gdkGLContext.get() == gdk_gl_context_get_current())
@@ -102,12 +179,64 @@
     return m_glContext ? m_glContext->makeContextCurrent() : false;
 }
 
+#if USE(WPE_RENDERER)
+int AcceleratedBackingStoreWayland::renderHostFileDescriptor()
+{
+    return wpe_view_backend_get_renderer_host_fd(wpe_view_backend_exportable_fdo_get_view_backend(m_exportable));
+}
+
+void AcceleratedBackingStoreWayland::displayBuffer(struct wpe_fdo_egl_exported_image* image)
+{
+    if (!m_viewTexture) {
+        if (!makeContextCurrent())
+            return;
+
+        glGenTextures(1, &m_viewTexture);
+        glBindTexture(GL_TEXTURE_2D, m_viewTexture);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+    }
+
+    if (m_pendingImage)
+        wpe_view_backend_exportable_fdo_egl_dispatch_release_image(m_exportable, m_pendingImage);
+    m_pendingImage = image;
+
+    m_webPage.setViewNeedsDisplay(IntRect(IntPoint::zero(), m_webPage.viewSize()));
+}
+#endif
+
 bool AcceleratedBackingStoreWayland::paint(cairo_t* cr, const IntRect& clipRect)
 {
     GLuint texture;
     IntSize textureSize;
+
+#if USE(WPE_RENDERER)
+    if (!makeContextCurrent())
+        return false;
+
+    if (m_pendingImage) {
+        wpe_view_backend_exportable_fdo_dispatch_frame_complete(m_exportable);
+
+        if (m_committedImage)
+            wpe_view_backend_exportable_fdo_egl_dispatch_release_exported_image(m_exportable, m_committedImage);
+        m_committedImage = m_pendingImage;
+        m_pendingImage = nullptr;
+    }
+
+    if (!m_committedImage)
+        return true;
+
+    glBindTexture(GL_TEXTURE_2D, m_viewTexture);
+    glImageTargetTexture2D(GL_TEXTURE_2D, wpe_fdo_egl_exported_image_get_egl_image(m_committedImage));
+
+    texture = m_viewTexture;
+    textureSize = { static_cast<int>(wpe_fdo_egl_exported_image_get_width(m_committedImage)), static_cast<int>(wpe_fdo_egl_exported_image_get_height(m_committedImage)) };
+#else
     if (!WaylandCompositor::singleton().getTexture(m_webPage, texture, textureSize))
         return false;
+#endif
 
     cairo_save(cr);
 

Modified: trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.h (245806 => 245807)


--- trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.h	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.h	2019-05-28 06:36:34 UTC (rev 245807)
@@ -33,7 +33,13 @@
 #include <gtk/gtk.h>
 #include <wtf/glib/GRefPtr.h>
 
+#if USE(WPE_RENDERER)
+#include <wpe/fdo.h>
+#endif
+
+typedef void* EGLImageKHR;
 typedef struct _GdkGLContext GdkGLContext;
+struct wpe_fdo_egl_exported_image;
 
 namespace WebCore {
 class GLContext;
@@ -53,9 +59,15 @@
     AcceleratedBackingStoreWayland(WebPageProxy&);
 
     void tryEnsureGLContext();
+#if USE(WPE_RENDERER)
+    void displayBuffer(struct wpe_fdo_egl_exported_image*);
+#endif
 
     bool paint(cairo_t*, const WebCore::IntRect&) override;
     bool makeContextCurrent() override;
+#if USE(WPE_RENDERER)
+    int renderHostFileDescriptor() override;
+#endif
 
     RefPtr<cairo_surface_t> m_surface;
     bool m_glContextInitialized { false };
@@ -63,6 +75,13 @@
     GRefPtr<GdkGLContext> m_gdkGLContext;
 #endif
     std::unique_ptr<WebCore::GLContext> m_glContext;
+
+#if USE(WPE_RENDERER)
+    struct wpe_view_backend_exportable_fdo* m_exportable { nullptr };
+    unsigned m_viewTexture { 0 };
+    struct wpe_fdo_egl_exported_image* m_committedImage { nullptr };
+    struct wpe_fdo_egl_exported_image* m_pendingImage { nullptr };
+#endif
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/UIProcess/gtk/HardwareAccelerationManager.cpp (245806 => 245807)


--- trunk/Source/WebKit/UIProcess/gtk/HardwareAccelerationManager.cpp	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/UIProcess/gtk/HardwareAccelerationManager.cpp	2019-05-28 06:36:34 UTC (rev 245807)
@@ -26,7 +26,6 @@
 #include "config.h"
 #include "HardwareAccelerationManager.h"
 
-#include "WaylandCompositor.h"
 #include <WebCore/NotImplemented.h>
 #include <WebCore/PlatformDisplay.h>
 
@@ -34,6 +33,14 @@
 #include <WebCore/PlatformDisplayX11.h>
 #endif
 
+#if PLATFORM(WAYLAND)
+#if USE(WPE_RENDERER)
+#include <wpe/fdo-egl.h>
+#else
+#include "WaylandCompositor.h"
+#endif
+#endif
+
 namespace WebKit {
 using namespace WebCore;
 
@@ -71,10 +78,17 @@
 
 #if PLATFORM(WAYLAND) && USE(EGL)
     if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::Wayland) {
+#if USE(WPE_RENDERER)
+        if (!wpe_fdo_initialize_for_egl_display(PlatformDisplay::sharedDisplay().eglDisplay())) {
+            m_canUseHardwareAcceleration = false;
+            return;
+        }
+#else
         if (!WaylandCompositor::singleton().isRunning()) {
             m_canUseHardwareAcceleration = false;
             return;
         }
+#endif
     }
 #endif
 

Modified: trunk/Source/WebKit/UIProcess/gtk/WaylandCompositor.cpp (245806 => 245807)


--- trunk/Source/WebKit/UIProcess/gtk/WaylandCompositor.cpp	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/UIProcess/gtk/WaylandCompositor.cpp	2019-05-28 06:36:34 UTC (rev 245807)
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "WaylandCompositor.h"
 
-#if PLATFORM(WAYLAND) && USE(EGL)
+#if PLATFORM(WAYLAND) && USE(EGL) && !USE(WPE_RENDERER)
 
 #include "WebKitWaylandServerProtocol.h"
 #include <EGL/egl.h>
@@ -576,4 +576,4 @@
 
 } // namespace WebKit
 
-#endif // PLATFORM(WAYLAND) && USE(EGL)
+#endif // PLATFORM(WAYLAND) && USE(EGL) && !USE(WPE_RENDERER)

Modified: trunk/Source/WebKit/UIProcess/gtk/WaylandCompositor.h (245806 => 245807)


--- trunk/Source/WebKit/UIProcess/gtk/WaylandCompositor.h	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/UIProcess/gtk/WaylandCompositor.h	2019-05-28 06:36:34 UTC (rev 245807)
@@ -25,7 +25,7 @@
 
 #pragma once
 
-#if PLATFORM(WAYLAND) && USE(EGL)
+#if PLATFORM(WAYLAND) && USE(EGL) && !USE(WPE_RENDERER)
 
 #include "WebPageProxy.h"
 #include <WebCore/RefPtrCairo.h>
@@ -129,4 +129,4 @@
 
 } // namespace WebKit
 
-#endif // PLATFORM(WAYLAND) && USE(EGL)
+#endif // PLATFORM(WAYLAND) && USE(EGL) && !USE(WPE_RENDERER)

Modified: trunk/Source/WebKit/WebProcess/WebPage/AcceleratedSurface.cpp (245806 => 245807)


--- trunk/Source/WebKit/WebProcess/WebPage/AcceleratedSurface.cpp	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/WebProcess/WebPage/AcceleratedSurface.cpp	2019-05-28 06:36:34 UTC (rev 245807)
@@ -37,7 +37,7 @@
 #include "AcceleratedSurfaceX11.h"
 #endif
 
-#if USE(LIBWPE)
+#if USE(WPE_RENDERER)
 #include "AcceleratedSurfaceLibWPE.h"
 #endif
 
@@ -48,8 +48,12 @@
 {
 #if PLATFORM(WAYLAND)
     if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::Wayland)
+#if USE(WPE_RENDERER)
+        return AcceleratedSurfaceLibWPE::create(webPage, client);
+#else
         return AcceleratedSurfaceWayland::create(webPage, client);
 #endif
+#endif
 #if USE(REDIRECTED_XCOMPOSITE_WINDOW)
     if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::X11)
         return AcceleratedSurfaceX11::create(webPage, client);

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (245806 => 245807)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-05-28 06:36:34 UTC (rev 245807)
@@ -423,7 +423,7 @@
     , m_userInterfaceLayoutDirection(parameters.userInterfaceLayoutDirection)
     , m_overrideContentSecurityPolicy { parameters.overrideContentSecurityPolicy }
     , m_cpuLimit(parameters.cpuLimit)
-#if PLATFORM(WPE)
+#if USE(WPE_RENDERER)
     , m_hostFileDescriptor(WTFMove(parameters.hostFileDescriptor))
 #endif
 #if ENABLE(VIEWPORT_RESIZING)

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (245806 => 245807)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-05-28 06:36:34 UTC (rev 245807)
@@ -1155,7 +1155,7 @@
     void didFinishLoadingApplicationManifest(uint64_t, const Optional<WebCore::ApplicationManifest>&);
 #endif
 
-#if PLATFORM(WPE)
+#if USE(WPE_RENDERER)
     int releaseHostFileDescriptor() { return m_hostFileDescriptor.releaseFileDescriptor(); }
 #endif
 
@@ -1917,7 +1917,7 @@
     const String m_overrideContentSecurityPolicy;
     const Optional<double> m_cpuLimit;
 
-#if PLATFORM(WPE)
+#if USE(WPE_RENDERER)
     IPC::Attachment m_hostFileDescriptor;
 #endif
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.cpp (245806 => 245807)


--- trunk/Source/WebKit/WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.cpp	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.cpp	2019-05-28 06:36:34 UTC (rev 245807)
@@ -26,6 +26,8 @@
 #include "config.h"
 #include "AcceleratedSurfaceLibWPE.h"
 
+#if USE(WPE_RENDERER)
+
 #include "WebPage.h"
 #include <WebCore/PlatformDisplayLibWPE.h>
 #include <wpe/wpe-egl.h>
@@ -65,7 +67,7 @@
         nullptr
     };
     wpe_renderer_backend_egl_target_set_client(m_backend, &s_client, this);
-    wpe_renderer_backend_egl_target_initialize(m_backend, downcast<PlatformDisplayLibWPE>(PlatformDisplay::sharedDisplay()).backend(),
+    wpe_renderer_backend_egl_target_initialize(m_backend, downcast<PlatformDisplayLibWPE>(PlatformDisplay::sharedDisplayForCompositing()).backend(),
         std::max(1, m_size.width()), std::max(1, m_size.height()));
 }
 
@@ -111,3 +113,4 @@
 
 } // namespace WebKit
 
+#endif // USE(WPE_RENDERER)

Modified: trunk/Source/WebKit/WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.h (245806 => 245807)


--- trunk/Source/WebKit/WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.h	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.h	2019-05-28 06:36:34 UTC (rev 245807)
@@ -25,7 +25,7 @@
 
 #pragma once
 
-#if PLATFORM(WPE)
+#if USE(WPE_RENDERER)
 
 #include "AcceleratedSurface.h"
 
@@ -44,7 +44,14 @@
     uint64_t window() const override;
     uint64_t surfaceID() const override;
     void clientResize(const WebCore::IntSize&) override;
-    bool shouldPaintMirrored() const override { return false; }
+    bool shouldPaintMirrored() const override
+    {
+#if PLATFORM(GTK)
+        return true;
+#else
+        return false;
+#endif
+    }
 
     void initialize() override;
     void finalize() override;
@@ -59,4 +66,4 @@
 
 } // namespace WebKit
 
-#endif // PLATFORM(WPE)
+#endif // USE(WPE_RENDERER)

Modified: trunk/Source/WebKit/WebProcess/WebProcess.h (245806 => 245807)


--- trunk/Source/WebKit/WebProcess/WebProcess.h	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/WebProcess/WebProcess.h	2019-05-28 06:36:34 UTC (rev 245807)
@@ -63,6 +63,10 @@
 #include "ProcessTaskStateObserver.h"
 #endif
 
+#if PLATFORM(WAYLAND) && USE(WPE_RENDERER)
+#include <WebCore/PlatformDisplayLibWPE.h>
+#endif
+
 namespace API {
 class Object;
 }
@@ -552,6 +556,11 @@
 #if PLATFORM(WAYLAND)
     std::unique_ptr<WaylandCompositorDisplay> m_waylandCompositorDisplay;
 #endif
+
+#if PLATFORM(WAYLAND) && USE(WPE_RENDERER)
+    std::unique_ptr<WebCore::PlatformDisplayLibWPE> m_wpeDisplay;
+#endif
+
     bool m_hasSuspendedPageProxy { false };
     bool m_isSuspending { false };
 

Modified: trunk/Source/WebKit/WebProcess/glib/WebProcessGLib.cpp (245806 => 245807)


--- trunk/Source/WebKit/WebProcess/glib/WebProcessGLib.cpp	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/WebKit/WebProcess/glib/WebProcessGLib.cpp	2019-05-28 06:36:34 UTC (rev 245807)
@@ -39,7 +39,7 @@
 #include "WaylandCompositorDisplay.h"
 #endif
 
-#if PLATFORM(WPE)
+#if USE(WPE_RENDERER)
 #include <WebCore/PlatformDisplayLibWPE.h>
 #include <wpe/wpe.h>
 #endif
@@ -65,9 +65,24 @@
         downcast<PlatformDisplayLibWPE>(PlatformDisplay::sharedDisplay()).initialize(parameters.hostClientFileDescriptor.releaseFileDescriptor());
     }
 #endif
+
 #if PLATFORM(WAYLAND)
-    m_waylandCompositorDisplay = WaylandCompositorDisplay::create(parameters.waylandCompositorDisplayName);
+    if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::Wayland) {
+#if USE(WPE_RENDERER)
+        if (!parameters.isServiceWorkerProcess) {
+            auto hostClientFileDescriptor = parameters.hostClientFileDescriptor.releaseFileDescriptor();
+            if (hostClientFileDescriptor != -1) {
+                wpe_loader_init(parameters.implementationLibraryName.data());
+                m_wpeDisplay = WebCore::PlatformDisplayLibWPE::create();
+                m_wpeDisplay->initialize(hostClientFileDescriptor);
+            }
+        }
+#else
+        m_waylandCompositorDisplay = WaylandCompositorDisplay::create(parameters.waylandCompositorDisplayName);
 #endif
+    }
+#endif
+
 #if USE(GSTREAMER)
     WebCore::initializeGStreamer(WTFMove(parameters.gstreamerOptions));
 #endif

Modified: trunk/Source/cmake/OptionsGTK.cmake (245806 => 245807)


--- trunk/Source/cmake/OptionsGTK.cmake	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/cmake/OptionsGTK.cmake	2019-05-28 06:36:34 UTC (rev 245807)
@@ -86,6 +86,7 @@
 WEBKIT_OPTION_DEFINE(USE_LIBSECRET "Whether to enable the persistent credential storage using libsecret." PUBLIC ON)
 WEBKIT_OPTION_DEFINE(USE_OPENJPEG "Whether to enable support for JPEG2000 images." PUBLIC ON)
 WEBKIT_OPTION_DEFINE(USE_WOFF2 "Whether to enable support for WOFF2 Web Fonts." PUBLIC ON)
+WEBKIT_OPTION_DEFINE(USE_WPE_RENDERER "Whether to enable WPE rendering" PUBLIC ON)
 
 # Private options specific to the GTK+ port. Changing these options is
 # completely unsupported. They are intended for use only by WebKit developers.
@@ -103,6 +104,8 @@
 WEBKIT_OPTION_DEPEND(ENABLE_WEBGL ENABLE_OPENGL)
 WEBKIT_OPTION_DEPEND(USE_REDIRECTED_XCOMPOSITE_WINDOW ENABLE_OPENGL)
 WEBKIT_OPTION_DEPEND(USE_REDIRECTED_XCOMPOSITE_WINDOW ENABLE_X11_TARGET)
+WEBKIT_OPTION_DEPEND(USE_WPE_RENDERER ENABLE_OPENGL)
+WEBKIT_OPTION_DEPEND(USE_WPE_RENDERER ENABLE_WAYLAND_TARGET)
 
 SET_AND_EXPOSE_TO_BUILD(ENABLE_DEVELOPER_MODE ${DEVELOPER_MODE})
 if (DEVELOPER_MODE)
@@ -199,6 +202,18 @@
 set(glib_components gio gio-unix gobject gthread gmodule)
 find_package(GLIB 2.36 REQUIRED COMPONENTS ${glib_components})
 
+if (USE_WPE_RENDERER)
+    find_package(WPE 1.3.0)
+    if (NOT WPE_FOUND)
+        message(FATAL_ERROR "libwpe is required for USE_WPE_RENDERER")
+    endif ()
+
+    find_package(WPEBackend-fdo 1.3.0)
+    if (NOT WPEBACKEND_FDO_FOUND)
+        message(FATAL_ERROR "WPEBackend-fdo is required for USE_WPE_RENDERER")
+    endif ()
+endif ()
+
 if (ENABLE_XSLT)
     find_package(LibXslt 1.1.7 REQUIRED)
 endif ()

Modified: trunk/Source/cmake/OptionsPlayStation.cmake (245806 => 245807)


--- trunk/Source/cmake/OptionsPlayStation.cmake	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/cmake/OptionsPlayStation.cmake	2019-05-28 06:36:34 UTC (rev 245807)
@@ -111,6 +111,7 @@
 SET_AND_EXPOSE_TO_BUILD(USE_FREETYPE ON)
 SET_AND_EXPOSE_TO_BUILD(USE_HARFBUZZ ON)
 SET_AND_EXPOSE_TO_BUILD(USE_LIBWPE ON)
+SET_AND_EXPOSE_TO_BUILD(USE_WPE_RENDERER ON)
 
 SET_AND_EXPOSE_TO_BUILD(USE_INSPECTOR_SOCKET_SERVER ${ENABLE_REMOTE_INSPECTOR})
 SET_AND_EXPOSE_TO_BUILD(USE_UNIX_DOMAIN_SOCKETS ON)

Modified: trunk/Source/cmake/OptionsWPE.cmake (245806 => 245807)


--- trunk/Source/cmake/OptionsWPE.cmake	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Source/cmake/OptionsWPE.cmake	2019-05-28 06:36:34 UTC (rev 245807)
@@ -172,6 +172,7 @@
 SET_AND_EXPOSE_TO_BUILD(USE_LIBEPOXY TRUE)
 SET_AND_EXPOSE_TO_BUILD(USE_LIBWPE TRUE)
 SET_AND_EXPOSE_TO_BUILD(USE_OPENGL_ES TRUE)
+SET_AND_EXPOSE_TO_BUILD(USE_WPE_RENDERER TRUE)
 SET_AND_EXPOSE_TO_BUILD(USE_XDGMIME TRUE)
 
 if (WTF_CPU_ARM OR WTF_CPU_MIPS)

Modified: trunk/Tools/ChangeLog (245806 => 245807)


--- trunk/Tools/ChangeLog	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Tools/ChangeLog	2019-05-28 06:36:34 UTC (rev 245807)
@@ -1,3 +1,14 @@
+2019-05-27  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Use WPEBackend-fdo for accelerating compositing in Wayland instead of the nested compositor
+        https://bugs.webkit.org/show_bug.cgi?id=197944
+
+        Reviewed by Michael Catanzaro.
+
+        Add WPEBackend-fdo to jhbuild moduleset.
+
+        * gtk/jhbuild.modules:
+
 2019-05-27  Wenson Hsieh  <[email protected]>
 
         [iOS] Dropping in an editable element should result in a ranged selection

Modified: trunk/Tools/gtk/jhbuild.modules (245806 => 245807)


--- trunk/Tools/gtk/jhbuild.modules	2019-05-28 04:06:07 UTC (rev 245806)
+++ trunk/Tools/gtk/jhbuild.modules	2019-05-28 06:36:34 UTC (rev 245807)
@@ -32,6 +32,7 @@
       <dep package="libgpg-error"/>
       <dep package="libgcrypt"/>
       <dep package="openjpeg"/>
+      <dep package="wpebackend-fdo"/>
       <if condition-set="linux">
           <dep package="xdg-dbus-proxy"/>
           <dep package="xserver"/>
@@ -81,6 +82,8 @@
       href=""
   <repository type="tarball" name="gnupg.org"
       href=""
+  <repository type="tarball" name="wpewebkit"
+      href=""
 
   <cmake id="brotli">
     <branch repo="github.com" module="google/brotli.git" checkoutdir="brotli" tag="v1.0.5"/>
@@ -464,6 +467,20 @@
             hash="sha256:3dc787c1bb6023ba846c2a0d9b1f6e179f1cd255172bde9eb75b01f1e6c7d71a"/>
   </cmake>
 
+  <cmake id="libwpe">
+    <branch repo="wpewebkit" module="libwpe-1.3.0.tar.xz" version="1.3.0"
+            hash="sha256:68986647af2433e74f830a06a497ed536dbc8721b04026ed82611a584be71148"/>
+  </cmake>
+
+  <cmake id="wpebackend-fdo">
+    <dependencies>
+      <dep package="libwpe"/>
+      <dep package="glib"/>
+    </dependencies>
+    <branch repo="wpewebkit" module="wpebackend-fdo-1.3.0.tar.xz" version="1.3.0"
+            hash="sha256:fed9ab29f5d53cf465188da80d014f3aa067c77704f8508c6bd17971fded359d"/>
+  </cmake>
+
   <!-- Dependencies listed below this point are not thought to affect test results, and are only
        included because they themselves depend on other dependencies built by jhbuild. -->
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to