Changeset 128005 in webkit
- Timestamp:
- Sep 9, 2012 4:59:41 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r128002 r128005 1 2012-09-09 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 Fix a place where single thread proxy wasn't setting the main thread 21 blocked state correctly. 22 23 * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: 24 (WebCore::CCLayerTreeHost::unlinkAllContentTextures): 25 (WebCore): 26 (WebCore::CCLayerTreeHost::deleteUnlinkedTextures): 27 * platform/graphics/chromium/cc/CCLayerTreeHost.h: 28 (CCLayerTreeHost): 29 * platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp: 30 (WebCore::CCPrioritizedTextureManager::clearAllMemory): 31 (WebCore::CCPrioritizedTextureManager::unlinkAllBackings): 32 (WebCore): 33 (WebCore::CCPrioritizedTextureManager::deleteAllUnlinkedBackings): 34 * platform/graphics/chromium/cc/CCPrioritizedTextureManager.h: 35 (CCPrioritizedTextureManager): 36 * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp: 37 (WebCore::CCSingleThreadProxy::commitAndComposite): 38 * platform/graphics/chromium/cc/CCThreadProxy.cpp: 39 (WebCore::CCThreadProxy::beginFrame): 40 (WebCore::CCThreadProxy::beginFrameCompleteOnImplThread): 41 1 42 2012-09-09 Andreas Kling <kling@webkit.org> 2 43 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
r127948 r128005 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
r127948 r128005 212 212 CCPrioritizedTextureManager* contentsTextureManager() const; 213 213 214 // This will cause contents texture manager to evict all textures, but 215 // without deleting them. This happens after all content textures have 216 // already been deleted on impl, after getting a 0 allocation limit. 217 // Set during a commit, but before updateLayers. 218 void evictAllContentTextures(); 214 void unlinkAllContentTextures(); 215 void deleteUnlinkedTextures(); 219 216 220 217 bool visible() const { return m_visible; } -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp
r127880 r128005 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
r127880 r128005 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
r127948 r128005 155 155 bool initialized; 156 156 { 157 DebugScopedSetMainThreadBlocked mainThreadBlocked; 157 158 DebugScopedSetImplThread impl; 158 159 if (!m_layerTreeHostImpl->contentsTexturesPurged()) … … 297 298 ASSERT(CCProxy::isMainThread()); 298 299 299 300 300 if (!m_layerTreeHost->initializeRendererIfNeeded()) 301 301 return false; 302 302 303 if (m_layerTreeHostImpl->contentsTexturesPurged()) 304 m_layerTreeHost->evictAllContentTextures(); 303 if (m_layerTreeHostImpl->contentsTexturesPurged()) { 304 m_layerTreeHost->unlinkAllContentTextures(); 305 DebugScopedSetImplThreadAndMainThreadBlocked implAndMainBlocked; 306 m_layerTreeHost->deleteUnlinkedTextures(); 307 } 305 308 306 309 CCTextureUpdateQueue queue; -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp
r127948 r128005 550 550 551 551 if (request->contentsTexturesWereDeleted) 552 m_layerTreeHost-> evictAllContentTextures();552 m_layerTreeHost->unlinkAllContentTextures(); 553 553 554 554 OwnPtr<CCTextureUpdateQueue> queue = adoptPtr(new CCTextureUpdateQueue); … … 592 592 TRACE_EVENT0("cc", "CCThreadProxy::beginFrameCompleteOnImplThread"); 593 593 ASSERT(!m_commitCompletionEventOnImplThread); 594 ASSERT(isImplThread() );594 ASSERT(isImplThread() && isMainThreadBlocked()); 595 595 ASSERT(m_schedulerOnImplThread); 596 596 ASSERT(m_schedulerOnImplThread->commitPending()); … … 602 602 } 603 603 604 if (!contentsTexturesWereDeleted && m_layerTreeHostImpl->contentsTexturesPurged()) { 604 if (contentsTexturesWereDeleted) { 605 ASSERT(m_layerTreeHostImpl->contentsTexturesPurged()); 606 // We unlinked all textures on the main thread, delete them now. 607 m_layerTreeHost->deleteUnlinkedTextures(); 608 // Mark that we can start drawing again when this commit is complete. 609 m_resetContentsTexturesPurgedAfterCommitOnImplThread = true; 610 } else if (m_layerTreeHostImpl->contentsTexturesPurged()) { 605 611 // We purged the content textures on the impl thread between the time we 606 612 // posted the beginFrame task and now, meaning we have a bunch of … … 609 615 queue->clearUploads(); 610 616 setNeedsCommitOnImplThread(); 611 } else 612 m_resetContentsTexturesPurgedAfterCommitOnImplThread = true; 617 } 613 618 614 619 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.