Changeset 86640 in webkit
- Timestamp:
- May 16, 2011 5:21:05 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 6 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r86635 r86640 1 2011-05-16 Andrew Wilson <atwilson@chromium.org> 2 3 Unreviewed, rolling out r86625. 4 http://trac.webkit.org/changeset/86625 5 https://bugs.webkit.org/show_bug.cgi?id=60719 6 7 Caused failed assertion on Chromium gpu canary bots 8 9 * WebCore.gypi: 10 * platform/chromium/TraceEvent.h: 11 * platform/graphics/chromium/ContentLayerChromium.cpp: 12 (WebCore::ContentLayerChromium::create): 13 (WebCore::ContentLayerChromium::ContentLayerChromium): 14 (WebCore::ContentLayerChromium::~ContentLayerChromium): 15 (WebCore::ContentLayerChromium::paintContentsIfDirty): 16 (WebCore::ContentLayerChromium::setLayerRenderer): 17 (WebCore::ContentLayerChromium::createTilerIfNeeded): 18 (WebCore::ContentLayerChromium::updateCompositorResources): 19 * platform/graphics/chromium/ContentLayerChromium.h: 20 (WebCore::ContentLayerChromium::drawsContent): 21 * platform/graphics/chromium/ImageLayerChromium.cpp: 22 (WebCore::ImageLayerChromium::paintContentsIfDirty): 23 (WebCore::ImageLayerChromium::updateCompositorResources): 24 * platform/graphics/chromium/ImageLayerChromium.h: 25 * platform/graphics/chromium/LayerPainterChromium.h: Removed. 26 * platform/graphics/chromium/LayerRendererChromium.cpp: 27 (WebCore::LayerRendererChromium::create): 28 (WebCore::LayerRendererChromium::LayerRendererChromium): 29 (WebCore::LayerRendererChromium::updateRootLayerContents): 30 (WebCore::LayerRendererChromium::drawRootLayer): 31 (WebCore::LayerRendererChromium::updateAndDrawLayers): 32 (WebCore::LayerRendererChromium::updateLayers): 33 * platform/graphics/chromium/LayerRendererChromium.h: 34 * platform/graphics/chromium/LayerTextureSubImage.cpp: Removed. 35 * platform/graphics/chromium/LayerTextureSubImage.h: Removed. 36 * platform/graphics/chromium/LayerTextureUpdater.h: Removed. 37 * platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp: Removed. 38 * platform/graphics/chromium/LayerTextureUpdaterCanvas.h: Removed. 39 * platform/graphics/chromium/LayerTilerChromium.cpp: 40 (WebCore::LayerTilerChromium::create): 41 (WebCore::LayerTilerChromium::LayerTilerChromium): 42 (WebCore::LayerTilerChromium::setLayerRenderer): 43 (WebCore::LayerTilerChromium::setTileSize): 44 (WebCore::LayerTilerChromium::update): 45 (WebCore::LayerTilerChromium::uploadCanvas): 46 (WebCore::LayerTilerChromium::updateFromPixels): 47 (WebCore::LayerTilerChromium::draw): 48 * platform/graphics/chromium/LayerTilerChromium.h: 49 (WebCore::LayerTilerChromium::Tile::Tile): 50 * platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp: 51 (WebCore::CCHeadsUpDisplay::draw): 52 1 53 2011-05-16 Antti Koivisto <antti@apple.com> 2 54 -
trunk/Source/WebCore/WebCore.gypi
r86625 r86640 4035 4035 'platform/graphics/chromium/LayerChromium.cpp', 4036 4036 'platform/graphics/chromium/LayerChromium.h', 4037 'platform/graphics/chromium/LayerPainterChromium.h',4038 4037 'platform/graphics/chromium/LayerRendererChromium.cpp', 4039 4038 'platform/graphics/chromium/LayerRendererChromium.h', 4040 4039 'platform/graphics/chromium/LayerTexture.cpp', 4041 4040 'platform/graphics/chromium/LayerTexture.h', 4042 'platform/graphics/chromium/LayerTextureSubImage.cpp',4043 'platform/graphics/chromium/LayerTextureSubImage.h',4044 'platform/graphics/chromium/LayerTextureUpdater.h',4045 'platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp',4046 'platform/graphics/chromium/LayerTextureUpdaterCanvas.h',4047 4041 'platform/graphics/chromium/LayerTilerChromium.cpp', 4048 4042 'platform/graphics/chromium/LayerTilerChromium.h', -
trunk/Source/WebCore/platform/chromium/TraceEvent.h
r86625 r86640 27 27 28 28 #include "PlatformBridge.h" 29 #include <wtf/OwnArrayPtr.h>30 29 31 30 // Implementation detail: trace event macros create temporary variables -
trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
r86625 r86640 37 37 #include "cc/CCLayerImpl.h" 38 38 #include "GraphicsContext3D.h" 39 #include "LayerPainterChromium.h"40 39 #include "LayerRendererChromium.h" 41 40 #include "LayerTexture.h" 42 #include "LayerTextureUpdaterCanvas.h"43 #include "LayerTilerChromium.h"44 41 #include "RenderLayerBacking.h" 45 42 #include "TextStream.h" … … 55 52 namespace WebCore { 56 53 57 class ContentLayerPainter : public LayerPainterChromium { 54 PassRefPtr<ContentLayerChromium> ContentLayerChromium::create(GraphicsLayerChromium* owner) 55 { 56 return adoptRef(new ContentLayerChromium(owner)); 57 } 58 59 ContentLayerChromium::ContentLayerChromium(GraphicsLayerChromium* owner) 60 : LayerChromium(owner) 61 , m_tilingOption(ContentLayerChromium::AutoTile) 62 { 63 } 64 65 ContentLayerChromium::~ContentLayerChromium() 66 { 67 m_tiler.clear(); 68 LayerChromium::cleanupResources(); 69 } 70 71 class ContentLayerPainter : public TilePaintInterface { 58 72 public: 59 73 explicit ContentLayerPainter(GraphicsLayerChromium* owner) … … 72 86 }; 73 87 74 PassRefPtr<ContentLayerChromium> ContentLayerChromium::create(GraphicsLayerChromium* owner)75 {76 return adoptRef(new ContentLayerChromium(owner));77 }78 79 ContentLayerChromium::ContentLayerChromium(GraphicsLayerChromium* owner)80 : LayerChromium(owner)81 , m_tilingOption(ContentLayerChromium::AutoTile)82 {83 }84 85 ContentLayerChromium::~ContentLayerChromium()86 {87 cleanupResources();88 }89 90 88 void ContentLayerChromium::paintContentsIfDirty(const IntRect& targetSurfaceRect) 91 89 { … … 93 91 ASSERT(layerRenderer()); 94 92 93 createTilerIfNeeded(); 94 95 ContentLayerPainter painter(m_owner); 95 96 updateLayerSize(layerBounds().size()); 96 97 … … 103 104 m_tiler->invalidateRect(dirty); 104 105 105 m_tiler-> prepareToUpdate(layerRect);106 m_tiler->update(painter, layerRect); 106 107 m_dirtyRect = FloatRect(); 107 }108 109 void ContentLayerChromium::cleanupResources()110 {111 m_tiler.clear();112 LayerChromium::cleanupResources();113 108 } 114 109 … … 117 112 LayerChromium::setLayerRenderer(layerRenderer); 118 113 createTilerIfNeeded(); 119 } 120 121 PassOwnPtr<LayerTextureUpdater> ContentLayerChromium::createTextureUpdater() 122 { 123 OwnPtr<LayerPainterChromium> painter = adoptPtr(new ContentLayerPainter(m_owner)); 124 return adoptPtr(new LayerTextureUpdaterBitmap(layerRendererContext(), painter.release(), layerRenderer()->contextSupportsMapSub())); 114 m_tiler->setLayerRenderer(layerRenderer); 125 115 } 126 116 … … 197 187 } 198 188 199 bool ContentLayerChromium::drawsContent() const200 {201 return m_owner && m_owner->drawsContent() && (!m_tiler || !m_tiler->skipsDraw());202 }203 204 189 void ContentLayerChromium::createTilerIfNeeded() 205 190 { 206 191 if (m_tiler) 207 192 return; 208 209 m_tiler = LayerTilerChromium::create( 210 layerRenderer(), 211 createTextureUpdater(), 212 IntSize(defaultTileSize, defaultTileSize), 213 LayerTilerChromium::HasBorderTexels); 193 m_tiler = LayerTilerChromium::create(layerRenderer(), IntSize(defaultTileSize, defaultTileSize), LayerTilerChromium::HasBorderTexels); 214 194 } 215 195 216 196 void ContentLayerChromium::updateCompositorResources() 217 197 { 218 m_tiler->up dateRect();198 m_tiler->uploadCanvas(); 219 199 } 220 200 -
trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h
r86625 r86640 36 36 37 37 #include "LayerChromium.h" 38 #include "LayerTilerChromium.h" 39 #include "TextureManager.h" 38 40 39 41 namespace WebCore { 40 42 41 43 class LayerTexture; 42 class LayerTilerChromium;43 class LayerTextureUpdater;44 44 45 45 // A Layer that requires a GraphicsContext to render its contents. … … 59 59 60 60 virtual void draw(const IntRect& targetSurfaceRect); 61 virtual bool drawsContent() const ;61 virtual bool drawsContent() const { return m_owner && m_owner->drawsContent() && (!m_tiler || !m_tiler->skipsDraw()); } 62 62 63 63 protected: … … 67 67 virtual void dumpLayerProperties(TextStream&, int indent) const; 68 68 69 virtual void cleanupResources();70 69 virtual void setLayerRenderer(LayerRendererChromium*); 71 72 virtual PassOwnPtr<LayerTextureUpdater> createTextureUpdater();73 70 74 71 virtual IntRect layerBounds() const; -
trunk/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp
r86625 r86640 39 39 #include "LayerRendererChromium.h" 40 40 #include "LayerTexture.h" 41 #include "LayerTextureSubImage.h"42 #include "LayerTextureUpdater.h"43 41 44 42 namespace WebCore { 45 46 class ImageLayerTextureUpdater : public LayerTextureUpdater {47 public:48 ImageLayerTextureUpdater(GraphicsContext3D* context, const PlatformImage& image, bool useMapTexSubImage)49 : LayerTextureUpdater(context)50 , m_image(image)51 , m_texSubImage(useMapTexSubImage)52 {53 }54 virtual ~ImageLayerTextureUpdater() { }55 56 virtual Orientation orientation() { return LayerTextureUpdater::BottomUpOrientation; }57 58 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels)59 {60 ASSERT(imageRect().contains(contentRect));61 m_texSubImage.setSubImageSize(tileSize);62 }63 64 virtual void updateTextureRect(LayerTexture* texture, const IntRect& sourceRect, const IntRect& destRect)65 {66 texture->bindTexture();67 m_texSubImage.upload(m_image.pixels(), imageRect(), sourceRect, destRect, context());68 }69 70 private:71 IntRect imageRect() const72 {73 return IntRect(IntPoint::zero(), m_image.size());74 }75 76 // FIXME: ImageLayerTextureUpdater should rather own a PlatformImage rather than keeping a reference.77 const PlatformImage& m_image;78 LayerTextureSubImage m_texSubImage;79 };80 43 81 44 PassRefPtr<ImageLayerChromium> ImageLayerChromium::create(GraphicsLayerChromium* owner) … … 118 81 m_dirtyRect = IntRect(); 119 82 } 120 m_tiler->prepareToUpdate(paintRect);121 83 } 122 84 } … … 124 86 void ImageLayerChromium::updateCompositorResources() 125 87 { 126 m_tiler->updateRect(); 127 } 128 129 PassOwnPtr<LayerTextureUpdater> ImageLayerChromium::createTextureUpdater() 130 { 131 return adoptPtr(new ImageLayerTextureUpdater(layerRendererContext(), m_decodedImage, layerRenderer()->contextSupportsMapSub())); 88 IntRect paintRect(IntPoint(0, 0), m_decodedImage.size()); 89 m_tiler->updateFromPixels(paintRect, paintRect, m_decodedImage.pixels()); 132 90 } 133 91 -
trunk/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.h
r86625 r86640 60 60 virtual const char* layerTypeAsString() const { return "ImageLayer"; } 61 61 62 virtual PassOwnPtr<LayerTextureUpdater> createTextureUpdater();63 62 virtual TransformationMatrix tilingTransform(); 64 63 virtual IntRect layerBounds() const; -
trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
r86625 r86640 41 41 #include "GraphicsContext3D.h" 42 42 #include "LayerChromium.h" 43 #include "LayerPainterChromium.h"44 43 #include "LayerTexture.h" 45 #include "LayerTextureUpdaterCanvas.h"46 44 #include "NotImplemented.h" 47 45 #include "TextStream.h" … … 96 94 } 97 95 98 PassRefPtr<LayerRendererChromium> LayerRendererChromium::create(PassRefPtr<GraphicsContext3D> context, PassOwnPtr< LayerPainterChromium> contentPaint)96 PassRefPtr<LayerRendererChromium> LayerRendererChromium::create(PassRefPtr<GraphicsContext3D> context, PassOwnPtr<TilePaintInterface> contentPaint) 99 97 { 100 98 if (!context) … … 109 107 110 108 LayerRendererChromium::LayerRendererChromium(PassRefPtr<GraphicsContext3D> context, 111 PassOwnPtr< LayerPainterChromium> contentPaint)109 PassOwnPtr<TilePaintInterface> contentPaint) 112 110 : m_viewportScrollPosition(IntPoint(-1, -1)) 113 111 , m_rootLayer(0) 112 , m_rootLayerContentPaint(contentPaint) 114 113 , m_currentShader(0) 115 114 , m_currentRenderSurface(0) … … 127 126 m_context->getExtensions()->ensureEnabled("GL_CHROMIUM_map_sub"); 128 127 m_hardwareCompositing = initializeSharedObjects(); 129 130 OwnPtr<LayerTextureUpdater> textureUpdater = adoptPtr(new LayerTextureUpdaterBitmap(m_context.get(), contentPaint, m_contextSupportsMapSub)); 131 m_rootLayerContentTiler = LayerTilerChromium::create(this, textureUpdater.release(), IntSize(256, 256), LayerTilerChromium::NoBorderTexels); 128 m_rootLayerContentTiler = LayerTilerChromium::create(this, IntSize(256, 256), LayerTilerChromium::NoBorderTexels); 132 129 ASSERT(m_rootLayerContentTiler); 133 130 … … 169 166 { 170 167 TRACE_EVENT("LayerRendererChromium::updateRootLayerContents", this, 0); 171 m_rootLayerContentTiler-> prepareToUpdate(m_viewportVisibleRect);168 m_rootLayerContentTiler->update(*m_rootLayerContentPaint, m_viewportVisibleRect); 172 169 } 173 170 … … 177 174 scroll.translate(-m_viewportVisibleRect.x(), -m_viewportVisibleRect.y()); 178 175 176 m_rootLayerContentTiler->uploadCanvas(); 179 177 m_rootLayerContentTiler->draw(m_viewportVisibleRect, scroll, 1.0f); 180 178 } … … 215 213 216 214 LayerList renderSurfaceLayerList; 215 217 216 updateLayers(renderSurfaceLayerList); 218 217 … … 319 318 320 319 updateCompositorResourcesRecursive(m_rootLayer.get()); 321 // Update compositor resources for root layer.322 m_rootLayerContentTiler->updateRect();323 320 324 321 // After updateCompositorResourcesRecursive, set/wait latches for all child -
trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h
r86625 r86640 65 65 class GeometryBinding; 66 66 class GraphicsContext3D; 67 class LayerPainterChromium;68 67 69 68 // Class that handles drawing of composited render layers using GL. 70 69 class LayerRendererChromium : public RefCounted<LayerRendererChromium> { 71 70 public: 72 static PassRefPtr<LayerRendererChromium> create(PassRefPtr<GraphicsContext3D>, PassOwnPtr< LayerPainterChromium> contentPaint);71 static PassRefPtr<LayerRendererChromium> create(PassRefPtr<GraphicsContext3D>, PassOwnPtr<TilePaintInterface> contentPaint); 73 72 74 73 ~LayerRendererChromium(); … … 150 149 typedef HashMap<GraphicsContext3D*, int> ChildContextMap; 151 150 152 LayerRendererChromium(PassRefPtr<GraphicsContext3D>, PassOwnPtr<LayerPainterChromium> contentPaint);151 explicit LayerRendererChromium(PassRefPtr<GraphicsContext3D>, PassOwnPtr<TilePaintInterface> contentPaint); 153 152 154 153 void updateLayers(LayerList& renderSurfaceLayerList); … … 190 189 191 190 RefPtr<LayerChromium> m_rootLayer; 191 OwnPtr<TilePaintInterface> m_rootLayerContentPaint; 192 192 OwnPtr<LayerTilerChromium> m_rootLayerContentTiler; 193 193 -
trunk/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.cpp
r86625 r86640 36 36 #include "LayerRendererChromium.h" 37 37 #include "LayerTexture.h" 38 #include "LayerTextureUpdater.h"39 38 #include "TraceEvent.h" 40 39 40 #include <wtf/PassOwnArrayPtr.h> 41 41 42 using namespace std; 42 43 43 44 namespace WebCore { 44 45 45 PassOwnPtr<LayerTilerChromium> LayerTilerChromium::create(LayerRendererChromium* layerRenderer, PassOwnPtr<LayerTextureUpdater> textureUpdater,const IntSize& tileSize, BorderTexelOption border)46 PassOwnPtr<LayerTilerChromium> LayerTilerChromium::create(LayerRendererChromium* layerRenderer, const IntSize& tileSize, BorderTexelOption border) 46 47 { 47 48 if (!layerRenderer || tileSize.isEmpty()) 48 49 return nullptr; 49 50 50 return adoptPtr(new LayerTilerChromium(layerRenderer, t extureUpdater, tileSize, border));51 } 52 53 LayerTilerChromium::LayerTilerChromium(LayerRendererChromium* layerRenderer, PassOwnPtr<LayerTextureUpdater> textureUpdater,const IntSize& tileSize, BorderTexelOption border)51 return adoptPtr(new LayerTilerChromium(layerRenderer, tileSize, border)); 52 } 53 54 LayerTilerChromium::LayerTilerChromium(LayerRendererChromium* layerRenderer, const IntSize& tileSize, BorderTexelOption border) 54 55 : m_skipsDraw(false) 55 56 , m_tilingData(max(tileSize.width(), tileSize.height()), 0, 0, border == HasBorderTexels) 56 , m_ textureUpdater(textureUpdater)57 , m_useMapSubForUploads(layerRenderer->contextSupportsMapSub()) 57 58 , m_layerRenderer(layerRenderer) 58 59 { 59 60 setTileSize(tileSize); 61 } 62 63 void LayerTilerChromium::setLayerRenderer(LayerRendererChromium* layerRenderer) 64 { 65 if (m_layerRenderer != layerRenderer) 66 reset(); 67 m_layerRenderer = layerRenderer; 60 68 } 61 69 … … 79 87 80 88 m_tileSize = size; 89 if (!m_useMapSubForUploads) 90 m_tilePixels = adoptArrayPtr(new uint8_t[m_tileSize.width() * m_tileSize.height() * 4]); 81 91 m_tilingData.setMaxTextureSize(max(size.width(), size.height())); 82 92 } … … 221 231 } 222 232 223 void LayerTilerChromium:: prepareToUpdate(const IntRect& contentRect)233 void LayerTilerChromium::update(TilePaintInterface& painter, const IntRect& contentRect) 224 234 { 225 235 if (m_skipsDraw) … … 258 268 return; 259 269 260 m_textureUpdater->prepareToUpdate(m_paintRect, m_tileSize, m_tilingData.borderTexels()); 261 } 262 263 void LayerTilerChromium::updateRect() 270 m_canvas.resize(m_paintRect.size()); 271 272 // Assumption: if a tiler is using border texels, then it is because the 273 // layer is likely to be filtered or transformed. Because of it might be 274 // transformed, draw the text in grayscale instead of subpixel antialiasing. 275 PlatformCanvas::Painter::TextOption textOption = m_tilingData.borderTexels() ? PlatformCanvas::Painter::GrayscaleText : PlatformCanvas::Painter::SubpixelText; 276 PlatformCanvas::Painter canvasPainter(&m_canvas, textOption); 277 canvasPainter.context()->translate(-m_paintRect.x(), -m_paintRect.y()); 278 { 279 TRACE_EVENT("LayerTilerChromium::update::paint", this, 0); 280 painter.paint(*canvasPainter.context(), m_paintRect); 281 } 282 } 283 284 void LayerTilerChromium::uploadCanvas() 285 { 286 PlatformCanvas::AutoLocker locker(&m_canvas); 287 { 288 TRACE_EVENT("LayerTilerChromium::updateFromPixels", this, 0); 289 updateFromPixels(m_updateRect, m_paintRect, locker.pixels()); 290 } 291 } 292 293 void LayerTilerChromium::updateFromPixels(const IntRect& contentRect, const IntRect& paintRect, const uint8_t* paintPixels) 264 294 { 265 295 // Painting could cause compositing to get turned off, which may cause the tiler to become invalidated mid-update. … … 270 300 271 301 int left, top, right, bottom; 272 contentRectToTileIndices( m_updateRect, left, top, right, bottom);302 contentRectToTileIndices(contentRect, left, top, right, bottom); 273 303 for (int j = top; j <= bottom; ++j) { 274 304 for (int i = left; i <= right; ++i) { … … 285 315 // Paint rect not guaranteed to line up on tile boundaries, so 286 316 // make sure that sourceRect doesn't extend outside of it. 287 sourceRect.intersect( m_paintRect);317 sourceRect.intersect(paintRect); 288 318 if (sourceRect.isEmpty()) 289 319 continue; … … 305 335 306 336 // Offset from paint rectangle to this tile's dirty rectangle. 307 IntPoint paintOffset(sourceRect.x() - m_paintRect.x(), sourceRect.y() - m_paintRect.y());337 IntPoint paintOffset(sourceRect.x() - paintRect.x(), sourceRect.y() - paintRect.y()); 308 338 if (paintOffset.x() < 0) 309 339 CRASH(); 310 340 if (paintOffset.y() < 0) 311 341 CRASH(); 312 if (paintOffset.x() + destRect.width() > m_paintRect.width())313 CRASH(); 314 if (paintOffset.y() + destRect.height() > m_paintRect.height())342 if (paintOffset.x() + destRect.width() > paintRect.width()) 343 CRASH(); 344 if (paintOffset.y() + destRect.height() > paintRect.height()) 315 345 CRASH(); 316 346 317 347 tile->texture()->bindTexture(); 348 318 349 const GC3Dint filter = m_tilingData.borderTexels() ? GraphicsContext3D::LINEAR : GraphicsContext3D::NEAREST; 319 350 GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, filter)); 320 351 GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, filter)); 321 352 322 m_textureUpdater->updateTextureRect(tile->texture(), sourceRect, destRect); 353 if (m_useMapSubForUploads) { 354 // Upload tile data via a mapped transfer buffer 355 Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(context->getExtensions()); 356 uint8_t* pixelDest = static_cast<uint8_t*>(extensions->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, destRect.x(), destRect.y(), destRect.width(), destRect.height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, Extensions3DChromium::WRITE_ONLY)); 357 ASSERT(pixelDest); 358 if (paintRect.width() == sourceRect.width() && !paintOffset.x()) 359 memcpy(pixelDest, &paintPixels[4 * paintOffset.y() * paintRect.width()], paintRect.width() * destRect.height() * 4); 360 else { 361 // Strides not equal, so do a row-by-row memcpy from the 362 // paint results into the pixelDest 363 for (int row = 0; row < destRect.height(); ++row) 364 memcpy(&pixelDest[destRect.width() * 4 * row], 365 &paintPixels[4 * (paintOffset.x() + (paintOffset.y() + row) * paintRect.width())], 366 destRect.width() * 4); 367 } 368 extensions->unmapTexSubImage2DCHROMIUM(pixelDest); 369 } else { 370 const uint8_t* pixelSource; 371 if (paintRect.width() == sourceRect.width() && !paintOffset.x()) 372 pixelSource = &paintPixels[4 * paintOffset.y() * paintRect.width()]; 373 else { 374 // Strides not equal, so do a row-by-row memcpy from the 375 // paint results into a temp buffer for uploading. 376 for (int row = 0; row < destRect.height(); ++row) 377 memcpy(&m_tilePixels[destRect.width() * 4 * row], 378 &paintPixels[4 * (paintOffset.x() + (paintOffset.y() + row) * paintRect.width())], 379 destRect.width() * 4); 380 381 pixelSource = &m_tilePixels[0]; 382 } 383 384 385 GLC(context, context->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, destRect.x(), destRect.y(), destRect.width(), destRect.height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixelSource)); 386 } 387 323 388 tile->clearDirty(); 324 389 } … … 366 431 float texScaleX = tileRect.width() / tileWidth; 367 432 float texScaleY = tileRect.height() / tileHeight; 368 // OpenGL coordinate system is bottom-up. 369 // If tile texture is top-down, we need to flip the texture coordinates. 370 if (m_textureUpdater->orientation() == LayerTextureUpdater::TopDownOrientation) { 371 texTranslateY += 1.0; 372 texScaleY *= -1.0; 373 } 433 374 434 drawTexturedQuad(context, layerRenderer()->projectionMatrix(), tileMatrix, tileRect.width(), tileRect.height(), opacity, texTranslateX, texTranslateY, texScaleX, texScaleY, program); 375 435 } -
trunk/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.h
r86625 r86640 32 32 #include "LayerChromium.h" 33 33 #include "LayerTexture.h" 34 #include "PlatformCanvas.h" 34 35 #include "TilingData.h" 35 36 #include <wtf/HashTraits.h> 37 #include <wtf/OwnArrayPtr.h> 36 38 #include <wtf/RefCounted.h> 37 39 … … 40 42 class GraphicsContext3D; 41 43 class LayerRendererChromium; 42 class LayerTextureUpdater; 44 45 class TilePaintInterface { 46 public: 47 virtual void paint(GraphicsContext& context, const IntRect& contentRect) = 0; 48 }; 43 49 44 50 class LayerTilerChromium { … … 47 53 enum BorderTexelOption { HasBorderTexels, NoBorderTexels }; 48 54 49 static PassOwnPtr<LayerTilerChromium> create(LayerRendererChromium*, PassOwnPtr<LayerTextureUpdater>,const IntSize& tileSize, BorderTexelOption);55 static PassOwnPtr<LayerTilerChromium> create(LayerRendererChromium*, const IntSize& tileSize, BorderTexelOption); 50 56 51 57 ~LayerTilerChromium(); … … 55 61 void invalidateEntireLayer(); 56 62 57 // Prepare data needed to update textures that instersect with contentRect. 58 void prepareToUpdate(const IntRect& contentRect); 59 // Update invalid textures that intersect with contentRect provided in prepareToUpdate(). 60 void updateRect(); 63 // Paint all invalidations and missing tiles needed to draw the contentRect 64 // into the internal canvas. 65 void update(TilePaintInterface& painter, const IntRect& contentRect); 66 67 // Reserve and upload tile textures from the internal canvas. 68 void uploadCanvas(); 69 70 // Reserve and upload tile textures from an externally painted buffer. 71 void updateFromPixels(const IntRect& contentRect, const IntRect& paintRect, const uint8_t* pixels); 72 61 73 // Draw all tiles that intersect with the content rect. 62 74 void draw(const IntRect& contentRect, const TransformationMatrix&, float opacity); … … 66 78 // Change the tile size. This may invalidate all the existing tiles. 67 79 void setTileSize(const IntSize& size); 80 void setLayerRenderer(LayerRendererChromium*); 68 81 69 82 bool skipsDraw() const { return m_skipsDraw; } … … 75 88 76 89 private: 77 LayerTilerChromium(LayerRendererChromium*, PassOwnPtr<LayerTextureUpdater>,const IntSize& tileSize, BorderTexelOption);90 LayerTilerChromium(LayerRendererChromium*, const IntSize& tileSize, BorderTexelOption); 78 91 79 92 class Tile : public RefCounted<Tile> { 80 93 WTF_MAKE_NONCOPYABLE(Tile); 81 94 public: 82 explicit Tile(PassOwnPtr<LayerTexture> tex) : m_tex(tex), m_i(-1), m_j(-1) { 95 explicit Tile(PassOwnPtr<LayerTexture> tex) : m_tex(tex), m_i(-1), m_j(-1) {} 83 96 84 97 LayerTexture* texture() { return m_tex.get(); } … … 145 158 Vector<RefPtr<Tile> > m_unusedTiles; 146 159 147 // State held between update and upload .160 // State held between update and uploadCanvas. 148 161 IntRect m_paintRect; 149 162 IntRect m_updateRect; 163 PlatformCanvas m_canvas; 164 165 // Cache a tile-sized pixel buffer to draw into. 166 OwnArrayPtr<uint8_t> m_tilePixels; 150 167 151 168 TilingData m_tilingData; 152 169 153 OwnPtr<LayerTextureUpdater> m_textureUpdater; 170 // Whether the tiler will use GL_CHROMIUM_map_sub for texture uploads. 171 bool m_useMapSubForUploads; 172 154 173 LayerRendererChromium* m_layerRenderer; 155 174 }; -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp
r86625 r86640 35 35 #include "LayerRendererChromium.h" 36 36 #include "LayerTexture.h" 37 #include "PlatformCanvas.h"38 37 #include "TextRun.h" 39 38 #include "TextStream.h" … … 116 115 extensions->unmapTexSubImage2DCHROMIUM(pixelDest); 117 116 } else 118 GLC(context , context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, canvas.size().width(), canvas.size().height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, locker.pixels()));117 GLC(context.get(), context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, canvas.size().width(), canvas.size().height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, locker.pixels())); 119 118 } 120 119 -
trunk/Source/WebKit/chromium/ChangeLog
r86625 r86640 1 2011-05-16 Andrew Wilson <atwilson@chromium.org> 2 3 Unreviewed, rolling out r86625. 4 http://trac.webkit.org/changeset/86625 5 https://bugs.webkit.org/show_bug.cgi?id=60719 6 7 Caused failed assertion on Chromium gpu canary bots 8 9 * src/WebViewImpl.cpp: 10 1 11 2011-05-16 Alok Priyadarshi <alokp@chromium.org> 2 12 -
trunk/Source/WebKit/chromium/src/WebViewImpl.cpp
r86625 r86640 73 73 #include "KeyboardCodes.h" 74 74 #include "KeyboardEvent.h" 75 #include "LayerPainterChromium.h"76 75 #include "MIMETypeRegistry.h" 77 76 #include "NodeRenderStyle.h" … … 2411 2410 } 2412 2411 2413 class WebViewImplContentPainter : public LayerPainterChromium{2412 class WebViewImplContentPainter : public TilePaintInterface { 2414 2413 WTF_MAKE_NONCOPYABLE(WebViewImplContentPainter); 2415 2414 public:
Note: See TracChangeset
for help on using the changeset viewer.