Changeset 118580 in webkit
- Timestamp:
- May 25, 2012, 3:49:35 PM (14 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
platform/graphics/chromium/ContentLayerChromium.cpp (modified) (3 diffs)
-
platform/graphics/chromium/TiledLayerChromium.cpp (modified) (5 diffs)
-
platform/graphics/chromium/TiledLayerChromium.h (modified) (3 diffs)
-
platform/graphics/chromium/cc/CCLayerTreeHost.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r118577 r118580 1 2012-05-25 Adrienne Walker <enne@google.com> 2 3 [chromium] Add setting for painting debug info onto tiles 4 https://bugs.webkit.org/show_bug.cgi?id=75763 5 6 Reviewed by James Robinson. 7 8 Add a compile-time CCSetting to paint debug information onto tiles. This 9 can help to understand paint counts and layer indices. This setting is 10 off by default. 11 12 * platform/graphics/chromium/ContentLayerChromium.cpp: 13 (WebCore::ContentLayerPainter::create): 14 (WebCore::ContentLayerPainter::paint): 15 (WebCore::ContentLayerPainter::ContentLayerPainter): 16 (WebCore::ContentLayerChromium::createTextureUpdater): 17 * platform/graphics/chromium/TiledLayerChromium.cpp: 18 (WebCore::UpdatableTile::UpdatableTile): 19 (WebCore::UpdatableTile::setUpdateFrame): 20 (WebCore::UpdatableTile::incrementPaintCount): 21 (WebCore::UpdatableTile::updateFrame): 22 (WebCore::UpdatableTile::paintCount): 23 (WebCore::TiledLayerChromium::TiledLayerChromium): 24 (WebCore::TiledLayerChromium::prepareToUpdateTiles): 25 (WebCore::TiledLayerChromium::paintDebugTileInfo): 26 * platform/graphics/chromium/TiledLayerChromium.h: 27 * platform/graphics/chromium/cc/CCLayerTreeHost.h: 28 (WebCore::CCSettings::CCSettings): 29 1 30 2012-05-25 Ami Fischman <fischman@chromium.org> 2 31 -
trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
r116142 r118580 50 50 WTF_MAKE_NONCOPYABLE(ContentLayerPainter); 51 51 public: 52 static PassOwnPtr<ContentLayerPainter> create(ContentLayerDelegate* delegate )52 static PassOwnPtr<ContentLayerPainter> create(ContentLayerDelegate* delegate, TiledLayerChromium* layer) 53 53 { 54 return adoptPtr(new ContentLayerPainter(delegate ));54 return adoptPtr(new ContentLayerPainter(delegate, layer)); 55 55 } 56 56 … … 60 60 context.clearRect(contentRect); 61 61 context.clip(contentRect); 62 m_delegate->paintContents(context, contentRect); 63 double paintEnd = currentTime(); 64 double pixelsPerSec = (contentRect.width() * contentRect.height()) / (paintEnd - paintStart); 65 WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelContentPaintDurationMS", (paintEnd - paintStart) * 1000, 0, 120, 30); 66 WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelContentPaintMegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30); 62 { 63 GraphicsContextStateSaver stateSaver(context, m_layer->layerTreeHost()->settings().debugShowTileInfo); 64 65 m_delegate->paintContents(context, contentRect); 66 double paintEnd = currentTime(); 67 double pixelsPerSec = (contentRect.width() * contentRect.height()) / (paintEnd - paintStart); 68 WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelContentPaintDurationMS", (paintEnd - paintStart) * 1000, 0, 120, 30); 69 WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelContentPaintMegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30); 70 } 71 if (m_layer->layerTreeHost()->settings().debugShowTileInfo) 72 m_layer->paintDebugTileInfo(context, contentRect); 67 73 } 68 74 private: 69 explicit ContentLayerPainter(ContentLayerDelegate* delegate )75 explicit ContentLayerPainter(ContentLayerDelegate* delegate, TiledLayerChromium* layer) 70 76 : m_delegate(delegate) 77 , m_layer(layer) 71 78 { 72 79 } 73 80 74 81 ContentLayerDelegate* m_delegate; 82 TiledLayerChromium* m_layer; 75 83 }; 76 84 … … 127 135 return; 128 136 if (layerTreeHost()->settings().acceleratePainting) 129 m_textureUpdater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate ));137 m_textureUpdater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate, this)); 130 138 else if (layerTreeHost()->settings().perTilePainting) 131 m_textureUpdater = BitmapSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate ), layerTreeHost()->layerRendererCapabilities().usingMapSub);139 m_textureUpdater = BitmapSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate, this), layerTreeHost()->layerRendererCapabilities().usingMapSub); 132 140 else 133 m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate ), layerTreeHost()->layerRendererCapabilities().usingMapSub);141 m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate, this), layerTreeHost()->layerRendererCapabilities().usingMapSub); 134 142 m_textureUpdater->setOpaque(opaque()); 135 143 -
trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp
r118383 r118580 30 30 #include "TiledLayerChromium.h" 31 31 32 #include "FontCache.h" 33 #include "FontDescription.h" 32 34 #include "GraphicsContext3D.h" 33 35 #include "LayerRendererChromium.h" 34 36 #include "ManagedTexture.h" 35 37 #include "Region.h" 38 #include "TextRun.h" 36 39 #include "TextStream.h" 37 40 #include "TraceEvent.h" … … 74 77 bool updated; 75 78 bool isInUseOnImpl; 79 int lastUpdateFrame; 80 int totalPaintCount; 76 81 private: 77 82 explicit UpdatableTile(PassOwnPtr<LayerTextureUpdater::Texture> texture) … … 79 84 , updated(false) 80 85 , isInUseOnImpl(false) 86 , lastUpdateFrame(0) 87 , totalPaintCount(0) 81 88 , m_texture(texture) 82 89 { … … 408 415 } 409 416 return; 417 } 418 419 if (tile->isDirty() && layerTreeHost()->settings().debugShowTileInfo) { 420 // Invalidate the entire tile so that text updates. 421 tile->dirtyRect = m_tiler->tileRect(tile); 422 tile->lastUpdateFrame = layerTreeHost()->frameNumber(); 423 tile->totalPaintCount++; 410 424 } 411 425 … … 713 727 } 714 728 729 void TiledLayerChromium::paintDebugTileInfo(GraphicsContext& context, const IntRect& layerRect) 730 { 731 FontCachePurgePreventer fontCachePurgePreventer; 732 733 // Don't bother writing info onto small tiles. 734 const int minDimension = 200; 735 if (m_tiler->tileSize().width() < minDimension || m_tiler->tileSize().height() < minDimension) 736 return; 737 738 if (!m_debugInfoFont) { 739 FontDescription fontDesc; 740 fontDesc.setGenericFamily(FontDescription::MonospaceFamily); 741 fontDesc.setComputedSize(10); 742 m_debugInfoFont = adoptPtr(new Font(fontDesc, 0, 0)); 743 m_debugInfoFont->update(0); 744 } 745 746 int fontHeight = m_debugInfoFont->fontMetrics().floatHeight() + 2; 747 748 int left, top, right, bottom; 749 m_tiler->layerRectToTileIndices(layerRect, left, top, right, bottom); 750 for (int j = top; j <= bottom; ++j) { 751 for (int i = left; i <= right; ++i) { 752 UpdatableTile* tile = tileAt(i, j); 753 if (!tile) 754 continue; 755 756 IntRect tileRect = m_tiler->tileRect(tile); 757 String info[] = { 758 String::format("LayerId(%d)", id()), 759 String::format("Index(%d, %d)", i, j), 760 String::format("Tile(%d, %d, %d, %d)", tileRect.x(), tileRect.y(), tileRect.width(), tileRect.height()), 761 String::format("Frame(%d)", tile->lastUpdateFrame), 762 String::format("Count(%d)", tile->totalPaintCount), 763 String::format("Layer(%d, %d)", contentBounds().width(), contentBounds().height()), 764 }; 765 const size_t lines = sizeof(info) / sizeof(info[0]); 766 int width[lines]; 767 768 IntPoint center = m_tiler->tileRect(tile).center(); 769 int currentY = center.y() - fontHeight * lines / 2; 770 771 int maxWidth = 0; 772 for (size_t i = 0; i < lines; ++i) { 773 width[i] = m_debugInfoFont->width(TextRun(info[i])); 774 maxWidth = max(width[i], maxWidth); 775 } 776 777 IntRect textRect(IntPoint(center.x() - maxWidth / 2, currentY - fontHeight / 2), IntSize(maxWidth, fontHeight * lines + fontHeight / 2)); 778 779 context.setFillColor(Color(192, 192, 192, 192), ColorSpaceDeviceRGB); 780 context.fillRect(FloatRect(textRect)); 781 782 context.setFillColor(Color(64, 64, 64), ColorSpaceDeviceRGB); 783 784 for (size_t i = 0; i < lines; ++i) { 785 TextRun run(info[i]); 786 int textWidth = m_debugInfoFont->width(run); 787 IntPoint textStart(center.x() - textWidth / 2, currentY + fontHeight / 2); 788 context.drawText(*m_debugInfoFont, run, textStart); 789 currentY += fontHeight; 790 } 791 } 792 } 793 } 794 715 795 } 716 796 #endif // USE(ACCELERATED_COMPOSITING) -
trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h
r118383 r118580 29 29 #if USE(ACCELERATED_COMPOSITING) 30 30 31 #include "Font.h" 31 32 #include "LayerChromium.h" 32 33 #include "cc/CCLayerTilingData.h" … … 65 66 66 67 virtual Region visibleContentOpaqueRegion() const OVERRIDE; 68 69 void paintDebugTileInfo(GraphicsContext&, const IntRect&); 67 70 68 71 protected: … … 128 131 TilingOption m_tilingOption; 129 132 OwnPtr<CCLayerTilingData> m_tiler; 133 OwnPtr<Font> m_debugInfoFont; 130 134 }; 131 135 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
r118525 r118580 78 78 CCSettings() 79 79 : acceleratePainting(false) 80 , debugShowTileInfo(false) 80 81 , showFPSCounter(false) 81 82 , showPlatformLayerTree(false) … … 94 95 95 96 bool acceleratePainting; 97 bool debugShowTileInfo; 96 98 bool showFPSCounter; 97 99 bool showPlatformLayerTree;
Note:
See TracChangeset
for help on using the changeset viewer.