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 24inc_valhall = include_directories(['.', 'valhall']) 25 26libpanfrost_bifrost_files = files( 27 'bi_helper_invocations.c', 28 'bi_layout.c', 29 'bi_liveness.c', 30 'bi_lower_divergent_indirects.c', 31 'bi_lower_swizzle.c', 32 'bi_print.c', 33 'bi_opt_constant_fold.c', 34 'bi_opt_copy_prop.c', 35 'bi_opt_dce.c', 36 'bi_opt_cse.c', 37 'bi_opt_push_ubo.c', 38 'bi_opt_message_preload.c', 39 'bi_opt_mod_props.c', 40 'bi_opt_dual_tex.c', 41 'bi_pressure_schedule.c', 42 'bi_pack.c', 43 'bi_ra.c', 44 'bi_schedule.c', 45 'bi_scoreboard.c', 46 'bi_validate.c', 47 'bir.c', 48 'bifrost_compile.c', 49 'valhall/va_insert_flow.c', 50 'valhall/va_lower_constants.c', 51 'valhall/va_lower_isel.c', 52 'valhall/va_lower_split_64bit.c', 53 'valhall/va_optimize.c', 54 'valhall/va_mark_last.c', 55 'valhall/va_merge_flow.c', 56 'valhall/va_pack.c', 57 'valhall/va_perf.c', 58 'valhall/va_validate.c', 59) 60 61bifrost_gen_disasm_c = custom_target( 62 'bifrost_gen_disasm.c', 63 input : ['gen_disasm.py', 'ISA.xml'], 64 output : 'bifrost_gen_disasm.c', 65 command : [prog_python, '@INPUT@'], 66 capture : true, 67 depend_files : files('bifrost_isa.py'), 68) 69 70bi_opcodes_c = custom_target( 71 'bi_opcodes.c', 72 input : ['bi_opcodes.c.py', 'ISA.xml'], 73 output : 'bi_opcodes.c', 74 command : [prog_python, '@INPUT@'], 75 capture : true, 76 depend_files : files('bifrost_isa.py'), 77) 78 79bi_printer_c = custom_target( 80 'bi_printer.c', 81 input : ['bi_printer.c.py', 'ISA.xml'], 82 output : 'bi_printer.c', 83 command : [prog_python, '@INPUT@'], 84 capture : true, 85 depend_files : files('bifrost_isa.py'), 86) 87 88bi_packer_c = custom_target( 89 'bi_packer.c', 90 input : ['bi_packer.c.py', 'ISA.xml'], 91 output : 'bi_packer.c', 92 command : [prog_python, '@INPUT@'], 93 capture : true, 94 depend_files : files('bifrost_isa.py'), 95) 96 97bi_opcodes_h = custom_target( 98 'bi_opcodes.h', 99 input : ['bi_opcodes.h.py', 'ISA.xml'], 100 output : 'bi_opcodes.h', 101 command : [prog_python, '@INPUT@'], 102 capture : true, 103 depend_files : files('bifrost_isa.py'), 104) 105 106idep_bi_opcodes_h = declare_dependency( 107 sources : [bi_opcodes_h], 108 include_directories : include_directories('.'), 109) 110 111bi_builder_h = custom_target( 112 'bi_builder.h', 113 input : ['bi_builder.h.py', 'ISA.xml'], 114 output : 'bi_builder.h', 115 command : [prog_python, '@INPUT@'], 116 capture : true, 117 depend_files : files('bifrost_isa.py'), 118) 119 120idep_bi_builder_h = declare_dependency( 121 sources : [bi_builder_h], 122 include_directories : include_directories('.'), 123) 124 125bifrost_nir_algebraic_c = custom_target( 126 'bifrost_nir_algebraic.c', 127 input : 'bifrost_nir_algebraic.py', 128 output : 'bifrost_nir_algebraic.c', 129 command : [ 130 prog_python, '@INPUT@', 131 '-p', join_paths(meson.source_root(), 'src/compiler/nir/'), 132 ], 133 capture : true, 134 depend_files : nir_algebraic_depends, 135) 136 137libpanfrost_bifrost_disasm = static_library( 138 'panfrost_bifrost_disasm', 139 ['disassemble.c', 'bi_print_common.c', bifrost_gen_disasm_c], 140 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_panfrost_hw], 141 dependencies: [idep_nir], 142 link_with: [libpanfrost_util], 143 c_args : [no_override_init_args], 144 gnu_symbol_visibility : 'hidden', 145 build_by_default : false, 146) 147 148libpanfrost_bifrost = static_library( 149 'panfrost_bifrost', 150 [libpanfrost_bifrost_files, bi_opcodes_c, bi_printer_c, bi_packer_c, bifrost_nir_algebraic_c, valhall_c], 151 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_panfrost_hw, inc_valhall], 152 dependencies: [idep_nir, idep_bi_opcodes_h, idep_bi_builder_h, idep_valhall_enums_h], 153 link_with: [libpanfrost_util, libpanfrost_bifrost_disasm, libpanfrost_valhall_disasm], 154 c_args : [no_override_init_args], 155 gnu_symbol_visibility : 'hidden', 156 build_by_default : false, 157) 158 159if with_tests 160 test( 161 'bifrost_tests', 162 executable( 163 'bifrost_tests', 164 files( 165 'test/test-constant-fold.cpp', 166 'test/test-dual-texture.cpp', 167 'test/test-message-preload.cpp', 168 'test/test-optimizer.cpp', 169 'test/test-pack-formats.cpp', 170 'test/test-packing.cpp', 171 'test/test-scheduler-predicates.cpp', 172 'valhall/test/test-add-imm.cpp', 173 'valhall/test/test-validate-fau.cpp', 174 'valhall/test/test-insert-flow.cpp', 175 'valhall/test/test-lower-isel.cpp', 176 'valhall/test/test-lower-constants.cpp', 177 'valhall/test/test-mark-last.cpp', 178 'valhall/test/test-merge-flow.cpp', 179 'valhall/test/test-packing.cpp', 180 ), 181 c_args : [c_msvc_compat_args, no_override_init_args], 182 gnu_symbol_visibility : 'hidden', 183 include_directories : [inc_include, inc_src, inc_mesa, inc_valhall], 184 dependencies: [idep_gtest, idep_nir, idep_bi_opcodes_h, idep_bi_builder_h], 185 link_with : [libpanfrost_bifrost], 186 ), 187 suite : ['panfrost'], 188 protocol : gtest_test_protocol, 189 ) 190endif 191