From: Eric Engestrom Date: Fri, 1 Mar 2019 16:37:31 +0000 (+0000) Subject: Revert "swr/rast: Archrast codegen updates" X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fc82ea13508766c5cdd45fc443bac55d72bc2760;p=mesa.git Revert "swr/rast: Archrast codegen updates" This reverts the following commits: 71a76a47ccb34c5c259781ed49b0013e86dfaa31 "swr/codegen: fix autotools build" 7763e664cefd1e394101b37fbc552b50f820f44a "meson/swr: replace hard-coded path with current_build_dir()" 773b3ceacaf6d32135348e07878b8514a4350b0e "swr/rast: Fix autotools and scons codegen" 16e10b8c304481e423e76311f70de5de9e7424b1 "swr/rast: Add general SWTag statistics" b45a15a39f7630d569fcf1296dac1415eb758249 "swr/rast: Add string handling to AR event framework" 8608a747aafe6aef42fba148bfcdbb3ca136e7de "swr/rast: Add initial SWTag proto definitions" 93cd9905c8fbb98985ae1a61c0eebdb225fd1325 "swr/rast: Cleanup and generalize gen_archrast" The last one in this list broke all the build systems that can build this (meson, autotools & scons). See MR !304 for more details: https://gitlab.freedesktop.org/mesa/mesa/merge_requests/304 Signed-off-by: Eric Engestrom --- diff --git a/src/gallium/drivers/swr/Makefile.am b/src/gallium/drivers/swr/Makefile.am index c111d31a874..3390ef6b096 100644 --- a/src/gallium/drivers/swr/Makefile.am +++ b/src/gallium/drivers/swr/Makefile.am @@ -82,10 +82,10 @@ BUILT_SOURCES = \ rasterizer/jitter/gen_builder.hpp \ rasterizer/jitter/gen_builder_meta.hpp \ rasterizer/jitter/gen_builder_intrin.hpp \ - rasterizer/codegen/gen_ar_event.hpp \ - rasterizer/codegen/gen_ar_event.cpp \ - rasterizer/codegen/gen_ar_eventhandler.hpp \ - rasterizer/codegen/gen_ar_eventhandlerfile.hpp \ + rasterizer/archrast/gen_ar_event.hpp \ + rasterizer/archrast/gen_ar_event.cpp \ + rasterizer/archrast/gen_ar_eventhandler.hpp \ + rasterizer/archrast/gen_ar_eventhandlerfile.hpp \ rasterizer/core/backends/gen_BackendPixelRate0.cpp \ rasterizer/core/backends/gen_BackendPixelRate1.cpp \ rasterizer/core/backends/gen_BackendPixelRate2.cpp \ @@ -155,36 +155,44 @@ rasterizer/jitter/gen_builder_intrin.hpp: rasterizer/codegen/gen_llvm_ir_macros. --gen_intrin_h $(AM_V_GEN)touch $@ -rasterizer/codegen/gen_ar_event.hpp: rasterizer/codegen/gen_archrast.py rasterizer/codegen/templates/gen_ar_event.hpp rasterizer/archrast/events.proto rasterizer/archrast/events_private.proto rasterizer/codegen/gen_common.py +rasterizer/archrast/gen_ar_event.hpp: rasterizer/codegen/gen_archrast.py rasterizer/codegen/templates/gen_ar_event.hpp rasterizer/archrast/events.proto rasterizer/archrast/events_private.proto rasterizer/codegen/gen_common.py $(MKDIR_GEN) $(PYTHON_GEN) \ $(srcdir)/rasterizer/codegen/gen_archrast.py \ - --proto $(srcdir)/rasterizer/archrast/events.proto $(srcdir)/rasterizer/archrast/events_private.proto \ - --output-dir rasterizer/codegen + --proto $(srcdir)/rasterizer/archrast/events.proto \ + --proto_private $(srcdir)/rasterizer/archrast/events_private.proto \ + --output rasterizer/archrast/gen_ar_event.hpp \ + --gen_event_hpp $(AM_V_GEN)touch $@ -rasterizer/codegen/gen_ar_event.cpp: rasterizer/codegen/gen_archrast.py rasterizer/codegen/templates/gen_ar_event.cpp rasterizer/archrast/events.proto rasterizer/archrast/events_private.proto rasterizer/codegen/gen_common.py +rasterizer/archrast/gen_ar_event.cpp: rasterizer/codegen/gen_archrast.py rasterizer/codegen/templates/gen_ar_event.cpp rasterizer/archrast/events.proto rasterizer/archrast/events_private.proto rasterizer/codegen/gen_common.py $(MKDIR_GEN) $(PYTHON_GEN) \ $(srcdir)/rasterizer/codegen/gen_archrast.py \ - --proto $(srcdir)/rasterizer/archrast/events.proto $(srcdir)/rasterizer/archrast/events_private.proto \ - --output-dir rasterizer/codegen + --proto $(srcdir)/rasterizer/archrast/events.proto \ + --proto_private $(srcdir)/rasterizer/archrast/events_private.proto \ + --output rasterizer/archrast/gen_ar_event.cpp \ + --gen_event_cpp $(AM_V_GEN)touch $@ -rasterizer/codegen/gen_ar_eventhandler.hpp: rasterizer/codegen/gen_archrast.py rasterizer/codegen/templates/gen_ar_eventhandler.hpp rasterizer/archrast/events.proto rasterizer/archrast/events_private.proto rasterizer/codegen/gen_common.py +rasterizer/archrast/gen_ar_eventhandler.hpp: rasterizer/codegen/gen_archrast.py rasterizer/codegen/templates/gen_ar_eventhandler.hpp rasterizer/archrast/events.proto rasterizer/archrast/events_private.proto rasterizer/codegen/gen_common.py $(MKDIR_GEN) $(PYTHON_GEN) \ $(srcdir)/rasterizer/codegen/gen_archrast.py \ - --proto $(srcdir)/rasterizer/archrast/events.proto $(srcdir)/rasterizer/archrast/events_private.proto \ - --output-dir rasterizer/codegen + --proto $(srcdir)/rasterizer/archrast/events.proto \ + --proto_private $(srcdir)/rasterizer/archrast/events_private.proto \ + --output rasterizer/archrast/gen_ar_eventhandler.hpp \ + --gen_eventhandler_hpp $(AM_V_GEN)touch $@ -rasterizer/codegen/gen_ar_eventhandlerfile.hpp: rasterizer/codegen/gen_archrast.py rasterizer/codegen/templates/gen_ar_eventhandlerfile.hpp rasterizer/archrast/events.proto rasterizer/archrast/events_private.proto rasterizer/codegen/gen_common.py +rasterizer/archrast/gen_ar_eventhandlerfile.hpp: rasterizer/codegen/gen_archrast.py rasterizer/codegen/templates/gen_ar_eventhandlerfile.hpp rasterizer/archrast/events.proto rasterizer/archrast/events_private.proto rasterizer/codegen/gen_common.py $(MKDIR_GEN) $(PYTHON_GEN) \ $(srcdir)/rasterizer/codegen/gen_archrast.py \ - --proto $(srcdir)/rasterizer/archrast/events.proto $(srcdir)/rasterizer/archrast/events_private.proto \ - --output-dir rasterizer/codegen + --proto $(srcdir)/rasterizer/archrast/events.proto \ + --proto_private $(srcdir)/rasterizer/archrast/events_private.proto \ + --output rasterizer/archrast/gen_ar_eventhandlerfile.hpp \ + --gen_eventhandlerfile_hpp $(AM_V_GEN)touch $@ rasterizer/core/backends/gen_BackendPixelRate0.cpp \ diff --git a/src/gallium/drivers/swr/SConscript b/src/gallium/drivers/swr/SConscript index 6d2d31a5260..a89d02c5db0 100644 --- a/src/gallium/drivers/swr/SConscript +++ b/src/gallium/drivers/swr/SConscript @@ -106,7 +106,7 @@ env.CodeGenerate( target = 'rasterizer/archrast/gen_ar_event.hpp', script = swrroot + 'rasterizer/codegen/gen_archrast.py', source = 'rasterizer/archrast/events.proto', - command = python_cmd + ' $SCRIPT --proto $SOURCE ' + srcroot + '/rasterizer/archrast/events_private.proto --output-dir ' + bldroot + '/rasterizer/archrast' + command = python_cmd + ' $SCRIPT --proto $SOURCE --proto_private ' + srcroot + '/rasterizer/archrast/events_private.proto --output $TARGET --gen_event_hpp' ) Depends('rasterizer/archrast/gen_ar_event.hpp', swrroot + 'rasterizer/archrast/events_private.proto') @@ -117,7 +117,7 @@ env.CodeGenerate( target = 'rasterizer/archrast/gen_ar_event.cpp', script = swrroot + 'rasterizer/codegen/gen_archrast.py', source = 'rasterizer/archrast/events.proto', - command = python_cmd + ' $SCRIPT --proto $SOURCE ' + srcroot + '/rasterizer/archrast/events_private.proto --output-dir ' + bldroot + '/rasterizer/archrast' + command = python_cmd + ' $SCRIPT --proto $SOURCE --proto_private ' + srcroot + '/rasterizer/archrast/events_private.proto --output $TARGET --gen_event_cpp' ) Depends('rasterizer/archrast/gen_ar_event.cpp', swrroot + 'rasterizer/archrast/events_private.proto') @@ -128,7 +128,7 @@ env.CodeGenerate( target = 'rasterizer/archrast/gen_ar_eventhandler.hpp', script = swrroot + 'rasterizer/codegen/gen_archrast.py', source = 'rasterizer/archrast/events.proto', - command = python_cmd + ' $SCRIPT --proto $SOURCE ' + srcroot + '/rasterizer/archrast/events_private.proto --output-dir ' + bldroot + '/rasterizer/archrast' + command = python_cmd + ' $SCRIPT --proto $SOURCE --proto_private ' + srcroot + '/rasterizer/archrast/events_private.proto --output $TARGET --gen_eventhandler_hpp' ) Depends('rasterizer/archrast/gen_ar_eventhandler.hpp', swrroot + 'rasterizer/archrast/events_private.proto') @@ -139,7 +139,7 @@ env.CodeGenerate( target = 'rasterizer/archrast/gen_ar_eventhandlerfile.hpp', script = swrroot + 'rasterizer/codegen/gen_archrast.py', source = 'rasterizer/archrast/events.proto', - command = python_cmd + ' $SCRIPT --proto $SOURCE ' + srcroot + '/rasterizer/archrast/events_private.proto --output-dir ' + bldroot + '/rasterizer/archrast' + command = python_cmd + ' $SCRIPT --proto $SOURCE --proto_private ' + srcroot + '/rasterizer/archrast/events_private.proto --output $TARGET --gen_eventhandlerfile_hpp' ) Depends('rasterizer/archrast/gen_ar_eventhandlerfile.hpp', swrroot + 'rasterizer/archrast/events_private.proto') diff --git a/src/gallium/drivers/swr/rasterizer/archrast/events.proto b/src/gallium/drivers/swr/rasterizer/archrast/events.proto index 1057a9437be..fdf39ee34e6 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/events.proto +++ b/src/gallium/drivers/swr/rasterizer/archrast/events.proto @@ -96,371 +96,330 @@ event SwrStoreTilesEvent event FrontendStatsEvent { uint32_t drawId; - uint64_t counter IaVertices; - uint64_t counter IaPrimitives; - uint64_t counter VsInvocations; - uint64_t counter HsInvocations; - uint64_t counter DsInvocations; - uint64_t counter GsInvocations; - uint64_t counter GsPrimitives; - uint64_t counter CInvocations; - uint64_t counter CPrimitives; - uint64_t counter SoPrimStorageNeeded0; - uint64_t counter SoPrimStorageNeeded1; - uint64_t counter SoPrimStorageNeeded2; - uint64_t counter SoPrimStorageNeeded3; - uint64_t counter SoNumPrimsWritten0; - uint64_t counter SoNumPrimsWritten1; - uint64_t counter SoNumPrimsWritten2; - uint64_t counter SoNumPrimsWritten3; + uint64_t IaVertices; + uint64_t IaPrimitives; + uint64_t VsInvocations; + uint64_t HsInvocations; + uint64_t DsInvocations; + uint64_t GsInvocations; + uint64_t GsPrimitives; + uint64_t CInvocations; + uint64_t CPrimitives; + uint64_t SoPrimStorageNeeded0; + uint64_t SoPrimStorageNeeded1; + uint64_t SoPrimStorageNeeded2; + uint64_t SoPrimStorageNeeded3; + uint64_t SoNumPrimsWritten0; + uint64_t SoNumPrimsWritten1; + uint64_t SoNumPrimsWritten2; + uint64_t SoNumPrimsWritten3; }; event BackendStatsEvent { uint32_t drawId; - uint64_t counter DepthPassCount; - uint64_t counter PsInvocations; - uint64_t counter CsInvocations; + uint64_t DepthPassCount; + uint64_t PsInvocations; + uint64_t CsInvocations; }; event EarlyZSingleSample { uint32_t drawId; - uint64_t counter passCount; - uint64_t counter failCount; -}; + uint64_t passCount; + uint64_t failCount; +}; event LateZSingleSample { uint32_t drawId; - uint64_t counter passCount; - uint64_t counter failCount; + uint64_t passCount; + uint64_t failCount; }; event EarlyStencilSingleSample { uint32_t drawId; - uint64_t counter passCount; - uint64_t counter failCount; + uint64_t passCount; + uint64_t failCount; }; event LateStencilSingleSample { uint32_t drawId; - uint64_t counter passCount; - uint64_t counter failCount; + uint64_t passCount; + uint64_t failCount; }; event EarlyZSampleRate { uint32_t drawId; - uint64_t counter passCount; - uint64_t counter failCount; -}; + uint64_t passCount; + uint64_t failCount; +}; event LateZSampleRate { uint32_t drawId; - uint64_t counter passCount; - uint64_t counter failCount; + uint64_t passCount; + uint64_t failCount; }; event EarlyStencilSampleRate { uint32_t drawId; - uint64_t counter passCount; - uint64_t counter failCount; + uint64_t passCount; + uint64_t failCount; }; event LateStencilSampleRate { uint32_t drawId; - uint64_t counter passCount; - uint64_t counter failCount; + uint64_t passCount; + uint64_t failCount; }; // Total Early-Z counts, SingleSample and SampleRate event EarlyZ { uint32_t drawId; - uint64_t counter passCount; - uint64_t counter failCount; -}; + uint64_t passCount; + uint64_t failCount; +}; // Total LateZ counts, SingleSample and SampleRate event LateZ { uint32_t drawId; - uint64_t counter passCount; - uint64_t counter failCount; + uint64_t passCount; + uint64_t failCount; }; // Total EarlyStencil counts, SingleSample and SampleRate event EarlyStencil { uint32_t drawId; - uint64_t counter passCount; - uint64_t counter failCount; + uint64_t passCount; + uint64_t failCount; }; // Total LateStencil counts, SingleSample and SampleRate event LateStencil { uint32_t drawId; - uint64_t counter passCount; - uint64_t counter failCount; + uint64_t passCount; + uint64_t failCount; }; event EarlyZNullPS { uint32_t drawId; - uint64_t counter passCount; - uint64_t counter failCount; + uint64_t passCount; + uint64_t failCount; }; event EarlyStencilNullPS { uint32_t drawId; - uint64_t counter passCount; - uint64_t counter failCount; + uint64_t passCount; + uint64_t failCount; }; event EarlyZPixelRate { uint32_t drawId; - uint64_t counter passCount; - uint64_t counter failCount; + uint64_t passCount; + uint64_t failCount; }; event LateZPixelRate { uint32_t drawId; - uint64_t counter passCount; - uint64_t counter failCount; + uint64_t passCount; + uint64_t failCount; }; event EarlyOmZ { uint32_t drawId; - uint64_t counter passCount; - uint64_t counter failCount; + uint64_t passCount; + uint64_t failCount; }; event EarlyOmStencil { uint32_t drawId; - uint64_t counter passCount; - uint64_t counter failCount; + uint64_t passCount; + uint64_t failCount; }; event LateOmZ { uint32_t drawId; - uint64_t counter passCount; - uint64_t counter failCount; + uint64_t passCount; + uint64_t failCount; }; event LateOmStencil { uint32_t drawId; - uint64_t counter passCount; - uint64_t counter failCount; + uint64_t passCount; + uint64_t failCount; }; event GSInputPrims { uint32_t drawId; - uint64_t counter inputPrimCount; + uint64_t inputPrimCount; }; event GSPrimsGen { uint32_t drawId; - uint64_t counter primGeneratedCount; + uint64_t primGeneratedCount; }; event GSVertsInput { uint32_t drawId; - uint64_t counter vertsInput; + uint64_t vertsInput; }; event TessPrims { uint32_t drawId; - uint64_t counter primCount; + uint64_t primCount; }; event RasterTiles { uint32_t drawId; - uint32_t counter rastTileCount; + uint32_t rastTileCount; }; event ClipperEvent { uint32_t drawId; - uint32_t counter trivialRejectCount; - uint32_t counter trivialAcceptCount; - uint32_t counter mustClipCount; + uint32_t trivialRejectCount; + uint32_t trivialAcceptCount; + uint32_t mustClipCount; }; event CullEvent { uint32_t drawId; - uint64_t counter backfacePrimCount; - uint64_t counter degeneratePrimCount; + uint64_t backfacePrimCount; + uint64_t degeneratePrimCount; }; event AlphaEvent { uint32_t drawId; - uint32_t counter alphaTestCount; - uint32_t counter alphaBlendCount; + uint32_t alphaTestCount; + uint32_t alphaBlendCount; }; event VSInfo { uint32_t drawId; - uint32_t counter numInstExecuted; - uint32_t counter numSampleExecuted; - uint32_t counter numSampleLExecuted; - uint32_t counter numSampleBExecuted; - uint32_t counter numSampleCExecuted; - uint32_t counter numSampleCLZExecuted; - uint32_t counter numSampleCDExecuted; - uint32_t counter numGather4Executed; - uint32_t counter numGather4CExecuted; - uint32_t counter numGather4CPOExecuted; - uint32_t counter numGather4CPOCExecuted; - uint32_t counter numLodExecuted; + uint32_t numInstExecuted; + uint32_t numSampleExecuted; + uint32_t numSampleLExecuted; + uint32_t numSampleBExecuted; + uint32_t numSampleCExecuted; + uint32_t numSampleCLZExecuted; + uint32_t numSampleCDExecuted; + uint32_t numGather4Executed; + uint32_t numGather4CExecuted; + uint32_t numGather4CPOExecuted; + uint32_t numGather4CPOCExecuted; + uint32_t numLodExecuted; }; event HSInfo { uint32_t drawId; - uint32_t counter numInstExecuted; - uint32_t counter numSampleExecuted; - uint32_t counter numSampleLExecuted; - uint32_t counter numSampleBExecuted; - uint32_t counter numSampleCExecuted; - uint32_t counter numSampleCLZExecuted; - uint32_t counter numSampleCDExecuted; - uint32_t counter numGather4Executed; - uint32_t counter numGather4CExecuted; - uint32_t counter numGather4CPOExecuted; - uint32_t counter numGather4CPOCExecuted; - uint32_t counter numLodExecuted; + uint32_t numInstExecuted; + uint32_t numSampleExecuted; + uint32_t numSampleLExecuted; + uint32_t numSampleBExecuted; + uint32_t numSampleCExecuted; + uint32_t numSampleCLZExecuted; + uint32_t numSampleCDExecuted; + uint32_t numGather4Executed; + uint32_t numGather4CExecuted; + uint32_t numGather4CPOExecuted; + uint32_t numGather4CPOCExecuted; + uint32_t numLodExecuted; }; event DSInfo { uint32_t drawId; - uint32_t counter numInstExecuted; - uint32_t counter numSampleExecuted; - uint32_t counter numSampleLExecuted; - uint32_t counter numSampleBExecuted; - uint32_t counter numSampleCExecuted; - uint32_t counter numSampleCLZExecuted; - uint32_t counter numSampleCDExecuted; - uint32_t counter numGather4Executed; - uint32_t counter numGather4CExecuted; - uint32_t counter numGather4CPOExecuted; - uint32_t counter numGather4CPOCExecuted; - uint32_t counter numLodExecuted; + uint32_t numInstExecuted; + uint32_t numSampleExecuted; + uint32_t numSampleLExecuted; + uint32_t numSampleBExecuted; + uint32_t numSampleCExecuted; + uint32_t numSampleCLZExecuted; + uint32_t numSampleCDExecuted; + uint32_t numGather4Executed; + uint32_t numGather4CExecuted; + uint32_t numGather4CPOExecuted; + uint32_t numGather4CPOCExecuted; + uint32_t numLodExecuted; }; event GSInfo { uint32_t drawId; - uint32_t counter numInstExecuted; - uint32_t counter numSampleExecuted; - uint32_t counter numSampleLExecuted; - uint32_t counter numSampleBExecuted; - uint32_t counter numSampleCExecuted; - uint32_t counter numSampleCLZExecuted; - uint32_t counter numSampleCDExecuted; - uint32_t counter numGather4Executed; - uint32_t counter numGather4CExecuted; - uint32_t counter numGather4CPOExecuted; - uint32_t counter numGather4CPOCExecuted; - uint32_t counter numLodExecuted; + uint32_t numInstExecuted; + uint32_t numSampleExecuted; + uint32_t numSampleLExecuted; + uint32_t numSampleBExecuted; + uint32_t numSampleCExecuted; + uint32_t numSampleCLZExecuted; + uint32_t numSampleCDExecuted; + uint32_t numGather4Executed; + uint32_t numGather4CExecuted; + uint32_t numGather4CPOExecuted; + uint32_t numGather4CPOCExecuted; + uint32_t numLodExecuted; }; event PSInfo { uint32_t drawId; - uint32_t counter numInstExecuted; - uint32_t counter numSampleExecuted; - uint32_t counter numSampleLExecuted; - uint32_t counter numSampleBExecuted; - uint32_t counter numSampleCExecuted; - uint32_t counter numSampleCLZExecuted; - uint32_t counter numSampleCDExecuted; - uint32_t counter numGather4Executed; - uint32_t counter numGather4CExecuted; - uint32_t counter numGather4CPOExecuted; - uint32_t counter numGather4CPOCExecuted; - uint32_t counter numLodExecuted; + uint32_t numInstExecuted; + uint32_t numSampleExecuted; + uint32_t numSampleLExecuted; + uint32_t numSampleBExecuted; + uint32_t numSampleCExecuted; + uint32_t numSampleCLZExecuted; + uint32_t numSampleCDExecuted; + uint32_t numGather4Executed; + uint32_t numGather4CExecuted; + uint32_t numGather4CPOExecuted; + uint32_t numGather4CPOCExecuted; + uint32_t numLodExecuted; }; event CSInfo { uint32_t drawId; - uint32_t counter numInstExecuted; - uint32_t counter numSampleExecuted; - uint32_t counter numSampleLExecuted; - uint32_t counter numSampleBExecuted; - uint32_t counter numSampleCExecuted; - uint32_t counter numSampleCLZExecuted; - uint32_t counter numSampleCDExecuted; - uint32_t counter numGather4Executed; - uint32_t counter numGather4CExecuted; - uint32_t counter numGather4CPOExecuted; - uint32_t counter numGather4CPOCExecuted; - uint32_t counter numLodExecuted; -}; - -event SWTagFrameEvent -{ - uint64_t swTagFrame; -}; - -event SWTagRenderpassEvent -{ - uint64_t swTagFrame; - uint32_t swTagDrawOrDispatch; - uint32_t swTagDraw; - uint32_t swTagDispatch; - uint32_t swTagRenderpassCount; -}; - -event SWTagDrawEvent -{ - uint64_t swTagFrame; - uint32_t swTagDrawOrDispatch; - uint32_t swTagDraw; - uint32_t swTagDispatch; -}; - -event SWTagDispatchEvent -{ - uint64_t swTagFrame; - uint32_t swTagDrawOrDispatch; - uint32_t swTagDraw; - uint32_t swTagDispatch; -}; - -event SWTagFlushEvent -{ - uint64_t swTagFrame; - uint32_t swTagDrawOrDispatch; - uint32_t swTagDraw; - uint32_t swTagDispatch; - uint32_t swTagFlushCounter; - char swTagFlushReason[256]; - uint32_t swTagFlushType; + uint32_t numInstExecuted; + uint32_t numSampleExecuted; + uint32_t numSampleLExecuted; + uint32_t numSampleBExecuted; + uint32_t numSampleCExecuted; + uint32_t numSampleCLZExecuted; + uint32_t numSampleCDExecuted; + uint32_t numGather4Executed; + uint32_t numGather4CExecuted; + uint32_t numGather4CPOExecuted; + uint32_t numGather4CPOCExecuted; + uint32_t numLodExecuted; }; \ No newline at end of file diff --git a/src/gallium/drivers/swr/rasterizer/codegen/gen_archrast.py b/src/gallium/drivers/swr/rasterizer/codegen/gen_archrast.py index b4b6127c8cc..c5842aa48d2 100644 --- a/src/gallium/drivers/swr/rasterizer/codegen/gen_archrast.py +++ b/src/gallium/drivers/swr/rasterizer/codegen/gen_archrast.py @@ -27,40 +27,34 @@ import re from gen_common import * def parse_event_fields(lines, idx, event_dict): - """ - Parses lines from a proto file that contain an event definition and stores it in event_dict - """ - fields = [] + field_names = [] + field_types = [] end_of_event = False + num_fields = 0 + # record all fields in event definition. # note: we don't check if there's a leading brace. while not end_of_event and idx < len(lines): line = lines[idx].rstrip() idx += 1 - match = re.match(r'(\s*)([\w\*]+)(\s+)(counter\s+)*([\w]+)(\[\d+\])*', line) + field = re.match(r'(\s*)(\w+)(\s*)(\w+)', line) - if match: - field = { - "type": match.group(2), - "name": match.group(5), - "size": int(match.group(6)[1:-1]) if match.group(6) else 1, - "counter": True if match.group(4) else False - } - fields.append(field) + if field: + field_types.append(field.group(2)) + field_names.append(field.group(4)) + num_fields += 1 end_of_event = re.match(r'(\s*)};', line) - event_dict['fields'] = fields - event_dict['num_fields'] = len(fields) + event_dict['field_types'] = field_types + event_dict['field_names'] = field_names + event_dict['num_fields'] = num_fields return idx def parse_enums(lines, idx, event_dict): - """ - Parses lines from a proto file that contain an enum definition and stores it in event_dict - """ enum_names = [] end_of_enum = False @@ -83,122 +77,145 @@ def parse_enums(lines, idx, event_dict): event_dict['names'] = enum_names return idx -def parse_protos(files, verbose=False): - """ - Parses a proto file and returns a dictionary of event definitions - """ - protos = {} - protos['events'] = {} # event dictionary containing events with their fields - protos['event_names'] = [] # needed to keep events in order parsed. dict is not ordered. - protos['event_map'] = {} # dictionary to map event ids to event names - protos['enums'] = {} - protos['enum_names'] = [] - - eventId = 0 - - if type(files) is not list: - files = [files] - - for filename in files: - if verbose: - print("Parsing proto file: %s" % os.path.normpath(filename)) - - with open(filename, 'r') as f: - lines=f.readlines() +def parse_protos(protos, filename): - idx = 0 + with open(filename, 'r') as f: + lines=f.readlines() - raw_text = [] - while idx < len(lines): - line = lines[idx].rstrip() - idx += 1 + idx = 0 - # search for event definitions. - match = re.match(r'(\s*)event(\s*)(\w+)', line) + eventId = 0 + raw_text = [] + while idx < len(lines): + line = lines[idx].rstrip() + idx += 1 - if match: - eventId += 1 - event_name = match.group(3) - protos["event_names"].append(event_name) + # search for event definitions. + match = re.match(r'(\s*)event(\s*)(\w+)', line) - protos["events"][event_name] = {} - protos["events"][event_name]["event_id"] = eventId - protos["event_map"][eventId] = event_name - idx = parse_event_fields(lines, idx, protos["events"][event_name]) + if match: + eventId += 1 + event_name = match.group(3) + protos['event_names'].append(event_name) - # search for enums. - match = re.match(r'(\s*)enum(\s*)(\w+)', line) + protos['events'][event_name] = {} + protos['events'][event_name]['event_id'] = eventId + idx = parse_event_fields(lines, idx, protos['events'][event_name]) - if match: - enum_name = match.group(3) - protos["enum_names"].append(enum_name) + # search for enums. + match = re.match(r'(\s*)enum(\s*)(\w+)', line) - protos["enums"][enum_name] = {} - idx = parse_enums(lines, idx, protos["enums"][enum_name]) - return protos + if match: + enum_name = match.group(3) + protos['enum_names'].append(enum_name) + protos['enums'][enum_name] = {} + idx = parse_enums(lines, idx, protos['enums'][enum_name]) def main(): # Parse args... parser = ArgumentParser() - parser.add_argument("--proto", "-p", dest="protos", nargs='+', help="Path to all proto file(s) to process. Accepts one or more paths (i.e. events.proto and events_private.proto)", required=True) - parser.add_argument("--output-dir", help="Output dir (defaults to ./codegen). Will create folder if it does not exist.", required=False, default="codegen") - parser.add_argument("--verbose", "-v", help="Verbose", action="store_true") + parser.add_argument('--proto', '-p', help='Path to proto file', required=True) + parser.add_argument('--proto_private', '-pp', help='Path to private proto file', required=True) + parser.add_argument('--output', '-o', help='Output filename (i.e. event.hpp)', required=True) + parser.add_argument('--gen_event_hpp', help='Generate event header', action='store_true', default=False) + parser.add_argument('--gen_event_cpp', help='Generate event cpp', action='store_true', default=False) + parser.add_argument('--gen_eventhandler_hpp', help='Generate eventhandler header', action='store_true', default=False) + parser.add_argument('--gen_eventhandlerfile_hpp', help='Generate eventhandler header for writing to files', action='store_true', default=False) args = parser.parse_args() - if not os.path.exists(args.output_dir): - MakeDir(args.output_dir) + proto_filename = args.proto + proto_private_filename = args.proto_private - for f in args.protos: - if not os.path.exists(f): - print('Error: Could not find proto file %s' % f, file=sys.stderr) - return 1 + (output_dir, output_filename) = os.path.split(args.output) - # Parse each proto file and add to protos container - protos = parse_protos(args.protos, args.verbose) + if not output_dir: + output_dir = '.' + + #print('output_dir = %s' % output_dir, file=sys.stderr) + #print('output_filename = %s' % output_filename, file=sys.stderr) + + if not os.path.exists(proto_filename): + print('Error: Could not find proto file %s' % proto_filename, file=sys.stderr) + return 1 + + if not os.path.exists(proto_private_filename): + print('Error: Could not find private proto file %s' % proto_private_filename, file=sys.stderr) + return 1 + + final_output_dir = output_dir + MakeDir(final_output_dir) + output_dir = MakeTmpDir('_codegen') + + protos = {} + protos['events'] = {} # event dictionary containing events with their fields + protos['event_names'] = [] # needed to keep events in order parsed. dict is not ordered. + protos['enums'] = {} + protos['enum_names'] = [] - files = [ - ["gen_ar_event.hpp", ""], - ["gen_ar_event.cpp", ""], - ["gen_ar_eventhandler.hpp", "gen_ar_event.hpp"], - ["gen_ar_eventhandlerfile.hpp", "gen_ar_eventhandler.hpp"] - ] + parse_protos(protos, proto_filename) + parse_protos(protos, proto_private_filename) rval = 0 try: - # Delete existing files - for f in files: - filename = f[0] - output_fullpath = os.path.join(args.output_dir, filename) - if os.path.exists(output_fullpath): - if args.verbose: - print("Deleting existing file: %s" % output_fullpath) - os.remove(output_fullpath) - - # Generate files from templates - print("Generating c++ from proto files...") - for f in files: - filename = f[0] - event_header = f[1] + # Generate event header + if args.gen_event_hpp: + curdir = os.path.dirname(os.path.abspath(__file__)) + template_file = os.sep.join([curdir, 'templates', 'gen_ar_event.hpp']) + output_fullpath = os.sep.join([output_dir, output_filename]) + + MakoTemplateWriter.to_file(template_file, output_fullpath, + cmdline=sys.argv, + filename=output_filename, + protos=protos) + + # Generate event implementation + if args.gen_event_cpp: curdir = os.path.dirname(os.path.abspath(__file__)) - template_file = os.path.join(curdir, 'templates', filename) - output_fullpath = os.path.join(args.output_dir, filename) + template_file = os.sep.join([curdir, 'templates', 'gen_ar_event.cpp']) + output_fullpath = os.sep.join([output_dir, output_filename]) - if args.verbose: - print("Generating: %s" % output_fullpath) MakoTemplateWriter.to_file(template_file, output_fullpath, cmdline=sys.argv, - filename=filename, - protos=protos, - event_header=event_header) + filename=output_filename, + protos=protos) + + # Generate event handler header + if args.gen_eventhandler_hpp: + curdir = os.path.dirname(os.path.abspath(__file__)) + template_file = os.sep.join([curdir, 'templates', 'gen_ar_eventhandler.hpp']) + output_fullpath = os.sep.join([output_dir, output_filename]) - except Exception as e: - print(e) + MakoTemplateWriter.to_file(template_file, output_fullpath, + cmdline=sys.argv, + filename=output_filename, + event_header='gen_ar_event.hpp', + protos=protos) + + # Generate event handler header + if args.gen_eventhandlerfile_hpp: + curdir = os.path.dirname(os.path.abspath(__file__)) + template_file = os.sep.join([curdir, 'templates', 'gen_ar_eventhandlerfile.hpp']) + output_fullpath = os.sep.join([output_dir, output_filename]) + + MakoTemplateWriter.to_file(template_file, output_fullpath, + cmdline=sys.argv, + filename=output_filename, + event_header='gen_ar_eventhandler.hpp', + protos=protos) + + rval = CopyDirFilesIfDifferent(output_dir, final_output_dir) + + except: rval = 1 + finally: + DeleteDirTree(output_dir) + return rval if __name__ == '__main__': sys.exit(main()) + diff --git a/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py b/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py index c24e19982b7..97a08d21f35 100644 --- a/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py +++ b/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py @@ -162,7 +162,7 @@ def parse_ir_builder(input_file): func_name == 'CreateGEP' or func_name == 'CreateLoad' or func_name == 'CreateMaskedLoad' or - func_name == 'CreateStore' or + func_name == 'CreateStore' or func_name == 'CreateMaskedStore' or func_name == 'CreateElementUnorderedAtomicMemCpy'): ignore = True diff --git a/src/gallium/drivers/swr/rasterizer/codegen/meson.build b/src/gallium/drivers/swr/rasterizer/codegen/meson.build index 2847664a530..28275176022 100644 --- a/src/gallium/drivers/swr/rasterizer/codegen/meson.build +++ b/src/gallium/drivers/swr/rasterizer/codegen/meson.build @@ -72,8 +72,10 @@ foreach x : [['gen_ar_event.hpp', '--gen_event_hpp'], command : [ prog_python, '@INPUT0@', - '--proto', '@INPUT1@', '@INPUT2@', - '--output-dir', meson.current_build_dir(), + '--proto', '@INPUT1@', + '--proto_private', '@INPUT2@', + '--output', '@OUTPUT@', + x[1], ], depend_files : files( join_paths('templates', x[0]), diff --git a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_ar_event.hpp b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_ar_event.hpp index 6c592f74461..fe3f261f680 100644 --- a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_ar_event.hpp +++ b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_ar_event.hpp @@ -68,14 +68,11 @@ namespace ArchRast #pragma pack(push, 1) struct ${name}Data {<% - fields = protos['events'][name]['fields'] %> + field_names = protos['events'][name]['field_names'] + field_types = protos['events'][name]['field_types'] %> // Fields - % for i in range(len(fields)): - % if fields[i]['size'] > 1: - ${fields[i]['type']} ${fields[i]['name']}[${fields[i]['size']}]; - % else: - ${fields[i]['type']} ${fields[i]['name']}; - % endif + % for i in range(len(field_names)): + ${field_types[i]} ${field_names[i]}; % endfor }; #pragma pack(pop) @@ -85,44 +82,24 @@ namespace ArchRast ////////////////////////////////////////////////////////////////////////// struct ${name} : Event {<% - fields = protos['events'][name]['fields'] %> + field_names = protos['events'][name]['field_names'] + field_types = protos['events'][name]['field_types'] %> ${name}Data data; // Constructor ${name}( - % for i in range(len(fields)): - % if i < len(fields)-1: - % if fields[i]['size'] > 1: - ${fields[i]['type']}* ${fields[i]['name']}, - uint32_t ${fields[i]['name']}_size, - % else: - ${fields[i]['type']} ${fields[i]['name']}, - % endif + % for i in range(len(field_names)): + % if i < len(field_names)-1: + ${field_types[i]} ${field_names[i]}, % endif - % if i == len(fields)-1: - % if fields[i]['size'] > 1: - ${fields[i]['type']}* ${fields[i]['name']}, - uint32_t ${fields[i]['name']}_size - % else: - ${fields[i]['type']} ${fields[i]['name']} - % endif + % if i == len(field_names)-1: + ${field_types[i]} ${field_names[i]} % endif % endfor ) { - % for i in range(len(fields)): - % if fields[i]['size'] > 1: - % if fields[i]['type'] == 'char': - // Copy size of string (null-terminated) followed by string into entire buffer - SWR_ASSERT(${fields[i]['name']}_size + 1 < ${fields[i]['size']} - sizeof(uint32_t), "String length must be less than size of char buffer - size(uint32_t)!"); - memcpy(data.${fields[i]['name']}, &${fields[i]['name']}_size, sizeof(uint32_t)); - strcpy_s(data.${fields[i]['name']} + sizeof(uint32_t), ${fields[i]['name']}_size + 1, ${fields[i]['name']}); - % else: - memcpy(data.${fields[i]['name']}, ${fields[i]['name']}, ${fields[i]['name']}_size); - % endif - % else: - data.${fields[i]['name']} = ${fields[i]['name']}; - % endif + % for i in range(len(field_names)): + data.${field_names[i]} = ${field_names[i]}; % endfor } diff --git a/src/gallium/drivers/swr/rasterizer/common/simdlib_512_emu.inl b/src/gallium/drivers/swr/rasterizer/common/simdlib_512_emu.inl index ec905505dc4..f25d834725c 100644 --- a/src/gallium/drivers/swr/rasterizer/common/simdlib_512_emu.inl +++ b/src/gallium/drivers/swr/rasterizer/common/simdlib_512_emu.inl @@ -559,7 +559,7 @@ static SIMDINLINE Float SIMDCALL // // SELECT4(src, control) { // CASE(control[1:0]) -// 0 : tmp[127:0] : = src[127:0] +// 0: tmp[127:0] : = src[127:0] // 1 : tmp[127:0] : = src[255:128] // 2 : tmp[127:0] : = src[383:256] // 3 : tmp[127:0] : = src[511:384]