Title: [116481] trunk/Source
Revision
116481
Author
[email protected]
Date
2012-05-08 19:26:23 -0700 (Tue, 08 May 2012)

Log Message

[chromium] Show borders for partial-draw-culled quads to visualize culling behaviour
https://bugs.webkit.org/show_bug.cgi?id=85414

Reviewed by Adrienne Walker.

Source/WebCore:

The borders are brown, and are only shown when the quad's visible rect
is non-empty and is different from the quad's original rect.

Adds a flag to CCQuadCuller constructor, to enable showing debug borders
around what it leaves after culling (when it culls anything in a quad
at all).

* platform/graphics/chromium/cc/CCDrawQuad.h:
(WebCore::CCDrawQuad::isDebugQuad):
(WebCore::CCDrawQuad::sharedQuadState):
(CCDrawQuad):
* platform/graphics/chromium/cc/CCQuadCuller.cpp:
(WebCore):
(WebCore::CCQuadCuller::CCQuadCuller):
(WebCore::appendQuadInternal):
(WebCore::CCQuadCuller::append):
(WebCore::CCQuadCuller::appendSurface):
(WebCore::CCQuadCuller::appendReplica):
* platform/graphics/chromium/cc/CCQuadCuller.h:
(CCQuadCuller):
* platform/graphics/chromium/cc/CCRenderPass.cpp:
(WebCore::CCRenderPass::appendQuadsForLayer):
(WebCore::CCRenderPass::appendQuadsForRenderSurfaceLayer):

Source/WebKit/chromium:

* tests/CCQuadCullerTest.cpp:
(WebCore::appendQuads):
* tests/MockCCQuadCuller.h:
(WebCore::MockCCQuadCuller::MockCCQuadCuller):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (116480 => 116481)


--- trunk/Source/WebCore/ChangeLog	2012-05-09 02:18:38 UTC (rev 116480)
+++ trunk/Source/WebCore/ChangeLog	2012-05-09 02:26:23 UTC (rev 116481)
@@ -1,3 +1,34 @@
+2012-05-08  Dana Jansens  <[email protected]>
+
+        [chromium] Show borders for partial-draw-culled quads to visualize culling behaviour
+        https://bugs.webkit.org/show_bug.cgi?id=85414
+
+        Reviewed by Adrienne Walker.
+
+        The borders are brown, and are only shown when the quad's visible rect
+        is non-empty and is different from the quad's original rect.
+
+        Adds a flag to CCQuadCuller constructor, to enable showing debug borders
+        around what it leaves after culling (when it culls anything in a quad
+        at all).
+
+        * platform/graphics/chromium/cc/CCDrawQuad.h:
+        (WebCore::CCDrawQuad::isDebugQuad):
+        (WebCore::CCDrawQuad::sharedQuadState):
+        (CCDrawQuad):
+        * platform/graphics/chromium/cc/CCQuadCuller.cpp:
+        (WebCore):
+        (WebCore::CCQuadCuller::CCQuadCuller):
+        (WebCore::appendQuadInternal):
+        (WebCore::CCQuadCuller::append):
+        (WebCore::CCQuadCuller::appendSurface):
+        (WebCore::CCQuadCuller::appendReplica):
+        * platform/graphics/chromium/cc/CCQuadCuller.h:
+        (CCQuadCuller):
+        * platform/graphics/chromium/cc/CCRenderPass.cpp:
+        (WebCore::CCRenderPass::appendQuadsForLayer):
+        (WebCore::CCRenderPass::appendQuadsForRenderSurfaceLayer):
+
 2012-05-08  Julien Chaffraix  <[email protected]>
 
         Move RenderLayers z-index lists dirtying to post style change

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h (116480 => 116481)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h	2012-05-09 02:18:38 UTC (rev 116480)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h	2012-05-09 02:26:23 UTC (rev 116481)
@@ -75,6 +75,7 @@
     };
 
     Material material() const { return m_material; }
+    bool isDebugQuad() const { return m_material == DebugBorder; }
 
     const CCCheckerboardDrawQuad* toCheckerboardDrawQuad() const;
     const CCDebugBorderDrawQuad* toDebugBorderDrawQuad() const;
@@ -85,6 +86,8 @@
     const CCTileDrawQuad* toTileDrawQuad() const;
     const CCVideoDrawQuad* toVideoDrawQuad() const;
 
+    const CCSharedQuadState* sharedQuadState() const { return m_sharedQuadState; }
+
 protected:
     CCDrawQuad(const CCSharedQuadState*, Material, const IntRect&);
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp (116480 => 116481)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp	2012-05-09 02:18:38 UTC (rev 116480)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp	2012-05-09 02:26:23 UTC (rev 116481)
@@ -31,6 +31,7 @@
 
 #include "Region.h"
 #include "TransformationMatrix.h"
