From 9e25f298eb169c03a566eaea07cf2cc1329012fe Mon Sep 17 00:00:00 2001 From: George Kyriazis Date: Fri, 23 Feb 2018 16:11:04 -0600 Subject: [PATCH] swr/rast: Rasterized Subspans stats support Reviewed-by: Bruce Cherniak --- .../drivers/swr/rasterizer/archrast/archrast.cpp | 15 +++++++++++++++ .../drivers/swr/rasterizer/archrast/events.proto | 6 ++++++ .../swr/rasterizer/archrast/events_private.proto | 6 ++++++ .../drivers/swr/rasterizer/core/rasterizer_impl.h | 3 +++ 4 files changed, 30 insertions(+) diff --git a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp index 8c09411029f..918616157eb 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp +++ b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp @@ -68,6 +68,11 @@ namespace ArchRast uint32_t vertsInput; }; + struct RastStats + { + uint32_t rasterTiles = 0; + }; + ////////////////////////////////////////////////////////////////////////// /// @brief Event handler that saves stat events to event files. This /// handler filters out unwanted events. @@ -227,12 +232,16 @@ namespace ArchRast EventHandlerFile::Handle(EarlyZNullPS(drawId, mDSNullPS.earlyZTestPassCount, mDSNullPS.earlyZTestFailCount)); EventHandlerFile::Handle(EarlyStencilNullPS(drawId, mDSNullPS.earlyStencilTestPassCount, mDSNullPS.earlyStencilTestFailCount)); + // Rasterized Subspans + EventHandlerFile::Handle(RasterTiles(drawId, rastStats.rasterTiles)); + //Reset Internal Counters mDSSingleSample = {}; mDSSampleRate = {}; mDSPixelRate = {}; mDSNullPS = {}; + rastStats = {}; mNeedFlush = false; } @@ -267,6 +276,11 @@ namespace ArchRast mTS.inputPrims += event.data.primCount; } + virtual void Handle(const RasterTileCount& event) + { + rastStats.rasterTiles += event.data.rasterTiles; + } + protected: bool mNeedFlush; // Per draw stats @@ -278,6 +292,7 @@ namespace ArchRast CStats mClipper = {}; TEStats mTS = {}; GSStats mGS = {}; + RastStats rastStats = {}; }; diff --git a/src/gallium/drivers/swr/rasterizer/archrast/events.proto b/src/gallium/drivers/swr/rasterizer/archrast/events.proto index 638dfd067c6..4a71e0d36a3 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/events.proto +++ b/src/gallium/drivers/swr/rasterizer/archrast/events.proto @@ -256,6 +256,12 @@ event TessPrims uint64_t primCount; }; +event RasterTiles +{ + uint32_t drawId; + uint32_t rastTileCount; +}; + event ClipperEvent { uint32_t drawId; diff --git a/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto b/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto index 8970141d60b..a07c4a7f136 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto +++ b/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto @@ -95,6 +95,12 @@ event TessPrimCount uint64_t primCount; }; +event RasterTileCount +{ + uint32_t drawId; + uint64_t rasterTiles; +}; + event GSPrimInfo { uint64_t inputPrimCount; diff --git a/src/gallium/drivers/swr/rasterizer/core/rasterizer_impl.h b/src/gallium/drivers/swr/rasterizer/core/rasterizer_impl.h index 62856cce8bf..7f9b3788c7f 100644 --- a/src/gallium/drivers/swr/rasterizer/core/rasterizer_impl.h +++ b/src/gallium/drivers/swr/rasterizer/core/rasterizer_impl.h @@ -1268,6 +1268,9 @@ void RasterizeTriangle(DRAW_CONTEXT* pDC, uint32_t workerId, uint32_t macroTile, UnrollerL<1, RT::MT::numSamples, 1>::step(copyCoverage); } + // Track rasterized subspans + AR_EVENT(RasterTileCount(pDC->drawId, 1)); + RDTSC_BEGIN(BEPixelBackend, pDC->drawId); backendFuncs.pfnBackend(pDC, workerId, tileX << KNOB_TILE_X_DIM_SHIFT, tileY << KNOB_TILE_Y_DIM_SHIFT, triDesc, renderBuffers); RDTSC_END(BEPixelBackend, 0); -- 2.30.2