aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlok Hota <[email protected]>2018-09-07 15:17:53 -0500
committerAlok Hota <[email protected]>2019-02-25 13:05:31 -0600
commitb45a15a39f7630d569fcf1296dac1415eb758249 (patch)
treed0de6d128e85b44e118d78f40af4cb6969c22016 /src
parent8608a747aafe6aef42fba148bfcdbb3ca136e7de (diff)
swr/rast: Add string handling to AR event framework
For use by an internal tool Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/swr/rasterizer/archrast/events.proto9
-rw-r--r--src/gallium/drivers/swr/rasterizer/codegen/gen_archrast.py23
-rw-r--r--src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py2
-rw-r--r--src/gallium/drivers/swr/rasterizer/codegen/templates/gen_ar_event.hpp49
-rw-r--r--src/gallium/drivers/swr/rasterizer/common/simdlib_512_emu.inl2
5 files changed, 54 insertions, 31 deletions
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 97a08d21f35..c24e19982b7 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/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]