Title: [127940] trunk/Source
Revision
127940
Author
commit-qu...@webkit.org
Date
2012-09-07 17:25:24 -0700 (Fri, 07 Sep 2012)

Log Message

[Chromium] Multiple commits without invalidation allowed per redraw.
https://bugs.webkit.org/show_bug.cgi?id=95661

Patch by David Reveman <reve...@chromium.org> on 2012-09-07
Reviewed by James Robinson.

Source/WebCore:

Always enter COMMIT_STATE_WAITING_FOR_FIRST_DRAW after commit. This
ensures we draw before beginning a new frame.

Unit tests: CCLayerTreeHostTestContinuousCommit.runMultiThread
            CCLayerTreeHostTestContinuousInvalidate.runMultiThread
            CCLayerTreeHostTestContinuousAnimate.runMultiThread

* platform/graphics/chromium/cc/CCSchedulerStateMachine.cpp:
(WebCore::CCSchedulerStateMachine::updateState):

Source/WebKit/chromium:

* tests/CCLayerTreeHostTest.cpp:
(CCLayerTreeHostTestContinuousCommit):
(WebKitTests::CCLayerTreeHostTestContinuousCommit::CCLayerTreeHostTestContinuousCommit):
(WebKitTests):
(WebKitTests::TEST_F):
(CCLayerTreeHostTestContinuousInvalidate):
(WebKitTests::CCLayerTreeHostTestContinuousInvalidate::CCLayerTreeHostTestContinuousInvalidate):
(CCLayerTreeHostTestContinuousAnimate):
(WebKitTests::CCLayerTreeHostTestContinuousAnimate::CCLayerTreeHostTestContinuousAnimate):
* tests/CCSchedulerStateMachineTest.cpp:
(WebCore::TEST):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (127939 => 127940)


--- trunk/Source/WebCore/ChangeLog	2012-09-07 23:59:10 UTC (rev 127939)
+++ trunk/Source/WebCore/ChangeLog	2012-09-08 00:25:24 UTC (rev 127940)
@@ -1,3 +1,20 @@
+2012-09-07  David Reveman  <reve...@chromium.org>
+
+        [Chromium] Multiple commits without invalidation allowed per redraw.
+        https://bugs.webkit.org/show_bug.cgi?id=95661
+
+        Reviewed by James Robinson.
+
+        Always enter COMMIT_STATE_WAITING_FOR_FIRST_DRAW after commit. This
+        ensures we draw before beginning a new frame.
+
+        Unit tests: CCLayerTreeHostTestContinuousCommit.runMultiThread
+                    CCLayerTreeHostTestContinuousInvalidate.runMultiThread
+                    CCLayerTreeHostTestContinuousAnimate.runMultiThread
+
+        * platform/graphics/chromium/cc/CCSchedulerStateMachine.cpp:
+        (WebCore::CCSchedulerStateMachine::updateState):
+
 2012-09-07  Tony Chang  <t...@chromium.org>
 
         Add OVERRIDE to computeLogical{Width,Height} overrides

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCSchedulerStateMachine.cpp (127939 => 127940)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCSchedulerStateMachine.cpp	2012-09-07 23:59:10 UTC (rev 127939)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCSchedulerStateMachine.cpp	2012-09-08 00:25:24 UTC (rev 127940)
@@ -203,11 +203,7 @@
         return;
 
     case ACTION_COMMIT:
-        if ((m_needsCommit || !m_visible) && !m_needsForcedCommit)
-            m_commitState = COMMIT_STATE_WAITING_FOR_FIRST_DRAW;
-        else
-            m_commitState = COMMIT_STATE_IDLE;
-
+        m_commitState = COMMIT_STATE_WAITING_FOR_FIRST_DRAW;
         m_needsRedraw = true;
         if (m_drawIfPossibleFailed)
             m_lastFrameNumberWhereDrawWasCalled = -1;

