Changeset 242364 in webkit


Ignore:
Timestamp:
Mar 4, 2019 10:06:18 AM (5 years ago)
Author:
commit-queue@webkit.org
Message:

[CoordinatedGraphics] The compositing loop is still running even after exiting AC mode
https://bugs.webkit.org/show_bug.cgi?id=195270

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2019-03-04
Reviewed by Don Olmstead.

Suspend the threaded compositor when the painting is paused or layer flush disabled, and resume it again when
painting is resumed and layer flush enabled.

  • Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:

(WebKit::ThreadedCompositor::suspend): Increment the suspend counter and mark the scene as inactive if it was suspended.
(WebKit::ThreadedCompositor::resume): Decrement the suspend counter and mark the scene as active if it's now resumed.

  • Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
  • WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:

(WebKit::DrawingAreaCoordinatedGraphics::forceRepaint): Return early if layer tree state is frozen.
(WebKit::DrawingAreaCoordinatedGraphics::forceRepaintAsync): Ditto.

  • WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:

(WebKit::LayerTreeHost::setLayerFlushSchedulingEnabled): Call ThreadedCompositor::suspend()/resume().
(WebKit::LayerTreeHost::pauseRendering): Call ThreadedCompositor::suspend.
(WebKit::LayerTreeHost::resumeRendering): Call ThreadedCompositor::resume().

Location:
trunk/Source/WebKit
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r242359 r242364  
     12019-03-04  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [CoordinatedGraphics] The compositing loop is still running even after exiting AC mode
     4        https://bugs.webkit.org/show_bug.cgi?id=195270
     5
     6        Reviewed by Don Olmstead.
     7
     8        Suspend the threaded compositor when the painting is paused or layer flush disabled, and resume it again when
     9        painting is resumed and layer flush enabled.
     10
     11        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
     12        (WebKit::ThreadedCompositor::suspend): Increment the suspend counter and mark the scene as inactive if it was suspended.
     13        (WebKit::ThreadedCompositor::resume): Decrement the suspend counter and mark the scene as active if it's now resumed.
     14        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
     15        * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
     16        (WebKit::DrawingAreaCoordinatedGraphics::forceRepaint): Return early if layer tree state is frozen.
     17        (WebKit::DrawingAreaCoordinatedGraphics::forceRepaintAsync): Ditto.
     18        * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
     19        (WebKit::LayerTreeHost::setLayerFlushSchedulingEnabled): Call ThreadedCompositor::suspend()/resume().
     20        (WebKit::LayerTreeHost::pauseRendering): Call ThreadedCompositor::suspend.
     21        (WebKit::LayerTreeHost::resumeRendering): Call ThreadedCompositor::resume().
     22
    1232019-03-04  Simon Fraser  <simon.fraser@apple.com>
    224
  • trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp

    r242205 r242364  
    117117}
    118118
     119void ThreadedCompositor::suspend()
     120{
     121    if (++m_suspendedCount > 1)
     122        return;
     123
     124    m_compositingRunLoop->stopUpdates();
     125    m_compositingRunLoop->performTaskSync([this, protectedThis = makeRef(*this)] {
     126        m_scene->setActive(false);
     127    });
     128}
     129
     130void ThreadedCompositor::resume()
     131{
     132    ASSERT(m_suspendedCount > 0);
     133    if (--m_suspendedCount > 0)
     134        return;
     135
     136    m_compositingRunLoop->performTaskSync([this, protectedThis = makeRef(*this)] {
     137        m_scene->setActive(true);
     138    });
     139}
     140
    119141void ThreadedCompositor::setNativeSurfaceHandleForCompositing(uint64_t handle)
    120142{
  • trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h

    r242205 r242364  
    8585    void frameComplete();
    8686
     87    void suspend();
     88    void resume();
     89
    8790private:
    8891    ThreadedCompositor(Client&, ThreadedDisplayRefreshMonitor::Client&, WebCore::PlatformDisplayID, const WebCore::IntSize&, float scaleFactor, ShouldDoFrameSync, WebCore::TextureMapper::PaintFlags);
     
    104107    WebCore::TextureMapper::PaintFlags m_paintFlags { 0 };
    105108    bool m_inForceRepaint { false };
     109    unsigned m_suspendedCount { 0 };
    106110
    107111    std::unique_ptr<CompositingRunLoop> m_compositingRunLoop;
  • trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp

    r242346 r242364  
    176176    }
    177177
     178    if (m_layerTreeStateIsFrozen)
     179        return;
     180
    178181    setNeedsDisplay();
    179182    m_webPage.layoutIfNeeded();
     
    196199bool DrawingAreaCoordinatedGraphics::forceRepaintAsync(CallbackID callbackID)
    197200{
     201    if (m_layerTreeStateIsFrozen)
     202        return false;
     203
    198204    return m_layerTreeHost && m_layerTreeHost->forceRepaintAsync(callbackID);
    199205}
  • trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp

    r242205 r242364  
    107107
    108108    if (m_layerFlushSchedulingEnabled) {
     109        m_compositor->resume();
    109110        scheduleLayerFlush();
    110111        return;
     
    112113
    113114    cancelPendingLayerFlush();
     115    m_compositor->suspend();
    114116}
    115117
     
    249251{
    250252    m_isSuspended = true;
     253    m_compositor->suspend();
    251254}
    252255
     
    254257{
    255258    m_isSuspended = false;
     259    m_compositor->resume();
    256260    scheduleLayerFlush();
    257261}
Note: See TracChangeset for help on using the changeset viewer.