+#include "cc/CCDebugBorderDrawQuad.h"
 #include "cc/CCLayerImpl.h"
 #include "cc/CCOverdrawMetrics.h"
 #include "cc/CCRenderPass.h"
@@ -40,14 +41,21 @@
 
 namespace WebCore {
 
-CCQuadCuller::CCQuadCuller(CCQuadList& quadList, CCLayerImpl* layer, const CCOcclusionTrackerImpl* occlusionTracker)
+static const int debugTileBorderWidth = 1;
+static const int debugTileBorderAlpha = 120;
+static const int debugTileBorderColorRed = 160;
+static const int debugTileBorderColorGreen = 100;
+static const int debugTileBorderColorBlue = 0;
+
+CCQuadCuller::CCQuadCuller(CCQuadList& quadList, CCLayerImpl* layer, const CCOcclusionTrackerImpl* occlusionTracker, bool showCullingWithDebugBorderQuads)
     : m_quadList(quadList)
     , m_layer(layer)
     , m_occlusionTracker(occlusionTracker)
+    , m_showCullingWithDebugBorderQuads(showCullingWithDebugBorderQuads)
 {
 }
 
-static inline bool appendQuadInternal(PassOwnPtr<CCDrawQuad> passDrawQuad, const IntRect& culledRect, CCQuadList& quadList, const CCOcclusionTrackerImpl& occlusionTracker)
+static inline bool appendQuadInternal(PassOwnPtr<CCDrawQuad> passDrawQuad, const IntRect& culledRect, CCQuadList& quadList, const CCOcclusionTrackerImpl& occlusionTracker, bool createDebugBorderQuads)
 {
     OwnPtr<CCDrawQuad> drawQuad(passDrawQuad);
     bool keepQuad = !culledRect.isEmpty();
@@ -57,28 +65,34 @@
     occlusionTracker.overdrawMetrics().didCullForDrawing(drawQuad->quadTransform(), drawQuad->quadRect(), culledRect);
     occlusionTracker.overdrawMetrics().didDraw(drawQuad->quadTransform(), culledRect, drawQuad->opaqueRect());
 
-    // Release the quad after we're done using it.
-    if (keepQuad)
+    if (keepQuad) {
+        if (createDebugBorderQuads && !drawQuad->isDebugQuad() && drawQuad->quadVisibleRect() != drawQuad->quadRect()) {
+            Color borderColor = Color(debugTileBorderColorRed, debugTileBorderColorGreen, debugTileBorderColorBlue, debugTileBorderAlpha);
+            quadList.append(CCDebugBorderDrawQuad::create(drawQuad->sharedQuadState(), drawQuad->quadVisibleRect(), borderColor, debugTileBorderWidth));
+        }
+
+        // Release the quad after we're done using it.
         quadList.append(drawQuad.release());
+    }
     return keepQuad;
 }
 
 bool CCQuadCuller::append(PassOwnPtr<CCDrawQuad> passDrawQuad)
 {
     IntRect culledRect = m_occlusionTracker->unoccludedContentRect(m_layer, passDrawQuad->quadRect());
-    return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusionTracker);
+    return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusionTracker, m_showCullingWithDebugBorderQuads);
 }
 
 bool CCQuadCuller::appendSurface(PassOwnPtr<CCDrawQuad> passDrawQuad)
 {
     IntRect culledRect = m_occlusionTracker->unoccludedContributingSurfaceContentRect(m_layer->renderSurface(), false, passDrawQuad->quadRect());
-    return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusionTracker);
+    return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusionTracker, m_showCullingWithDebugBorderQuads);
 }
 
 bool CCQuadCuller::appendReplica(PassOwnPtr<CCDrawQuad> passDrawQuad)
 {
     IntRect culledRect = m_occlusionTracker->unoccludedContributingSurfaceContentRect(m_layer->renderSurface(), true, passDrawQuad->quadRect());
-    return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusionTracker);
+    return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusionTracker, m_showCullingWithDebugBorderQuads);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h (116480 => 116481)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h	2012-05-09 02:18:38 UTC (rev 116480)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h	2012-05-09 02:26:23 UTC (rev 116481)
@@ -36,7 +36,7 @@
 public:
     // Passing 0 for CCOverdrawCounts* is valid, and disable the extra computation
     // done to estimate over draw statistics.
