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

Unified Diff: cc/CCThreadProxy.cpp

Issue 10916292: Adaptively throttle texture uploads (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address comments in PS2, except constant partials 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..bd9790a1461814fb5a627e5c2efec7d451ba63ea 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(CCTextureUpdateController::maxTextureUpdatesDefault())
, 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);
reveman 2012/09/15 17:26:19 I think it's fine to not use partial updates at al
brianderson 2012/09/17 22:48:27 Sounds good.
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 = CCTextureUpdateController::maxTextureUpdatesDefault();
+ 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;
+
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");

Powered by Google App Engine
This is Rietveld 408576698