Modified: trunk/Source/WebKit/chromium/ChangeLog (127939 => 127940)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-09-07 23:59:10 UTC (rev 127939)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-09-08 00:25:24 UTC (rev 127940)
@@ -1,3 +1,22 @@
+2012-09-07  David Reveman  <reve...@chromium.org>
+
+        [Chromium] Multiple commits without invalidation allowed per redraw.
+        https://bugs.webkit.org/show_bug.cgi?id=95661
+
+        Reviewed by James Robinson.
+
+        * tests/CCLayerTreeHostTest.cpp:
+        (CCLayerTreeHostTestContinuousCommit):
+        (WebKitTests::CCLayerTreeHostTestContinuousCommit::CCLayerTreeHostTestContinuousCommit):
+        (WebKitTests):
+        (WebKitTests::TEST_F):
+        (CCLayerTreeHostTestContinuousInvalidate):
+        (WebKitTests::CCLayerTreeHostTestContinuousInvalidate::CCLayerTreeHostTestContinuousInvalidate):
+        (CCLayerTreeHostTestContinuousAnimate):
+        (WebKitTests::CCLayerTreeHostTestContinuousAnimate::CCLayerTreeHostTestContinuousAnimate):
+        * tests/CCSchedulerStateMachineTest.cpp:
+        (WebCore::TEST):
+
 2012-09-07  Dominic Mazzoni  <dmazz...@google.com>
 
         AX: WebCore accessibility roles should be cross-platform

Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (127939 => 127940)


--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp	2012-09-07 23:59:10 UTC (rev 127939)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp	2012-09-08 00:25:24 UTC (rev 127940)
@@ -2849,4 +2849,171 @@
     runTest(true);
 }
 
+class CCLayerTreeHostTestContinuousCommit : public CCLayerTreeHostTest {
+public:
+    CCLayerTreeHostTestContinuousCommit()
+        : m_numCommitComplete(0)
+        , m_numDrawLayers(0)
+    {
+    }
+
+    virtual void beginTest() OVERRIDE
+    {
+        m_layerTreeHost->setViewportSize(IntSize(10, 10), IntSize(10, 10));
+        m_layerTreeHost->rootLayer()->setBounds(IntSize(10, 10));
+
+        postSetNeedsCommitToMainThread();
+    }
+
+    virtual void didCommit() OVERRIDE
+    {
+        postSetNeedsCommitToMainThread();
+    }
+
+    virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE
+    {
+        if (m_numDrawLayers == 1)
+            m_numCommitComplete++;
+    }
+
+    virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE
+    {
+        m_numDrawLayers++;
+        if (m_numDrawLayers == 2)
+            endTest();
+    }
+
+    virtual void afterTest() OVERRIDE
+    {
+        // Check that we didn't commit twice between first and second draw.
+        EXPECT_EQ(1, m_numCommitComplete);
+    }
+
+private:
+    int m_numCommitComplete;
+    int m_numDrawLayers;
+};
+
+TEST_F(CCLayerTreeHostTestContinuousCommit, runMultiThread)
+{
+    runTest(true);
+}
+
+class CCLayerTreeHostTestContinuousInvalidate : public CCLayerTreeHostTest {
+public:
+    CCLayerTreeHostTestContinuousInvalidate()
+        : m_numCommitComplete(0)
+        , m_numDrawLayers(0)
+    {
+    }
+
+    virtual void beginTest() OVERRIDE
+    {
+        m_layerTreeHost->setViewportSize(IntSize(10, 10), IntSize(10, 10));
+        m_layerTreeHost->rootLayer()->setBounds(IntSize(10, 10));
+
+        m_contentLayer = ContentLayerChromium::create(&m_mockDelegate);
+        m_contentLayer->setBounds(IntSize(10, 10));
+        m_contentLayer->setPosition(FloatPoint(0, 0));
+        m_contentLayer->setAnchorPoint(FloatPoint(0, 0));
+        m_contentLayer->setIsDrawable(true);
+        m_layerTreeHost->rootLayer()->addChild(m_contentLayer);
+
+        postSetNeedsCommitToMainThread();
+    }
+
+    virtual void didCommit() OVERRIDE
+    {
+        m_contentLayer->setNeedsDisplay();
+    }
+
+    virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE
+    {
+        if (m_numDrawLayers == 1)
+            m_numCommitComplete++;
+    }
+
+    virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE
+    {
+        m_numDrawLayers++;
+        if (m_numDrawLayers == 2)
+            endTest();
+    }
+
+    virtual void afterTest() OVERRIDE
+    {
+        // Check that we didn't commit twice between first and second draw.
+        EXPECT_EQ(1, m_numCommitComplete);
+
+        // Clear layer references so CCLayerTreeHost dies.
+        m_contentLayer.clear();
+    }
+
+private:
+    MockContentLayerChromiumClient m_mockDelegate;
+    RefPtr<LayerChromium> m_contentLayer;
+    int m_numCommitComplete;
+    int m_numDrawLayers;
+};
+
+TEST_F(CCLayerTreeHostTestContinuousInvalidate, runMultiThread)
+{
+    runTest(true);
+}
+
+class CCLayerTreeHostTestContinuousAnimate : public CCLayerTreeHostTest {
+public:
+    CCLayerTreeHostTestContinuousAnimate()
+        : m_numCommitComplete(0)
+        , m_numDrawLayers(0)
+    {
+    }
+
+    virtual void beginTest() OVERRIDE
+    {
+        m_layerTreeHost->setViewportSize(IntSize(10, 10), IntSize(10, 10));
+        m_layerTreeHost->rootLayer()->setBounds(IntSize(10, 10));
+
+        postSetNeedsCommitToMainThread();
+    }
+
+    virtual void animate(double) OVERRIDE
+    {
+        m_layerTreeHost->setNeedsAnimate();
+    }
+
+    virtual void layout() OVERRIDE
+    {
+        m_layerTreeHost->rootLayer()->setNeedsDisplay();
+    }
+
+    virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE
+    {
+        if (m_numDrawLayers == 1)
+            m_numCommitComplete++;
+    }
+
+    virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE
+    {
+        m_numDrawLayers++;
+        if (m_numDrawLayers == 2)
+            endTest();
+    }
+
+    virtual void afterTest() OVERRIDE
+    {
+        // Check that we didn't commit twice between first and second draw.
+        EXPECT_EQ(1, m_numCommitComplete);
+    }
+
+private:
+    int m_numCommitComplete;
+    int m_numDrawLayers;
+};
+
+TEST_F(CCLayerTreeHostTestContinuousAnimate, runMultiThread)
+{
+    runTest(true);
+}
+
 } // namespace

