1bf215546Sopenharmony_ci# Copyright © 2018 Rob Clark
2bf215546Sopenharmony_ci# Copyright © 2019 Collabora
3bf215546Sopenharmony_ci
4bf215546Sopenharmony_ci# Permission is hereby granted, free of charge, to any person obtaining a copy
5bf215546Sopenharmony_ci# of this software and associated documentation files (the "Software"), to deal
6bf215546Sopenharmony_ci# in the Software without restriction, including without limitation the rights
7bf215546Sopenharmony_ci# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8bf215546Sopenharmony_ci# copies of the Software, and to permit persons to whom the Software is
9bf215546Sopenharmony_ci# furnished to do so, subject to the following conditions:
10bf215546Sopenharmony_ci
11bf215546Sopenharmony_ci# The above copyright notice and this permission notice shall be included in
12bf215546Sopenharmony_ci# all copies or substantial portions of the Software.
13bf215546Sopenharmony_ci
14bf215546Sopenharmony_ci# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15bf215546Sopenharmony_ci# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16bf215546Sopenharmony_ci# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17bf215546Sopenharmony_ci# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18bf215546Sopenharmony_ci# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19bf215546Sopenharmony_ci# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20bf215546Sopenharmony_ci# SOFTWARE.
21bf215546Sopenharmony_ci
22bf215546Sopenharmony_cisubdir('valhall')
23bf215546Sopenharmony_ci
24bf215546Sopenharmony_ciinc_valhall = include_directories(['.', 'valhall'])
25bf215546Sopenharmony_ci
26bf215546Sopenharmony_cilibpanfrost_bifrost_files = files(
27bf215546Sopenharmony_ci  'bi_helper_invocations.c',
28bf215546Sopenharmony_ci  'bi_layout.c',
29bf215546Sopenharmony_ci  'bi_liveness.c',
30bf215546Sopenharmony_ci  'bi_lower_divergent_indirects.c',
31bf215546Sopenharmony_ci  'bi_lower_swizzle.c',
32bf215546Sopenharmony_ci  'bi_print.c',
33bf215546Sopenharmony_ci  'bi_opt_constant_fold.c',
34bf215546Sopenharmony_ci  'bi_opt_copy_prop.c',
35bf215546Sopenharmony_ci  'bi_opt_dce.c',
36bf215546Sopenharmony_ci  'bi_opt_cse.c',
37bf215546Sopenharmony_ci  'bi_opt_push_ubo.c',
38bf215546Sopenharmony_ci  'bi_opt_message_preload.c',
39bf215546Sopenharmony_ci  'bi_opt_mod_props.c',
40bf215546Sopenharmony_ci  'bi_opt_dual_tex.c',
41bf215546Sopenharmony_ci  'bi_pressure_schedule.c',
42bf215546Sopenharmony_ci  'bi_pack.c',
43bf215546Sopenharmony_ci  'bi_ra.c',
44bf215546Sopenharmony_ci  'bi_schedule.c',
45bf215546Sopenharmony_ci  'bi_scoreboard.c',
46bf215546Sopenharmony_ci  'bi_validate.c',
47bf215546Sopenharmony_ci  'bir.c',
48bf215546Sopenharmony_ci  'bifrost_compile.c',
49bf215546Sopenharmony_ci  'valhall/va_insert_flow.c',
50bf215546Sopenharmony_ci  'valhall/va_lower_constants.c',
51bf215546Sopenharmony_ci  'valhall/va_lower_isel.c',
52bf215546Sopenharmony_ci  'valhall/va_lower_split_64bit.c',
53bf215546Sopenharmony_ci  'valhall/va_optimize.c',
54bf215546Sopenharmony_ci  'valhall/va_mark_last.c',
55bf215546Sopenharmony_ci  'valhall/va_merge_flow.c',
56bf215546Sopenharmony_ci  'valhall/va_pack.c',
57bf215546Sopenharmony_ci  'valhall/va_perf.c',
58bf215546Sopenharmony_ci  'valhall/va_validate.c',
59bf215546Sopenharmony_ci)
60bf215546Sopenharmony_ci
61bf215546Sopenharmony_cibifrost_gen_disasm_c = custom_target(
62bf215546Sopenharmony_ci  'bifrost_gen_disasm.c',
63bf215546Sopenharmony_ci  input : ['gen_disasm.py', 'ISA.xml'],
64bf215546Sopenharmony_ci  output : 'bifrost_gen_disasm.c',
65bf215546Sopenharmony_ci  command : [prog_python, '@INPUT@'],
66bf215546Sopenharmony_ci  capture : true,
67bf215546Sopenharmony_ci  depend_files : files('bifrost_isa.py'),
68bf215546Sopenharmony_ci)
69bf215546Sopenharmony_ci
70bf215546Sopenharmony_cibi_opcodes_c = custom_target(
71bf215546Sopenharmony_ci  'bi_opcodes.c',
72bf215546Sopenharmony_ci  input : ['bi_opcodes.c.py', 'ISA.xml'],
73bf215546Sopenharmony_ci  output : 'bi_opcodes.c',
74bf215546Sopenharmony_ci  command : [prog_python, '@INPUT@'],
75bf215546Sopenharmony_ci  capture : true,
76bf215546Sopenharmony_ci  depend_files : files('bifrost_isa.py'),
77bf215546Sopenharmony_ci)
78bf215546Sopenharmony_ci
79bf215546Sopenharmony_cibi_printer_c = custom_target(
80bf215546Sopenharmony_ci  'bi_printer.c',
81bf215546Sopenharmony_ci  input : ['bi_printer.c.py', 'ISA.xml'],
82bf215546Sopenharmony_ci  output : 'bi_printer.c',
83bf215546Sopenharmony_ci  command : [prog_python, '@INPUT@'],
84bf215546Sopenharmony_ci  capture : true,
85bf215546Sopenharmony_ci  depend_files : files('bifrost_isa.py'),
86bf215546Sopenharmony_ci)
87bf215546Sopenharmony_ci
88bf215546Sopenharmony_cibi_packer_c = custom_target(
89bf215546Sopenharmony_ci  'bi_packer.c',
90bf215546Sopenharmony_ci  input : ['bi_packer.c.py', 'ISA.xml'],
91bf215546Sopenharmony_ci  output : 'bi_packer.c',
92bf215546Sopenharmony_ci  command : [prog_python, '@INPUT@'],
93bf215546Sopenharmony_ci  capture : true,
94bf215546Sopenharmony_ci  depend_files : files('bifrost_isa.py'),
95bf215546Sopenharmony_ci)
96bf215546Sopenharmony_ci
97bf215546Sopenharmony_cibi_opcodes_h = custom_target(
98bf215546Sopenharmony_ci  'bi_opcodes.h',
99bf215546Sopenharmony_ci  input : ['bi_opcodes.h.py', 'ISA.xml'],
100bf215546Sopenharmony_ci  output : 'bi_opcodes.h',
101bf215546Sopenharmony_ci  command : [prog_python, '@INPUT@'],
102bf215546Sopenharmony_ci  capture : true,
103bf215546Sopenharmony_ci  depend_files : files('bifrost_isa.py'),
104bf215546Sopenharmony_ci)
105bf215546Sopenharmony_ci
106bf215546Sopenharmony_ciidep_bi_opcodes_h = declare_dependency(
107bf215546Sopenharmony_ci  sources : [bi_opcodes_h],
108bf215546Sopenharmony_ci  include_directories : include_directories('.'),
109bf215546Sopenharmony_ci)
110bf215546Sopenharmony_ci
111bf215546Sopenharmony_cibi_builder_h = custom_target(
112bf215546Sopenharmony_ci  'bi_builder.h',
113bf215546Sopenharmony_ci  input : ['bi_builder.h.py', 'ISA.xml'],
114bf215546Sopenharmony_ci  output : 'bi_builder.h',
115bf215546Sopenharmony_ci  command : [prog_python, '@INPUT@'],
116bf215546Sopenharmony_ci  capture : true,
117bf215546Sopenharmony_ci  depend_files : files('bifrost_isa.py'),
118bf215546Sopenharmony_ci)
119bf215546Sopenharmony_ci
120bf215546Sopenharmony_ciidep_bi_builder_h = declare_dependency(
121bf215546Sopenharmony_ci  sources : [bi_builder_h],
122bf215546Sopenharmony_ci  include_directories : include_directories('.'),
123bf215546Sopenharmony_ci)
124bf215546Sopenharmony_ci
125bf215546Sopenharmony_cibifrost_nir_algebraic_c = custom_target(
126bf215546Sopenharmony_ci  'bifrost_nir_algebraic.c',
127bf215546Sopenharmony_ci  input : 'bifrost_nir_algebraic.py',
128bf215546Sopenharmony_ci  output : 'bifrost_nir_algebraic.c',
129bf215546Sopenharmony_ci  command : [
130bf215546Sopenharmony_ci    prog_python, '@INPUT@',
131bf215546Sopenharmony_ci    '-p', join_paths(meson.source_root(), 'src/compiler/nir/'),
132bf215546Sopenharmony_ci  ],
133bf215546Sopenharmony_ci  capture : true,
134bf215546Sopenharmony_ci  depend_files : nir_algebraic_depends,
135bf215546Sopenharmony_ci)
136bf215546Sopenharmony_ci
137bf215546Sopenharmony_cilibpanfrost_bifrost_disasm = static_library(
138bf215546Sopenharmony_ci  'panfrost_bifrost_disasm',
139bf215546Sopenharmony_ci  ['disassemble.c', 'bi_print_common.c', bifrost_gen_disasm_c],
140bf215546Sopenharmony_ci  include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_panfrost_hw],
141bf215546Sopenharmony_ci  dependencies: [idep_nir],
142bf215546Sopenharmony_ci  link_with: [libpanfrost_util],
143bf215546Sopenharmony_ci  c_args : [no_override_init_args],
144bf215546Sopenharmony_ci  gnu_symbol_visibility : 'hidden',
145bf215546Sopenharmony_ci  build_by_default : false,
146bf215546Sopenharmony_ci)
147bf215546Sopenharmony_ci
148bf215546Sopenharmony_cilibpanfrost_bifrost = static_library(
149bf215546Sopenharmony_ci  'panfrost_bifrost',
150bf215546Sopenharmony_ci  [libpanfrost_bifrost_files, bi_opcodes_c, bi_printer_c, bi_packer_c, bifrost_nir_algebraic_c, valhall_c],
151bf215546Sopenharmony_ci  include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_panfrost_hw, inc_valhall],
152bf215546Sopenharmony_ci  dependencies: [idep_nir, idep_bi_opcodes_h, idep_bi_builder_h, idep_valhall_enums_h],
153bf215546Sopenharmony_ci  link_with: [libpanfrost_util, libpanfrost_bifrost_disasm, libpanfrost_valhall_disasm],
154bf215546Sopenharmony_ci  c_args : [no_override_init_args],
155bf215546Sopenharmony_ci  gnu_symbol_visibility : 'hidden',
156bf215546Sopenharmony_ci  build_by_default : false,
157bf215546Sopenharmony_ci)
158bf215546Sopenharmony_ci
159bf215546Sopenharmony_ciif with_tests
160bf215546Sopenharmony_ci  test(
161bf215546Sopenharmony_ci    'bifrost_tests',
162bf215546Sopenharmony_ci    executable(
163bf215546Sopenharmony_ci      'bifrost_tests',
164bf215546Sopenharmony_ci      files(
165bf215546Sopenharmony_ci        'test/test-constant-fold.cpp',
166bf215546Sopenharmony_ci        'test/test-dual-texture.cpp',
167bf215546Sopenharmony_ci        'test/test-message-preload.cpp',
168bf215546Sopenharmony_ci	'test/test-optimizer.cpp',
169bf215546Sopenharmony_ci	'test/test-pack-formats.cpp',
170bf215546Sopenharmony_ci	'test/test-packing.cpp',
171bf215546Sopenharmony_ci	'test/test-scheduler-predicates.cpp',
172bf215546Sopenharmony_ci        'valhall/test/test-add-imm.cpp',
173bf215546Sopenharmony_ci        'valhall/test/test-validate-fau.cpp',
174bf215546Sopenharmony_ci        'valhall/test/test-insert-flow.cpp',
175bf215546Sopenharmony_ci        'valhall/test/test-lower-isel.cpp',
176bf215546Sopenharmony_ci        'valhall/test/test-lower-constants.cpp',
177bf215546Sopenharmony_ci        'valhall/test/test-mark-last.cpp',
178bf215546Sopenharmony_ci        'valhall/test/test-merge-flow.cpp',
179bf215546Sopenharmony_ci        'valhall/test/test-packing.cpp',
180bf215546Sopenharmony_ci      ),
181bf215546Sopenharmony_ci      c_args : [c_msvc_compat_args, no_override_init_args],
182bf215546Sopenharmony_ci      gnu_symbol_visibility : 'hidden',
183bf215546Sopenharmony_ci      include_directories : [inc_include, inc_src, inc_mesa, inc_valhall],
184bf215546Sopenharmony_ci      dependencies: [idep_gtest, idep_nir, idep_bi_opcodes_h, idep_bi_builder_h],
185bf215546Sopenharmony_ci      link_with : [libpanfrost_bifrost],
186bf215546Sopenharmony_ci    ),
187bf215546Sopenharmony_ci    suite : ['panfrost'],
188bf215546Sopenharmony_ci    protocol : gtest_test_protocol,
189bf215546Sopenharmony_ci  )
190bf215546Sopenharmony_ciendif
191