Changeset 117825 in webkit


Ignore:
Timestamp:
May 21, 2012 3:57:49 PM (12 years ago)
Author:
piman@chromium.org
Message:

Don't force rendering in finishAllRendering
https://bugs.webkit.org/show_bug.cgi?id=86919

Reviewed by James Robinson.

After we acquire the texture layers on the main thread, we can't draw.
In particular if we destroyed the texture ids used previously by
TextureLayerChromium, drawing before a commit would cause a
bind-after-destroy.

Tested by CCLayerTreeHostTestFinishAllRendering.

  • platform/graphics/chromium/cc/CCThreadProxy.cpp:

(WebCore::CCThreadProxy::CCThreadProxy):
(WebCore::CCThreadProxy::finishAllRenderingOnImplThread):
(WebCore::CCThreadProxy::scheduledActionDrawAndSwapInternal):

Location:
trunk/Source
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r117817 r117825  
     12012-05-21  Antoine Labour  <piman@chromium.org>
     2
     3        Don't force rendering in finishAllRendering
     4        https://bugs.webkit.org/show_bug.cgi?id=86919
     5
     6        Reviewed by James Robinson.
     7
     8        After we acquire the texture layers on the main thread, we can't draw.
     9        In particular if we destroyed the texture ids used previously by
     10        TextureLayerChromium, drawing before a commit would cause a
     11        bind-after-destroy.
     12
     13        Tested by CCLayerTreeHostTestFinishAllRendering.
     14
     15        * platform/graphics/chromium/cc/CCThreadProxy.cpp:
     16        (WebCore::CCThreadProxy::CCThreadProxy):
     17        (WebCore::CCThreadProxy::finishAllRenderingOnImplThread):
     18        (WebCore::CCThreadProxy::scheduledActionDrawAndSwapInternal):
     19
    1202012-05-21  Joshua Bell  <jsbell@chromium.org>
    221
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp

    r117312 r117825  
    8282    , m_beginFrameCompletionEventOnImplThread(0)
    8383    , m_readbackRequestOnImplThread(0)
    84     , m_finishAllRenderingCompletionEventOnImplThread(0)
    8584    , m_commitCompletionEventOnImplThread(0)
    8685    , m_textureAcquisitionCompletionEventOnImplThread(0)
     
    432431    TRACE_EVENT("CCThreadProxy::finishAllRenderingOnImplThread", this, 0);
    433432    ASSERT(isImplThread());
    434     ASSERT(!m_finishAllRenderingCompletionEventOnImplThread);
    435     m_finishAllRenderingCompletionEventOnImplThread = completion;
    436 
    437     m_schedulerOnImplThread->setNeedsForcedRedraw();
     433    m_layerTreeHostImpl->finishAllRendering();
     434    completion->signal();
    438435}
    439436
     
    666663        result.didSwap = m_layerTreeHostImpl->swapBuffers();
    667664
    668     // Process any finish request
    669     if (m_finishAllRenderingCompletionEventOnImplThread) {
    670         m_layerTreeHostImpl->finishAllRendering();
    671         m_finishAllRenderingCompletionEventOnImplThread->signal();
    672         m_finishAllRenderingCompletionEventOnImplThread = 0;
    673     }
    674 
    675665    // Tell the main thread that the the newly-commited frame was drawn.
    676666    if (m_nextFrameIsNewlyCommittedFrameOnImplThread) {
  • trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp

    r117608 r117825  
    5050#include <gtest/gtest.h>
    5151#include <public/Platform.h>
     52#include <wtf/Locker.h>
    5253#include <wtf/MainThread.h>
    5354#include <wtf/PassRefPtr.h>
     55#include <wtf/ThreadingPrimitives.h>
    5456#include <wtf/Vector.h>
    5557
     
    8183    virtual void didRecreateContext(bool succeded) { }
    8284    virtual void didCommitAndDrawFrame() { }
     85    virtual void scheduleComposite() { }
    8386
    8487    // Implementation of CCLayerAnimationDelegate
     
    285288    virtual void scheduleComposite() OVERRIDE
    286289    {
     290        m_testHooks->scheduleComposite();
    287291    }
    288292
     
    369373        , m_endWhenBeginReturns(false)
    370374        , m_timedOut(false)
    371         , m_finished(false) { }
     375        , m_finished(false)
     376        , m_scheduled(false) { }
    372377
    373378    void doBeginTest();
     379
     380    virtual void scheduleComposite()
     381    {
     382        if (m_scheduled || m_finished)
     383            return;
     384        m_scheduled = true;
     385        callOnMainThread(&CCLayerTreeHostTest::dispatchComposite, this);
     386    }
    374387
    375388    static void onEndTest(void* self)
     
    487500        if (test->m_layerTreeHost)
    488501            test->m_layerTreeHost->setVisible(false);
     502    }
     503
     504    static void dispatchComposite(void* self)
     505    {
     506        CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
     507        test->m_scheduled = false;
     508        if (test->m_layerTreeHost && !test->m_finished)
     509            test->m_layerTreeHost->composite();
    489510    }
    490511
     
    577598    bool m_timedOut;
    578599    bool m_finished;
     600    bool m_scheduled;
    579601
    580602    OwnPtr<WebThread> m_webThread;
     
    12161238    virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime)
    12171239    {
    1218         const CCFloatAnimationCurve* curve = m_layerTreeHost->rootLayer()->layerAnimationController()->getActiveAnimation(0, CCActiveAnimation::Opacity)->curve()->toFloatAnimationCurve();
     1240        const CCActiveAnimation* animation = m_layerTreeHost->rootLayer()->layerAnimationController()->getActiveAnimation(0, CCActiveAnimation::Opacity);
     1241        if (!animation)
     1242            return;
     1243        const CCFloatAnimationCurve* curve = animation->curve()->toFloatAnimationCurve();
    12191244        float startOpacity = curve->getValue(0);
    12201245        float endOpacity = curve->getValue(curve->duration());
     
    26452670}
    26462671
     2672class CCLayerTreeHostTestFinishAllRendering : public CCLayerTreeHostTest {
     2673public:
     2674    CCLayerTreeHostTestFinishAllRendering()
     2675        : m_once(false)
     2676        , m_mutex()
     2677        , m_drawCount(0)
     2678    {
     2679    }
     2680
     2681    virtual void beginTest()
     2682    {
     2683        m_layerTreeHost->setNeedsRedraw();
     2684    }
     2685
     2686    virtual void didCommitAndDrawFrame()
     2687    {
     2688        if (m_once)
     2689            return;
     2690        m_once = true;
     2691        m_layerTreeHost->setNeedsRedraw();
     2692        m_layerTreeHost->acquireLayerTextures();
     2693        {
     2694            Locker<Mutex> lock(m_mutex);
     2695            m_drawCount = 0;
     2696        }
     2697        m_layerTreeHost->finishAllRendering();
     2698        {
     2699            Locker<Mutex> lock(m_mutex);
     2700            EXPECT_EQ(0, m_drawCount);
     2701        }
     2702        endTest();
     2703    }
     2704
     2705    virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl)
     2706    {
     2707        Locker<Mutex> lock(m_mutex);
     2708        ++m_drawCount;
     2709    }
     2710
     2711    virtual void afterTest()
     2712    {
     2713    }
     2714private:
     2715
     2716    bool m_once;
     2717    Mutex m_mutex;
     2718    int m_drawCount;
     2719};
     2720
     2721SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestFinishAllRendering)
     2722
    26472723} // namespace
Note: See TracChangeset for help on using the changeset viewer.