mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 20:20:18 +01:00
freedreno/registers: split header build into subdirs
Instead of building the adreno/foo.xml headers from the toplevel, split out a subdir(). This fits better with how meson likes things to be structured. But it does require fixing a bit about how gen_header.py resolves imports, ie. it cannot assume the src file is at the root of the $RNN_PATH. This is needed for the next patch, to add support for installing the register database for use with installed tools. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6154>
This commit is contained in:
parent
e59b241213
commit
62ebd342e6
10 changed files with 87 additions and 53 deletions
|
|
@ -25,9 +25,9 @@
|
||||||
|
|
||||||
#include "util/u_math.h"
|
#include "util/u_math.h"
|
||||||
|
|
||||||
#include "registers/adreno_pm4.xml.h"
|
#include "adreno_pm4.xml.h"
|
||||||
#include "registers/adreno_common.xml.h"
|
#include "adreno_common.xml.h"
|
||||||
#include "registers/a6xx.xml.h"
|
#include "a6xx.xml.h"
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "ir3_asm.h"
|
#include "ir3_asm.h"
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@
|
||||||
#include "drm/freedreno_drmif.h"
|
#include "drm/freedreno_drmif.h"
|
||||||
#include "drm/freedreno_ringbuffer.h"
|
#include "drm/freedreno_ringbuffer.h"
|
||||||
|
|
||||||
#include "registers/adreno_pm4.xml.h"
|
#include "adreno_pm4.xml.h"
|
||||||
#include "registers/adreno_common.xml.h"
|
#include "adreno_common.xml.h"
|
||||||
|
|
||||||
#define MAX_BUFS 4
|
#define MAX_BUFS 4
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
# SOFTWARE.
|
# SOFTWARE.
|
||||||
|
|
||||||
inc_freedreno = include_directories(['.', './registers', './common'])
|
inc_freedreno = include_directories(['.', './registers', './registers/adreno', './common'])
|
||||||
inc_freedreno_rnn = include_directories('rnn')
|
inc_freedreno_rnn = include_directories('rnn')
|
||||||
|
|
||||||
rnn_src_path = meson.source_root() + '/src/freedreno/registers'
|
rnn_src_path = meson.source_root() + '/src/freedreno/registers'
|
||||||
|
|
|
||||||
56
src/freedreno/registers/adreno/meson.build
Normal file
56
src/freedreno/registers/adreno/meson.build
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
# Copyright © 2019 Google, Inc
|
||||||
|
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
# The above copyright notice and this permission notice shall be included in
|
||||||
|
# all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
|
|
||||||
|
xml_files = [
|
||||||
|
'a2xx.xml',
|
||||||
|
'a3xx.xml',
|
||||||
|
'a4xx.xml',
|
||||||
|
'a5xx.xml',
|
||||||
|
'a6xx.xml',
|
||||||
|
'adreno_common.xml',
|
||||||
|
'adreno_pm4.xml',
|
||||||
|
]
|
||||||
|
|
||||||
|
foreach f : xml_files
|
||||||
|
_name = f + '.h'
|
||||||
|
freedreno_xml_header_files += custom_target(
|
||||||
|
_name,
|
||||||
|
input: [gen_header_py, f],
|
||||||
|
output: _name,
|
||||||
|
command: [prog_python, '@INPUT0@', rnn_src_path, '@INPUT1@'],
|
||||||
|
capture: true,
|
||||||
|
)
|
||||||
|
endforeach
|
||||||
|
|
||||||
|
freedreno_xml_header_files += custom_target(
|
||||||
|
'a6xx-pack.xml.h',
|
||||||
|
input: [gen_header_py, 'a6xx.xml'],
|
||||||
|
output: 'a6xx-pack.xml.h',
|
||||||
|
command: [prog_python, '@INPUT0@', rnn_src_path, '@INPUT1@', '--pack-structs'],
|
||||||
|
capture: true,
|
||||||
|
)
|
||||||
|
|
||||||
|
freedreno_xml_header_files += custom_target(
|
||||||
|
'adreno-pm4-pack.xml.h',
|
||||||
|
input: [gen_header_py, 'adreno_pm4.xml'],
|
||||||
|
output: 'adreno-pm4-pack.xml.h',
|
||||||
|
command: [prog_python, '@INPUT0@', rnn_src_path, '@INPUT1@', '--pack-structs'],
|
||||||
|
capture: true,
|
||||||
|
)
|
||||||
|
|
@ -335,14 +335,7 @@ class Parser(object):
|
||||||
raise self.error(e);
|
raise self.error(e);
|
||||||
|
|
||||||
def do_parse(self, filename):
|
def do_parse(self, filename):
|
||||||
try:
|
file = open(filename, "rb")
|
||||||
file = open(filename, "rb")
|
|
||||||
except FileNotFoundError as e:
|
|
||||||
# Look for the file in the parent directory if not
|
|
||||||
# found in same directory:
|
|
||||||
path = os.path.dirname(filename)
|
|
||||||
base = os.path.basename(filename)
|
|
||||||
file = open(path + "/../" + base, "rb")
|
|
||||||
parser = xml.parsers.expat.ParserCreate()
|
parser = xml.parsers.expat.ParserCreate()
|
||||||
self.stack.append((parser, filename))
|
self.stack.append((parser, filename))
|
||||||
parser.StartElementHandler = self.start_element
|
parser.StartElementHandler = self.start_element
|
||||||
|
|
@ -351,8 +344,8 @@ class Parser(object):
|
||||||
self.stack.pop()
|
self.stack.pop()
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
def parse(self, filename):
|
def parse(self, rnn_path, filename):
|
||||||
self.path = os.path.dirname(filename)
|
self.path = rnn_path
|
||||||
self.stack = []
|
self.stack = []
|
||||||
self.do_parse(filename)
|
self.do_parse(filename)
|
||||||
|
|
||||||
|
|
@ -373,7 +366,7 @@ class Parser(object):
|
||||||
|
|
||||||
def start_element(self, name, attrs):
|
def start_element(self, name, attrs):
|
||||||
if name == "import":
|
if name == "import":
|
||||||
filename = os.path.basename(attrs["file"])
|
filename = attrs["file"]
|
||||||
self.do_parse(os.path.join(self.path, filename))
|
self.do_parse(os.path.join(self.path, filename))
|
||||||
elif name == "domain":
|
elif name == "domain":
|
||||||
self.current_domain = attrs["name"]
|
self.current_domain = attrs["name"]
|
||||||
|
|
@ -449,8 +442,9 @@ class Parser(object):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
p = Parser()
|
p = Parser()
|
||||||
xml_file = sys.argv[1]
|
rnn_path = sys.argv[1]
|
||||||
if len(sys.argv) > 2 and sys.argv[2] == '--pack-structs':
|
xml_file = sys.argv[2]
|
||||||
|
if len(sys.argv) > 3 and sys.argv[3] == '--pack-structs':
|
||||||
do_structs = True
|
do_structs = True
|
||||||
guard = str.replace(os.path.basename(xml_file), '.', '_').upper() + '_STRUCTS'
|
guard = str.replace(os.path.basename(xml_file), '.', '_').upper() + '_STRUCTS'
|
||||||
else:
|
else:
|
||||||
|
|
@ -460,7 +454,7 @@ def main():
|
||||||
print("#ifndef %s\n#define %s\n" % (guard, guard))
|
print("#ifndef %s\n#define %s\n" % (guard, guard))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
p.parse(xml_file)
|
p.parse(rnn_path, xml_file)
|
||||||
except Error as e:
|
except Error as e:
|
||||||
print(e)
|
print(e)
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
|
||||||
|
|
@ -19,38 +19,22 @@
|
||||||
# SOFTWARE.
|
# SOFTWARE.
|
||||||
|
|
||||||
xml_files = [
|
xml_files = [
|
||||||
'a2xx.xml',
|
'adreno.xml',
|
||||||
'a3xx.xml',
|
|
||||||
'a4xx.xml',
|
|
||||||
'a5xx.xml',
|
|
||||||
'a6xx.xml',
|
|
||||||
'adreno_common.xml',
|
|
||||||
'adreno_pm4.xml',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
gen_header_py = files('gen_header.py')
|
||||||
|
|
||||||
freedreno_xml_header_files = []
|
freedreno_xml_header_files = []
|
||||||
|
|
||||||
foreach f : xml_files
|
foreach f : xml_files
|
||||||
_name = f + '.h'
|
_name = f + '.h'
|
||||||
freedreno_xml_header_files += custom_target(
|
freedreno_xml_header_files += custom_target(
|
||||||
_name,
|
_name,
|
||||||
input : ['gen_header.py', 'adreno/' + f],
|
input: [gen_header_py, f],
|
||||||
output : _name,
|
output: _name,
|
||||||
command : [prog_python, '@INPUT@'],
|
command: [prog_python, '@INPUT0@', rnn_src_path, '@INPUT1@'],
|
||||||
capture : true,
|
capture: true,
|
||||||
)
|
)
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
freedreno_xml_header_files += custom_target(
|
subdir('adreno')
|
||||||
'a6xx-pack.xml.h',
|
|
||||||
input : ['gen_header.py', 'adreno/a6xx.xml'],
|
|
||||||
output : 'a6xx-pack.xml.h',
|
|
||||||
command : [prog_python, '@INPUT@', '--pack-structs'],
|
|
||||||
capture : true,
|
|
||||||
)
|
|
||||||
freedreno_xml_header_files += custom_target(
|
|
||||||
'adreno-pm4-pack.xml.h',
|
|
||||||
input : ['gen_header.py', 'adreno/adreno_pm4.xml'],
|
|
||||||
output : 'adreno-pm4-pack.xml.h',
|
|
||||||
command : [prog_python, '@INPUT@', '--pack-structs'],
|
|
||||||
capture : true,
|
|
||||||
)
|
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@
|
||||||
|
|
||||||
#include "tu_private.h"
|
#include "tu_private.h"
|
||||||
|
|
||||||
#include "registers/adreno_pm4.xml.h"
|
#include "adreno_pm4.xml.h"
|
||||||
#include "registers/adreno_common.xml.h"
|
#include "adreno_common.xml.h"
|
||||||
|
|
||||||
#include "vk_format.h"
|
#include "vk_format.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include "tu_private.h"
|
#include "tu_private.h"
|
||||||
|
|
||||||
#include "registers/adreno_pm4.xml.h"
|
#include "adreno_pm4.xml.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
tu_cs_init(struct tu_cs *cs,
|
tu_cs_init(struct tu_cs *cs,
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,8 @@
|
||||||
|
|
||||||
#include "tu_private.h"
|
#include "tu_private.h"
|
||||||
|
|
||||||
#include "registers/adreno_common.xml.h"
|
#include "adreno_common.xml.h"
|
||||||
#include "registers/a6xx.xml.h"
|
#include "a6xx.xml.h"
|
||||||
|
|
||||||
#include "vk_format.h"
|
#include "vk_format.h"
|
||||||
#include "vk_util.h"
|
#include "vk_util.h"
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,9 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "registers/adreno_pm4.xml.h"
|
#include "adreno_pm4.xml.h"
|
||||||
#include "registers/adreno_common.xml.h"
|
#include "adreno_common.xml.h"
|
||||||
#include "registers/a6xx.xml.h"
|
#include "a6xx.xml.h"
|
||||||
|
|
||||||
#include "nir/nir_builder.h"
|
#include "nir/nir_builder.h"
|
||||||
#include "util/os_time.h"
|
#include "util/os_time.h"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue