Changeset 96173 in webkit
- Timestamp:
- Sep 27, 2011 5:25:01 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 deleted
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r96172 r96173 1 2011-09-27 Mihai Parparita <mihaip@chromium.org> 2 3 Unreviewed, rolling out r96141. 4 http://trac.webkit.org/changeset/96141 5 https://bugs.webkit.org/show_bug.cgi?id=68190 6 7 Breaks PrerenderBrowserTest.PrerenderHTML5Video in 8 browser_tests 9 10 * WebCore.gypi: 11 * platform/graphics/chromium/Canvas2DLayerChromium.cpp: 12 (WebCore::Canvas2DLayerChromium::updateCompositorResources): 13 * platform/graphics/chromium/Canvas2DLayerChromium.h: 14 * platform/graphics/chromium/ImageLayerChromium.cpp: 15 (WebCore::ImageLayerTextureUpdater::updateTextureRect): 16 * platform/graphics/chromium/LayerChromium.h: 17 (WebCore::LayerChromium::updateCompositorResources): 18 * platform/graphics/chromium/LayerRendererChromium.cpp: 19 (WebCore::LayerRendererChromium::LayerRendererChromium): 20 (WebCore::LayerRendererChromium::releaseRenderSurfaceTextures): 21 (WebCore::LayerRendererChromium::drawLayers): 22 (WebCore::LayerRendererChromium::createLayerTexture): 23 (WebCore::LayerRendererChromium::deleteLayerTexture): 24 (WebCore::LayerRendererChromium::useRenderSurface): 25 (WebCore::LayerRendererChromium::initializeSharedObjects): 26 (WebCore::LayerRendererChromium::cleanupSharedObjects): 27 * platform/graphics/chromium/LayerRendererChromium.h: 28 (WebCore::LayerRendererChromium::setContentsTextureMemoryUseBytes): 29 * platform/graphics/chromium/LayerTextureUpdater.h: 30 * platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp: 31 (WebCore::LayerTextureUpdaterBitmap::updateTextureRect): 32 (WebCore::LayerTextureUpdaterSkPicture::updateTextureRect): 33 * platform/graphics/chromium/LayerTextureUpdaterCanvas.h: 34 * platform/graphics/chromium/ManagedTexture.cpp: 35 (WebCore::ManagedTexture::bindTexture): 36 (WebCore::ManagedTexture::framebufferTexture2D): 37 * platform/graphics/chromium/ManagedTexture.h: 38 * platform/graphics/chromium/TextureManager.cpp: 39 (WebCore::memoryUseBytes): 40 (WebCore::TextureManager::deleteEvictedTextures): 41 (WebCore::TextureManager::evictAndDeleteAllTextures): 42 (WebCore::TextureManager::removeTexture): 43 (WebCore::TextureManager::allocateTexture): 44 (WebCore::TextureManager::requestTexture): 45 * platform/graphics/chromium/TextureManager.h: 46 * platform/graphics/chromium/TiledLayerChromium.cpp: 47 (WebCore::TiledLayerChromium::updateCompositorResources): 48 * platform/graphics/chromium/TiledLayerChromium.h: 49 * platform/graphics/chromium/TrackingTextureAllocator.cpp: Removed. 50 * platform/graphics/chromium/TrackingTextureAllocator.h: Removed. 51 * platform/graphics/chromium/VideoLayerChromium.cpp: 52 (WebCore::VideoLayerChromium::updateCompositorResources): 53 (WebCore::VideoLayerChromium::updateTexture): 54 * platform/graphics/chromium/VideoLayerChromium.h: 55 * platform/graphics/chromium/WebGLLayerChromium.cpp: 56 (WebCore::WebGLLayerChromium::updateCompositorResources): 57 * platform/graphics/chromium/WebGLLayerChromium.h: 58 * platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp: 59 (WebCore::CCHeadsUpDisplay::draw): 60 * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: 61 (WebCore::CCLayerTreeHost::~CCLayerTreeHost): 62 (WebCore::CCLayerTreeHost::deleteContentsTextures): 63 (WebCore::CCLayerTreeHost::commitTo): 64 (WebCore::CCLayerTreeHost::didRecreateGraphicsContext): 65 (WebCore::CCLayerTreeHost::updateCompositorResources): 66 * platform/graphics/chromium/cc/CCLayerTreeHost.cpp.rej: Removed. 67 * platform/graphics/chromium/cc/CCLayerTreeHost.h: 68 * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: 69 (WebCore::CCLayerTreeHostImpl::initializeLayerRenderer): 70 * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h: 71 * platform/graphics/chromium/cc/CCRenderSurface.cpp: 72 (WebCore::CCRenderSurface::drawSurface): 73 * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp: 74 (WebCore::CCSingleThreadProxy::setNeedsCommit): 75 (WebCore::CCSingleThreadProxy::stop): 76 (WebCore::CCSingleThreadProxy::recreateContextIfNeeded): 77 (WebCore::CCSingleThreadProxy::commitIfNeeded): 78 * platform/graphics/chromium/cc/CCThreadProxy.cpp: 79 (WebCore::CCThreadProxy::commitOnCCThread): 80 (WebCore::CCThreadProxy::layerTreeHostClosedOnCCThread): 81 1 82 2011-09-27 James Robinson <jamesr@chromium.org> 2 83 -
trunk/Source/WebCore/WebCore.gypi
r96142 r96173 3467 3467 'platform/graphics/chromium/SimpleFontDataChromiumWin.cpp', 3468 3468 'platform/graphics/chromium/SimpleFontDataLinux.cpp', 3469 'platform/graphics/chromium/TrackingTextureAllocator.cpp',3470 'platform/graphics/chromium/TrackingTextureAllocator.h',3471 3469 'platform/graphics/chromium/TextureManager.cpp', 3472 3470 'platform/graphics/chromium/TextureManager.h', -
trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp
r96141 r96173 65 65 } 66 66 67 void Canvas2DLayerChromium::updateCompositorResources(GraphicsContext3D* , TextureAllocator*)67 void Canvas2DLayerChromium::updateCompositorResources(GraphicsContext3D*) 68 68 { 69 69 if (m_dirtyRect.isEmpty() || !drawsContent()) -
trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.h
r96141 r96173 47 47 virtual ~Canvas2DLayerChromium(); 48 48 virtual bool drawsContent() const; 49 virtual void updateCompositorResources(GraphicsContext3D* , TextureAllocator*);49 virtual void updateCompositorResources(GraphicsContext3D*); 50 50 51 51 void setTextureChanged(); -
trunk/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp
r96141 r96173 67 67 } 68 68 69 virtual void updateTextureRect(GraphicsContext3D* context, TextureAllocator* allocator,ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect)69 virtual void updateTextureRect(GraphicsContext3D* context, ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect) 70 70 { 71 texture->bindTexture(context , allocator);71 texture->bindTexture(context); 72 72 73 73 // Source rect should never go outside the image pixels, even if this -
trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h
r96141 r96173 153 153 virtual bool drawsContent() const { return false; } 154 154 virtual void paintContentsIfDirty() { } 155 virtual void updateCompositorResources(GraphicsContext3D* , TextureAllocator*) { }155 virtual void updateCompositorResources(GraphicsContext3D*) { } 156 156 virtual void setIsMask(bool) {} 157 157 virtual void unreserveContentsTexture() { } -
trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
r96141 r96173 52 52 #include "TreeSynchronizer.h" 53 53 #include "TraceEvent.h" 54 #include "TrackingTextureAllocator.h"55 54 #include "WebGLLayerChromium.h" 56 55 #include "cc/CCLayerImpl.h" … … 149 148 , m_currentRenderSurface(0) 150 149 , m_offscreenFramebufferId(0) 150 , m_contentsTextureMemoryUseBytes(0) 151 151 , m_context(context) 152 152 , m_defaultRenderSurface(0) … … 215 215 void LayerRendererChromium::releaseRenderSurfaceTextures() 216 216 { 217 m_renderSurfaceTextureManager->evictAndDeleteAllTextures(m_ renderSurfaceTextureAllocator.get());217 m_renderSurfaceTextureManager->evictAndDeleteAllTextures(m_context.get()); 218 218 } 219 219 … … 238 238 return; 239 239 240 size_t contentsMemoryUseBytes = m_contentsTextureAllocator->currentMemoryUseBytes(); 241 m_renderSurfaceTextureManager->setMemoryLimitBytes(TextureManager::highLimitBytes() - contentsMemoryUseBytes); 240 m_renderSurfaceTextureManager->setMemoryLimitBytes(TextureManager::highLimitBytes() - m_contentsTextureMemoryUseBytes); 242 241 drawLayersInternal(); 243 242 244 if (TextureManager::reclaimLimitBytes() > contentsMemoryUseBytes)245 m_renderSurfaceTextureManager->reduceMemoryToLimit(TextureManager::reclaimLimitBytes() - contentsMemoryUseBytes);243 if (TextureManager::reclaimLimitBytes() > m_contentsTextureMemoryUseBytes) 244 m_renderSurfaceTextureManager->reduceMemoryToLimit(TextureManager::reclaimLimitBytes() - m_contentsTextureMemoryUseBytes); 246 245 else 247 246 m_renderSurfaceTextureManager->reduceMemoryToLimit(0); 248 m_renderSurfaceTextureManager->deleteEvictedTextures(m_ renderSurfaceTextureAllocator.get());247 m_renderSurfaceTextureManager->deleteEvictedTextures(m_context.get()); 249 248 250 249 if (settings().compositeOffscreen) … … 438 437 } 439 438 439 // FIXME: This method should eventually be replaced by a proper texture manager. 440 unsigned LayerRendererChromium::createLayerTexture() 441 { 442 unsigned textureId = 0; 443 GLC(m_context.get(), textureId = m_context->createTexture()); 444 GLC(m_context.get(), m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId)); 445 // Do basic linear filtering on resize. 446 GLC(m_context.get(), m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); 447 GLC(m_context.get(), m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); 448 // NPOT textures in GL ES only work when the wrap mode is set to GraphicsContext3D::CLAMP_TO_EDGE. 449 GLC(m_context.get(), m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE)); 450 GLC(m_context.get(), m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE)); 451 return textureId; 452 } 453 454 void LayerRendererChromium::deleteLayerTexture(unsigned textureId) 455 { 456 if (!textureId) 457 return; 458 459 GLC(m_context.get(), m_context->deleteTexture(textureId)); 460 } 461 440 462 // Returns true if any part of the layer falls within the visibleRect 441 463 bool LayerRendererChromium::isLayerVisible(LayerChromium* layer, const TransformationMatrix& matrix, const IntRect& visibleRect) … … 495 517 return false; 496 518 497 renderSurface->contentsTexture()->framebufferTexture2D(m_context.get() , m_renderSurfaceTextureAllocator.get());519 renderSurface->contentsTexture()->framebufferTexture2D(m_context.get()); 498 520 499 521 #if !defined ( NDEBUG ) … … 614 636 615 637 m_renderSurfaceTextureManager = TextureManager::create(TextureManager::highLimitBytes(), m_capabilities.maxTextureSize); 616 m_contentsTextureAllocator = TrackingTextureAllocator::create(m_context.get());617 m_renderSurfaceTextureAllocator = TrackingTextureAllocator::create(m_context.get());618 638 return true; 619 639 } … … 824 844 GLC(m_context.get(), m_context->deleteFramebuffer(m_offscreenFramebufferId)); 825 845 846 ASSERT(!m_contentsTextureMemoryUseBytes); 826 847 releaseRenderSurfaceTextures(); 827 848 } -
trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h
r96141 r96173 39 39 #include "IntRect.h" 40 40 #include "LayerChromium.h" 41 #include "TrackingTextureAllocator.h"42 41 #include "VideoLayerChromium.h" 43 42 #include "cc/CCCanvasLayerImpl.h" … … 70 69 class GraphicsContext3D; 71 70 class NonCompositedContentHost; 72 class TrackingTextureAllocator;73 71 74 72 // Class that handles drawing of composited render layers using GL. … … 81 79 void close(); 82 80 83 ~LayerRendererChromium();81 virtual ~LayerRendererChromium(); 84 82 85 83 const CCSettings& settings() const { return m_owner->settings(); } … … 107 105 108 106 void setZoomAnimatorTransform(const TransformationMatrix& t) { m_zoomAnimatorTransform = t; } 107 108 unsigned createLayerTexture(); 109 void deleteLayerTexture(unsigned); 109 110 110 111 static void debugGLCall(GraphicsContext3D*, const char* command, const char* file, int line); … … 133 134 134 135 TextureManager* renderSurfaceTextureManager() const { return m_renderSurfaceTextureManager.get(); } 135 TextureAllocator* renderSurfaceTextureAllocator() const { return m_renderSurfaceTextureAllocator.get(); }136 TextureAllocator* contentsTextureAllocator() const { return m_contentsTextureAllocator.get(); }137 136 138 137 CCHeadsUpDisplay* headsUpDisplay() { return m_headsUpDisplay.get(); } … … 149 148 150 149 typedef Vector<RefPtr<CCLayerImpl> > CCLayerList; 150 151 void setContentsTextureMemoryUseBytes(size_t contentsTextureMemoryUseBytes) { m_contentsTextureMemoryUseBytes = contentsTextureMemoryUseBytes; } 151 152 152 153 static void toGLMatrix(float*, const TransformationMatrix&); … … 213 214 OwnPtr<CCVideoLayerImpl::YUVProgram> m_videoLayerYUVProgram; 214 215 216 size_t m_contentsTextureMemoryUseBytes; 215 217 OwnPtr<TextureManager> m_renderSurfaceTextureManager; 216 OwnPtr<TrackingTextureAllocator> m_contentsTextureAllocator;217 OwnPtr<TrackingTextureAllocator> m_renderSurfaceTextureAllocator;218 218 219 219 OwnPtr<CCHeadsUpDisplay> m_headsUpDisplay; -
trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h
r96141 r96173 39 39 class IntSize; 40 40 class ManagedTexture; 41 class TextureAllocator;42 41 43 42 class LayerTextureUpdater : public RefCounted<LayerTextureUpdater> { … … 63 62 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) = 0; 64 63 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels) = 0; 65 virtual void updateTextureRect(GraphicsContext3D*, TextureAllocator*,ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect) = 0;64 virtual void updateTextureRect(GraphicsContext3D*, ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect) = 0; 66 65 }; 67 66 -
trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp
r96172 r96173 94 94 } 95 95 96 void LayerTextureUpdaterBitmap::updateTextureRect(GraphicsContext3D* context, TextureAllocator* allocator,ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect)96 void LayerTextureUpdaterBitmap::updateTextureRect(GraphicsContext3D* context, ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect) 97 97 { 98 98 PlatformCanvas::AutoLocker locker(&m_canvas); 99 99 100 texture->bindTexture(context , allocator);100 texture->bindTexture(context); 101 101 m_texSubImage.upload(locker.pixels(), contentRect(), sourceRect, destRect, texture->format(), context); 102 102 } … … 145 145 } 146 146 147 void LayerTextureUpdaterSkPicture::updateTextureRect(GraphicsContext3D* compositorContext, TextureAllocator* allocator,ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect)147 void LayerTextureUpdaterSkPicture::updateTextureRect(GraphicsContext3D* compositorContext, ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect) 148 148 { 149 149 ASSERT(!m_context || m_context == compositorContext); … … 160 160 // Bind texture. 161 161 context()->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo); 162 texture->framebufferTexture2D(context() , allocator);162 texture->framebufferTexture2D(context()); 163 163 ASSERT(context()->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) == GraphicsContext3D::FRAMEBUFFER_COMPLETE); 164 164 -
trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdaterCanvas.h
r96172 r96173 72 72 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat); 73 73 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels); 74 virtual void updateTextureRect(GraphicsContext3D*, TextureAllocator*,ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect);74 virtual void updateTextureRect(GraphicsContext3D*, ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect); 75 75 76 76 private: … … 89 89 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat); 90 90 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels); 91 virtual void updateTextureRect(GraphicsContext3D*, TextureAllocator*,ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect);91 virtual void updateTextureRect(GraphicsContext3D*, ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect); 92 92 93 93 private: -
trunk/Source/WebCore/platform/graphics/chromium/ManagedTexture.cpp
r96141 r96173 81 81 } 82 82 83 void ManagedTexture::bindTexture(GraphicsContext3D* context , TextureAllocator* allocator)83 void ManagedTexture::bindTexture(GraphicsContext3D* context) 84 84 { 85 85 ASSERT(m_textureManager->hasTexture(m_token)); 86 86 if (!m_textureId) 87 m_textureId = m_textureManager->allocateTexture( allocator, m_token);87 m_textureId = m_textureManager->allocateTexture(context, m_token); 88 88 context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_textureId); 89 89 } 90 90 91 void ManagedTexture::framebufferTexture2D(GraphicsContext3D* context , TextureAllocator* allocator)91 void ManagedTexture::framebufferTexture2D(GraphicsContext3D* context) 92 92 { 93 93 ASSERT(m_textureManager->hasTexture(m_token)); 94 94 if (!m_textureId) 95 m_textureId = m_textureManager->allocateTexture( allocator, m_token);95 m_textureId = m_textureManager->allocateTexture(context, m_token); 96 96 context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_textureId, 0); 97 97 } -
trunk/Source/WebCore/platform/graphics/chromium/ManagedTexture.h
r96141 r96173 37 37 38 38 class GraphicsContext3D; 39 class TextureManager; 39 40 40 41 class ManagedTexture { … … 56 57 } 57 58 58 void bindTexture(GraphicsContext3D* , TextureAllocator*);59 void framebufferTexture2D(GraphicsContext3D* , TextureAllocator*);59 void bindTexture(GraphicsContext3D*); 60 void framebufferTexture2D(GraphicsContext3D*); 60 61 61 62 IntSize size() const { return m_size; } -
trunk/Source/WebCore/platform/graphics/chromium/TextureManager.cpp
r96141 r96173 33 33 namespace WebCore { 34 34 35 size_t TextureManager::highLimitBytes() 36 { 37 return 128 * 1024 * 1024; 38 } 39 40 size_t TextureManager::reclaimLimitBytes() 41 { 42 return 64 * 1024 * 1024; 43 } 44 45 size_t TextureManager::lowLimitBytes() 46 { 47 return 3 * 1024 * 1024; 48 } 49 50 size_t TextureManager::memoryUseBytes(const IntSize& size, GC3Denum textureFormat) 35 static size_t memoryUseBytes(IntSize size, GC3Denum textureFormat) 51 36 { 52 37 // FIXME: This assumes all textures are 1 byte/component. … … 60 45 } 61 46 47 size_t TextureManager::highLimitBytes() 48 { 49 return 128 * 1024 * 1024; 50 } 51 52 size_t TextureManager::reclaimLimitBytes() 53 { 54 return 64 * 1024 * 1024; 55 } 56 57 size_t TextureManager::lowLimitBytes() 58 { 59 return 3 * 1024 * 1024; 60 } 62 61 63 62 TextureManager::TextureManager(size_t memoryLimitBytes, int maxTextureSize) … … 154 153 } 155 154 156 void TextureManager::deleteEvictedTextures( TextureAllocator* allocator)157 { 158 if ( allocator) {155 void TextureManager::deleteEvictedTextures(GraphicsContext3D* context) 156 { 157 if (context) { 159 158 for (size_t i = 0; i < m_evictedTextures.size(); ++i) { 160 159 if (m_evictedTextures[i].textureId) { 161 160 #ifndef NDEBUG 162 ASSERT(m_evictedTextures[i].allocat or == allocator);163 #endif 164 allocator->deleteTexture(m_evictedTextures[i].textureId, m_evictedTextures[i].size, m_evictedTextures[i].format);161 ASSERT(m_evictedTextures[i].allocatingContext == context); 162 #endif 163 GLC(context, context->deleteTexture(m_evictedTextures[i].textureId)); 165 164 } 166 165 } … … 169 168 } 170 169 171 void TextureManager::evictAndDeleteAllTextures( TextureAllocator* allocator)170 void TextureManager::evictAndDeleteAllTextures(GraphicsContext3D* context) 172 171 { 173 172 unprotectAllTextures(); 174 173 reduceMemoryToLimit(0); 175 deleteEvictedTextures( allocator);174 deleteEvictedTextures(context); 176 175 } 177 176 … … 186 185 EvictionEntry entry; 187 186 entry.textureId = info.textureId; 188 entry.size = info.size; 189 entry.format = info.format; 190 #ifndef NDEBUG 191 entry.allocator = info.allocator; 187 #ifndef NDEBUG 188 entry.allocatingContext = info.allocatingContext; 192 189 #endif 193 190 m_evictedTextures.append(entry); 194 191 } 195 192 196 unsigned TextureManager::allocateTexture( TextureAllocator* allocator, TextureToken token)193 unsigned TextureManager::allocateTexture(GraphicsContext3D* context, TextureToken token) 197 194 { 198 195 TextureMap::iterator it = m_textures.find(token); … … 201 198 ASSERT(info->isProtected); 202 199 203 unsigned textureId = allocator->createTexture(info->size, info->format); 200 unsigned textureId; 201 GLC(context, textureId = context->createTexture()); 202 GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId)); 203 // Do basic linear filtering on resize. 204 GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); 205 GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); 206 // NPOT textures in GL ES only work when the wrap mode is set to GraphicsContext3D::CLAMP_TO_EDGE. 207 GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE)); 208 GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE)); 209 GLC(context, context->texImage2DResourceSafe(GraphicsContext3D::TEXTURE_2D, 0, info->format, info->size.width(), info->size.height(), 0, info->format, GraphicsContext3D::UNSIGNED_BYTE)); 204 210 info->textureId = textureId; 205 211 #ifndef NDEBUG 206 info->allocat or = allocator;212 info->allocatingContext = context; 207 213 #endif 208 214 return textureId; … … 234 240 info.isProtected = true; 235 241 #ifndef NDEBUG 236 info.allocat or= 0;242 info.allocatingContext = 0; 237 243 #endif 238 244 addTexture(token, info); -
trunk/Source/WebCore/platform/graphics/chromium/TextureManager.h
r96141 r96173 38 38 typedef int TextureToken; 39 39 40 class TextureAllocator {41 public:42 virtual unsigned createTexture(const IntSize&, GC3Denum format) = 0;43 virtual void deleteTexture(unsigned texture, const IntSize&, GC3Denum) = 0;44 45 protected:46 virtual ~TextureAllocator() { }47 };48 49 40 class TextureManager { 50 41 WTF_MAKE_NONCOPYABLE(TextureManager); … … 62 53 static size_t lowLimitBytes(); 63 54 64 static size_t memoryUseBytes(const IntSize&, GC3Denum format);65 66 55 void setMemoryLimitBytes(size_t); 67 56 … … 77 66 bool isProtected(TextureToken); 78 67 79 unsigned allocateTexture( TextureAllocator*, TextureToken);80 void deleteEvictedTextures( TextureAllocator*);68 unsigned allocateTexture(GraphicsContext3D*, TextureToken); 69 void deleteEvictedTextures(GraphicsContext3D*); 81 70 82 void evictAndDeleteAllTextures( TextureAllocator*);71 void evictAndDeleteAllTextures(GraphicsContext3D*); 83 72 84 73 void reduceMemoryToLimit(size_t); … … 94 83 bool isProtected; 95 84 #ifndef NDEBUG 96 TextureAllocator* allocator;85 GraphicsContext3D* allocatingContext; 97 86 #endif 98 87 }; … … 112 101 struct EvictionEntry { 113 102 unsigned textureId; 114 IntSize size;115 GC3Denum format;116 103 #ifndef NDEBUG 117 TextureAllocator* allocator;104 GraphicsContext3D* allocatingContext; 118 105 #endif 119 106 }; -
trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp
r96141 r96173 152 152 } 153 153 154 void TiledLayerChromium::updateCompositorResources(GraphicsContext3D* context , TextureAllocator* allocator)154 void TiledLayerChromium::updateCompositorResources(GraphicsContext3D* context) 155 155 { 156 156 // Painting could cause compositing to get turned off, which may cause the tiler to become invalidated mid-update. … … 198 198 CRASH(); 199 199 200 tile->texture()->bindTexture(context , allocator);200 tile->texture()->bindTexture(context); 201 201 const GC3Dint filter = m_tiler->hasBorderTexels() ? GraphicsContext3D::LINEAR : GraphicsContext3D::NEAREST; 202 202 GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, filter)); … … 204 204 GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0)); 205 205 206 textureUpdater()->updateTextureRect(context, allocator,tile->texture(), sourceRect, destRect);206 textureUpdater()->updateTextureRect(context, tile->texture(), sourceRect, destRect); 207 207 tile->clearDirty(); 208 208 } -
trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h
r96141 r96173 44 44 virtual ~TiledLayerChromium(); 45 45 46 virtual void updateCompositorResources(GraphicsContext3D* , TextureAllocator*);46 virtual void updateCompositorResources(GraphicsContext3D*); 47 47 virtual void setIsMask(bool); 48 48 -
trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
r96141 r96173 79 79 } 80 80 81 void VideoLayerChromium::updateCompositorResources(GraphicsContext3D* context , TextureAllocator* allocator)81 void VideoLayerChromium::updateCompositorResources(GraphicsContext3D* context) 82 82 { 83 83 if (!m_delegate) … … 131 131 ASSERT(texture.m_texture); 132 132 ASSERT(frame->requiredTextureSize(plane) == texture.m_texture->size()); 133 updateTexture(context, allocator,texture, frame->data(plane));133 updateTexture(context, texture, frame->data(plane)); 134 134 } 135 135 … … 248 248 } 249 249 250 void VideoLayerChromium::updateTexture(GraphicsContext3D* context, Texture Allocator* allocator, Texture& texture, const void* data) const250 void VideoLayerChromium::updateTexture(GraphicsContext3D* context, Texture& texture, const void* data) const 251 251 { 252 252 ASSERT(context); 253 253 ASSERT(texture.m_texture); 254 254 255 texture.m_texture->bindTexture(context , allocator);255 texture.m_texture->bindTexture(context); 256 256 257 257 GC3Denum format = texture.m_texture->format(); -
trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.h
r96141 r96173 51 51 virtual PassRefPtr<CCLayerImpl> createCCLayerImpl(); 52 52 53 virtual void updateCompositorResources(GraphicsContext3D* , TextureAllocator*);53 virtual void updateCompositorResources(GraphicsContext3D*); 54 54 virtual bool drawsContent() const { return true; } 55 55 … … 77 77 bool texturesValid(); 78 78 bool reserveTextures(const VideoFrameChromium*, GC3Denum textureFormat); 79 void updateTexture(GraphicsContext3D*, Texture Allocator*, Texture&, const void*) const;79 void updateTexture(GraphicsContext3D*, Texture&, const void*) const; 80 80 81 81 void resetFrameParameters(); -
trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp
r96141 r96173 66 66 } 67 67 68 void WebGLLayerChromium::updateCompositorResources(GraphicsContext3D* rendererContext , TextureAllocator*)68 void WebGLLayerChromium::updateCompositorResources(GraphicsContext3D* rendererContext) 69 69 { 70 70 if (!drawsContent()) -
trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.h
r96141 r96173 51 51 52 52 virtual bool drawsContent() const; 53 virtual void updateCompositorResources(GraphicsContext3D* , TextureAllocator*);53 virtual void updateCompositorResources(GraphicsContext3D*); 54 54 void setTextureUpdated(); 55 55 bool paintRenderedResultsToCanvas(ImageBuffer*); -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp
r96141 r96173 127 127 PlatformCanvas::AutoLocker locker(&canvas); 128 128 129 m_hudTexture->bindTexture(context , m_layerRenderer->renderSurfaceTextureAllocator());129 m_hudTexture->bindTexture(context); 130 130 bool uploadedViaMap = false; 131 131 if (m_useMapSubForUploads) { … … 149 149 ASSERT(program && program->initialized()); 150 150 GLC(context, context->activeTexture(GraphicsContext3D::TEXTURE0)); 151 m_hudTexture->bindTexture(context , m_layerRenderer->renderSurfaceTextureAllocator());151 m_hudTexture->bindTexture(context); 152 152 GLC(context, context->useProgram(program->program())); 153 153 GLC(context, context->uniform1i(program->fragmentShader().samplerLocation(), 0)); -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
r96141 r96173 93 93 m_proxy.clear(); 94 94 clearPendingUpdate(); 95 } 96 97 void CCLayerTreeHost::deleteContentsTexturesOnCCThread(TextureAllocator* allocator) 95 ASSERT(!m_contentsTextureManager || !m_contentsTextureManager->currentMemoryUseBytes()); 96 m_contentsTextureManager.clear(); 97 } 98 99 void CCLayerTreeHost::deleteContentsTextures(GraphicsContext3D* context) 98 100 { 99 101 ASSERT(CCProxy::isImplThread()); 100 102 if (m_contentsTextureManager) 101 m_contentsTextureManager->evictAndDeleteAllTextures( allocator);103 m_contentsTextureManager->evictAndDeleteAllTextures(context); 102 104 } 103 105 … … 114 116 // should be delayed until the CCLayerTreeHost::commitComplete, which will run 115 117 // after the commit, but on the main thread. 116 void CCLayerTreeHost::commitTo OnCCThread(CCLayerTreeHostImpl* hostImpl)118 void CCLayerTreeHost::commitTo(CCLayerTreeHostImpl* hostImpl) 117 119 { 118 120 ASSERT(CCProxy::isImplThread()); … … 121 123 122 124 contentsTextureManager()->reduceMemoryToLimit(TextureManager::reclaimLimitBytes()); 123 contentsTextureManager()->deleteEvictedTextures(hostImpl->conte ntsTextureAllocator());124 125 updateCompositorResources(m_updateList, hostImpl->context() , hostImpl->contentsTextureAllocator());125 contentsTextureManager()->deleteEvictedTextures(hostImpl->context()); 126 127 updateCompositorResources(m_updateList, hostImpl->context()); 126 128 127 129 hostImpl->setVisible(m_visible); 128 130 hostImpl->setZoomAnimatorTransform(m_zoomAnimatorTransform); 129 131 hostImpl->setViewport(viewportSize()); 132 133 hostImpl->layerRenderer()->setContentsTextureMemoryUseBytes(m_contentsTextureManager->currentMemoryUseBytes()); 130 134 131 135 // Synchronize trees, if one exists at all... … … 161 165 void CCLayerTreeHost::didRecreateGraphicsContext(bool success) 162 166 { 167 m_contentsTextureManager->evictAndDeleteAllTextures(0); 168 163 169 if (rootLayer()) 164 170 rootLayer()->cleanupResourcesRecursive(); … … 372 378 } 373 379 374 void CCLayerTreeHost::updateCompositorResources(const LayerList& renderSurfaceLayerList, GraphicsContext3D* context , TextureAllocator* allocator)380 void CCLayerTreeHost::updateCompositorResources(const LayerList& renderSurfaceLayerList, GraphicsContext3D* context) 375 381 { 376 382 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { … … 389 395 continue; 390 396 391 updateCompositorResources(layer, context , allocator);397 updateCompositorResources(layer, context); 392 398 } 393 399 } 394 400 } 395 401 396 void CCLayerTreeHost::updateCompositorResources(LayerChromium* layer, GraphicsContext3D* context , TextureAllocator* allocator)402 void CCLayerTreeHost::updateCompositorResources(LayerChromium* layer, GraphicsContext3D* context) 397 403 { 398 404 if (layer->bounds().isEmpty()) … … 403 409 404 410 if (layer->maskLayer()) 405 updateCompositorResources(layer->maskLayer(), context , allocator);411 updateCompositorResources(layer->maskLayer(), context); 406 412 if (layer->replicaLayer()) 407 updateCompositorResources(layer->replicaLayer(), context , allocator);413 updateCompositorResources(layer->replicaLayer(), context); 408 414 409 415 if (layer->drawsContent()) 410 layer->updateCompositorResources(context , allocator);416 layer->updateCompositorResources(context); 411 417 } 412 418 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
r96141 r96173 46 46 class LayerChromium; 47 47 class LayerPainterChromium; 48 class TextureAllocator;49 48 class TextureManager; 50 49 … … 100 99 void animateAndLayout(double frameBeginTime); 101 100 void commitComplete(); 102 void commitTo OnCCThread(CCLayerTreeHostImpl*);101 void commitTo(CCLayerTreeHostImpl*); 103 102 PassOwnPtr<CCThread> createCompositorThread(); 104 103 PassRefPtr<GraphicsContext3D> createLayerTreeHostContext3D(); … … 108 107 void scheduleComposite(); 109 108 #endif 110 void deleteContentsTexturesOnCCThread(TextureAllocator*);111 109 112 110 // CCLayerTreeHost interface to WebView. … … 155 153 void updateLayers(); 156 154 155 void deleteContentsTextures(GraphicsContext3D*); 156 157 157 protected: 158 158 CCLayerTreeHost(CCLayerTreeHostClient*, PassRefPtr<LayerChromium> rootLayer, const CCSettings&); … … 164 164 void paintLayerContents(const LayerList&); 165 165 void updateLayers(LayerChromium*); 166 void updateCompositorResources(const LayerList&, GraphicsContext3D* , TextureAllocator*);167 void updateCompositorResources(LayerChromium*, GraphicsContext3D* , TextureAllocator*);166 void updateCompositorResources(const LayerList&, GraphicsContext3D*); 167 void updateCompositorResources(LayerChromium*, GraphicsContext3D*); 168 168 void clearPendingUpdate(); 169 169 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp
r96141 r96173 99 99 } 100 100 101 TextureAllocator* CCLayerTreeHostImpl::contentsTextureAllocator() const102 {103 return m_layerRenderer->contentsTextureAllocator();104 }105 106 101 void CCLayerTreeHostImpl::present() 107 102 { … … 140 135 } 141 136 142 if (m_layerRenderer) 137 // If we had a previous layer renderer, then its context must have been lost along with all of its resources. 138 // Let the old layer renderer known its resources are gone. 139 if (m_layerRenderer) { 140 m_layerRenderer->setContentsTextureMemoryUseBytes(0); 143 141 m_layerRenderer->close(); 142 } 144 143 145 144 m_layerRenderer = layerRenderer.release(); -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h
r96141 r96173 38 38 class CCLayerImpl; 39 39 class LayerRendererChromium; 40 class TextureAllocator;41 40 struct LayerRendererCapabilities; 42 41 class TransformationMatrix; … … 63 62 LayerRendererChromium* layerRenderer() { return m_layerRenderer.get(); } 64 63 const LayerRendererCapabilities& layerRendererCapabilities() const; 65 TextureAllocator* contentsTextureAllocator() const;66 64 67 65 void present(); -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp
r96141 r96173 188 188 GLC(context3D, context3D->activeTexture(GraphicsContext3D::TEXTURE0)); 189 189 GLC(context3D, context3D->uniform1i(program->fragmentShader().samplerLocation(), 0)); 190 m_contentsTexture->bindTexture(context3D , layerRenderer->renderSurfaceTextureAllocator());190 m_contentsTexture->bindTexture(context3D); 191 191 192 192 if (shaderMaskSamplerLocation != -1) { -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp
r96141 r96173 161 161 ScopedSetImplThread impl; 162 162 m_layerTreeHostImpl->beginCommit(); 163 m_layerTreeHost->commitTo OnCCThread(m_layerTreeHostImpl.get());163 m_layerTreeHost->commitTo(m_layerTreeHostImpl.get()); 164 164 m_layerTreeHostImpl->commitComplete(); 165 165 } … … 191 191 { 192 192 ScopedSetImplThread impl; 193 m_layerTreeHost->deleteContentsTextures OnCCThread(m_layerTreeHostImpl->contentsTextureAllocator());193 m_layerTreeHost->deleteContentsTextures(m_layerTreeHostImpl->context()); 194 194 m_layerTreeHostImpl.clear(); 195 195 } … … 228 228 { 229 229 ScopedSetImplThread impl; 230 m_layerTreeHost->deleteContentsTexturesOnCCThread(m_layerTreeHostImpl->contentsTextureAllocator());231 230 ok = m_layerTreeHostImpl->initializeLayerRenderer(context); 232 231 if (ok) … … 265 264 ScopedSetImplThread impl; 266 265 m_layerTreeHostImpl->beginCommit(); 267 m_layerTreeHost->commitTo OnCCThread(m_layerTreeHostImpl.get());266 m_layerTreeHost->commitTo(m_layerTreeHostImpl.get()); 268 267 m_layerTreeHostImpl->commitComplete(); 269 268 } -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp
r96141 r96173 346 346 } 347 347 m_layerTreeHostImpl->beginCommit(); 348 m_layerTreeHost->commitTo OnCCThread(m_layerTreeHostImpl.get());348 m_layerTreeHost->commitTo(m_layerTreeHostImpl.get()); 349 349 m_layerTreeHostImpl->commitComplete(); 350 350 … … 431 431 TRACE_EVENT("CCThreadProxy::layerTreeHostClosedOnCCThread", this, 0); 432 432 ASSERT(isImplThread()); 433 m_layerTreeHost->deleteContentsTextures OnCCThread(m_layerTreeHostImpl->contentsTextureAllocator());433 m_layerTreeHost->deleteContentsTextures(m_layerTreeHostImpl->context()); 434 434 m_layerTreeHostImpl.clear(); 435 435 completion->signal();
Note: See TracChangeset
for help on using the changeset viewer.