Title: [211783] releases/WebKitGTK/webkit-2.14/Source/WebKit2
Revision
211783
Author
carlo...@webkit.org
Date
2017-02-07 01:32:26 -0800 (Tue, 07 Feb 2017)

Log Message

Merge r210954 - [Threaded Compositor] Initialize the threaded compositor with the current size
https://bugs.webkit.org/show_bug.cgi?id=167196

Reviewed by Žan Doberšek.

We are always creating the threaded compositor with an empty size and then a sizeDidChange always happen when
the backing store state changes. This is always happening because the threaded compositor is created before the
first backing store state, but if we wanted to create it later, for example to enter/leave AC mode on demand,
the threaded compositor will not have the viewport size unless the window is resized, or sizeDidChange is called
manually when entering AC mode. Creating the threaded compositor is sync and changing the size too, so it's
better to do both things at the same time using the same sync operation.

* Shared/CoordinatedGraphics/SimpleViewportController.cpp:
(WebKit::SimpleViewportController::SimpleViewportController): Pass an initial size to the constructor.
* Shared/CoordinatedGraphics/SimpleViewportController.h:
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::ThreadedCompositor::create): Add viewportSize and scaleFactor construction parameters,
(WebKit::ThreadedCompositor::ThreadedCompositor): Ditto. Also mark as needs resize if the given size is not empty.
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
* WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
(WebKit::ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost): Initialize the threaded compositor
with an initial viewport size and scale factor.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.14/Source/WebKit2/ChangeLog (211782 => 211783)


--- releases/WebKitGTK/webkit-2.14/Source/WebKit2/ChangeLog	2017-02-07 09:32:17 UTC (rev 211782)
+++ releases/WebKitGTK/webkit-2.14/Source/WebKit2/ChangeLog	2017-02-07 09:32:26 UTC (rev 211783)
@@ -1,3 +1,28 @@
+2017-01-19  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [Threaded Compositor] Initialize the threaded compositor with the current size
+        https://bugs.webkit.org/show_bug.cgi?id=167196
+
+        Reviewed by Žan Doberšek.
+
+        We are always creating the threaded compositor with an empty size and then a sizeDidChange always happen when
+        the backing store state changes. This is always happening because the threaded compositor is created before the
+        first backing store state, but if we wanted to create it later, for example to enter/leave AC mode on demand,
+        the threaded compositor will not have the viewport size unless the window is resized, or sizeDidChange is called
+        manually when entering AC mode. Creating the threaded compositor is sync and changing the size too, so it's
+        better to do both things at the same time using the same sync operation.
+
+        * Shared/CoordinatedGraphics/SimpleViewportController.cpp:
+        (WebKit::SimpleViewportController::SimpleViewportController): Pass an initial size to the constructor.
+        * Shared/CoordinatedGraphics/SimpleViewportController.h:
+        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
+        (WebKit::ThreadedCompositor::create): Add viewportSize and scaleFactor construction parameters,
+        (WebKit::ThreadedCompositor::ThreadedCompositor): Ditto. Also mark as needs resize if the given size is not empty.
+        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
+        * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
+        (WebKit::ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost): Initialize the threaded compositor
+        with an initial viewport size and scale factor.
+
 2017-01-24  Miguel Gomez  <mago...@igalia.com>
 
         [Coordinated Graphics] Ensure that we're in AC mode before trying to create GraphicsLayers

Modified: releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.cpp (211782 => 211783)


--- releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.cpp	2017-02-07 09:32:17 UTC (rev 211782)
+++ releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.cpp	2017-02-07 09:32:26 UTC (rev 211783)
@@ -28,7 +28,8 @@
 
 namespace WebKit {
 
-SimpleViewportController::SimpleViewportController()
+SimpleViewportController::SimpleViewportController(const IntSize& size)
+    : m_viewportSize(size)
 {
     resetViewportToDefaultState();
 }

Modified: releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.h (211782 => 211783)


--- releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.h	2017-02-07 09:32:17 UTC (rev 211782)
+++ releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.h	2017-02-07 09:32:26 UTC (rev 211783)
@@ -37,7 +37,7 @@
 class SimpleViewportController {
     WTF_MAKE_NONCOPYABLE(SimpleViewportController);
 public:
-    SimpleViewportController();
+    SimpleViewportController(const WebCore::IntSize&);
 
     void didChangeViewportSize(const WebCore::IntSize&);
     void didChangeContentsSize(const WebCore::IntSize&);

Modified: releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp (211782 => 211783)


--- releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp	2017-02-07 09:32:17 UTC (rev 211782)
+++ releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp	2017-02-07 09:32:26 UTC (rev 211783)
@@ -42,16 +42,19 @@
 
 namespace WebKit {
 
-Ref<ThreadedCompositor> ThreadedCompositor::create(Client& client, uint64_t nativeSurfaceHandle, ShouldDoFrameSync doFrameSync, TextureMapper::PaintFlags paintFlags)
+Ref<ThreadedCompositor> ThreadedCompositor::create(Client& client, const IntSize& viewportSize, float scaleFactor, uint64_t nativeSurfaceHandle, ShouldDoFrameSync doFrameSync, TextureMapper::PaintFlags paintFlags)
 {
-    return adoptRef(*new ThreadedCompositor(client, nativeSurfaceHandle, doFrameSync, paintFlags));
+    return adoptRef(*new ThreadedCompositor(client, viewportSize, scaleFactor, nativeSurfaceHandle, doFrameSync, paintFlags));
 }
 
-ThreadedCompositor::ThreadedCompositor(Client& client, uint64_t nativeSurfaceHandle, ShouldDoFrameSync doFrameSync, TextureMapper::PaintFlags paintFlags)
+ThreadedCompositor::ThreadedCompositor(Client& client, const IntSize& viewportSize, float scaleFactor, uint64_t nativeSurfaceHandle, ShouldDoFrameSync doFrameSync, TextureMapper::PaintFlags paintFlags)
     : m_client(client)
+    , m_viewportSize(viewportSize)
+    , m_scaleFactor(scaleFactor)
     , m_nativeSurfaceHandle(nativeSurfaceHandle)
     , m_doFrameSync(doFrameSync)
     , m_paintFlags(paintFlags)
+    , m_needsResize(!viewportSize.isEmpty())
     , m_compositingRunLoop(std::make_unique<CompositingRunLoop>([this] { renderLayerTree(); }))
 {
     m_compositingRunLoop->performTaskSync([this, protectedThis = makeRef(*this)] {

Modified: releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h (211782 => 211783)


--- releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h	2017-02-07 09:32:17 UTC (rev 211782)
+++ releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h	2017-02-07 09:32:26 UTC (rev 211783)
@@ -58,7 +58,7 @@
 
     enum class ShouldDoFrameSync { No, Yes };
 
-    static Ref<ThreadedCompositor> create(Client&, uint64_t nativeSurfaceHandle = 0, ShouldDoFrameSync = ShouldDoFrameSync::Yes, WebCore::TextureMapper::PaintFlags = 0);
+    static Ref<ThreadedCompositor> create(Client&, const WebCore::IntSize&, float scaleFactor, uint64_t nativeSurfaceHandle = 0, ShouldDoFrameSync = ShouldDoFrameSync::Yes, WebCore::TextureMapper::PaintFlags = 0);
     virtual ~ThreadedCompositor();
 
     void setNativeSurfaceHandleForCompositing(uint64_t);
@@ -74,7 +74,7 @@
     void forceRepaint();
 
 private:
-    ThreadedCompositor(Client&, uint64_t nativeSurfaceHandle, ShouldDoFrameSync, WebCore::TextureMapper::PaintFlags);
+    ThreadedCompositor(Client&, const WebCore::IntSize&, float scaleFactor, uint64_t nativeSurfaceHandle, ShouldDoFrameSync, WebCore::TextureMapper::PaintFlags);
 
     // CoordinatedGraphicsSceneClient
     void renderNextFrame() override;

Modified: releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp (211782 => 211783)


--- releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp	2017-02-07 09:32:17 UTC (rev 211782)
+++ releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp	2017-02-07 09:32:26 UTC (rev 211783)
@@ -53,7 +53,12 @@
     : CoordinatedLayerTreeHost(webPage)
     , m_compositorClient(*this)
     , m_surface(AcceleratedSurface::create(webPage))
+    , m_viewportController(webPage.size())
 {
+    IntSize scaledSize(m_webPage.size());
+    scaledSize.scale(m_webPage.deviceScaleFactor());
+    float scaleFactor = m_webPage.deviceScaleFactor() * m_viewportController.pageScaleFactor();
+
     if (m_surface) {
         TextureMapper::PaintFlags paintFlags = 0;
 
@@ -63,10 +68,12 @@
         // Do not do frame sync when rendering offscreen in the web process to ensure that SwapBuffers never blocks.
         // Rendering to the actual screen will happen later anyway since the UI process schedules a redraw for every update,
         // the compositor will take care of syncing to vblank.
-        m_compositor = ThreadedCompositor::create(m_compositorClient, m_surface->window(), ThreadedCompositor::ShouldDoFrameSync::No, paintFlags);
+        m_compositor = ThreadedCompositor::create(m_compositorClient, scaledSize, scaleFactor, m_surface->window(), ThreadedCompositor::ShouldDoFrameSync::No, paintFlags);
         m_layerTreeContext.contextID = m_surface->surfaceID();
     } else
-        m_compositor = ThreadedCompositor::create(m_compositorClient);
+        m_compositor = ThreadedCompositor::create(m_compositorClient, scaledSize, scaleFactor);
+
+    didChangeViewport();
 }
 
 void ThreadedCoordinatedLayerTreeHost::invalidate()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to