Modified: trunk/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp (127939 => 127940)


--- trunk/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp	2012-09-07 23:59:10 UTC (rev 127939)
+++ trunk/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp	2012-09-08 00:25:24 UTC (rev 127940)
@@ -766,7 +766,7 @@
 
     // Commit.
     state.updateState(CCSchedulerStateMachine::ACTION_COMMIT);
-    EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_IDLE, state.commitState());
+    EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, state.commitState());
     EXPECT_TRUE(state.needsRedraw());
 
     // Expect to do nothing until vsync.
@@ -979,6 +979,11 @@
     EXPECT_EQ(CCSchedulerStateMachine::ACTION_COMMIT, state.nextAction());
     state.updateState(state.nextAction());
 
+    EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, state.commitState());
+
+    EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction());
+    state.updateState(state.nextAction());
+
     // Expect to be told to begin context recreation, independent of vsync state
     state.didEnterVSync();
     EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction());
@@ -1009,9 +1014,6 @@
     state.didLoseContext();
 
     // Ask for another draw and also set needs commit. Expect nothing happens.
-    // Setting another commit will put us into
-    // COMMIT_STATE_WAITING_FOR_FIRST_DRAW after we finish the frame on the main
-    // thread.
     state.setNeedsRedraw(true);
     state.setNeedsCommit(true);
     EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
@@ -1104,7 +1106,7 @@
     EXPECT_EQ(CCSchedulerStateMachine::ACTION_COMMIT, state.nextAction());
     state.updateState(state.nextAction());
 
-    EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_IDLE, state.commitState());
+    EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, state.commitState());
 
     EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction());
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to