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