-    CCQuadCuller(CCQuadList&, CCLayerImpl*, const CCOcclusionTrackerImpl*);
+    CCQuadCuller(CCQuadList&, CCLayerImpl*, const CCOcclusionTrackerImpl*, bool showCullingWithDebugBorderQuads);
 
     // Returns true if the quad is added to the list, and false if the quad is entirely culled.
     virtual bool append(PassOwnPtr<CCDrawQuad> passDrawQuad);
@@ -47,6 +47,7 @@
     CCQuadList& m_quadList;
     CCLayerImpl* m_layer;
     const CCOcclusionTrackerImpl* m_occlusionTracker;
+    bool m_showCullingWithDebugBorderQuads;
 };
 
 }

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp (116480 => 116481)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp	2012-05-09 02:18:38 UTC (rev 116480)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp	2012-05-09 02:26:23 UTC (rev 116481)
@@ -60,7 +60,7 @@
 
 void CCRenderPass::appendQuadsForLayer(CCLayerImpl* layer, CCOcclusionTrackerImpl* occlusionTracker, bool& hadMissingTiles)
 {
-    CCQuadCuller quadCuller(m_quadList, layer, occlusionTracker);
+    CCQuadCuller quadCuller(m_quadList, layer, occlusionTracker, layer->hasDebugBorders());
 
     OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState();
     layer->appendDebugBorderQuad(quadCuller, sharedQuadState.get());
@@ -72,7 +72,7 @@
 {
     // FIXME: render surface layers should be a CCLayerImpl-derived class and
     // not be handled specially here.
-    CCQuadCuller quadCuller(m_quadList, layer, occlusionTracker);
+    CCQuadCuller quadCuller(m_quadList, layer, occlusionTracker, layer->hasDebugBorders());
 
     CCRenderSurface* surface = layer->renderSurface();
     OwnPtr<CCSharedQuadState> sharedQuadState = surface->createSharedQuadState();

Modified: trunk/Source/WebKit/chromium/ChangeLog (116480 => 116481)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-05-09 02:18:38 UTC (rev 116480)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-05-09 02:26:23 UTC (rev 116481)
@@ -1,3 +1,15 @@
+2012-05-08  Dana Jansens  <[email protected]>
+
+        [chromium] Show borders for partial-draw-culled quads to visualize culling behaviour
+        https://bugs.webkit.org/show_bug.cgi?id=85414
+
+        Reviewed by Adrienne Walker.
+
+        * tests/CCQuadCullerTest.cpp:
+        (WebCore::appendQuads):
+        * tests/MockCCQuadCuller.h:
+        (WebCore::MockCCQuadCuller::MockCCQuadCuller):
+
 2012-05-08  Tony Chang  <[email protected]>
 
         [chromium] force ENABLE_REGISTER_PROTOCOL_HANDLER=1 in features.gypi

Modified: trunk/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp (116480 => 116481)


--- trunk/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp	2012-05-09 02:18:38 UTC (rev 116480)
+++ trunk/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp	2012-05-09 02:26:23 UTC (rev 116481)
@@ -91,7 +91,7 @@
 static void appendQuads(CCQuadList& quadList, Vector<OwnPtr<CCSharedQuadState> >& sharedStateList, CCTiledLayerImpl* layer, CCLayerIteratorType& it, CCOcclusionTrackerImpl& occlusionTracker)
 {
     occlusionTracker.enterLayer(it);
-    CCQuadCuller quadCuller(quadList, layer, &occlusionTracker);
+    CCQuadCuller quadCuller(quadList, layer, &occlusionTracker, false);
     OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState();
     bool hadMissingTiles = false;
     layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles);

Modified: trunk/Source/WebKit/chromium/tests/MockCCQuadCuller.h (116480 => 116481)


--- trunk/Source/WebKit/chromium/tests/MockCCQuadCuller.h	2012-05-09 02:18:38 UTC (rev 116480)
+++ trunk/Source/WebKit/chromium/tests/MockCCQuadCuller.h	2012-05-09 02:26:23 UTC (rev 116481)
@@ -35,12 +35,12 @@
 class MockCCQuadCuller : public WebCore::CCQuadCuller {
 public:
     MockCCQuadCuller()
-        : CCQuadCuller(m_quadListStorage, 0, 0)
+        : CCQuadCuller(m_quadListStorage, 0, 0, false)
         , m_activeQuadList(m_quadListStorage)
     { }
 
     explicit MockCCQuadCuller(CCQuadList& externalQuadList)
-        : CCQuadCuller(externalQuadList, 0, 0)
+        : CCQuadCuller(externalQuadList, 0, 0, false)
         , m_activeQuadList(externalQuadList)
     { }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to