Diff
Modified: trunk/Source/WebCore/ChangeLog (99252 => 99253)
--- trunk/Source/WebCore/ChangeLog 2011-11-04 00:27:07 UTC (rev 99252)
+++ trunk/Source/WebCore/ChangeLog 2011-11-04 00:31:27 UTC (rev 99253)
@@ -1,3 +1,16 @@
+2011-11-03 James Robinson <[email protected]>
+
+ [chromium] Notify scheduler on SwapBuffers in threaded compositor mode
+ https://bugs.webkit.org/show_bug.cgi?id=71381
+
+ Reviewed by Kenneth Russell.
+
+ * platform/graphics/chromium/cc/CCScheduler.cpp:
+ (WebCore::CCScheduler::didSwapBuffers):
+ * platform/graphics/chromium/cc/CCScheduler.h:
+ * platform/graphics/chromium/cc/CCThreadProxy.cpp:
+ (WebCore::CCThreadProxy::drawLayersAndSwapOnImplThread):
+
2011-11-03 Daniel Bates <[email protected]>
CMake: Add missing WebGL IDL file html/canvas/WebGLContextEvent.idl
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.cpp (99252 => 99253)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.cpp 2011-11-04 00:27:07 UTC (rev 99252)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.cpp 2011-11-04 00:31:27 UTC (rev 99253)
@@ -50,6 +50,7 @@
CCFrameRateController::CCFrameRateController(PassRefPtr<CCTimeSource> timer)
: m_client(0)
, m_numFramesPending(0)
+ , m_maxFramesPending(0)
, m_timeSource(timer)
{
m_timeSourceClientAdapter = CCFrameRateControllerTimeSourceAdapter::create(this);
@@ -61,10 +62,15 @@
m_timeSource->setActive(false);
}
+void CCFrameRateController::setMaxFramesPending(int maxFramesPending)
+{
+ m_maxFramesPending = maxFramesPending;
+}
+
void CCFrameRateController::onTimerTick()
{
// Don't forward the tick if we have too many frames in flight.
- if (m_numFramesPending >= kMaxFramesPending)
+ if (m_maxFramesPending && m_numFramesPending >= m_maxFramesPending)
return;
if (m_client)
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.h (99252 => 99253)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.h 2011-11-04 00:27:07 UTC (rev 99252)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.h 2011-11-04 00:31:27 UTC (rev 99253)
@@ -52,6 +52,7 @@
void setActive(bool active) { m_timeSource->setActive(active); }
+ void setMaxPendingFrames(int);
// Use the following methods to adjust target frame rate.
//
// Multiple frames can be in-progress, but for every didBeginFrame, a
@@ -61,17 +62,15 @@
void didBeginFrame();
void didFinishFrame();
void didAbortAllPendingFrames();
+ void setMaxFramesPending(int); // 0 for unlimited.
- enum {
- kMaxFramesPending = 2
- };
-
protected:
friend class CCFrameRateControllerTimeSourceAdapter;
void onTimerTick();
CCFrameRateControllerClient* m_client;
int m_numFramesPending;
+ int m_maxFramesPending;
RefPtr<CCTimeSource> m_timeSource;
OwnPtr<CCFrameRateControllerTimeSourceAdapter> m_timeSourceClientAdapter;
};
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.cpp (99252 => 99253)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.cpp 2011-11-04 00:27:07 UTC (rev 99252)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.cpp 2011-11-04 00:31:27 UTC (rev 99253)
@@ -75,6 +75,11 @@
processScheduledActions();
}
+void CCScheduler::setMaxFramesPending(int maxFramesPending)
+{
+ m_frameRateController->setMaxFramesPending(maxFramesPending);
+}
+
void CCScheduler::didSwapBuffersComplete()
{
TRACE_EVENT("CCScheduler::didSwapBuffersComplete", this, 0);
@@ -124,6 +129,7 @@
break;
case CCSchedulerStateMachine::ACTION_DRAW:
m_client->scheduledActionDrawAndSwap();
+ m_frameRateController->didBeginFrame();
break;
}
m_stateMachine.updateState(action);
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.h (99252 => 99253)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.h 2011-11-04 00:27:07 UTC (rev 99252)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.h 2011-11-04 00:31:27 UTC (rev 99253)
@@ -66,6 +66,7 @@
void beginFrameComplete();
+ void setMaxFramesPending(int);
void didSwapBuffersComplete();
void didSwapBuffersAbort();
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp (99252 => 99253)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp 2011-11-04 00:27:07 UTC (rev 99252)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp 2011-11-04 00:31:27 UTC (rev 99253)
@@ -456,9 +456,9 @@
m_commitCompletionEventOnImplThread = 0;
}
-void CCThreadProxy::drawLayersAndSwapOnImplThread()
+void CCThreadProxy::scheduledActionDrawAndSwap()
{
- TRACE_EVENT("CCThreadProxy::drawLayersAndSwapOnImplThread", this, 0);
+ TRACE_EVENT("CCThreadProxy::scheduledActionDrawAndSwap", this, 0);
ASSERT(isImplThread());
if (!m_layerTreeHostImpl)
return;
@@ -519,8 +519,11 @@
ASSERT(isImplThread());
RefPtr<GraphicsContext3D> context(adoptRef(contextPtr));
*initializeSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(context);
- if (*initializeSucceeded)
+ if (*initializeSucceeded) {
*capabilities = m_layerTreeHostImpl->layerRendererCapabilities();
+ if (capabilities->usingSwapCompleteCallback)
+ m_schedulerOnImplThread->setMaxFramesPending(2);
+ }
m_inputHandlerOnImplThread = CCInputHandler::create(m_layerTreeHostImpl.get());
*compositorIdentifier = m_inputHandlerOnImplThread->identifier();
@@ -539,10 +542,4 @@
completion->signal();
}
-void CCThreadProxy::scheduledActionDrawAndSwap()
-{
- TRACE_EVENT("CCThreadProxy::scheduledActionDrawAndSwap", this, 0);
- drawLayersAndSwapOnImplThread();
-}
-
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h (99252 => 99253)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h 2011-11-04 00:27:07 UTC (rev 99252)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h 2011-11-04 00:31:27 UTC (rev 99253)
@@ -94,8 +94,6 @@
PassOwnPtr<CCMainThread::Task> createBeginFrameAndCommitTaskOnImplThread();
void obtainBeginFrameAndCommitTaskFromCCThread(CCCompletionEvent*, CCMainThread::Task**);
void beginFrameCompleteOnImplThread(CCCompletionEvent*);
- void drawLayersAndSwapOnImplThread();
- void drawLayersOnImplThread();
void requestReadbackOnImplThread(ReadbackRequest*);
void finishAllRenderingOnImplThread(CCCompletionEvent*);
void initializeImplOnImplThread(CCCompletionEvent*);
Modified: trunk/Source/WebKit/chromium/tests/CCFrameRateControllerTest.cpp (99252 => 99253)
--- trunk/Source/WebKit/chromium/tests/CCFrameRateControllerTest.cpp 2011-11-04 00:27:07 UTC (rev 99252)
+++ trunk/Source/WebKit/chromium/tests/CCFrameRateControllerTest.cpp 2011-11-04 00:31:27 UTC (rev 99253)
@@ -85,9 +85,6 @@
TEST(CCFrameRateControllerTest, TestFrameThrottling_TwoFramesInFlight)
{
- // This test only works for the case of kMaxFramesPending = 2
- ASSERT_EQ(2, CCFrameRateController::kMaxFramesPending);
-
FakeCCThread thread;
FakeCCFrameRateControllerClient client;
RefPtr<FakeCCDelayBasedTimeSource> timeSource = FakeCCDelayBasedTimeSource::create(1000.0 / 60.0, &thread);
@@ -95,6 +92,7 @@
controller.setClient(&client);
controller.setActive(true);
+ controller.setMaxFramesPending(2);
double elapsed = 0; // Muck around with time a bit
Modified: trunk/Source/WebKit/chromium/tests/CCSchedulerTest.cpp (99252 => 99253)
--- trunk/Source/WebKit/chromium/tests/CCSchedulerTest.cpp 2011-11-04 00:27:07 UTC (rev 99252)
+++ trunk/Source/WebKit/chromium/tests/CCSchedulerTest.cpp 2011-11-04 00:31:27 UTC (rev 99253)
@@ -132,4 +132,8 @@
{
}
+TEST(CCSchedulerTest, RequestRedrawWithTwoFramesPending)
+{
}
+
+}