Mesa (master): swr: [rasterizer archrast] fix event file issue with saving data

Tim Rowley torowley at kemper.freedesktop.org
Fri Oct 14 05:10:03 UTC 2016


Module: Mesa
Branch: master
Commit: bf1f46216cbe9e293e51a44187ee53a5b883c848
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bf1f46216cbe9e293e51a44187ee53a5b883c848

Author: Tim Rowley <timothy.o.rowley at intel.com>
Date:   Tue Oct 11 12:42:35 2016 -0500

swr: [rasterizer archrast] fix event file issue with saving data

Also, tagging stats with draw id to correlate these events with
draw/dispatch events.

Signed-off-by: Tim Rowley <timothy.o.rowley at intel.com>

---

 .../drivers/swr/rasterizer/archrast/events.proto       |  8 +++++---
 src/gallium/drivers/swr/rasterizer/core/threads.cpp    |  2 +-
 .../rasterizer/scripts/templates/ar_event_h.template   | 18 +++++++++++++++---
 .../scripts/templates/ar_eventhandlerfile_h.template   |  2 +-
 4 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/archrast/events.proto b/src/gallium/drivers/swr/rasterizer/archrast/events.proto
index 6dccad6..4ddb7c9 100644
--- a/src/gallium/drivers/swr/rasterizer/archrast/events.proto
+++ b/src/gallium/drivers/swr/rasterizer/archrast/events.proto
@@ -99,7 +99,7 @@ event End
 
 event DrawInstancedEvent
 {
-    uint32_t id;
+    uint32_t drawId;
     uint32_t topology;
     uint32_t numVertices;
     int32_t  startVertex;
@@ -109,7 +109,7 @@ event DrawInstancedEvent
 
 event DrawIndexedInstancedEvent
 {
-    uint32_t id;
+    uint32_t drawId;
     uint32_t topology;
     uint32_t numIndices;
     int32_t  indexOffset;
@@ -120,7 +120,7 @@ event DrawIndexedInstancedEvent
 
 event DispatchEvent
 {
-    uint32_t id;
+    uint32_t drawId;
     uint32_t threadGroupCountX;
     uint32_t threadGroupCountY;
     uint32_t threadGroupCountZ;
@@ -134,6 +134,7 @@ event FrameEndEvent
 
 event FrontendStatsEvent
 {
+    uint32_t drawId;
     uint64_t IaVertices;
     uint64_t IaPrimitives;
     uint64_t VsInvocations;
@@ -155,6 +156,7 @@ event FrontendStatsEvent
 
 event BackendStatsEvent
 {
+    uint32_t drawId;
     uint64_t DepthPassCount;
     uint64_t PsInvocations;
     uint64_t CsInvocations;
diff --git a/src/gallium/drivers/swr/rasterizer/core/threads.cpp b/src/gallium/drivers/swr/rasterizer/core/threads.cpp
index 6e7495c..a8864c7 100644
--- a/src/gallium/drivers/swr/rasterizer/core/threads.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/threads.cpp
@@ -570,7 +570,7 @@ INLINE void CompleteDrawFE(SWR_CONTEXT* pContext, uint32_t workerId, DRAW_CONTEX
     {
         SWR_STATS_FE& stats = pDC->dynState.statsFE;
 
-        AR_EVENT(FrontendStatsEvent(
+        AR_EVENT(FrontendStatsEvent(pDC->drawId,
             stats.IaVertices, stats.IaPrimitives, stats.VsInvocations, stats.HsInvocations,
             stats.DsInvocations, stats.GsInvocations, stats.GsPrimitives, stats.CInvocations, stats.CPrimitives,
             stats.SoPrimStorageNeeded[0], stats.SoPrimStorageNeeded[1], stats.SoPrimStorageNeeded[2], stats.SoPrimStorageNeeded[3],
diff --git a/src/gallium/drivers/swr/rasterizer/scripts/templates/ar_event_h.template b/src/gallium/drivers/swr/rasterizer/scripts/templates/ar_event_h.template
index c1576f7..e5c94c7 100644
--- a/src/gallium/drivers/swr/rasterizer/scripts/templates/ar_event_h.template
+++ b/src/gallium/drivers/swr/rasterizer/scripts/templates/ar_event_h.template
@@ -56,9 +56,10 @@ namespace ArchRast
 % for name in protos['event_names']:
 
     //////////////////////////////////////////////////////////////////////////
-    /// ${name}
+    /// ${name}Data
     //////////////////////////////////////////////////////////////////////////
-    struct ${name} : Event
+#pragma pack(push, 1)
+    struct ${name}Data
     {<%
         field_names = protos['events'][name]['field_names']
         field_types = protos['events'][name]['field_types'] %>
@@ -66,6 +67,17 @@ namespace ArchRast
         % for i in range(len(field_names)):
         ${field_types[i]} ${field_names[i]};
         % endfor
+    };
+#pragma pack(pop)
+
+    //////////////////////////////////////////////////////////////////////////
+    /// ${name}
+    //////////////////////////////////////////////////////////////////////////
+    struct ${name} : Event
+    {<%
+        field_names = protos['events'][name]['field_names']
+        field_types = protos['events'][name]['field_types'] %>
+        ${name}Data data;
 
         // Constructor
         ${name}(
@@ -79,7 +91,7 @@ namespace ArchRast
         % endfor
         {
         % for i in range(len(field_names)):
-            this->${field_names[i]} = ${field_names[i]};
+            data.${field_names[i]} = ${field_names[i]};
         % endfor
         }
 
diff --git a/src/gallium/drivers/swr/rasterizer/scripts/templates/ar_eventhandlerfile_h.template b/src/gallium/drivers/swr/rasterizer/scripts/templates/ar_eventhandlerfile_h.template
index 2e3b5c3..1924b15 100644
--- a/src/gallium/drivers/swr/rasterizer/scripts/templates/ar_eventhandlerfile_h.template
+++ b/src/gallium/drivers/swr/rasterizer/scripts/templates/ar_eventhandlerfile_h.template
@@ -83,7 +83,7 @@ namespace ArchRast
 % for name in protos['event_names']:
         virtual void handle(${name}& event)
         {
-            write(${protos['events'][name]['event_id']}, (char*)&event, sizeof(event));
+            write(${protos['events'][name]['event_id']}, (char*)&event.data, sizeof(event.data));
         }
 % endfor
 




More information about the mesa-commit mailing list