From: Tim Rowley Date: Tue, 11 Oct 2016 17:42:35 +0000 (-0500) Subject: swr: [rasterizer archrast] fix event file issue with saving data X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bf1f46216cbe9e293e51a44187ee53a5b883c848;p=mesa.git 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 --- diff --git a/src/gallium/drivers/swr/rasterizer/archrast/events.proto b/src/gallium/drivers/swr/rasterizer/archrast/events.proto index 6dccad61c45..4ddb7c988c0 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 6e7495cdc50..a8864c7d7bc 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 c1576f7b317..e5c94c7a8d6 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 2e3b5c32464..1924b15ca32 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