Changeset 116481 in webkit


Ignore:
Timestamp:
May 8, 2012 7:26:23 PM (12 years ago)
Author:
danakj@chromium.org
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):

Location:
trunk/Source
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r116480 r116481  
     12012-05-08  Dana Jansens  <danakj@chromium.org>
     2
     3        [chromium] Show borders for partial-draw-culled quads to visualize culling behaviour
     4        https://bugs.webkit.org/show_bug.cgi?id=85414
     5
     6        Reviewed by Adrienne Walker.
     7
     8        The borders are brown, and are only shown when the quad's visible rect
     9        is non-empty and is different from the quad's original rect.
     10
     11        Adds a flag to CCQuadCuller constructor, to enable showing debug borders
     12        around what it leaves after culling (when it culls anything in a quad
     13        at all).
     14
     15        * platform/graphics/chromium/cc/CCDrawQuad.h:
     16        (WebCore::CCDrawQuad::isDebugQuad):
     17        (WebCore::CCDrawQuad::sharedQuadState):
     18        (CCDrawQuad):
     19        * platform/graphics/chromium/cc/CCQuadCuller.cpp:
     20        (WebCore):
     21        (WebCore::CCQuadCuller::CCQuadCuller):
     22        (WebCore::appendQuadInternal):
     23        (WebCore::CCQuadCuller::append):
     24        (WebCore::CCQuadCuller::appendSurface):
     25        (WebCore::CCQuadCuller::appendReplica):
     26        * platform/graphics/chromium/cc/CCQuadCuller.h:
     27        (CCQuadCuller):
     28        * platform/graphics/chromium/cc/CCRenderPass.cpp:
     29        (WebCore::CCRenderPass::appendQuadsForLayer):
     30        (WebCore::CCRenderPass::appendQuadsForRenderSurfaceLayer):
     31
    1322012-05-08  Julien Chaffraix  <jchaffraix@webkit.org>
    233
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h

    r115394 r116481  
    7676
    7777    Material material() const { return m_material; }
     78    bool isDebugQuad() const { return m_material == DebugBorder; }
    7879
    7980    const CCCheckerboardDrawQuad* toCheckerboardDrawQuad() const;
     
    8586    const CCTileDrawQuad* toTileDrawQuad() const;
    8687    const CCVideoDrawQuad* toVideoDrawQuad() const;
     88
     89    const CCSharedQuadState* sharedQuadState() const { return m_sharedQuadState; }
    8790
    8891protected:
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp

    r115930 r116481  
    3232#include "Region.h"
    3333#include "TransformationMatrix.h"
     34#include "cc/CCDebugBorderDrawQuad.h"
    3435#include "cc/CCLayerImpl.h"
    3536#include "cc/CCOverdrawMetrics.h"
     
    4142namespace WebCore {
    4243
    43 CCQuadCuller::CCQuadCuller(CCQuadList& quadList, CCLayerImpl* layer, const CCOcclusionTrackerImpl* occlusionTracker)
     44static const int debugTileBorderWidth = 1;
     45static const int debugTileBorderAlpha = 120;
     46static const int debugTileBorderColorRed = 160;
     47static const int debugTileBorderColorGreen = 100;
     48static const int debugTileBorderColorBlue = 0;
     49
     50CCQuadCuller::CCQuadCuller(CCQuadList& quadList, CCLayerImpl* layer, const CCOcclusionTrackerImpl* occlusionTracker, bool showCullingWithDebugBorderQuads)
    4451    : m_quadList(quadList)
    4552    , m_layer(layer)
    4653    , m_occlusionTracker(occlusionTracker)
     54    , m_showCullingWithDebugBorderQuads(showCullingWithDebugBorderQuads)
    4755{
    4856}
    4957
    50 static inline bool appendQuadInternal(PassOwnPtr<CCDrawQuad> passDrawQuad, const IntRect& culledRect, CCQuadList& quadList, const CCOcclusionTrackerImpl& occlusionTracker)
     58static inline bool appendQuadInternal(PassOwnPtr<CCDrawQuad> passDrawQuad, const IntRect& culledRect, CCQuadList& quadList, const CCOcclusionTrackerImpl& occlusionTracker, bool createDebugBorderQuads)
    5159{
    5260    OwnPtr<CCDrawQuad> drawQuad(passDrawQuad);
     
    5866    occlusionTracker.overdrawMetrics().didDraw(drawQuad->quadTransform(), culledRect, drawQuad->opaqueRect());
    5967
    60     // Release the quad after we're done using it.
    61     if (keepQuad)
     68    if (keepQuad) {
     69        if (createDebugBorderQuads && !drawQuad->isDebugQuad() && drawQuad->quadVisibleRect() != drawQuad->quadRect()) {
     70            Color borderColor = Color(debugTileBorderColorRed, debugTileBorderColorGreen, debugTileBorderColorBlue, debugTileBorderAlpha);
     71            quadList.append(CCDebugBorderDrawQuad::create(drawQuad->sharedQuadState(), drawQuad->quadVisibleRect(), borderColor, debugTileBorderWidth));
     72        }
     73
     74        // Release the quad after we're done using it.
    6275        quadList.append(drawQuad.release());
     76    }
    6377    return keepQuad;
    6478}
     
    6781{
    6882    IntRect culledRect = m_occlusionTracker->unoccludedContentRect(m_layer, passDrawQuad->quadRect());
    69     return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusionTracker);
     83    return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusionTracker, m_showCullingWithDebugBorderQuads);
    7084}
    7185
     
    7387{
    7488    IntRect culledRect = m_occlusionTracker->unoccludedContributingSurfaceContentRect(m_layer->renderSurface(), false, passDrawQuad->quadRect());
    75     return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusionTracker);
     89    return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusionTracker, m_showCullingWithDebugBorderQuads);
    7690}
    7791
     
    7993{
    8094    IntRect culledRect = m_occlusionTracker->unoccludedContributingSurfaceContentRect(m_layer->renderSurface(), true, passDrawQuad->quadRect());
    81     return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusionTracker);
     95    return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusionTracker, m_showCullingWithDebugBorderQuads);
    8296}
    8397
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h

    r113652 r116481  
    3737    // Passing 0 for CCOverdrawCounts* is valid, and disable the extra computation
    3838    // done to estimate over draw statistics.
    39     CCQuadCuller(CCQuadList&, CCLayerImpl*, const CCOcclusionTrackerImpl*);
     39    CCQuadCuller(CCQuadList&, CCLayerImpl*, const CCOcclusionTrackerImpl*, bool showCullingWithDebugBorderQuads);
    4040
    4141    // Returns true if the quad is added to the list, and false if the quad is entirely culled.
     
    4848    CCLayerImpl* m_layer;
    4949    const CCOcclusionTrackerImpl* m_occlusionTracker;
     50    bool m_showCullingWithDebugBorderQuads;
    5051};
    5152
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp

    r113871 r116481  
    6161void CCRenderPass::appendQuadsForLayer(CCLayerImpl* layer, CCOcclusionTrackerImpl* occlusionTracker, bool& hadMissingTiles)
    6262{
    63     CCQuadCuller quadCuller(m_quadList, layer, occlusionTracker);
     63    CCQuadCuller quadCuller(m_quadList, layer, occlusionTracker, layer->hasDebugBorders());
    6464
    6565    OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState();
     
    7373    // FIXME: render surface layers should be a CCLayerImpl-derived class and
    7474    // not be handled specially here.
    75     CCQuadCuller quadCuller(m_quadList, layer, occlusionTracker);
     75    CCQuadCuller quadCuller(m_quadList, layer, occlusionTracker, layer->hasDebugBorders());
    7676
    7777    CCRenderSurface* surface = layer->renderSurface();
  • trunk/Source/WebKit/chromium/ChangeLog

    r116474 r116481  
     12012-05-08  Dana Jansens  <danakj@chromium.org>
     2
     3        [chromium] Show borders for partial-draw-culled quads to visualize culling behaviour
     4        https://bugs.webkit.org/show_bug.cgi?id=85414
     5
     6        Reviewed by Adrienne Walker.
     7
     8        * tests/CCQuadCullerTest.cpp:
     9        (WebCore::appendQuads):
     10        * tests/MockCCQuadCuller.h:
     11        (WebCore::MockCCQuadCuller::MockCCQuadCuller):
     12
    1132012-05-08  Tony Chang  <tony@chromium.org>
    214
  • trunk/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp

    r114601 r116481  
    9292{
    9393    occlusionTracker.enterLayer(it);
    94     CCQuadCuller quadCuller(quadList, layer, &occlusionTracker);
     94    CCQuadCuller quadCuller(quadList, layer, &occlusionTracker, false);
    9595    OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState();
    9696    bool hadMissingTiles = false;
  • trunk/Source/WebKit/chromium/tests/MockCCQuadCuller.h

    r111700 r116481  
    3636public:
    3737    MockCCQuadCuller()
    38         : CCQuadCuller(m_quadListStorage, 0, 0)
     38        : CCQuadCuller(m_quadListStorage, 0, 0, false)
    3939        , m_activeQuadList(m_quadListStorage)
    4040    { }
    4141
    4242    explicit MockCCQuadCuller(CCQuadList& externalQuadList)
    43         : CCQuadCuller(externalQuadList, 0, 0)
     43        : CCQuadCuller(externalQuadList, 0, 0, false)
    4444        , m_activeQuadList(externalQuadList)
    4545    { }
Note: See TracChangeset for help on using the changeset viewer.