Title: [127476] trunk/Source/WebCore
Revision
127476
Author
[email protected]
Date
2012-09-04 11:37:26 -0700 (Tue, 04 Sep 2012)

Log Message

[chromium] Do not allow infinite pending frames in CCFrameRateController
https://bugs.webkit.org/show_bug.cgi?id=94254

Patch by Brian Anderson <[email protected]> on 2012-09-04
Reviewed by James Robinson.

Removes support for infinite pending frames in CCFrameRateController
if swap acks are available.

Functionality covered by existing tests.

* platform/graphics/chromium/cc/CCFrameRateController.cpp:
(WebCore::CCFrameRateController::CCFrameRateController):
(WebCore::CCFrameRateController::setMaxFramesPending):
(WebCore::CCFrameRateController::setSwapBuffersCompleteSupported):
(WebCore):
(WebCore::CCFrameRateController::onTimerTick):
(WebCore::CCFrameRateController::didBeginFrame):
(WebCore::CCFrameRateController::didFinishFrame):
* platform/graphics/chromium/cc/CCFrameRateController.h:
(CCFrameRateController):
* platform/graphics/chromium/cc/CCScheduler.cpp:
(WebCore::CCScheduler::setSwapBuffersCompleteSupported):
(WebCore):
* platform/graphics/chromium/cc/CCScheduler.h:
(CCScheduler):
* platform/graphics/chromium/cc/CCThreadProxy.cpp:
(WebCore::CCThreadProxy::initializeRendererOnImplThread):

Modified Paths

Property Changed

Diff

Modified: trunk/Source/WebCore/ChangeLog (127475 => 127476)


--- trunk/Source/WebCore/ChangeLog	2012-09-04 18:33:10 UTC (rev 127475)
+++ trunk/Source/WebCore/ChangeLog	2012-09-04 18:37:26 UTC (rev 127476)
@@ -1,3 +1,33 @@
+2012-09-04  Brian Anderson  <[email protected]>
+
+        [chromium] Do not allow infinite pending frames in CCFrameRateController
+        https://bugs.webkit.org/show_bug.cgi?id=94254
+
+        Reviewed by James Robinson.
+
+        Removes support for infinite pending frames in CCFrameRateController
+        if swap acks are available.        
+
+        Functionality covered by existing tests.
+
+        * platform/graphics/chromium/cc/CCFrameRateController.cpp:
+        (WebCore::CCFrameRateController::CCFrameRateController):
+        (WebCore::CCFrameRateController::setMaxFramesPending):
+        (WebCore::CCFrameRateController::setSwapBuffersCompleteSupported):
+        (WebCore):
+        (WebCore::CCFrameRateController::onTimerTick):
+        (WebCore::CCFrameRateController::didBeginFrame):
+        (WebCore::CCFrameRateController::didFinishFrame):
+        * platform/graphics/chromium/cc/CCFrameRateController.h:
+        (CCFrameRateController):
+        * platform/graphics/chromium/cc/CCScheduler.cpp:
+        (WebCore::CCScheduler::setSwapBuffersCompleteSupported):
+        (WebCore):
+        * platform/graphics/chromium/cc/CCScheduler.h:
+        (CCScheduler):
+        * platform/graphics/chromium/cc/CCThreadProxy.cpp:
+        (WebCore::CCThreadProxy::initializeRendererOnImplThread):
+
 2012-09-04  Tim Horton  <[email protected]>
 
         ASSERTion failure when SVG element is removed from document and readded

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.cpp (127475 => 127476)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.cpp	2012-09-04 18:33:10 UTC (rev 127475)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.cpp	2012-09-04 18:37:26 UTC (rev 127476)
@@ -31,6 +31,14 @@
 #include "TraceEvent.h"
 #include <wtf/CurrentTime.h>
 
