⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 245807 in webkit


Ignore:
Timestamp:
May 27, 2019, 11:36:34 PM (7 years ago)
Author:
Carlos Garcia Campos
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:
Location:
trunk
Files:
49 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r245790 r245807  
     12019-05-27  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Use WPEBackend-fdo for accelerating compositing in Wayland instead of the nested compositor
     4        https://bugs.webkit.org/show_bug.cgi?id=197944
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Add USE_WPE_RENDERER option to use WPEBackend-fdo.
     9
     10        * Source/cmake/OptionsGTK.cmake:
     11        * Source/cmake/OptionsPlayStation.cmake:
     12        * Source/cmake/OptionsWPE.cmake:
     13
    1142019-05-27  Carlos Garcia Campos  <cgarcia@igalia.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r245802 r245807  
     12019-05-27  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Use WPEBackend-fdo for accelerating compositing in Wayland instead of the nested compositor
     4        https://bugs.webkit.org/show_bug.cgi?id=197944
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        * PlatformGTK.cmake:
     9        * SourcesGTK.txt:
     10        * platform/graphics/GLContext.cpp:
     11        (WebCore::GLContext::createContextForWindow): Check current display is X11 before trying to create a GLX context.
     12        * platform/graphics/PlatformDisplay.cpp:
     13        (WebCore::PlatformDisplay::createPlatformDisplay): Use USE(WPE_RENDERER) instead of USE(LIBWPE).
     14        * platform/graphics/PlatformDisplay.h:
     15        * platform/graphics/egl/GLContextEGL.cpp:
     16        (WebCore::GLContextEGL::createWindowContext): Use USE(WPE_RENDERER) instead of PLATFORM(WPE).
     17        (WebCore::GLContextEGL::createContext): Ditto.
     18        (WebCore::GLContextEGL::createSharingContext): Ditto.
     19        (WebCore::GLContextEGL::~GLContextEGL): Ditto.
     20        * platform/graphics/egl/GLContextEGL.h:
     21        * platform/graphics/egl/GLContextEGLLibWPE.cpp:
     22        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
     23        (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext): Ditto.
     24        * platform/graphics/libwpe/PlatformDisplayLibWPE.cpp:
     25        (WebCore::PlatformDisplayLibWPE::PlatformDisplayLibWPE): In GTK port set the display as the shared one for compositing.
     26        * platform/graphics/libwpe/PlatformDisplayLibWPE.h:
     27
    1282019-05-27  Takashi Komori  <Takashi.Komori@sony.com>
    229
  • trunk/Source/WebCore/PlatformGTK.cmake

    r245179 r245807  
    3737)
    3838
     39if (USE_WPE_RENDERER)
     40    list(APPEND WebCore_INCLUDE_DIRECTORIES
     41        "${WEBCORE_DIR}/platform/graphics/libwpe"
     42    )
     43endif ()
     44
    3945list(APPEND WebCorePlatformGTK_SOURCES
    4046    editing/gtk/EditorGtk.cpp
     
    121127)
    122128
     129if (USE_WPE_RENDERER)
     130    list(APPEND WebCore_LIBRARIES
     131        ${WPE_LIBRARIES}
     132    )
     133endif ()
     134
    123135list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
    124136    ${ATK_INCLUDE_DIRS}
     
    133145)
    134146
     147if (USE_WPE_RENDERER)
     148    list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
     149        ${WPE_INCLUDE_DIRS}
     150    )
     151endif ()
     152
    135153if (USE_OPENGL_ES)
    136154    list(APPEND WebCore_SOURCES
  • trunk/Source/WebCore/SourcesGTK.txt

    r243970 r245807  
    6868
    6969platform/graphics/egl/GLContextEGL.cpp
     70platform/graphics/egl/GLContextEGLLibWPE.cpp
    7071platform/graphics/egl/GLContextEGLWayland.cpp @no-unify
    7172platform/graphics/egl/GLContextEGLX11.cpp @no-unify
     
    7475
    7576platform/graphics/gstreamer/ImageGStreamerCairo.cpp
     77
     78platform/graphics/libwpe/PlatformDisplayLibWPE.cpp
    7679
    7780platform/graphics/opengl/Extensions3DOpenGLCommon.cpp
  • trunk/Source/WebCore/platform/graphics/GLContext.cpp

    r245088 r245807  
    9191
    9292#if USE(GLX)
    93     if (auto glxContext = GLContextGLX::createContext(windowHandle, display))
    94         return glxContext;
     93    if (display.type() == PlatformDisplay::Type::X11) {
     94        if (auto glxContext = GLContextGLX::createContext(windowHandle, display))
     95            return glxContext;
     96    }
    9597#endif
    9698#if USE(EGL)
  • trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp

    r238492 r245807  
    4343#endif
    4444
    45 #if USE(LIBWPE)
     45#if USE(WPE_RENDERER)
    4646#include "PlatformDisplayLibWPE.h"
    4747#endif
     
    9292#endif // PLATFORM(GTK)
    9393
    94 #if USE(LIBWPE)
     94#if USE(WPE_RENDERER)
    9595    return PlatformDisplayLibWPE::create();
    9696#elif PLATFORM(WIN)
  • trunk/Source/WebCore/platform/graphics/PlatformDisplay.h

    r238282 r245807  
    5555        Windows,
    5656#endif
    57 #if USE(LIBWPE)
     57#if USE(WPE_RENDERER)
    5858        WPE,
    5959#endif
  • trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp

    r245088 r245807  
    183183        surface = createWindowSurfaceWayland(display, config, window);
    184184#endif
    185 #elif PLATFORM(WPE)
     185#endif
     186
     187#if USE(WPE_RENDERER)
    186188    if (platformDisplay.type() == PlatformDisplay::Type::WPE)
    187189        surface = createWindowSurfaceWPE(display, config, window);
     
    280282            context = createWaylandContext(platformDisplay, eglSharingContext);
    281283#endif
    282 #if PLATFORM(WPE)
     284#if USE(WPE_RENDERER)
    283285        if (platformDisplay.type() == PlatformDisplay::Type::WPE)
    284286            context = createWPEContext(platformDisplay, eglSharingContext);
     
    317319            context = createWaylandContext(platformDisplay);
    318320#endif
    319 #if PLATFORM(WPE)
     321#if USE(WPE_RENDERER)
    320322        if (platformDisplay.type() == PlatformDisplay::Type::WPE)
    321323            context = createWPEContext(platformDisplay);
     
    360362    destroyWaylandWindow();
    361363#endif
    362 #if PLATFORM(WPE)
     364#if USE(WPE_RENDERER)
    363365    destroyWPETarget();
    364366#endif
  • trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.h

    r238282 r245807  
    3333#endif
    3434
    35 #if USE(LIBWPE)
     35#if USE(WPE_RENDERER)
    3636struct wpe_renderer_backend_egl_offscreen_target;
    3737#endif
     
    8383    void destroyWaylandWindow();
    8484#endif
    85 #if USE(LIBWPE)
     85#if USE(WPE_RENDERER)
    8686    GLContextEGL(PlatformDisplay&, EGLContext, EGLSurface, struct wpe_renderer_backend_egl_offscreen_target*);
    8787    void destroyWPETarget();
     
    9999    static EGLSurface createWindowSurfaceWayland(EGLDisplay, EGLConfig, GLNativeWindowType);
    100100#endif
    101 #if USE(LIBWPE)
     101#if USE(WPE_RENDERER)
    102102    static std::unique_ptr<GLContextEGL> createWPEContext(PlatformDisplay&, EGLContext sharingContext = nullptr);
    103103    static EGLSurface createWindowSurfaceWPE(EGLDisplay, EGLConfig, GLNativeWindowType);
     
    116116    struct wl_egl_window* m_wlWindow { nullptr };
    117117#endif
    118 #if USE(LIBWPE)
     118#if USE(WPE_RENDERER)
    119119    struct wpe_renderer_backend_egl_offscreen_target* m_wpeTarget { nullptr };
    120120#endif
  • trunk/Source/WebCore/platform/graphics/egl/GLContextEGLLibWPE.cpp

    r243284 r245807  
    2020#include "GLContextEGL.h"
    2121
    22 #if USE(EGL) && USE(LIBWPE)
    23 
     22#if USE(EGL) && USE(WPE_RENDERER)
    2423#include "PlatformDisplayLibWPE.h"
    2524
     
    3029#include "EpoxyEGL.h"
    3130#else
     31#if PLATFORM(WAYLAND)
     32// These includes need to be in this order because wayland-egl.h defines WL_EGL_PLATFORM
     33// and eglplatform.h, included by egl.h, checks that to decide whether it's Wayland platform.
     34#include <wayland-egl.h>
     35#endif
    3236#include <EGL/egl.h>
    3337#endif
     
    97101} // namespace WebCore
    98102
    99 #endif // USE(EGL) && USE(LIBWPE)
     103#endif // USE(EGL) && USE(WPE_RENDERER)
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp

    r243690 r245807  
    103103#if PLATFORM(WAYLAND)
    104104#include "PlatformDisplayWayland.h"
    105 #elif PLATFORM(WPE)
     105#endif
     106
     107#if USE(WPE_RENDERER)
    106108#include "PlatformDisplayLibWPE.h"
    107109#endif
     
    449451#endif
    450452
    451 #if PLATFORM(WPE)
     453#if USE(WPE_RENDERER)
    452454        ASSERT(is<PlatformDisplayLibWPE>(sharedDisplay));
    453455        GST_DEBUG_OBJECT(pipeline(), "Creating WPE shared EGL display");
  • trunk/Source/WebCore/platform/graphics/libwpe/PlatformDisplayLibWPE.cpp

    r238282 r245807  
    2727#include "PlatformDisplayLibWPE.h"
    2828
    29 #if USE(LIBWPE)
     29#if USE(WPE_RENDERER)
    3030
    3131#include "GLContextEGL.h"
     
    3737#include "EpoxyEGL.h"
    3838#else
     39#if PLATFORM(WAYLAND)
     40// These includes need to be in this order because wayland-egl.h defines WL_EGL_PLATFORM
     41// and eglplatform.h, included by egl.h, checks that to decide whether it's Wayland platform.
     42#include <wayland-egl.h>
     43#endif
    3944#include <EGL/egl.h>
    4045#endif
     
    5257    : PlatformDisplay(NativeDisplayOwned::No)
    5358{
     59#if PLATFORM(GTK)
     60    PlatformDisplay::setSharedDisplayForCompositing(*this);
     61#endif
    5462}
    5563
     
    7482} // namespace WebCore
    7583
    76 #endif // USE(LIBWPE)
     84#endif // USE(WPE_RENDERER)
  • trunk/Source/WebCore/platform/graphics/libwpe/PlatformDisplayLibWPE.h

    r238282 r245807  
    2626#pragma once
    2727
    28 #if USE(LIBWPE)
     28#if USE(WPE_RENDERER)
    2929
    3030#include "PlatformDisplay.h"
     
    5656SPECIALIZE_TYPE_TRAITS_PLATFORM_DISPLAY(PlatformDisplayLibWPE, WPE)
    5757
    58 #endif // USE(LIBWPE)
     58#endif // USE(WPE_RENDERER)
  • trunk/Source/WebKit/ChangeLog

    r245803 r245807  
     12019-05-27  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Use WPEBackend-fdo for accelerating compositing in Wayland instead of the nested compositor
     4        https://bugs.webkit.org/show_bug.cgi?id=197944
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        The WPEBackend-fdo implementation is quite similar to our Wayland nested compositor, but more efficient (using
     9        linux dmabuf, resource caching, etc.). This allows us to share even more code with WPE port too.
     10
     11        * PlatformGTK.cmake:
     12        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
     13        (WebKit::ThreadedCompositor::forceRepaint): WPE doesn't support force repaint yet.
     14        * Shared/WebPageCreationParameters.cpp:
     15        (WebKit::WebPageCreationParameters::encode const): Use USE(WPE_RENDERER) instead of PLATFORM(WPE).
     16        (WebKit::WebPageCreationParameters::decode): Ditto.
     17        * Shared/WebPageCreationParameters.h:
     18        * Shared/WebProcessCreationParameters.cpp:
     19        (WebKit::WebProcessCreationParameters::encode const): Ditto.
     20        (WebKit::WebProcessCreationParameters::decode): Ditto.
     21        * Shared/WebProcessCreationParameters.h:
     22        * SourcesGTK.txt:
     23        * UIProcess/API/gtk/PageClientImpl.cpp:
     24        (WebKit::PageClientImpl::hostFileDescriptor): Implement it when using WPE just calling webkitWebViewBaseRenderHostFileDescriptor().
     25        * UIProcess/API/gtk/PageClientImpl.h:
     26        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
     27        (webkitWebViewBaseCreateWebPage): Initialize the web page after the accelerated backing store is created, since
     28        it's used now during intialization.
     29        (webkitWebViewBaseRenderHostFileDescriptor): Return AcceleratedBackingStore::renderHostFileDescriptor()
     30        * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
     31        * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
     32        * UIProcess/PageClient.h:
     33        * UIProcess/WebPageProxy.cpp:
     34        (WebKit::WebPageProxy::creationParameters): Use USE(WPE_RENDERER) instead of PLATFORM(WPE).
     35        * UIProcess/WebProcessPool.cpp:
     36        (WebKit::WebProcessPool::initializeNewWebProcess): Remove wayland display name initialization.
     37        * UIProcess/glib/WebProcessPoolGLib.cpp:
     38        (WebKit::WebProcessPool::platformInitializeWebProcess): Initialize wayland display name when not using WPE here
     39        now. In case of using WPE, initialize hostClientFileDescriptor and implementationLibraryName.
     40        * UIProcess/glib/WebProcessProxyGLib.cpp:
     41        (WebKit::WebProcessProxy::platformGetLaunchOptions): Remove unused wayland socket command line process parameter.
     42        * UIProcess/gtk/AcceleratedBackingStore.h:
     43        (WebKit::AcceleratedBackingStore::renderHostFileDescriptor): Return -1 by default.
     44        * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
     45        (WebKit::AcceleratedBackingStoreWayland::create): When using WPE call wpe_fdo_initialize_for_egl_display() and
     46        check we have the required extensions.
     47        (WebKit::AcceleratedBackingStoreWayland::AcceleratedBackingStoreWayland): When using WPE initialize the view backend.
     48        (WebKit::AcceleratedBackingStoreWayland::~AcceleratedBackingStoreWayland): When using WPE release the EGL images
     49        still in use and the view texture.
     50        (WebKit::AcceleratedBackingStoreWayland::renderHostFileDescriptor): Call wpe_view_backend_get_renderer_host_fd().
     51        (WebKit::AcceleratedBackingStoreWayland::displayBuffer): Create the view texture if needed, save the pending
     52        image and schedule a redraw.
     53        (WebKit::AcceleratedBackingStoreWayland::paint): When using WPE commit the pending image and use it as target of
     54        the view texture.
     55        * UIProcess/gtk/AcceleratedBackingStoreWayland.h:
     56        * UIProcess/gtk/HardwareAccelerationManager.cpp:
     57        (WebKit::HardwareAccelerationManager::HardwareAccelerationManager): When using WPE disable hardware acceleration
     58        if wpe_fdo_initialize_for_egl_display() fails.
     59        * UIProcess/gtk/WaylandCompositor.cpp:
     60        * UIProcess/gtk/WaylandCompositor.h:
     61        * WebProcess/WebPage/AcceleratedSurface.cpp:
     62        (WebKit::AcceleratedSurface::create): Create an AcceleratedSurfaceLibWPE for GTK port when using WPE and shared
     63        display is Wayland.
     64        * WebProcess/WebPage/WebPage.cpp:
     65        * WebProcess/WebPage/WebPage.h:
     66        * WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.cpp:
     67        (WebKit::AcceleratedSurfaceLibWPE::initialize): Use the shared display for compositing instead of shared display.
     68        * WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.h:
     69        * WebProcess/WebProcess.h:
     70        * WebProcess/glib/WebProcessGLib.cpp:
     71        (WebKit::WebProcess::platformInitializeWebProcess): Initialize the wpe display when using WPE.
     72
    1732019-05-27  Wenson Hsieh  <wenson_hsieh@apple.com>
    274
  • trunk/Source/WebKit/PlatformGTK.cmake

    r244541 r245807  
    429429)
    430430
     431if (USE_WPE_RENDERER)
     432    list(APPEND WebKit_INCLUDE_DIRECTORIES
     433        "${WEBKIT_DIR}/WebProcess/WebPage/libwpe"
     434    )
     435    list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES
     436        ${WPE_INCLUDE_DIRS}
     437        ${WPEBACKEND_FDO_INCLUDE_DIRS}
     438    )
     439endif ()
     440
    431441if (USE_LIBNOTIFY)
    432442list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES
     
    464474# WebCore should be specifed before and after WebCorePlatformGTK
    465475list(APPEND WebKit_LIBRARIES PRIVATE WebCore)
     476
     477if (USE_WPE_RENDERER)
     478    list(APPEND WebKit_LIBRARIES
     479      ${WPE_LIBRARIES}
     480      ${WPEBACKEND_FDO_LIBRARIES}
     481    )
     482endif ()
    466483
    467484if (LIBNOTIFY_FOUND)
  • trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp

    r243865 r245807  
    189189    // FIXME: Enable this for WPE once it's possible to do these forced updates
    190190    // in a way that doesn't starve out the underlying graphics buffers.
    191 #if PLATFORM(GTK)
     191#if PLATFORM(GTK) && !USE(WPE_RENDERER)
    192192    m_compositingRunLoop->performTaskSync([this, protectedThis = makeRef(*this)] {
    193193        SetForScope<bool> change(m_inForceRepaint, true);
  • trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp

    r245799 r245807  
    104104    encoder << additionalSupportedImageTypes;
    105105#endif
    106 #if PLATFORM(WPE)
     106#if USE(WPE_RENDERER)
    107107    encoder << hostFileDescriptor;
    108108#endif
     
    303303#endif
    304304
    305 #if PLATFORM(WPE)
     305#if USE(WPE_RENDERER)
    306306    if (!decoder.decode(parameters.hostFileDescriptor))
    307307        return WTF::nullopt;
  • trunk/Source/WebKit/Shared/WebPageCreationParameters.h

    r245796 r245807  
    164164    Vector<String> additionalSupportedImageTypes;
    165165#endif
    166 #if PLATFORM(WPE)
     166#if USE(WPE_RENDERER)
    167167    IPC::Attachment hostFileDescriptor;
    168168#endif
  • trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp

    r243460 r245807  
    152152#endif
    153153
    154 #if PLATFORM(WPE)
     154#if USE(WPE_RENDERER)
    155155    encoder << isServiceWorkerProcess;
    156156    encoder << hostClientFileDescriptor;
     
    372372#endif
    373373
    374 #if PLATFORM(WPE)
     374#if USE(WPE_RENDERER)
    375375    if (!decoder.decode(parameters.isServiceWorkerProcess))
    376376        return false;
  • trunk/Source/WebKit/Shared/WebProcessCreationParameters.h

    r243460 r245807  
    190190#endif
    191191
    192 #if PLATFORM(WPE)
     192#if USE(WPE_RENDERER)
    193193    bool isServiceWorkerProcess { false };
    194194    IPC::Attachment hostClientFileDescriptor;
  • trunk/Source/WebKit/SourcesGTK.txt

    r245565 r245807  
    421421WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp
    422422
     423WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.cpp
     424
    423425WebProcess/glib/WebProcessGLib.cpp
    424426
  • trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp

    r244744 r245807  
    553553}
    554554
     555#if USE(WPE_RENDERER)
     556IPC::Attachment PageClientImpl::hostFileDescriptor()
     557{
     558    return webkitWebViewBaseRenderHostFileDescriptor(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
     559}
     560#endif
     561
    555562} // namespace WebKit
  • trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h

    r244635 r245807  
    165165    bool effectiveAppearanceIsDark() const override;
    166166
     167#if USE(WPE_RENDERER)
     168    IPC::Attachment hostFileDescriptor() override;
     169#endif
     170
    167171    // Members of PageClientImpl class
    168172    GtkWidget* m_viewWidget;
  • trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp

    r245617 r245807  
    14601460    WebProcessPool* processPool = configuration->processPool();
    14611461    priv->pageProxy = processPool->createWebPage(*priv->pageClient, WTFMove(configuration));
     1462    priv->acceleratedBackingStore = AcceleratedBackingStore::create(*priv->pageProxy);
    14621463    priv->pageProxy->initializeWebPage();
    1463 
    1464     priv->acceleratedBackingStore = AcceleratedBackingStore::create(*priv->pageProxy);
    14651464
    14661465    priv->inputMethodFilter.setPage(priv->pageProxy.get());
     
    18301829#endif
    18311830}
     1831
     1832#if USE(WPE_RENDERER)
     1833int webkitWebViewBaseRenderHostFileDescriptor(WebKitWebViewBase* webkitWebViewBase)
     1834{
     1835    if (webkitWebViewBase->priv->acceleratedBackingStore)
     1836        return webkitWebViewBase->priv->acceleratedBackingStore->renderHostFileDescriptor();
     1837    return -1;
     1838}
     1839#endif
  • trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h

    r245460 r245807  
    9696
    9797void webkitWebViewBaseShowEmojiChooser(WebKitWebViewBase*, const WebCore::IntRect&, CompletionHandler<void(String)>&&);
     98
     99#if USE(WPE_RENDERER)
     100int webkitWebViewBaseRenderHostFileDescriptor(WebKitWebViewBase*);
     101#endif
  • trunk/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp

    r243505 r245807  
    3636#include "WebPreferences.h"
    3737#include "WebProcessProxy.h"
     38#include <WebCore/PlatformDisplay.h>
    3839#include <WebCore/Region.h>
    3940
    4041#if PLATFORM(GTK)
    4142#include <gtk/gtk.h>
    42 #endif
    43 
    44 #if PLATFORM(WAYLAND)
    45 #include "WaylandCompositor.h"
    46 #include <WebCore/PlatformDisplay.h>
    4743#endif
    4844
  • trunk/Source/WebKit/UIProcess/PageClient.h

    r245778 r245807  
    506506#endif
    507507
    508 #if PLATFORM(WPE)
     508#if USE(WPE_RENDERER)
    509509    virtual IPC::Attachment hostFileDescriptor() = 0;
    510510#endif
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r245796 r245807  
    71837183    parameters.cpuLimit = m_cpuLimit;
    71847184
    7185 #if PLATFORM(WPE)
     7185#if USE(WPE_RENDERER)
    71867186    parameters.hostFileDescriptor = pageClient().hostFileDescriptor();
    71877187#endif
  • trunk/Source/WebKit/UIProcess/WebProcessPool.cpp

    r245796 r245807  
    118118#endif
    119119
    120 #if PLATFORM(WAYLAND)
    121 #include "WaylandCompositor.h"
    122 #include <WebCore/PlatformDisplay.h>
    123 #endif
    124 
    125120#if PLATFORM(COCOA)
    126121#include "VersionChecks.h"
     
    978973#if OS(LINUX)
    979974    parameters.shouldEnableMemoryPressureReliefLogging = true;
    980 #endif
    981 
    982 #if PLATFORM(WAYLAND) && USE(EGL)
    983     if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::Wayland)
    984         parameters.waylandCompositorDisplayName = WaylandCompositor::singleton().displayName();
    985975#endif
    986976
  • trunk/Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp

    r245676 r245807  
    3232#include "WebProcessCreationParameters.h"
    3333#include <JavaScriptCore/RemoteInspectorServer.h>
     34#include <WebCore/PlatformDisplay.h>
     35#include <wtf/FileSystem.h>
     36#include <wtf/glib/GUniquePtr.h>
    3437
    3538#if USE(GSTREAMER)
     
    3740#endif
    3841
    39 #include <wtf/FileSystem.h>
    40 #include <wtf/glib/GUniquePtr.h>
     42#if PLATFORM(WAYLAND)
     43#if USE(WPE_RENDERER)
     44#include <wpe/fdo-egl.h>
     45#else
     46#include "WaylandCompositor.h"
     47#endif
     48#endif
    4149
    42 #if PLATFORM(WPE)
     50#if USE(WPE_RENDERER)
    4351#include <wpe/wpe.h>
    4452#endif
     
    109117#endif
    110118
     119#if PLATFORM(WAYLAND)
     120    if (WebCore::PlatformDisplay::sharedDisplay().type() == WebCore::PlatformDisplay::Type::Wayland) {
     121#if USE(WPE_RENDERER)
     122        wpe_loader_init("libWPEBackend-fdo-1.0.so");
     123        if (wpe_fdo_initialize_for_egl_display(WebCore::PlatformDisplay::sharedDisplay().eglDisplay())) {
     124            parameters.hostClientFileDescriptor = wpe_renderer_host_create_client();
     125            parameters.implementationLibraryName = FileSystem::fileSystemRepresentation(wpe_loader_get_loaded_implementation_library_name());
     126        }
     127#else
     128        parameters.waylandCompositorDisplayName = WaylandCompositor::singleton().displayName();
     129#endif
     130    }
     131#endif
     132
    111133    parameters.memoryCacheDisabled = m_memoryCacheDisabled || cacheModel() == CacheModel::DocumentViewer;
    112134    parameters.proxySettings = m_networkProxySettings;
  • trunk/Source/WebKit/UIProcess/glib/WebProcessProxyGLib.cpp

    r243708 r245807  
    2727#include "WebProcessProxy.h"
    2828
    29 #if PLATFORM(WAYLAND) && USE(EGL)
    30 #include "WaylandCompositor.h"
    31 #endif
    3229#include "WebProcessPool.h"
    3330#include "WebsiteDataStore.h"
     
    4845
    4946    launchOptions.extraWebProcessSandboxPaths = m_processPool->sandboxPaths();
    50 
    51 #if PLATFORM(WAYLAND) && USE(EGL)
    52     if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::Wayland) {
    53         String displayName = WaylandCompositor::singleton().displayName();
    54         String runtimeDir(g_get_user_runtime_dir());
    55         String waylandSocket = FileSystem::pathByAppendingComponent(runtimeDir, displayName);
    56         launchOptions.extraInitializationData.set("waylandSocket", waylandSocket);
    57     }
    58 #endif
    5947}
    6048
  • trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.h

    r242082 r245807  
    4848    virtual bool paint(cairo_t*, const WebCore::IntRect&) = 0;
    4949    virtual bool makeContextCurrent() { return false; }
     50    virtual int renderHostFileDescriptor() { return -1; }
    5051
    5152protected:
  • trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp

    r242082 r245807  
    11/*
    2  * Copyright (C) 2016 Igalia S.L.
     2 * Copyright (C) 2016, 2019 Igalia S.L.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2929#if PLATFORM(WAYLAND) && USE(EGL)
    3030
    31 #include "WaylandCompositor.h"
    3231#include "WebPageProxy.h"
     32// These includes need to be in this order because wayland-egl.h defines WL_EGL_PLATFORM
     33// and eglplatform.h, included by egl.h, checks that to decide whether it's Wayland platform.
     34#include <gdk/gdkwayland.h>
     35#include <EGL/egl.h>
     36#include <EGL/eglext.h>
    3337#include <WebCore/CairoUtilities.h>
    3438#include <WebCore/GLContext.h>
     
    3640#if USE(OPENGL_ES)
    3741#include <GLES2/gl2.h>
    38 #else
     42#include <GLES2/gl2ext.h>
     43#include <WebCore/Extensions3DOpenGLES.h>
     44#else
     45#include <WebCore/Extensions3DOpenGL.h>
    3946#include <WebCore/OpenGLShims.h>
     47#endif
     48
     49#if USE(WPE_RENDERER)
     50#include <wpe/fdo-egl.h>
     51#else
     52#include "WaylandCompositor.h"
     53#endif
     54
     55#if USE(WPE_RENDERER)
     56#if !defined(PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)
     57typedef void (*PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES);
     58#endif
     59
     60static PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glImageTargetTexture2D;
    4061#endif
    4162
     
    4566std::unique_ptr<AcceleratedBackingStoreWayland> AcceleratedBackingStoreWayland::create(WebPageProxy& webPage)
    4667{
     68#if USE(WPE_RENDERER)
     69    if (!glImageTargetTexture2D) {
     70        if (!wpe_fdo_initialize_for_egl_display(PlatformDisplay::sharedDisplay().eglDisplay()))
     71            return nullptr;
     72
     73        std::unique_ptr<WebCore::GLContext> eglContext = GLContext::createOffscreenContext();
     74        if (!eglContext)
     75            return nullptr;
     76
     77        if (!eglContext->makeContextCurrent())
     78            return nullptr;
     79
     80#if USE(OPENGL_ES)
     81        std::unique_ptr<Extensions3DOpenGLES> glExtensions = std::make_unique<Extensions3DOpenGLES>(nullptr,  false);
     82#else
     83        std::unique_ptr<Extensions3DOpenGL> glExtensions = std::make_unique<Extensions3DOpenGL>(nullptr, GLContext::current()->version() >= 320);
     84#endif
     85        if (glExtensions->supports("GL_OES_EGL_image") || glExtensions->supports("GL_OES_EGL_image_external"))
     86            glImageTargetTexture2D = reinterpret_cast<PFNGLEGLIMAGETARGETTEXTURE2DOESPROC>(eglGetProcAddress("glEGLImageTargetTexture2DOES"));
     87    }
     88
     89    if (!glImageTargetTexture2D) {
     90        WTFLogAlways("AcceleratedBackingStoreWPE requires glEGLImageTargetTexture2D.");
     91        return nullptr;
     92    }
     93#else
    4794    if (!WaylandCompositor::singleton().isRunning())
    4895        return nullptr;
     96#endif
    4997    return std::unique_ptr<AcceleratedBackingStoreWayland>(new AcceleratedBackingStoreWayland(webPage));
    5098}
     
    53101    : AcceleratedBackingStore(webPage)
    54102{
     103#if USE(WPE_RENDERER)
     104    static struct wpe_view_backend_exportable_fdo_egl_client exportableClient = {
     105        // export_egl_image
     106        nullptr,
     107        // export_fdo_egl_image
     108        [](void* data, struct wpe_fdo_egl_exported_image* image)
     109        {
     110            static_cast<AcceleratedBackingStoreWayland*>(data)->displayBuffer(image);
     111        },
     112        // padding
     113        nullptr, nullptr, nullptr
     114    };
     115
     116    auto viewSize = webPage.viewSize();
     117    m_exportable = wpe_view_backend_exportable_fdo_egl_create(&exportableClient, this, viewSize.width(), viewSize.height());
     118    wpe_view_backend_initialize(wpe_view_backend_exportable_fdo_get_view_backend(m_exportable));
     119#else
    55120    WaylandCompositor::singleton().registerWebPage(m_webPage);
     121#endif
    56122}
    57123
    58124AcceleratedBackingStoreWayland::~AcceleratedBackingStoreWayland()
    59125{
     126#if USE(WPE_RENDERER)
     127    if (m_pendingImage)
     128        wpe_view_backend_exportable_fdo_egl_dispatch_release_exported_image(m_exportable, m_pendingImage);
     129    if (m_committedImage)
     130        wpe_view_backend_exportable_fdo_egl_dispatch_release_exported_image(m_exportable, m_committedImage);
     131    if (m_viewTexture) {
     132        if (makeContextCurrent())
     133            glDeleteTextures(1, &m_viewTexture);
     134    }
     135#else
    60136    WaylandCompositor::singleton().unregisterWebPage(m_webPage);
     137#endif
    61138
    62139#if GTK_CHECK_VERSION(3, 16, 0)
     
    103180}
    104181
     182#if USE(WPE_RENDERER)
     183int AcceleratedBackingStoreWayland::renderHostFileDescriptor()
     184{
     185    return wpe_view_backend_get_renderer_host_fd(wpe_view_backend_exportable_fdo_get_view_backend(m_exportable));
     186}
     187
     188void AcceleratedBackingStoreWayland::displayBuffer(struct wpe_fdo_egl_exported_image* image)
     189{
     190    if (!m_viewTexture) {
     191        if (!makeContextCurrent())
     192            return;
     193
     194        glGenTextures(1, &m_viewTexture);
     195        glBindTexture(GL_TEXTURE_2D, m_viewTexture);
     196        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
     197        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
     198        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
     199        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
     200    }
     201
     202    if (m_pendingImage)
     203        wpe_view_backend_exportable_fdo_egl_dispatch_release_image(m_exportable, m_pendingImage);
     204    m_pendingImage = image;
     205
     206    m_webPage.setViewNeedsDisplay(IntRect(IntPoint::zero(), m_webPage.viewSize()));
     207}
     208#endif
     209
    105210bool AcceleratedBackingStoreWayland::paint(cairo_t* cr, const IntRect& clipRect)
    106211{
    107212    GLuint texture;
    108213    IntSize textureSize;
     214
     215#if USE(WPE_RENDERER)
     216    if (!makeContextCurrent())
     217        return false;
     218
     219    if (m_pendingImage) {
     220        wpe_view_backend_exportable_fdo_dispatch_frame_complete(m_exportable);
     221
     222        if (m_committedImage)
     223            wpe_view_backend_exportable_fdo_egl_dispatch_release_exported_image(m_exportable, m_committedImage);
     224        m_committedImage = m_pendingImage;
     225        m_pendingImage = nullptr;
     226    }
     227
     228    if (!m_committedImage)
     229        return true;
     230
     231    glBindTexture(GL_TEXTURE_2D, m_viewTexture);
     232    glImageTargetTexture2D(GL_TEXTURE_2D, wpe_fdo_egl_exported_image_get_egl_image(m_committedImage));
     233
     234    texture = m_viewTexture;
     235    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)) };
     236#else
    109237    if (!WaylandCompositor::singleton().getTexture(m_webPage, texture, textureSize))
    110238        return false;
     239#endif
    111240
    112241    cairo_save(cr);
  • trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.h

    r240712 r245807  
    3434#include <wtf/glib/GRefPtr.h>
    3535
     36#if USE(WPE_RENDERER)
     37#include <wpe/fdo.h>
     38#endif
     39
     40typedef void* EGLImageKHR;
    3641typedef struct _GdkGLContext GdkGLContext;
     42struct wpe_fdo_egl_exported_image;
    3743
    3844namespace WebCore {
     
    5460
    5561    void tryEnsureGLContext();
     62#if USE(WPE_RENDERER)
     63    void displayBuffer(struct wpe_fdo_egl_exported_image*);
     64#endif
    5665
    5766    bool paint(cairo_t*, const WebCore::IntRect&) override;
    5867    bool makeContextCurrent() override;
     68#if USE(WPE_RENDERER)
     69    int renderHostFileDescriptor() override;
     70#endif
    5971
    6072    RefPtr<cairo_surface_t> m_surface;
     
    6476#endif
    6577    std::unique_ptr<WebCore::GLContext> m_glContext;
     78
     79#if USE(WPE_RENDERER)
     80    struct wpe_view_backend_exportable_fdo* m_exportable { nullptr };
     81    unsigned m_viewTexture { 0 };
     82    struct wpe_fdo_egl_exported_image* m_committedImage { nullptr };
     83    struct wpe_fdo_egl_exported_image* m_pendingImage { nullptr };
     84#endif
    6685};
    6786
  • trunk/Source/WebKit/UIProcess/gtk/HardwareAccelerationManager.cpp

    r241654 r245807  
    2727#include "HardwareAccelerationManager.h"
    2828
    29 #include "WaylandCompositor.h"
    3029#include <WebCore/NotImplemented.h>
    3130#include <WebCore/PlatformDisplay.h>
     
    3332#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
    3433#include <WebCore/PlatformDisplayX11.h>
     34#endif
     35
     36#if PLATFORM(WAYLAND)
     37#if USE(WPE_RENDERER)
     38#include <wpe/fdo-egl.h>
     39#else
     40#include "WaylandCompositor.h"
     41#endif
    3542#endif
    3643
     
    7279#if PLATFORM(WAYLAND) && USE(EGL)
    7380    if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::Wayland) {
     81#if USE(WPE_RENDERER)
     82        if (!wpe_fdo_initialize_for_egl_display(PlatformDisplay::sharedDisplay().eglDisplay())) {
     83            m_canUseHardwareAcceleration = false;
     84            return;
     85        }
     86#else
    7487        if (!WaylandCompositor::singleton().isRunning()) {
    7588            m_canUseHardwareAcceleration = false;
    7689            return;
    7790        }
     91#endif
    7892    }
    7993#endif
  • trunk/Source/WebKit/UIProcess/gtk/WaylandCompositor.cpp

    r245796 r245807  
    2727#include "WaylandCompositor.h"
    2828
    29 #if PLATFORM(WAYLAND) && USE(EGL)
     29#if PLATFORM(WAYLAND) && USE(EGL) && !USE(WPE_RENDERER)
    3030
    3131#include "WebKitWaylandServerProtocol.h"
     
    577577} // namespace WebKit
    578578
    579 #endif // PLATFORM(WAYLAND) && USE(EGL)
     579#endif // PLATFORM(WAYLAND) && USE(EGL) && !USE(WPE_RENDERER)
  • trunk/Source/WebKit/UIProcess/gtk/WaylandCompositor.h

    r245796 r245807  
    2626#pragma once
    2727
    28 #if PLATFORM(WAYLAND) && USE(EGL)
     28#if PLATFORM(WAYLAND) && USE(EGL) && !USE(WPE_RENDERER)
    2929
    3030#include "WebPageProxy.h"
     
    130130} // namespace WebKit
    131131
    132 #endif // PLATFORM(WAYLAND) && USE(EGL)
     132#endif // PLATFORM(WAYLAND) && USE(EGL) && !USE(WPE_RENDERER)
  • trunk/Source/WebKit/WebProcess/WebPage/AcceleratedSurface.cpp

    r245337 r245807  
    3838#endif
    3939
    40 #if USE(LIBWPE)
     40#if USE(WPE_RENDERER)
    4141#include "AcceleratedSurfaceLibWPE.h"
    4242#endif
     
    4949#if PLATFORM(WAYLAND)
    5050    if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::Wayland)
     51#if USE(WPE_RENDERER)
     52        return AcceleratedSurfaceLibWPE::create(webPage, client);
     53#else
    5154        return AcceleratedSurfaceWayland::create(webPage, client);
     55#endif
    5256#endif
    5357#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r245796 r245807  
    424424    , m_overrideContentSecurityPolicy { parameters.overrideContentSecurityPolicy }
    425425    , m_cpuLimit(parameters.cpuLimit)
    426 #if PLATFORM(WPE)
     426#if USE(WPE_RENDERER)
    427427    , m_hostFileDescriptor(WTFMove(parameters.hostFileDescriptor))
    428428#endif
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r245803 r245807  
    11561156#endif
    11571157
    1158 #if PLATFORM(WPE)
     1158#if USE(WPE_RENDERER)
    11591159    int releaseHostFileDescriptor() { return m_hostFileDescriptor.releaseFileDescriptor(); }
    11601160#endif
     
    19181918    const Optional<double> m_cpuLimit;
    19191919
    1920 #if PLATFORM(WPE)
     1920#if USE(WPE_RENDERER)
    19211921    IPC::Attachment m_hostFileDescriptor;
    19221922#endif
  • trunk/Source/WebKit/WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.cpp

    r245796 r245807  
    2626#include "config.h"
    2727#include "AcceleratedSurfaceLibWPE.h"
     28
     29#if USE(WPE_RENDERER)
    2830
    2931#include "WebPage.h"
     
    6668    };
    6769    wpe_renderer_backend_egl_target_set_client(m_backend, &s_client, this);
    68     wpe_renderer_backend_egl_target_initialize(m_backend, downcast<PlatformDisplayLibWPE>(PlatformDisplay::sharedDisplay()).backend(),
     70    wpe_renderer_backend_egl_target_initialize(m_backend, downcast<PlatformDisplayLibWPE>(PlatformDisplay::sharedDisplayForCompositing()).backend(),
    6971        std::max(1, m_size.width()), std::max(1, m_size.height()));
    7072}
     
    112114} // namespace WebKit
    113115
     116#endif // USE(WPE_RENDERER)
  • trunk/Source/WebKit/WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.h

    r245337 r245807  
    2626#pragma once
    2727
    28 #if PLATFORM(WPE)
     28#if USE(WPE_RENDERER)
    2929
    3030#include "AcceleratedSurface.h"
     
    4545    uint64_t surfaceID() const override;
    4646    void clientResize(const WebCore::IntSize&) override;
    47     bool shouldPaintMirrored() const override { return false; }
     47    bool shouldPaintMirrored() const override
     48    {
     49#if PLATFORM(GTK)
     50        return true;
     51#else
     52        return false;
     53#endif
     54    }
    4855
    4956    void initialize() override;
     
    6067} // namespace WebKit
    6168
    62 #endif // PLATFORM(WPE)
     69#endif // USE(WPE_RENDERER)
  • trunk/Source/WebKit/WebProcess/WebProcess.h

    r245796 r245807  
    6262#if PLATFORM(IOS_FAMILY)
    6363#include "ProcessTaskStateObserver.h"
     64#endif
     65
     66#if PLATFORM(WAYLAND) && USE(WPE_RENDERER)
     67#include <WebCore/PlatformDisplayLibWPE.h>
    6468#endif
    6569
     
    553557    std::unique_ptr<WaylandCompositorDisplay> m_waylandCompositorDisplay;
    554558#endif
     559
     560#if PLATFORM(WAYLAND) && USE(WPE_RENDERER)
     561    std::unique_ptr<WebCore::PlatformDisplayLibWPE> m_wpeDisplay;
     562#endif
     563
    555564    bool m_hasSuspendedPageProxy { false };
    556565    bool m_isSuspending { false };
  • trunk/Source/WebKit/WebProcess/glib/WebProcessGLib.cpp

    r245676 r245807  
    4040#endif
    4141
    42 #if PLATFORM(WPE)
     42#if USE(WPE_RENDERER)
    4343#include <WebCore/PlatformDisplayLibWPE.h>
    4444#include <wpe/wpe.h>
     
    6666    }
    6767#endif
     68
    6869#if PLATFORM(WAYLAND)
    69     m_waylandCompositorDisplay = WaylandCompositorDisplay::create(parameters.waylandCompositorDisplayName);
     70    if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::Wayland) {
     71#if USE(WPE_RENDERER)
     72        if (!parameters.isServiceWorkerProcess) {
     73            auto hostClientFileDescriptor = parameters.hostClientFileDescriptor.releaseFileDescriptor();
     74            if (hostClientFileDescriptor != -1) {
     75                wpe_loader_init(parameters.implementationLibraryName.data());
     76                m_wpeDisplay = WebCore::PlatformDisplayLibWPE::create();
     77                m_wpeDisplay->initialize(hostClientFileDescriptor);
     78            }
     79        }
     80#else
     81        m_waylandCompositorDisplay = WaylandCompositorDisplay::create(parameters.waylandCompositorDisplayName);
    7082#endif
     83    }
     84#endif
     85
    7186#if USE(GSTREAMER)
    7287    WebCore::initializeGStreamer(WTFMove(parameters.gstreamerOptions));
  • trunk/Source/cmake/OptionsGTK.cmake

    r245790 r245807  
    8787WEBKIT_OPTION_DEFINE(USE_OPENJPEG "Whether to enable support for JPEG2000 images." PUBLIC ON)
    8888WEBKIT_OPTION_DEFINE(USE_WOFF2 "Whether to enable support for WOFF2 Web Fonts." PUBLIC ON)
     89WEBKIT_OPTION_DEFINE(USE_WPE_RENDERER "Whether to enable WPE rendering" PUBLIC ON)
    8990
    9091# Private options specific to the GTK+ port. Changing these options is
     
    104105WEBKIT_OPTION_DEPEND(USE_REDIRECTED_XCOMPOSITE_WINDOW ENABLE_OPENGL)
    105106WEBKIT_OPTION_DEPEND(USE_REDIRECTED_XCOMPOSITE_WINDOW ENABLE_X11_TARGET)
     107WEBKIT_OPTION_DEPEND(USE_WPE_RENDERER ENABLE_OPENGL)
     108WEBKIT_OPTION_DEPEND(USE_WPE_RENDERER ENABLE_WAYLAND_TARGET)
    106109
    107110SET_AND_EXPOSE_TO_BUILD(ENABLE_DEVELOPER_MODE ${DEVELOPER_MODE})
     
    199202set(glib_components gio gio-unix gobject gthread gmodule)
    200203find_package(GLIB 2.36 REQUIRED COMPONENTS ${glib_components})
     204
     205if (USE_WPE_RENDERER)
     206    find_package(WPE 1.3.0)
     207    if (NOT WPE_FOUND)
     208        message(FATAL_ERROR "libwpe is required for USE_WPE_RENDERER")
     209    endif ()
     210
     211    find_package(WPEBackend-fdo 1.3.0)
     212    if (NOT WPEBACKEND_FDO_FOUND)
     213        message(FATAL_ERROR "WPEBackend-fdo is required for USE_WPE_RENDERER")
     214    endif ()
     215endif ()
    201216
    202217if (ENABLE_XSLT)
  • trunk/Source/cmake/OptionsPlayStation.cmake

    r245492 r245807  
    112112SET_AND_EXPOSE_TO_BUILD(USE_HARFBUZZ ON)
    113113SET_AND_EXPOSE_TO_BUILD(USE_LIBWPE ON)
     114SET_AND_EXPOSE_TO_BUILD(USE_WPE_RENDERER ON)
    114115
    115116SET_AND_EXPOSE_TO_BUILD(USE_INSPECTOR_SOCKET_SERVER ${ENABLE_REMOTE_INSPECTOR})
  • trunk/Source/cmake/OptionsWPE.cmake

    r245565 r245807  
    173173SET_AND_EXPOSE_TO_BUILD(USE_LIBWPE TRUE)
    174174SET_AND_EXPOSE_TO_BUILD(USE_OPENGL_ES TRUE)
     175SET_AND_EXPOSE_TO_BUILD(USE_WPE_RENDERER TRUE)
    175176SET_AND_EXPOSE_TO_BUILD(USE_XDGMIME TRUE)
    176177
  • trunk/Tools/ChangeLog

    r245803 r245807  
     12019-05-27  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Use WPEBackend-fdo for accelerating compositing in Wayland instead of the nested compositor
     4        https://bugs.webkit.org/show_bug.cgi?id=197944
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Add WPEBackend-fdo to jhbuild moduleset.
     9
     10        * gtk/jhbuild.modules:
     11
    1122019-05-27  Wenson Hsieh  <wenson_hsieh@apple.com>
    213
  • trunk/Tools/gtk/jhbuild.modules

    r245324 r245807  
    3333      <dep package="libgcrypt"/>
    3434      <dep package="openjpeg"/>
     35      <dep package="wpebackend-fdo"/>
    3536      <if condition-set="linux">
    3637          <dep package="xdg-dbus-proxy"/>
     
    8283  <repository type="tarball" name="gnupg.org"
    8384      href="https://www.gnupg.org/ftp/gcrypt/"/>
     85  <repository type="tarball" name="wpewebkit"
     86      href="https://wpewebkit.org/releases/"/>
    8487
    8588  <cmake id="brotli">
     
    465468  </cmake>
    466469
     470  <cmake id="libwpe">
     471    <branch repo="wpewebkit" module="libwpe-1.3.0.tar.xz" version="1.3.0"
     472            hash="sha256:68986647af2433e74f830a06a497ed536dbc8721b04026ed82611a584be71148"/>
     473  </cmake>
     474
     475  <cmake id="wpebackend-fdo">
     476    <dependencies>
     477      <dep package="libwpe"/>
     478      <dep package="glib"/>
     479    </dependencies>
     480    <branch repo="wpewebkit" module="wpebackend-fdo-1.3.0.tar.xz" version="1.3.0"
     481            hash="sha256:fed9ab29f5d53cf465188da80d014f3aa067c77704f8508c6bd17971fded359d"/>
     482  </cmake>
     483
    467484  <!-- Dependencies listed below this point are not thought to affect test results, and are only
    468485       included because they themselves depend on other dependencies built by jhbuild. -->
Note: See TracChangeset for help on using the changeset viewer.