Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1907)

Unified Diff: cc/CCThreadProxy.cpp

Issue 10916292: Adaptively throttle texture uploads (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/CCThreadProxy.cpp
diff --git a/cc/CCThreadProxy.cpp b/cc/CCThreadProxy.cpp
index 26e734b8565f09e63fa789d162a0a7a20bb3cbdd..63ea2efb574536680e700f775b0a024002882f12 100644
--- a/cc/CCThreadProxy.cpp
+++ b/cc/CCThreadProxy.cpp
@@ -61,6 +61,7 @@ CCThreadProxy::CCThreadProxy(CCLayerTreeHost* layerTreeHost)
, m_textureAcquisitionCompletionEventOnImplThread(0)
, m_resetContentsTexturesPurgedAfterCommitOnImplThread(false)
, m_nextFrameIsNewlyCommittedFrameOnImplThread(false)
+ , m_mostRecentMaxTextureUpdatesOnMainThread(12)
brianderson 2012/09/13 20:09:26 Will fix this hard coded constant.
, m_renderVSyncEnabled(layerTreeHost->settings().renderVSyncEnabled)
{
TRACE_EVENT0("cc", "CCThreadProxy::CCThreadProxy");
@@ -85,7 +86,6 @@ bool CCThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect)
return false;
}
-
// Perform a synchronous commit.
{
DebugScopedSetMainThreadBlocked mainThreadBlocked;
@@ -94,7 +94,7 @@ bool CCThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect)
beginFrameCompletion.wait();
}
m_inCompositeAndReadback = true;
- beginFrame();
+ beginFrame(m_mostRecentMaxTextureUpdatesOnMainThread);
m_inCompositeAndReadback = false;
// Perform a synchronous readback.
@@ -458,7 +458,11 @@ void CCThreadProxy::scheduledActionBeginFrame()
m_pendingBeginFrameRequest->contentsTexturesWereDeleted = m_layerTreeHostImpl->contentsTexturesPurged();
m_pendingBeginFrameRequest->memoryAllocationLimitBytes = m_layerTreeHostImpl->memoryAllocationLimitBytes();
- m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrame));
+ size_t maxTextureUpdates = 12;
brianderson 2012/09/13 20:09:26 Will also fix this hard-coded constant.
+ if (m_layerTreeHostImpl && m_layerTreeHostImpl->renderer() && m_layerTreeHostImpl->renderer()->textureUploader())
+ maxTextureUpdates = CCTextureUpdateController::maxTextureUpdates(m_layerTreeHostImpl->renderer()->textureUploader());
+
+ m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrame, maxTextureUpdates));
if (m_beginFrameCompletionEventOnImplThread) {
m_beginFrameCompletionEventOnImplThread->signal();
@@ -466,10 +470,13 @@ void CCThreadProxy::scheduledActionBeginFrame()
}
}
-void CCThreadProxy::beginFrame()
+void CCThreadProxy::beginFrame(size_t maxTextureUpdates)
{
TRACE_EVENT0("cc", "CCThreadProxy::beginFrame");
ASSERT(isMainThread());
+
+ m_mostRecentMaxTextureUpdatesOnMainThread = maxTextureUpdates;
+
brianderson 2012/09/13 20:09:26 Need to store the most recent maxTextureUpdates on
if (!m_layerTreeHost)
return;
@@ -531,7 +538,7 @@ void CCThreadProxy::beginFrame()
m_layerTreeHost->unlinkAllContentTextures();
OwnPtr<CCTextureUpdateQueue> queue = adoptPtr(new CCTextureUpdateQueue);
- m_layerTreeHost->updateLayers(*(queue.get()), request->memoryAllocationLimitBytes);
+ m_layerTreeHost->updateLayers(*(queue.get()), request->memoryAllocationLimitBytes, &maxTextureUpdates);
// Once single buffered layers are committed, they cannot be modified until
// they are drawn by the impl thread.
@@ -558,7 +565,7 @@ void CCThreadProxy::beginFrame()
DebugScopedSetMainThreadBlocked mainThreadBlocked;
CCCompletionEvent completion;
- CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrameCompleteOnImplThread, &completion, queue.release(), request->contentsTexturesWereDeleted));
+ CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrameCompleteOnImplThread, &completion, queue.release(), request->contentsTexturesWereDeleted, maxTextureUpdates));
completion.wait();
}
@@ -566,7 +573,7 @@ void CCThreadProxy::beginFrame()
m_layerTreeHost->didBeginFrame();
}
-void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion, PassOwnPtr<CCTextureUpdateQueue> queue, bool contentsTexturesWereDeleted)
+void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion, PassOwnPtr<CCTextureUpdateQueue> queue, bool contentsTexturesWereDeleted, size_t maxTextureUpdates)
{
TRACE_EVENT0("cc", "CCThreadProxy::beginFrameCompleteOnImplThread");
ASSERT(!m_commitCompletionEventOnImplThread);
@@ -595,7 +602,7 @@ void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion
setNeedsCommitOnImplThread();
}
- m_currentTextureUpdateControllerOnImplThread = CCTextureUpdateController::create(CCProxy::implThread(), queue, m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHostImpl->renderer()->textureUploader());
+ m_currentTextureUpdateControllerOnImplThread = CCTextureUpdateController::create(CCProxy::implThread(), queue, m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHostImpl->renderer()->textureUploader(), maxTextureUpdates);
m_commitCompletionEventOnImplThread = completion;
m_schedulerOnImplThread->beginFrameComplete();
@@ -895,11 +902,6 @@ void CCThreadProxy::setFullRootLayerDamageOnImplThread()
m_layerTreeHostImpl->setFullRootLayerDamage();
}
-size_t CCThreadProxy::maxPartialTextureUpdates() const
-{
- return CCTextureUpdateController::maxPartialTextureUpdates();
-}
-
void CCThreadProxy::recreateContextOnImplThread(CCCompletionEvent* completion, CCGraphicsContext* contextPtr, bool* recreateSucceeded, RendererCapabilities* capabilities)
{
TRACE_EVENT0("cc", "CCThreadProxy::recreateContextOnImplThread");
« cc/CCLayerTreeHost.cpp ('K') | « cc/CCThreadProxy.h ('k') | cc/TextureUploader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698