swr/rast: Rasterized Subspans stats support
authorGeorge Kyriazis <george.kyriazis@intel.com>
Fri, 23 Feb 2018 22:11:04 +0000 (16:11 -0600)
committerGeorge Kyriazis <george.kyriazis@intel.com>
Fri, 9 Mar 2018 15:35:47 +0000 (09:35 -0600)
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp
src/gallium/drivers/swr/rasterizer/archrast/events.proto
src/gallium/drivers/swr/rasterizer/archrast/events_private.proto
src/gallium/drivers/swr/rasterizer/core/rasterizer_impl.h

index 8c09411029fc09aa0ccff20b03aa3b1bcea6508a..918616157ebc342967bd8e8ab58eb5f203b04a97 100644 (file)
@@ -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 = {};
 
     };
 
index 638dfd067c655b4220336c8fa1fc1d4674dac613..4a71e0d36a35b59e6ac1915fbdeb10d3c5f6593b 100644 (file)
@@ -256,6 +256,12 @@ event TessPrims
     uint64_t primCount;
 };
 
+event RasterTiles
+{
+    uint32_t drawId;
+    uint32_t rastTileCount;
+};
+
 event ClipperEvent
 {
     uint32_t drawId;
index 8970141d60bdf40fc8a9a247ff3d4a066936fac3..a07c4a7f13646bae164fab04fec407e72e5d6796 100644 (file)
@@ -95,6 +95,12 @@ event TessPrimCount
     uint64_t primCount;
 };
 
+event RasterTileCount
+{
+    uint32_t drawId;
+    uint64_t rasterTiles;
+};
+
 event GSPrimInfo
 {
     uint64_t inputPrimCount;
index 62856cce8bf5e5ba8a5917dafb6058428e80af89..7f9b3788c7f364640cea1bb6bd2a216fe38a7178 100644 (file)
@@ -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);