Changeset 98360 in webkit
- Timestamp:
- Oct 25, 2011, 10:44:31 AM (14 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r98359 r98360 1 2011-10-25 Adrienne Walker <enne@google.com> 2 3 [chromium] Batch up texture uploads so that they can be updated incrementally 4 https://bugs.webkit.org/show_bug.cgi?id=70454 5 6 Reviewed by James Robinson. 7 8 Because texture uploads can sometimes take more than a frame to 9 complete, collect all the uploads that need to occur in a 10 CCTextureUpdater so that we can easily incrementally upload some of 11 them, interleaving input and drawing so that the compositor thread 12 continues to appear responsive during a commit. 13 14 This change doesn't actually interleave the commits, it just pushes 15 the infrastructure for doing so up to the CCProxy level so that a 16 future scheduler can make this decision. 17 18 VideoLayerChromium is the only layer type to not use this system. It 19 needs to be converted to use a texture updater first and it is less of 20 a priority than the tiled layers. 21 22 * WebCore.gypi: 23 * platform/graphics/chromium/Canvas2DLayerChromium.cpp: 24 (WebCore::Canvas2DLayerChromium::updateCompositorResources): 25 * platform/graphics/chromium/Canvas2DLayerChromium.h: 26 * platform/graphics/chromium/LayerChromium.h: 27 (WebCore::LayerChromium::updateCompositorResources): 28 * platform/graphics/chromium/TiledLayerChromium.cpp: 29 (WebCore::TiledLayerChromium::updateCompositorResources): 30 * platform/graphics/chromium/TiledLayerChromium.h: 31 * platform/graphics/chromium/VideoLayerChromium.cpp: 32 (WebCore::VideoLayerChromium::updateCompositorResources): 33 * platform/graphics/chromium/VideoLayerChromium.h: 34 * platform/graphics/chromium/WebGLLayerChromium.cpp: 35 (WebCore::WebGLLayerChromium::updateCompositorResources): 36 * platform/graphics/chromium/WebGLLayerChromium.h: 37 * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: 38 (WebCore::CCLayerTreeHost::beginCommitOnImplThread): 39 (WebCore::CCLayerTreeHost::finishCommitOnImplThread): 40 (WebCore::CCLayerTreeHost::updateCompositorResources): 41 * platform/graphics/chromium/cc/CCLayerTreeHost.h: 42 * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp: 43 (WebCore::CCSingleThreadProxy::setNeedsCommit): 44 (WebCore::CCSingleThreadProxy::doCommit): 45 (WebCore::CCSingleThreadProxy::commitIfNeeded): 46 * platform/graphics/chromium/cc/CCSingleThreadProxy.h: 47 * platform/graphics/chromium/cc/CCTextureUpdater.cpp: Added. 48 (WebCore::CCTextureUpdater::CCTextureUpdater): 49 (WebCore::CCTextureUpdater::~CCTextureUpdater): 50 (WebCore::CCTextureUpdater::append): 51 (WebCore::CCTextureUpdater::update): 52 (WebCore::CCTextureUpdater::clear): 53 * platform/graphics/chromium/cc/CCTextureUpdater.h: Added. 54 (WebCore::CCTextureUpdater::allocator): 55 * platform/graphics/chromium/cc/CCThreadProxy.cpp: 56 (WebCore::CCThreadProxy::commitOnImplThread): 57 1 58 2011-10-24 Jer Noble <jer.noble@apple.com> 2 59 -
trunk/Source/WebCore/WebCore.gypi
r98305 r98360 3560 3560 'platform/graphics/chromium/cc/CCSingleThreadProxy.cpp', 3561 3561 'platform/graphics/chromium/cc/CCSingleThreadProxy.h', 3562 'platform/graphics/chromium/cc/CCTextureUpdater.cpp', 3563 'platform/graphics/chromium/cc/CCTextureUpdater.h', 3562 3564 'platform/graphics/chromium/cc/CCThread.h', 3563 3565 'platform/graphics/chromium/cc/CCThreadProxy.cpp', -
trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp
r97780 r98360 65 65 } 66 66 67 void Canvas2DLayerChromium::updateCompositorResources(GraphicsContext3D*, TextureAllocator*)67 void Canvas2DLayerChromium::updateCompositorResources(GraphicsContext3D*, CCTextureUpdater&) 68 68 { 69 69 if (m_dirtyRect.isEmpty() || !drawsContent()) -
trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.h
r96186 r98360 47 47 virtual ~Canvas2DLayerChromium(); 48 48 virtual bool drawsContent() const; 49 virtual void updateCompositorResources(GraphicsContext3D*, TextureAllocator*);49 virtual void updateCompositorResources(GraphicsContext3D*, CCTextureUpdater&); 50 50 51 51 void setTextureChanged(); -
trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h
r97924 r98360 54 54 class CCLayerImpl; 55 55 class CCLayerTreeHost; 56 class CCTextureUpdater; 56 57 class GraphicsContext3D; 57 58 … … 160 161 virtual bool drawsContent() const { return false; } 161 162 virtual void paintContentsIfDirty() { } 162 virtual void updateCompositorResources(GraphicsContext3D*, TextureAllocator*) { }163 virtual void updateCompositorResources(GraphicsContext3D*, CCTextureUpdater&) { } 163 164 virtual void setIsMask(bool) { } 164 165 virtual void unreserveContentsTexture() { } -
trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp
r97809 r98360 35 35 #include "TextStream.h" 36 36 #include "cc/CCLayerImpl.h" 37 #include "cc/CCTextureUpdater.h" 37 38 #include "cc/CCTiledLayerImpl.h" 38 39 #include <wtf/CurrentTime.h> … … 151 152 } 152 153 153 void TiledLayerChromium::updateCompositorResources(GraphicsContext3D* context, TextureAllocator* allocator)154 void TiledLayerChromium::updateCompositorResources(GraphicsContext3D* context, CCTextureUpdater& updater) 154 155 { 155 156 // Painting could cause compositing to get turned off, which may cause the tiler to become invalidated mid-update. … … 197 198 CRASH(); 198 199 199 tile->texture()->bindTexture(context, allocator);200 tile->texture()->bindTexture(context, updater.allocator()); 200 201 const GC3Dint filter = m_tiler->hasBorderTexels() ? GraphicsContext3D::LINEAR : GraphicsContext3D::NEAREST; 201 202 GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, filter)); 202 203 GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, filter)); 203 GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0)); 204 205 textureUpdater()->updateTextureRect(context, allocator, tile->texture(), sourceRect, destRect); 204 205 updater.append(tile->texture(), textureUpdater(), sourceRect, destRect); 206 206 tile->clearDirty(); 207 207 } -
trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h
r97809 r98360 44 44 virtual ~TiledLayerChromium(); 45 45 46 virtual void updateCompositorResources(GraphicsContext3D*, TextureAllocator*);46 virtual void updateCompositorResources(GraphicsContext3D*, CCTextureUpdater&); 47 47 virtual void setIsMask(bool); 48 48 -
trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
r97780 r98360 41 41 #include "VideoFrameProvider.h" 42 42 #include "cc/CCLayerImpl.h" 43 #include "cc/CCTextureUpdater.h" 43 44 #include "cc/CCVideoLayerImpl.h" 44 45 … … 77 78 } 78 79 79 void VideoLayerChromium::updateCompositorResources(GraphicsContext3D* context, TextureAllocator* allocator)80 void VideoLayerChromium::updateCompositorResources(GraphicsContext3D* context, CCTextureUpdater& updater) 80 81 { 81 82 if (!m_delegate || !m_provider) … … 129 130 ASSERT(texture.m_texture); 130 131 ASSERT(frame->requiredTextureSize(plane) == texture.m_texture->size()); 131 updateTexture(context, allocator, texture, frame->data(plane));132 updateTexture(context, updater.allocator(), texture, frame->data(plane)); 132 133 } 133 134 -
trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.h
r97451 r98360 51 51 virtual PassRefPtr<CCLayerImpl> createCCLayerImpl(); 52 52 53 virtual void updateCompositorResources(GraphicsContext3D*, TextureAllocator*);53 virtual void updateCompositorResources(GraphicsContext3D*, CCTextureUpdater&); 54 54 virtual bool drawsContent() const { return true; } 55 55 -
trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp
r97780 r98360 66 66 } 67 67 68 void WebGLLayerChromium::updateCompositorResources(GraphicsContext3D* rendererContext, TextureAllocator*)68 void WebGLLayerChromium::updateCompositorResources(GraphicsContext3D* rendererContext, CCTextureUpdater&) 69 69 { 70 70 if (!drawsContent()) -
trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.h
r96186 r98360 51 51 52 52 virtual bool drawsContent() const; 53 virtual void updateCompositorResources(GraphicsContext3D*, TextureAllocator*);53 virtual void updateCompositorResources(GraphicsContext3D*, CCTextureUpdater&); 54 54 void setTextureUpdated(); 55 55 bool paintRenderedResultsToCanvas(ImageBuffer*); -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
r98313 r98360 110 110 } 111 111 112 void CCLayerTreeHost::beginCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) 113 { 114 ASSERT(CCProxy::isImplThread()); 115 TRACE_EVENT("CCLayerTreeHost::commitTo", this, 0); 116 117 contentsTextureManager()->reduceMemoryToLimit(TextureManager::reclaimLimitBytes()); 118 contentsTextureManager()->deleteEvictedTextures(hostImpl->contentsTextureAllocator()); 119 } 120 112 121 // This function commits the CCLayerTreeHost to an impl tree. When modifying 113 122 // this function, keep in mind that the function *runs* on the impl thread! Any … … 115 124 // should be delayed until the CCLayerTreeHost::commitComplete, which will run 116 125 // after the commit, but on the main thread. 117 void CCLayerTreeHost:: commitToOnImplThread(CCLayerTreeHostImpl* hostImpl)126 void CCLayerTreeHost::finishCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) 118 127 { 119 128 ASSERT(CCProxy::isImplThread()); 120 TRACE_EVENT("CCLayerTreeHost::commitTo", this, 0);121 129 hostImpl->setSourceFrameNumber(frameNumber()); 122 123 contentsTextureManager()->reduceMemoryToLimit(TextureManager::reclaimLimitBytes());124 contentsTextureManager()->deleteEvictedTextures(hostImpl->contentsTextureAllocator());125 126 updateCompositorResources(m_updateList, hostImpl->context(), hostImpl->contentsTextureAllocator());127 128 130 hostImpl->setVisible(m_visible); 129 131 hostImpl->setZoomAnimatorTransform(m_zoomAnimatorTransform); … … 363 365 } 364 366 365 void CCLayerTreeHost::updateCompositorResources( const LayerList& renderSurfaceLayerList, GraphicsContext3D* context, TextureAllocator* allocator)366 { 367 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) {368 LayerChromium* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex].get();367 void CCLayerTreeHost::updateCompositorResources(GraphicsContext3D* context, CCTextureUpdater& updater) 368 { 369 for (int surfaceIndex = m_updateList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { 370 LayerChromium* renderSurfaceLayer = m_updateList[surfaceIndex].get(); 369 371 RenderSurfaceChromium* renderSurface = renderSurfaceLayer->renderSurface(); 370 372 ASSERT(renderSurface); … … 374 376 375 377 if (renderSurfaceLayer->maskLayer()) 376 updateCompositorResources(renderSurfaceLayer->maskLayer(), context, allocator);378 updateCompositorResources(renderSurfaceLayer->maskLayer(), context, updater); 377 379 378 380 if (renderSurfaceLayer->replicaLayer()) { 379 updateCompositorResources(renderSurfaceLayer->replicaLayer(), context, allocator);381 updateCompositorResources(renderSurfaceLayer->replicaLayer(), context, updater); 380 382 381 383 if (renderSurfaceLayer->replicaLayer()->maskLayer()) 382 updateCompositorResources(renderSurfaceLayer->replicaLayer()->maskLayer(), context, allocator);384 updateCompositorResources(renderSurfaceLayer->replicaLayer()->maskLayer(), context, updater); 383 385 } 384 386 … … 390 392 continue; 391 393 392 updateCompositorResources(layer, context, allocator);394 updateCompositorResources(layer, context, updater); 393 395 } 394 396 } 395 397 } 396 398 397 void CCLayerTreeHost::updateCompositorResources(LayerChromium* layer, GraphicsContext3D* context, TextureAllocator* allocator)399 void CCLayerTreeHost::updateCompositorResources(LayerChromium* layer, GraphicsContext3D* context, CCTextureUpdater& updater) 398 400 { 399 401 // For normal layers, these conditions should have already been checked while creating the render surface layer lists. … … 402 404 return; 403 405 404 layer->updateCompositorResources(context, allocator);406 layer->updateCompositorResources(context, updater); 405 407 } 406 408 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
r98313 r98360 43 43 44 44 class CCLayerTreeHostImpl; 45 class CCTextureUpdater; 45 46 class GraphicsContext3D; 46 47 class LayerChromium; … … 103 104 // CCLayerTreeHost interface to CCProxy. 104 105 void animateAndLayout(double frameBeginTime); 106 void beginCommitOnImplThread(CCLayerTreeHostImpl*); 107 void finishCommitOnImplThread(CCLayerTreeHostImpl*); 105 108 void commitComplete(); 106 void commitToOnImplThread(CCLayerTreeHostImpl*);107 109 PassRefPtr<GraphicsContext3D> createLayerTreeHostContext3D(); 108 110 virtual PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHostImpl(CCLayerTreeHostImplClient*); … … 157 159 void updateLayers(); 158 160 161 void updateCompositorResources(GraphicsContext3D*, CCTextureUpdater&); 159 162 void applyScrollDeltas(const CCScrollUpdateSet&); 160 163 protected: … … 169 172 170 173 void updateLayers(LayerChromium*); 171 void updateCompositorResources(const LayerList&, GraphicsContext3D*, TextureAllocator*); 172 void updateCompositorResources(LayerChromium*, GraphicsContext3D*, TextureAllocator*); 173 void updateMaskResourcesForRenderSurface(LayerChromium*, GraphicsContext3D*, TextureAllocator*); 174 void updateCompositorResources(LayerChromium*, GraphicsContext3D*, CCTextureUpdater&); 174 175 void clearPendingUpdate(); 175 176 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp
r98039 r98360 33 33 #include "cc/CCMainThreadTask.h" 34 34 #include "cc/CCScrollController.h" 35 #include "cc/CCTextureUpdater.h" 35 36 #include <wtf/CurrentTime.h> 36 37 … … 148 149 { 149 150 ASSERT(CCProxy::isMainThread()); 151 doCommit(); 152 } 153 154 void CCSingleThreadProxy::doCommit() 155 { 156 ASSERT(CCProxy::isMainThread()); 150 157 // Commit immediately 151 158 { 152 159 DebugScopedSetImplThread impl; 153 160 m_layerTreeHostImpl->beginCommit(); 154 m_layerTreeHost->commitToOnImplThread(m_layerTreeHostImpl.get()); 161 162 m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); 163 CCTextureUpdater updater(m_layerTreeHostImpl->contentsTextureAllocator()); 164 m_layerTreeHost->updateCompositorResources(m_layerTreeHostImpl->context(), updater); 165 while (updater.update(m_layerTreeHostImpl->context(), 1)) { } 166 m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); 167 155 168 m_layerTreeHostImpl->commitComplete(); 156 169 … … 254 267 ASSERT(CCProxy::isMainThread()); 255 268 256 // Update257 269 m_layerTreeHost->updateLayers(); 258 270 259 // Commit 260 { 261 DebugScopedSetImplThread impl; 262 m_layerTreeHostImpl->beginCommit(); 263 m_layerTreeHost->commitToOnImplThread(m_layerTreeHostImpl.get()); 264 m_layerTreeHostImpl->commitComplete(); 265 } 266 m_layerTreeHost->commitComplete(); 271 doCommit(); 267 272 } 268 273 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h
r98039 r98360 68 68 bool recreateContextIfNeeded(); 69 69 void commitIfNeeded(); 70 void doCommit(); 70 71 bool doComposite(); 71 72 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp
r98039 r98360 35 35 #include "cc/CCScopedMainThreadProxy.h" 36 36 #include "cc/CCScrollController.h" 37 #include "cc/CCTextureUpdater.h" 37 38 #include "cc/CCThreadTask.h" 38 39 #include <wtf/CurrentTime.h> … … 420 421 } 421 422 m_layerTreeHostImpl->beginCommit(); 422 m_layerTreeHost->commitToOnImplThread(m_layerTreeHostImpl.get()); 423 424 m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); 425 CCTextureUpdater updater(m_layerTreeHostImpl->contentsTextureAllocator()); 426 m_layerTreeHost->updateCompositorResources(m_layerTreeHostImpl->context(), updater); 427 while (updater.update(m_layerTreeHostImpl->context(), 1)) { } 428 m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); 429 423 430 m_layerTreeHostImpl->commitComplete(); 424 431
Note:
See TracChangeset
for help on using the changeset viewer.