Changeset 210954 in webkit


Ignore:
Timestamp:
Jan 19, 2017 10:55:46 PM (7 years ago)
Author:
Carlos Garcia Campos
Message:

[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.

Location:
trunk/Source/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r210949 r210954  
     12017-01-19  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [Threaded Compositor] Initialize the threaded compositor with the current size
     4        https://bugs.webkit.org/show_bug.cgi?id=167196
     5
     6        Reviewed by Žan Doberšek.
     7
     8        We are always creating the threaded compositor with an empty size and then a sizeDidChange always happen when
     9        the backing store state changes. This is always happening because the threaded compositor is created before the
     10        first backing store state, but if we wanted to create it later, for example to enter/leave AC mode on demand,
     11        the threaded compositor will not have the viewport size unless the window is resized, or sizeDidChange is called
     12        manually when entering AC mode. Creating the threaded compositor is sync and changing the size too, so it's
     13        better to do both things at the same time using the same sync operation.
     14
     15        * Shared/CoordinatedGraphics/SimpleViewportController.cpp:
     16        (WebKit::SimpleViewportController::SimpleViewportController): Pass an initial size to the constructor.
     17        * Shared/CoordinatedGraphics/SimpleViewportController.h:
     18        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
     19        (WebKit::ThreadedCompositor::create): Add viewportSize and scaleFactor construction parameters,
     20        (WebKit::ThreadedCompositor::ThreadedCompositor): Ditto. Also mark as needs resize if the given size is not empty.
     21        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
     22        * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
     23        (WebKit::ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost): Initialize the threaded compositor
     24        with an initial viewport size and scale factor.
     25
    1262017-01-19  Chris Dumez  <cdumez@apple.com>
    227
  • trunk/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.cpp

    r205395 r210954  
    2929namespace WebKit {
    3030
    31 SimpleViewportController::SimpleViewportController()
     31SimpleViewportController::SimpleViewportController(const IntSize& size)
     32    : m_viewportSize(size)
    3233{
    3334    resetViewportToDefaultState();
  • trunk/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.h

    r205395 r210954  
    3838    WTF_MAKE_NONCOPYABLE(SimpleViewportController);
    3939public:
    40     SimpleViewportController();
     40    SimpleViewportController(const WebCore::IntSize&);
    4141
    4242    void didChangeViewportSize(const WebCore::IntSize&);
  • trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp

    r206080 r210954  
    4343namespace WebKit {
    4444
    45 Ref<ThreadedCompositor> ThreadedCompositor::create(Client& client, uint64_t nativeSurfaceHandle, ShouldDoFrameSync doFrameSync, TextureMapper::PaintFlags paintFlags)
    46 {
    47     return adoptRef(*new ThreadedCompositor(client, nativeSurfaceHandle, doFrameSync, paintFlags));
    48 }
    49 
    50 ThreadedCompositor::ThreadedCompositor(Client& client, uint64_t nativeSurfaceHandle, ShouldDoFrameSync doFrameSync, TextureMapper::PaintFlags paintFlags)
     45Ref<ThreadedCompositor> ThreadedCompositor::create(Client& client, const IntSize& viewportSize, float scaleFactor, uint64_t nativeSurfaceHandle, ShouldDoFrameSync doFrameSync, TextureMapper::PaintFlags paintFlags)
     46{
     47    return adoptRef(*new ThreadedCompositor(client, viewportSize, scaleFactor, nativeSurfaceHandle, doFrameSync, paintFlags));
     48}
     49
     50ThreadedCompositor::ThreadedCompositor(Client& client, const IntSize& viewportSize, float scaleFactor, uint64_t nativeSurfaceHandle, ShouldDoFrameSync doFrameSync, TextureMapper::PaintFlags paintFlags)
    5151    : m_client(client)
     52    , m_viewportSize(viewportSize)
     53    , m_scaleFactor(scaleFactor)
    5254    , m_nativeSurfaceHandle(nativeSurfaceHandle)
    5355    , m_doFrameSync(doFrameSync)
    5456    , m_paintFlags(paintFlags)
     57    , m_needsResize(!viewportSize.isEmpty())
    5558    , m_compositingRunLoop(std::make_unique<CompositingRunLoop>([this] { renderLayerTree(); }))
    5659{
  • trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h

    r206080 r210954  
    5959    enum class ShouldDoFrameSync { No, Yes };
    6060
    61     static Ref<ThreadedCompositor> create(Client&, uint64_t nativeSurfaceHandle = 0, ShouldDoFrameSync = ShouldDoFrameSync::Yes, WebCore::TextureMapper::PaintFlags = 0);
     61    static Ref<ThreadedCompositor> create(Client&, const WebCore::IntSize&, float scaleFactor, uint64_t nativeSurfaceHandle = 0, ShouldDoFrameSync = ShouldDoFrameSync::Yes, WebCore::TextureMapper::PaintFlags = 0);
    6262    virtual ~ThreadedCompositor();
    6363
     
    7575
    7676private:
    77     ThreadedCompositor(Client&, uint64_t nativeSurfaceHandle, ShouldDoFrameSync, WebCore::TextureMapper::PaintFlags);
     77    ThreadedCompositor(Client&, const WebCore::IntSize&, float scaleFactor, uint64_t nativeSurfaceHandle, ShouldDoFrameSync, WebCore::TextureMapper::PaintFlags);
    7878
    7979    // CoordinatedGraphicsSceneClient
  • trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp

    r206080 r210954  
    5454    , m_compositorClient(*this)
    5555    , m_surface(AcceleratedSurface::create(webPage))
     56    , m_viewportController(webPage.size())
    5657{
     58    IntSize scaledSize(m_webPage.size());
     59    scaledSize.scale(m_webPage.deviceScaleFactor());
     60    float scaleFactor = m_webPage.deviceScaleFactor() * m_viewportController.pageScaleFactor();
     61
    5762    if (m_surface) {
    5863        TextureMapper::PaintFlags paintFlags = 0;
     
    6469        // Rendering to the actual screen will happen later anyway since the UI process schedules a redraw for every update,
    6570        // the compositor will take care of syncing to vblank.
    66         m_compositor = ThreadedCompositor::create(m_compositorClient, m_surface->window(), ThreadedCompositor::ShouldDoFrameSync::No, paintFlags);
     71        m_compositor = ThreadedCompositor::create(m_compositorClient, scaledSize, scaleFactor, m_surface->window(), ThreadedCompositor::ShouldDoFrameSync::No, paintFlags);
    6772        m_layerTreeContext.contextID = m_surface->surfaceID();
    6873    } else
    69         m_compositor = ThreadedCompositor::create(m_compositorClient);
     74        m_compositor = ThreadedCompositor::create(m_compositorClient, scaledSize, scaleFactor);
     75
     76    didChangeViewport();
    7077}
    7178
Note: See TracChangeset for help on using the changeset viewer.