Title: [245957] trunk/Source/WebKit
Revision
245957
Author
carlo...@webkit.org
Date
2019-05-31 01:17:39 -0700 (Fri, 31 May 2019)

Log Message

[GTK] WPERenderer: ensure we complete the last frame when leaving AC mode
https://bugs.webkit.org/show_bug.cgi?id=198372

Reviewed by Michael Catanzaro.

It can happen that we leave AC mode after a new image is received from the web process but before it's
committed. It can also happen that we receive a new image from the web process right after we have left AC
mode. In both cases we need to complete the frame to ensure we don't leave the wayland compositor waiting
forever for a frame to be completed.

* UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
(WebKit::AcceleratedBackingStoreWayland::update): Complete any pending image when a new surface is used.
(WebKit::AcceleratedBackingStoreWayland::displayBuffer): Complete the given image and return early if we already
left AC mode.
* UIProcess/gtk/AcceleratedBackingStoreWayland.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (245956 => 245957)


--- trunk/Source/WebKit/ChangeLog	2019-05-31 08:15:09 UTC (rev 245956)
+++ trunk/Source/WebKit/ChangeLog	2019-05-31 08:17:39 UTC (rev 245957)
@@ -1,5 +1,23 @@
 2019-05-31  Carlos Garcia Campos  <cgar...@igalia.com>
 
+        [GTK] WPERenderer: ensure we complete the last frame when leaving AC mode
+        https://bugs.webkit.org/show_bug.cgi?id=198372
+
+        Reviewed by Michael Catanzaro.
+
+        It can happen that we leave AC mode after a new image is received from the web process but before it's
+        committed. It can also happen that we receive a new image from the web process right after we have left AC
+        mode. In both cases we need to complete the frame to ensure we don't leave the wayland compositor waiting
+        forever for a frame to be completed.
+
+        * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
+        (WebKit::AcceleratedBackingStoreWayland::update): Complete any pending image when a new surface is used.
+        (WebKit::AcceleratedBackingStoreWayland::displayBuffer): Complete the given image and return early if we already
+        left AC mode.
+        * UIProcess/gtk/AcceleratedBackingStoreWayland.h:
+
+2019-05-31  Carlos Garcia Campos  <cgar...@igalia.com>
+
         [CoordinatedGraphics] WPERenderer: do not release the host file descritor when initializing the render target
         https://bugs.webkit.org/show_bug.cgi?id=198371
 

Modified: trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp (245956 => 245957)


--- trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp	2019-05-31 08:15:09 UTC (rev 245956)
+++ trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp	2019-05-31 08:17:39 UTC (rev 245957)
@@ -28,6 +28,7 @@
 
 #if PLATFORM(WAYLAND) && USE(EGL)
 
+#include "LayerTreeContext.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.
@@ -181,6 +182,19 @@
 }
 
 #if USE(WPE_RENDERER)
+void AcceleratedBackingStoreWayland::update(const LayerTreeContext& context)
+{
+    if (m_surfaceID == context.contextID)
+        return;
+
+    m_surfaceID = context.contextID;
+    if (m_pendingImage) {
+        wpe_view_backend_exportable_fdo_dispatch_frame_complete(m_exportable);
+        wpe_view_backend_exportable_fdo_egl_dispatch_release_exported_image(m_exportable, m_pendingImage);
+        m_pendingImage = nullptr;
+    }
+}
+
 int AcceleratedBackingStoreWayland::renderHostFileDescriptor()
 {
     return wpe_view_backend_get_renderer_host_fd(wpe_view_backend_exportable_fdo_get_view_backend(m_exportable));
@@ -188,6 +202,12 @@
 
 void AcceleratedBackingStoreWayland::displayBuffer(struct wpe_fdo_egl_exported_image* image)
 {
+    if (!m_surfaceID) {
+        wpe_view_backend_exportable_fdo_dispatch_frame_complete(m_exportable);
+        wpe_view_backend_exportable_fdo_egl_dispatch_release_exported_image(m_exportable, image);
+        return;
+    }
+
     if (!m_viewTexture) {
         if (!makeContextCurrent())
             return;

Modified: trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.h (245956 => 245957)


--- trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.h	2019-05-31 08:15:09 UTC (rev 245956)
+++ trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.h	2019-05-31 08:17:39 UTC (rev 245957)
@@ -66,6 +66,7 @@
     bool paint(cairo_t*, const WebCore::IntRect&) override;
     bool makeContextCurrent() override;
 #if USE(WPE_RENDERER)
+    void update(const LayerTreeContext&) override;
     int renderHostFileDescriptor() override;
 #endif
 
@@ -78,6 +79,7 @@
 
 #if USE(WPE_RENDERER)
     struct wpe_view_backend_exportable_fdo* m_exportable { nullptr };
+    uint64_t m_surfaceID { 0 };
     unsigned m_viewTexture { 0 };
     struct wpe_fdo_egl_exported_image* m_committedImage { nullptr };
     struct wpe_fdo_egl_exported_image* m_pendingImage { nullptr };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to