From: Alok Hota Date: Fri, 7 Sep 2018 20:17:53 +0000 (-0500) Subject: swr/rast: Add string handling to AR event framework X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b8adb540a0dca76bab94bb52de3dbfb4a4faf726;p=mesa.git swr/rast: Add string handling to AR event framework For use by an internal tool Reviewed-by: Bruce Cherniak --- diff --git a/src/gallium/drivers/swr/rasterizer/archrast/events.proto b/src/gallium/drivers/swr/rasterizer/archrast/events.proto index fd803830101..aedc37b7440 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/events.proto +++ b/src/gallium/drivers/swr/rasterizer/archrast/events.proto @@ -129,7 +129,7 @@ event EarlyZSingleSample uint32_t drawId; uint64_t passCount; uint64_t failCount; -}; +}; event LateZSingleSample { @@ -157,7 +157,7 @@ event EarlyZSampleRate uint32_t drawId; uint64_t passCount; uint64_t failCount; -}; +}; event LateZSampleRate { @@ -186,7 +186,7 @@ event EarlyZ uint32_t drawId; uint64_t passCount; uint64_t failCount; -}; +}; // Total LateZ counts, SingleSample and SampleRate event LateZ @@ -445,5 +445,6 @@ event SWTagDispatchEvent event SWTagFlushEvent { uint32_t drawId; - uint32_t flushType; + char flushReason[256]; + uint32_t flushType; }; \ 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 87c68fcf364..6182504567a 100644 --- a/src/gallium/drivers/swr/rasterizer/codegen/gen_archrast.py +++ b/src/gallium/drivers/swr/rasterizer/codegen/gen_archrast.py @@ -27,30 +27,29 @@ import re from gen_common import * def parse_event_fields(lines, idx, event_dict): - field_names = [] - field_types = [] + fields = [] 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 - field = re.match(r'(\s*)(\w+)(\s*)(\w+)', line) + match = re.match(r'(\s*)([\w\*]+)(\s*)([\w]+)(\[\d+\])*', line) - if field: - field_types.append(field.group(2)) - field_names.append(field.group(4)) - num_fields += 1 + if match: + field = { + "type": match.group(2), + "name": match.group(4), + "size": int(match.group(5)[1:-1]) if match.group(5) else 1 + } + fields.append(field) end_of_event = re.match(r'(\s*)};', line) - event_dict['field_types'] = field_types - event_dict['field_names'] = field_names - event_dict['num_fields'] = num_fields + event_dict['fields'] = fields + event_dict['num_fields'] = len(fields) return idx 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 685365cde34..ac685ad51ed 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 @@ -165,7 +165,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/templates/gen_ar_event.hpp b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_ar_event.hpp index fe3f261f680..884a3210039 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,11 +68,14 @@ namespace ArchRast #pragma pack(push, 1) struct ${name}Data {<% - field_names = protos['events'][name]['field_names'] - field_types = protos['events'][name]['field_types'] %> + fields = protos['events'][name]['fields'] %> // Fields - % for i in range(len(field_names)): - ${field_types[i]} ${field_names[i]}; + % 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 % endfor }; #pragma pack(pop) @@ -82,24 +85,44 @@ namespace ArchRast ////////////////////////////////////////////////////////////////////////// struct ${name} : Event {<% - field_names = protos['events'][name]['field_names'] - field_types = protos['events'][name]['field_types'] %> + fields = protos['events'][name]['fields'] %> ${name}Data data; // Constructor ${name}( - % for i in range(len(field_names)): - % if i < len(field_names)-1: - ${field_types[i]} ${field_names[i]}, + % 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 % endif - % if i == len(field_names)-1: - ${field_types[i]} ${field_names[i]} + % 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 % endif % endfor ) { - % for i in range(len(field_names)): - data.${field_names[i]} = ${field_names[i]}; + % 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 buffer info 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 % 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 f25d834725c..ec905505dc4 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]