[Mesa-dev] [PATCH 2/9] swr/rast: Rasterized Subspans stats support

George Kyriazis george.kyriazis at intel.com
Thu Mar 8 01:32:04 UTC 2018


---
 src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp  | 15 +++++++++++++++
 src/gallium/drivers/swr/rasterizer/archrast/events.proto  |  6 ++++++
 .../drivers/swr/rasterizer/archrast/events_private.proto  |  6 ++++++
 src/gallium/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 8c09411..9186161 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 638dfd0..4a71e0d 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 8970141..a07c4a7 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 62856cc..7f9b378 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.7.4



More information about the mesa-dev mailing list