Changeset 127820 in webkit
- Timestamp:
- Sep 6, 2012 9:39:50 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r127819 r127820 1 2012-09-06 Christopher Cameron <ccameron@chromium.org> 2 3 [chromium] Do not delete texture backing structures on the main thread 4 https://bugs.webkit.org/show_bug.cgi?id=96018 5 6 Reviewed by James Robinson. 7 8 Do not delete CCPrioritizedTexture::Backing structures on the main 9 thread. Instead, unlink them from their owning CCPrioritizedTexture 10 in the main thread, and have the impl thread then delete all unlinked 11 textures. 12 13 This is towards having the main thread not access the m_backings set, 14 which will allow the impl thread to traverse that set when deleting 15 resources in response to GPU memory management events. 16 17 Tested by existing eviction tests (CCLayerTreeHostTest's 18 TestEvictTextures, LostContextAfterEvictTextures) 19 20 * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: 21 (WebCore::CCLayerTreeHost::unlinkAllContentTextures): 22 (WebCore): 23 (WebCore::CCLayerTreeHost::deleteUnlinkedTextures): 24 * platform/graphics/chromium/cc/CCLayerTreeHost.h: 25 (CCLayerTreeHost): 26 * platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp: 27 (WebCore::CCPrioritizedTextureManager::clearAllMemory): 28 (WebCore::CCPrioritizedTextureManager::unlinkAllBackings): 29 (WebCore): 30 (WebCore::CCPrioritizedTextureManager::deleteAllUnlinkedBackings): 31 * platform/graphics/chromium/cc/CCPrioritizedTextureManager.h: 32 (CCPrioritizedTextureManager): 33 * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp: 34 (WebCore::CCSingleThreadProxy::commitAndComposite): 35 * platform/graphics/chromium/cc/CCThreadProxy.cpp: 36 (WebCore::CCThreadProxy::beginFrame): 37 (WebCore::CCThreadProxy::beginFrameCompleteOnImplThread): 38 1 39 2012-09-06 Simon Hausmann <simon.hausmann@nokia.com> 2 40 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
r127789 r127820 415 415 } 416 416 417 void CCLayerTreeHost:: evictAllContentTextures()417 void CCLayerTreeHost::unlinkAllContentTextures() 418 418 { 419 419 ASSERT(CCProxy::isMainThread()); 420 420 ASSERT(m_contentsTextureManager.get()); 421 m_contentsTextureManager->allBackingTexturesWereDeleted(); 421 m_contentsTextureManager->unlinkAllBackings(); 422 } 423 424 void CCLayerTreeHost::deleteUnlinkedTextures() 425 { 426 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); 427 ASSERT(m_contentsTextureManager.get()); 428 m_contentsTextureManager->deleteAllUnlinkedBackings(); 422 429 } 423 430 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
r127311 r127820 213 213 CCPrioritizedTextureManager* contentsTextureManager() const; 214 214 215 // This will cause contents texture manager to evict all textures, but 216 // without deleting them. This happens after all content textures have 217 // already been deleted on impl, after getting a 0 allocation limit. 218 // Set during a commit, but before updateLayers. 219 void evictAllContentTextures(); 215 void unlinkAllContentTextures(); 216 void deleteUnlinkedTextures(); 220 217 221 218 bool visible() const { return m_visible; } -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp
r127317 r127820 249 249 void CCPrioritizedTextureManager::clearAllMemory(CCResourceProvider* resourceProvider) 250 250 { 251 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); 252 ASSERT(resourceProvider); 251 253 // Unlink and destroy all backing textures. 252 254 while (m_backings.size() > 0) { … … 258 260 } 259 261 260 void CCPrioritizedTextureManager::allBackingTexturesWereDeleted() 261 { 262 // Same as clearAllMemory, except all our textures were already 263 // deleted externally, so we don't delete them. Passing no 264 // resourceProvider results in leaking the (now invalid) texture ids. 265 clearAllMemory(0); 262 void CCPrioritizedTextureManager::unlinkAllBackings() 263 { 264 ASSERT(CCProxy::isMainThread()); 265 for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it) 266 if ((*it)->owner()) 267 (*it)->owner()->unlink(); 268 } 269 270 void CCPrioritizedTextureManager::deleteAllUnlinkedBackings() 271 { 272 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); 273 BackingVector backingsToDelete; 274 for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it) 275 if (!(*it)->owner()) 276 backingsToDelete.append((*it)); 277 278 for (BackingVector::iterator it = backingsToDelete.begin(); it != backingsToDelete.end(); ++it) 279 destroyBacking((*it), 0); 266 280 } 267 281 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h
r124093 r127820 79 79 void reduceMemory(CCResourceProvider*); 80 80 void clearAllMemory(CCResourceProvider*); 81 void allBackingTexturesWereDeleted(); 81 void unlinkAllBackings(); 82 void deleteAllUnlinkedBackings(); 82 83 83 84 void acquireBackingTextureIfNeeded(CCPrioritizedTexture*, CCResourceProvider*); -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp
r126540 r127820 298 298 ASSERT(CCProxy::isMainThread()); 299 299 300 301 300 if (!m_layerTreeHost->initializeRendererIfNeeded()) 302 301 return false; 303 302 304 if (m_layerTreeHostImpl->contentsTexturesPurged()) 305 m_layerTreeHost->evictAllContentTextures(); 303 if (m_layerTreeHostImpl->contentsTexturesPurged()) { 304 m_layerTreeHost->unlinkAllContentTextures(); 305 DebugScopedSetImplThreadAndMainThreadBlocked implAndMainBlocked; 306 m_layerTreeHost->deleteUnlinkedTextures(); 307 } 306 308 307 309 CCTextureUpdateQueue queue; -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp
r127556 r127820 556 556 557 557 if (request->contentsTexturesWereDeleted) 558 m_layerTreeHost-> evictAllContentTextures();558 m_layerTreeHost->unlinkAllContentTextures(); 559 559 560 560 OwnPtr<CCTextureUpdateQueue> queue = adoptPtr(new CCTextureUpdateQueue); … … 598 598 TRACE_EVENT0("cc", "CCThreadProxy::beginFrameCompleteOnImplThread"); 599 599 ASSERT(!m_commitCompletionEventOnImplThread); 600 ASSERT(isImplThread() );600 ASSERT(isImplThread() && isMainThreadBlocked()); 601 601 ASSERT(m_schedulerOnImplThread); 602 602 ASSERT(m_schedulerOnImplThread->commitPending()); … … 608 608 } 609 609 610 if (!contentsTexturesWereDeleted && m_layerTreeHostImpl->contentsTexturesPurged()) { 610 if (contentsTexturesWereDeleted) { 611 ASSERT(m_layerTreeHostImpl->contentsTexturesPurged()); 612 // We unlinked all textures on the main thread, delete them now. 613 m_layerTreeHost->deleteUnlinkedTextures(); 614 // Mark that we can start drawing again when this commit is complete. 615 m_resetContentsTexturesPurgedAfterCommitOnImplThread = true; 616 } else if (m_layerTreeHostImpl->contentsTexturesPurged()) { 611 617 // We purged the content textures on the impl thread between the time we 612 618 // posted the beginFrame task and now, meaning we have a bunch of … … 615 621 queue->clearUploads(); 616 622 setNeedsCommitOnImplThread(); 617 } else 618 m_resetContentsTexturesPurgedAfterCommitOnImplThread = true; 623 } 619 624 620 625 m_currentTextureUpdateControllerOnImplThread = CCTextureUpdateController::create(CCProxy::implThread(), queue, m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHostImpl->renderer()->textureUploader());
Note: See TracChangeset
for help on using the changeset viewer.