2018-02-23 13:59:05 +01:00
|
|
|
From c1714e8bf49fc0034c91ffed4adfbb067dbdf856 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Stefan Dirsch <sndirsch@suse.de>
|
|
|
|
Date: Fri, 23 Feb 2018 12:46:18 +0100
|
|
|
|
Subject: [PATCH] r600/egd_tables.py: added support for python 3
|
|
|
|
|
|
|
|
Patch by "Tomas Chvatal" <tchvatal@suse.com> with modifications
|
|
|
|
by "Michal Srb" <msrb@suse.com> to not break python 2.
|
|
|
|
https://bugzilla.suse.com/show_bug.cgi?id=1082303
|
|
|
|
|
|
|
|
Signed-off-by: Stefan Dirsch <sndirsch@suse.de>
|
|
|
|
---
|
|
|
|
src/gallium/drivers/r600/egd_tables.py | 52 +++++++++++++++++-----------------
|
|
|
|
1 file changed, 26 insertions(+), 26 deletions(-)
|
|
|
|
|
2018-01-08 12:57:13 +01:00
|
|
|
diff --git a/src/gallium/drivers/r600/egd_tables.py b/src/gallium/drivers/r600/egd_tables.py
|
2018-02-23 13:59:05 +01:00
|
|
|
index d7b78c7fb1..b3b8b50292 100644
|
2018-01-08 12:57:13 +01:00
|
|
|
--- a/src/gallium/drivers/r600/egd_tables.py
|
|
|
|
+++ b/src/gallium/drivers/r600/egd_tables.py
|
|
|
|
@@ -60,7 +60,7 @@ class StringTable:
|
|
|
|
"""
|
|
|
|
fragments = [
|
|
|
|
'"%s\\0" /* %s */' % (
|
|
|
|
- te[0].encode('string_escape'),
|
|
|
|
+ te[0].encode('unicode_escape'),
|
|
|
|
', '.join(str(idx) for idx in te[2])
|
|
|
|
)
|
|
|
|
for te in self.table
|
|
|
|
@@ -217,10 +217,10 @@ def write_tables(regs, packets):
|
|
|
|
strings = StringTable()
|
|
|
|
strings_offsets = IntTable("int")
|
|
|
|
|
|
|
|
- print '/* This file is autogenerated by egd_tables.py from evergreend.h. Do not edit directly. */'
|
|
|
|
- print
|
|
|
|
- print CopyRight.strip()
|
|
|
|
- print '''
|
|
|
|
+ print('/* This file is autogenerated by egd_tables.py from evergreend.h. Do not edit directly. */')
|
2018-01-10 10:51:07 +01:00
|
|
|
+ print('')
|
2018-01-08 12:57:13 +01:00
|
|
|
+ print(CopyRight.strip())
|
|
|
|
+ print('''
|
|
|
|
#ifndef EG_TABLES_H
|
|
|
|
#define EG_TABLES_H
|
|
|
|
|
|
|
|
@@ -242,20 +242,20 @@ struct eg_packet3 {
|
|
|
|
unsigned name_offset;
|
|
|
|
unsigned op;
|
|
|
|
};
|
|
|
|
-'''
|
|
|
|
+''')
|
|
|
|
|
|
|
|
- print 'static const struct eg_packet3 packet3_table[] = {'
|
|
|
|
+ print('static const struct eg_packet3 packet3_table[] = {')
|
|
|
|
for pkt in packets:
|
|
|
|
- print '\t{%s, %s},' % (strings.add(pkt[5:]), pkt)
|
|
|
|
- print '};'
|
|
|
|
- print
|
|
|
|
+ print('\t{%s, %s},' % (strings.add(pkt[5:]), pkt))
|
|
|
|
+ print('};')
|
2018-01-10 10:51:07 +01:00
|
|
|
+ print('')
|
2018-01-08 12:57:13 +01:00
|
|
|
|
|
|
|
- print 'static const struct eg_field egd_fields_table[] = {'
|
|
|
|
+ print('static const struct eg_field egd_fields_table[] = {')
|
|
|
|
|
|
|
|
fields_idx = 0
|
|
|
|
for reg in regs:
|
|
|
|
if len(reg.fields) and reg.own_fields:
|
|
|
|
- print '\t/* %s */' % (fields_idx)
|
|
|
|
+ print('\t/* %s */' % (fields_idx))
|
|
|
|
|
|
|
|
reg.fields_idx = fields_idx
|
|
|
|
|
|
|
|
@@ -266,34 +266,34 @@ struct eg_packet3 {
|
|
|
|
while value[1] >= len(values_offsets):
|
|
|
|
values_offsets.append(-1)
|
|
|
|
values_offsets[value[1]] = strings.add(strip_prefix(value[0]))
|
|
|
|
- print '\t{%s, %s(~0u), %s, %s},' % (
|
|
|
|
+ print('\t{%s, %s(~0u), %s, %s},' % (
|
|
|
|
strings.add(field.name), field.s_name,
|
|
|
|
- len(values_offsets), strings_offsets.add(values_offsets))
|
|
|
|
+ len(values_offsets), strings_offsets.add(values_offsets)))
|
|
|
|
else:
|
|
|
|
- print '\t{%s, %s(~0u)},' % (strings.add(field.name), field.s_name)
|
|
|
|
+ print('\t{%s, %s(~0u)},' % (strings.add(field.name), field.s_name))
|
|
|
|
fields_idx += 1
|
|
|
|
|
|
|
|
- print '};'
|
|
|
|
- print
|
|
|
|
+ print('};')
|
2018-01-10 10:51:07 +01:00
|
|
|
+ print('')
|
2018-01-08 12:57:13 +01:00
|
|
|
|
|
|
|
- print 'static const struct eg_reg egd_reg_table[] = {'
|
|
|
|
+ print('static const struct eg_reg egd_reg_table[] = {')
|
|
|
|
for reg in regs:
|
|
|
|
if len(reg.fields):
|
|
|
|
- print '\t{%s, %s, %s, %s},' % (strings.add(reg.name), reg.r_name,
|
|
|
|
- len(reg.fields), reg.fields_idx if reg.own_fields else reg.fields_owner.fields_idx)
|
|
|
|
+ print('\t{%s, %s, %s, %s},' % (strings.add(reg.name), reg.r_name,
|
|
|
|
+ len(reg.fields), reg.fields_idx if reg.own_fields else reg.fields_owner.fields_idx))
|
|
|
|
else:
|
|
|
|
- print '\t{%s, %s},' % (strings.add(reg.name), reg.r_name)
|
|
|
|
- print '};'
|
|
|
|
- print
|
|
|
|
+ print('\t{%s, %s},' % (strings.add(reg.name), reg.r_name))
|
|
|
|
+ print('};')
|
2018-01-10 10:51:07 +01:00
|
|
|
+ print('')
|
2018-01-08 12:57:13 +01:00
|
|
|
|
|
|
|
strings.emit(sys.stdout, "egd_strings")
|
|
|
|
|
|
|
|
- print
|
2018-01-10 10:51:07 +01:00
|
|
|
+ print('')
|
2018-01-08 12:57:13 +01:00
|
|
|
|
|
|
|
strings_offsets.emit(sys.stdout, "egd_strings_offsets")
|
|
|
|
|
|
|
|
- print
|
|
|
|
- print '#endif'
|
2018-01-10 10:51:07 +01:00
|
|
|
+ print('')
|
2018-01-08 12:57:13 +01:00
|
|
|
+ print('#endif')
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
2018-02-23 13:59:05 +01:00
|
|
|
--
|
|
|
|
2.13.6
|
|
|
|
|