WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
updated to tip of tree, but not for review yet
bug-79400-20120301113027.patch (text/plain), 12.93 KB, created by
Shawn Singh
on 2012-03-01 11:30:28 PST
(
hide
)
Description:
updated to tip of tree, but not for review yet
Filename:
MIME Type:
Creator:
Shawn Singh
Created:
2012-03-01 11:30:28 PST
Size:
12.93 KB
patch
obsolete
>Subversion Revision: 109303 >diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp >index 7a26db28a0ce7343d5e4459e8c7f71dc759877f4..25f8aac8bf22d3f5d3459afac3219bb65d462b82 100644 >--- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp >+++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp >@@ -1561,6 +1561,20 @@ bool LayerRendererChromium::isContextLost() > return (m_context.get()->getExtensions()->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR); > } > >+void LayerRendererChromium::giveDebugRectInfoToHUD(CCLayerImpl* rootLayer, const Vector<CCLayerImpl*>& renderSurfaceLayerList) >+{ >+ // Note: this logging must happen before layer's property change tracking is reset. >+ >+ if (settings().showUpdateRects) >+ m_headsUpDisplay->logUpdateRectsToHUD(rootLayer); >+ >+ if (settings().showDrawRects) >+ m_headsUpDisplay->logDrawRectsToHUD(renderSurfaceLayerList); >+ >+ if (settings().showDamageRects) >+ m_headsUpDisplay->logDamageRectsToHUD(renderSurfaceLayerList); >+} >+ > } // namespace WebCore > > #endif // USE(ACCELERATED_COMPOSITING) >diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h >index ee9895ae1d4c94cda6310dc7b3fb043d295cb7dc..8c787ae3e464b2889abc42a0616a3af811ac1a5d 100644 >--- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h >+++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h >@@ -155,6 +155,8 @@ public: > float width, float height, float opacity, const FloatQuad&, > int matrixLocation, int alphaLocation, int quadLocation); > >+ void giveDebugRectInfoToHUD(CCLayerImpl* rootLayer, const Vector<CCLayerImpl*>& renderSurfaceLayerList); >+ > private: > LayerRendererChromium(CCLayerTreeHostImpl*, PassRefPtr<GraphicsContext3D>); > bool initialize(); >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp >index 3ddc123c0f5983bd24588951427e449119038aea..884d001af797b8b0f8efbfdb9d822dfd8f2abbbe 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp >@@ -27,6 +27,9 @@ > #if USE(ACCELERATED_COMPOSITING) > #include "CCHeadsUpDisplay.h" > >+#include "CCDamageTracker.h" >+#include "CCLayerImpl.h" >+#include "CCRenderSurface.h" > #include "Extensions3DChromium.h" > #include "Font.h" > #include "FontCache.h" >@@ -104,7 +107,7 @@ void CCHeadsUpDisplay::draw() > > // Use a fullscreen texture only if we need to... > IntSize hudSize; >- if (settings().showPlatformLayerTree) { >+ if (settings().showPlatformLayerTree || settings().showUpdateRects || settings().showDrawRects || settings().showDamageRects) { > hudSize.setWidth(min(2048, m_layerRenderer->viewportWidth())); > hudSize.setHeight(min(2048, m_layerRenderer->viewportHeight())); > } else { >@@ -184,6 +187,8 @@ void CCHeadsUpDisplay::drawHudContents(GraphicsContext* ctx, const IntSize& hudS > > if (settings().showPlatformLayerTree) > drawPlatformLayerTree(ctx, platformLayerTreeTop); >+ >+ drawCompositorRects(ctx); > } > > void CCHeadsUpDisplay::drawFPSCounter(GraphicsContext* ctx, int top, int height) >@@ -260,6 +265,112 @@ const CCSettings& CCHeadsUpDisplay::settings() const > return m_layerRenderer->settings(); > } > >+void CCHeadsUpDisplay::drawCompositorRects(GraphicsContext* ctx) >+{ >+ // update rects in red >+ ctx->setStrokeColor(Color(255, 0, 0, 255), ColorSpaceDeviceRGB); >+ for (size_t i = 0; i < m_updateRectsThisUpdate.size(); ++i) { >+ ctx->fillRect(m_updateRectsThisUpdate[i], Color(255, 0, 0, 30), ColorSpaceDeviceRGB); >+ ctx->strokeRect(m_updateRectsThisUpdate[i], 2.0); >+ } >+ >+ // draw rects in blue >+ ctx->setStrokeColor(Color(0, 0, 255, 255), ColorSpaceDeviceRGB); >+ for (size_t i = 0; i < m_drawRectsThisUpdate.size(); ++i) { >+ ctx->fillRect(m_drawRectsThisUpdate[i], Color(0, 0, 255, 30), ColorSpaceDeviceRGB); >+ ctx->strokeRect(m_drawRectsThisUpdate[i], 2.0); >+ } >+ >+ // exposed rects in purple >+ ctx->setStrokeColor(Color(150, 0, 220, 255), ColorSpaceDeviceRGB); >+ for (size_t i = 0; i < m_exposedRectsThisUpdate.size(); ++i) { >+ ctx->fillRect(m_exposedRectsThisUpdate[i], Color(150, 0, 220, 30), ColorSpaceDeviceRGB); >+ ctx->strokeRect(m_exposedRectsThisUpdate[i], 2.0); >+ } >+ >+ // damage rects in yellow >+ ctx->setStrokeColor(Color(200, 100, 0, 255), ColorSpaceDeviceRGB); >+ for (size_t i = 0; i < m_damageRectsThisUpdate.size(); ++i) { >+ ctx->fillRect(m_damageRectsThisUpdate[i], Color(200, 100, 0, 30), ColorSpaceDeviceRGB); >+ ctx->strokeRect(m_damageRectsThisUpdate[i], 2.0); >+ } >+ >+ m_updateRectsThisUpdate.clear(); >+ m_drawRectsThisUpdate.clear(); >+ m_exposedRectsThisUpdate.clear(); >+ m_damageRectsThisUpdate.clear(); >+} >+ >+void CCHeadsUpDisplay::addUpdateRect(const FloatRect& screenSpaceUpdateRect) >+{ >+ m_updateRectsThisUpdate.append(screenSpaceUpdateRect); >+} >+ >+void CCHeadsUpDisplay::addDrawRect(const FloatRect& screenSpaceDrawRect) >+{ >+ m_drawRectsThisUpdate.append(screenSpaceDrawRect); >+} >+ >+void CCHeadsUpDisplay::addDamageRect(const FloatRect& screenSpaceDamageRect) >+{ >+ m_damageRectsThisUpdate.append(screenSpaceDamageRect); >+} >+ >+void CCHeadsUpDisplay::logUpdateRectsToHUD(CCLayerImpl* layer) >+{ >+ // We would like to visualize where any layer's update rect has changed, >+ // regardless of whether this layer is skipped for actual drawing or not. >+ // Therefore we traverse recursively over all layers, not just the >+ // render surface list. >+ >+ if (!layer->updateRect().isEmpty() && layer->drawsContent()) >+ addUpdateRect(layer->screenSpaceTransform().mapRect(layer->updateRect())); >+ >+ for (unsigned i = 0; i < layer->children().size(); ++i) >+ logUpdateRectsToHUD(layer->children()[i].get()); >+} >+ >+void CCHeadsUpDisplay::logDrawRectsToHUD(const Vector<CCLayerImpl*>& renderSurfaceLayerList) >+{ >+ for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { >+ CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; >+ CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); >+ ASSERT(renderSurface); >+ >+ const Vector<CCLayerImpl*>& layerList = renderSurface->layerList(); >+ for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerIndex) { >+ CCLayerImpl* layer = layerList[layerIndex]; >+ >+ if (layer->renderSurface() && layer->renderSurface() != layer->targetRenderSurface()) >+ continue; >+ >+ // Note, the way this is defined, update rects (which also require officially being drawn) are not logged as "draw rects". >+ // so if the purpose of visualizing this is to see what stuff is drawn, we have to also look at the update rects. >+ if (layer->layerPropertyChanged()) >+ addDrawRect(layer->screenSpaceTransform().mapRect(FloatRect(FloatPoint::zero(), layer->bounds()))); >+ } >+ } >+} >+ >+void CCHeadsUpDisplay::logDamageRectsToHUD(const Vector<CCLayerImpl* >& renderSurfaceLayerList) >+{ >+ for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { >+ CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; >+ CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); >+ ASSERT(renderSurface); >+ >+ TransformationMatrix screenSpaceSurfaceTransform = renderSurface->originTransform(); >+ CCLayerImpl* currentLayer = renderSurfaceLayer->parent(); >+ while (currentLayer) { >+ if (currentLayer->renderSurface()) >+ screenSpaceSurfaceTransform.multiply(currentLayer->renderSurface()->originTransform()); >+ currentLayer = currentLayer->parent(); >+ } >+ addDamageRect(screenSpaceSurfaceTransform.mapRect(renderSurface->damageTracker()->currentDamageRect())); >+ } >+} >+ >+ > } > > #endif // USE(ACCELERATED_COMPOSITING) >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.h b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.h >index 05cb20d526979859268e41774fcaa4a4ce1ba2a4..ee0e8c80b059d48cad4f2d69ddea43b17bebef8a 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.h >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.h >@@ -34,6 +34,7 @@ > namespace WebCore { > > struct CCSettings; >+class CCLayerImpl; > class GeometryBinding; > class GraphicsContext3D; > class LayerRendererChromium; >@@ -58,6 +59,10 @@ public: > bool enabled() const; > void draw(); > >+ void logUpdateRectsToHUD(CCLayerImpl*); >+ void logDrawRectsToHUD(const Vector<CCLayerImpl*>& renderSurfaceLayerList); >+ void logDamageRectsToHUD(const Vector<CCLayerImpl*>& renderSurfaceLayerList); >+ > typedef ProgramBinding<VertexShaderPosTex, FragmentShaderRGBATexSwizzleAlpha> Program; > > private: >@@ -65,8 +70,14 @@ private: > void drawHudContents(GraphicsContext*, const IntSize& hudSize); > void drawFPSCounter(GraphicsContext*, int top, int height); > void drawPlatformLayerTree(GraphicsContext*, int top); >+ void drawCompositorRects(GraphicsContext* ctx); > const CCSettings& settings() const; > >+ // Helper functions for logging update/draw/damage rects. >+ void addUpdateRect(const FloatRect& screenSpaceUpdateRect); >+ void addDrawRect(const FloatRect& screenSpaceDrawRect); >+ void addDamageRect(const FloatRect& screenSpaceDamageRect); >+ > int m_currentFrameNumber; > > double m_filteredFrameTime; >@@ -82,6 +93,11 @@ private: > OwnPtr<Font> m_mediumFont; > > bool m_useMapSubForUploads; >+ >+ Vector<FloatRect> m_updateRectsThisUpdate; >+ Vector<FloatRect> m_drawRectsThisUpdate; >+ Vector<FloatRect> m_exposedRectsThisUpdate; >+ Vector<FloatRect> m_damageRectsThisUpdate; > }; > > } >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h >index 89ade558bb96c11b6952c7a8b1dd4d4ef64ff024..3e794826c56decdba37be38dea738e488e1e8800 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h >@@ -73,6 +73,12 @@ struct CCSettings { > , compositeOffscreen(false) > , showFPSCounter(false) > , showPlatformLayerTree(false) >+ // DON'T COMMIT THIS, JUST FOR DEBUG VISUALIZATION. >+ // - "approximate" because it only visualizes layers, not tiles/quads. And it does not take into account culling. >+ // - updateRects and drawRects are disjoint. Both rects combined will reflect what needs to be redrawn totally. >+ , showUpdateRects(true) // Set to true for visualizing update rects (approximate what was painted and loaded to texture, which needs to be redrawn) >+ , showDrawRects(true) // Set to true for visualizing draw rects (what layers had property changes that need a full redraw) >+ , showDamageRects(true) // Set to true for visualizing damage rects, one for each render surface. > , refreshRate(0) > , perTilePainting(false) > , partialSwapEnabled(false) >@@ -83,6 +89,9 @@ struct CCSettings { > bool compositeOffscreen; > bool showFPSCounter; > bool showPlatformLayerTree; >+ bool showUpdateRects; >+ bool showDrawRects; >+ bool showDamageRects; > double refreshRate; > bool perTilePainting; > bool partialSwapEnabled; >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp >index 80e4738cc13ad4f9c08d5fd75db13cff586dc955..d0cd73e862fb5b36816265875b95ad042645cced 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp >@@ -194,7 +194,7 @@ void CCLayerTreeHostImpl::calculateRenderPasses(CCRenderPassList& passes, CCLaye > CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer(), rootLayer(), identityMatrix, identityMatrix, renderSurfaceLayerList, rootLayer()->renderSurface()->layerList(), &m_layerSorter, layerRendererCapabilities().maxTextureSize); > } > >- if (layerRendererCapabilities().usingPartialSwap) >+ if (layerRendererCapabilities().usingPartialSwap || m_settings.showDamageRects) > trackDamageForAllSurfaces(rootLayer(), renderSurfaceLayerList); > m_rootDamageRect = rootLayer()->renderSurface()->damageTracker()->currentDamageRect(); > >@@ -302,6 +302,8 @@ void CCLayerTreeHostImpl::drawLayers() > if (it.representsItself() && !it->visibleLayerRect().isEmpty()) > it->didDraw(); > } >+ >+ m_layerRenderer->giveDebugRectInfoToHUD(rootLayer(), renderSurfaceLayerList); > m_layerRenderer->finishDrawingFrame(); > > ++m_frameNumber;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 79400
:
128557
|
129726
|
138028
|
138152
|
138385