+namespace {
+
+// This will be the maximum number of pending frames unless
+// CCFrameRateController::setMaxFramesPending is called.
+const int defaultMaxFramesPending = 2;
+
+}
+
 namespace WebCore {
 
 class CCFrameRateControllerTimeSourceAdapter : public CCTimeSourceClient {
@@ -52,9 +60,10 @@
 CCFrameRateController::CCFrameRateController(PassRefPtr<CCTimeSource> timer)
     : m_client(0)
     , m_numFramesPending(0)
-    , m_maxFramesPending(0)
+    , m_maxFramesPending(defaultMaxFramesPending)
     , m_timeSource(timer)
     , m_active(false)
+    , m_swapBuffersCompleteSupported(true)
     , m_isTimeSourceThrottling(true)
 {
     m_timeSourceClientAdapter = CCFrameRateControllerTimeSourceAdapter::create(this);
@@ -64,8 +73,9 @@
 CCFrameRateController::CCFrameRateController(CCThread* thread)
     : m_client(0)
     , m_numFramesPending(0)
-    , m_maxFramesPending(0)
+    , m_maxFramesPending(defaultMaxFramesPending)
     , m_active(false)
+    , m_swapBuffersCompleteSupported(true)
     , m_isTimeSourceThrottling(false)
 {
     m_manualTicker = adoptPtr(new CCTimer(thread, this));
@@ -96,6 +106,7 @@
 
 void CCFrameRateController::setMaxFramesPending(int maxFramesPending)
 {
+    ASSERT(maxFramesPending > 0);
     m_maxFramesPending = maxFramesPending;
 }
 
@@ -105,12 +116,17 @@
         m_timeSource->setTimebaseAndInterval(timebase, intervalSeconds);
 }
 
+void CCFrameRateController::setSwapBuffersCompleteSupported(bool supported)
+{
+    m_swapBuffersCompleteSupported = supported;
+}
+
 void CCFrameRateController::onTimerTick()
 {
     ASSERT(m_active);
 
     // Don't forward the tick if we have too many frames in flight.
-    if (m_maxFramesPending && m_numFramesPending >= m_maxFramesPending) {
+    if (m_numFramesPending >= m_maxFramesPending) {
         TRACE_EVENT0("cc", "CCFrameRateController::onTimerTickButMaxFramesPending");
         return;
     }
@@ -118,8 +134,7 @@
     if (m_client)
         m_client->vsyncTick();
 
-    if (!m_isTimeSourceThrottling
-        && (!m_maxFramesPending || m_numFramesPending < m_maxFramesPending))
+    if (m_swapBuffersCompleteSupported && !m_isTimeSourceThrottling && m_numFramesPending < m_maxFramesPending)
         postManualTick();
 }
 
@@ -136,11 +151,16 @@
 
 void CCFrameRateController::didBeginFrame()
 {
-    m_numFramesPending++;
+    if (m_swapBuffersCompleteSupported)
+        m_numFramesPending++;
+    else if (!m_isTimeSourceThrottling)
+        postManualTick();
 }
 
 void CCFrameRateController::didFinishFrame()
 {
+    ASSERT(m_swapBuffersCompleteSupported);
+
     m_numFramesPending--;
     if (!m_isTimeSourceThrottling)
         postManualTick();
Property changes on: trunk/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.cpp
___________________________________________________________________

Added: svn:executable

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.h (127475 => 127476)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.h	2012-09-04 18:33:10 UTC (rev 127475)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.h	2012-09-04 18:37:26 UTC (rev 127476)
@@ -70,6 +70,7 @@
     double nextTickTimeIfActivated();
 
     void setTimebaseAndInterval(double timebase, double intervalSeconds);
+    void setSwapBuffersCompleteSupported(bool);
 
 protected:
     friend class CCFrameRateControllerTimeSourceAdapter;
@@ -86,6 +87,7 @@
     RefPtr<CCTimeSource> m_timeSource;
     OwnPtr<CCFrameRateControllerTimeSourceAdapter> m_timeSourceClientAdapter;
     bool m_active;
+    bool m_swapBuffersCompleteSupported;
 
     // Members for unthrottled frame-rate.
     bool m_isTimeSourceThrottling;

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.cpp (127475 => 127476)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.cpp	2012-09-04 18:33:10 UTC (rev 127475)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.cpp	2012-09-04 18:37:26 UTC (rev 127476)
@@ -106,6 +106,11 @@
     m_frameRateController->setMaxFramesPending(maxFramesPending);
 }
 
+void CCScheduler::setSwapBuffersCompleteSupported(bool supported)
+{
+    m_frameRateController->setSwapBuffersCompleteSupported(supported);
+}
+
 void CCScheduler::didSwapBuffersComplete()
 {
     TRACE_EVENT0("cc", "CCScheduler::didSwapBuffersComplete");

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.h (127475 => 127476)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.h	2012-09-04 18:33:10 UTC (rev 127475)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.h	2012-09-04 18:37:26 UTC (rev 127476)
@@ -97,6 +97,7 @@
     void beginFrameAborted();
 
     void setMaxFramesPending(int);
+    void setSwapBuffersCompleteSupported(bool);
     void didSwapBuffersComplete();
 
     void didLoseContext();

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp (127475 => 127476)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp	2012-09-04 18:33:10 UTC (rev 127475)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp	2012-09-04 18:37:26 UTC (rev 127476)
@@ -888,8 +888,8 @@
     *initializeSucceeded = m_layerTreeHostImpl->initializeRenderer(m_contextBeforeInitializationOnImplThread.release(), textureUploader);
     if (*initializeSucceeded) {
         *capabilities = m_layerTreeHostImpl->rendererCapabilities();
-        if (capabilities->usingSwapCompleteCallback)
-            m_schedulerOnImplThread->setMaxFramesPending(2);
+        m_schedulerOnImplThread->setSwapBuffersCompleteSupported(
+                capabilities->usingSwapCompleteCallback);
     }
 
     completion->signal();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to