1bf215546Sopenharmony_ci# Copyright © 2020 Google, Inc 2bf215546Sopenharmony_ci 3bf215546Sopenharmony_ci# Permission is hereby granted, free of charge, to any person obtaining a copy 4bf215546Sopenharmony_ci# of this software and associated documentation files (the "Software"), to deal 5bf215546Sopenharmony_ci# in the Software without restriction, including without limitation the rights 6bf215546Sopenharmony_ci# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7bf215546Sopenharmony_ci# copies of the Software, and to permit persons to whom the Software is 8bf215546Sopenharmony_ci# furnished to do so, subject to the following conditions: 9bf215546Sopenharmony_ci 10bf215546Sopenharmony_ci# The above copyright notice and this permission notice shall be included in 11bf215546Sopenharmony_ci# all copies or substantial portions of the Software. 12bf215546Sopenharmony_ci 13bf215546Sopenharmony_ci# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14bf215546Sopenharmony_ci# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15bf215546Sopenharmony_ci# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16bf215546Sopenharmony_ci# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17bf215546Sopenharmony_ci# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18bf215546Sopenharmony_ci# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19bf215546Sopenharmony_ci# SOFTWARE. 20bf215546Sopenharmony_ci 21bf215546Sopenharmony_ciif with_tests 22bf215546Sopenharmony_ci diff = find_program('diff') 23bf215546Sopenharmony_ciendif 24bf215546Sopenharmony_ci 25bf215546Sopenharmony_ci# Shared cmdstream decoding: 26bf215546Sopenharmony_cilibfreedreno_cffdec = static_library( 27bf215546Sopenharmony_ci 'freedreno_cffdec', 28bf215546Sopenharmony_ci [ 29bf215546Sopenharmony_ci 'buffers.c', 30bf215546Sopenharmony_ci 'buffers.h', 31bf215546Sopenharmony_ci 'cffdec.c', 32bf215546Sopenharmony_ci 'cffdec.h', 33bf215546Sopenharmony_ci 'pager.c', 34bf215546Sopenharmony_ci 'pager.h', 35bf215546Sopenharmony_ci 'rnnutil.c', 36bf215546Sopenharmony_ci 'rnnutil.h', 37bf215546Sopenharmony_ci 'util.h', 38bf215546Sopenharmony_ci ], 39bf215546Sopenharmony_ci include_directories: [ 40bf215546Sopenharmony_ci inc_freedreno, 41bf215546Sopenharmony_ci inc_freedreno_rnn, 42bf215546Sopenharmony_ci inc_include, 43bf215546Sopenharmony_ci inc_src, 44bf215546Sopenharmony_ci ], 45bf215546Sopenharmony_ci c_args : [ no_override_init_args ], 46bf215546Sopenharmony_ci gnu_symbol_visibility: 'hidden', 47bf215546Sopenharmony_ci dependencies: [], 48bf215546Sopenharmony_ci link_with: [ 49bf215546Sopenharmony_ci libfreedreno_rnn, 50bf215546Sopenharmony_ci libfreedreno_ir2, # for disasm_a2xx 51bf215546Sopenharmony_ci libfreedreno_ir3, # for disasm_a3xx 52bf215546Sopenharmony_ci _libmesa_util, 53bf215546Sopenharmony_ci ], 54bf215546Sopenharmony_ci build_by_default: false, 55bf215546Sopenharmony_ci) 56bf215546Sopenharmony_ci 57bf215546Sopenharmony_ciif dep_libarchive.found() 58bf215546Sopenharmony_ci libfreedreno_io = static_library( 59bf215546Sopenharmony_ci 'libfreedreno_io', 60bf215546Sopenharmony_ci [ 61bf215546Sopenharmony_ci 'io.c', 62bf215546Sopenharmony_ci 'io.h', 63bf215546Sopenharmony_ci ], 64bf215546Sopenharmony_ci include_directories: [], 65bf215546Sopenharmony_ci c_args : [no_override_init_args], 66bf215546Sopenharmony_ci gnu_symbol_visibility: 'hidden', 67bf215546Sopenharmony_ci dependencies: [ 68bf215546Sopenharmony_ci dep_libarchive, 69bf215546Sopenharmony_ci ], 70bf215546Sopenharmony_ci build_by_default: false, 71bf215546Sopenharmony_ci ) 72bf215546Sopenharmony_ciendif 73bf215546Sopenharmony_ci 74bf215546Sopenharmony_ciif dep_lua.found() and dep_libarchive.found() 75bf215546Sopenharmony_ci cffdump = executable( 76bf215546Sopenharmony_ci 'cffdump', 77bf215546Sopenharmony_ci [ 78bf215546Sopenharmony_ci 'cffdump.c', 79bf215546Sopenharmony_ci 'script.c', 80bf215546Sopenharmony_ci 'script.h' 81bf215546Sopenharmony_ci ], 82bf215546Sopenharmony_ci include_directories: [ 83bf215546Sopenharmony_ci inc_freedreno, 84bf215546Sopenharmony_ci inc_freedreno_rnn, 85bf215546Sopenharmony_ci inc_include, 86bf215546Sopenharmony_ci inc_src, 87bf215546Sopenharmony_ci ], 88bf215546Sopenharmony_ci c_args : [no_override_init_args], 89bf215546Sopenharmony_ci gnu_symbol_visibility: 'hidden', 90bf215546Sopenharmony_ci dependencies: [ 91bf215546Sopenharmony_ci dep_lua, 92bf215546Sopenharmony_ci ], 93bf215546Sopenharmony_ci link_with: [ 94bf215546Sopenharmony_ci libfreedreno_cffdec, 95bf215546Sopenharmony_ci libfreedreno_io, 96bf215546Sopenharmony_ci ], 97bf215546Sopenharmony_ci build_by_default: with_tools.contains('freedreno'), 98bf215546Sopenharmony_ci install: install_fd_decode_tools, 99bf215546Sopenharmony_ci ) 100bf215546Sopenharmony_ci 101bf215546Sopenharmony_ci if with_tests 102bf215546Sopenharmony_ci # dump only a single frame, and single tile pass, to keep the 103bf215546Sopenharmony_ci # reference output size managable 104bf215546Sopenharmony_ci cffdump_tests = [ 105bf215546Sopenharmony_ci ['fd-clouds', ['--frame', '0', '--once']], 106bf215546Sopenharmony_ci ['es2gears-a320', ['--frame', '0', '--once']], 107bf215546Sopenharmony_ci ['glxgears-a420', ['--frame', '1', '--once']], 108bf215546Sopenharmony_ci ['dEQP-GLES2.functional.texture.specification.basic_teximage2d.rgba16f_2d', ['--once']], 109bf215546Sopenharmony_ci ['dEQP-VK.draw.indirect_draw.indexed.indirect_draw_count.triangle_list', ['--frame', '0', '--once']], 110bf215546Sopenharmony_ci # Test a lua script to ensure we don't break scripting API 111bf215546Sopenharmony_ci ['shadow', ['--script', files(join_paths(meson.current_source_dir(), 'scripts', 'parse-submits.lua'))]], 112bf215546Sopenharmony_ci ] 113bf215546Sopenharmony_ci foreach cffdump_test: cffdump_tests 114bf215546Sopenharmony_ci name = cffdump_test[0] 115bf215546Sopenharmony_ci args = cffdump_test[1] 116bf215546Sopenharmony_ci 117bf215546Sopenharmony_ci log = custom_target(name + '.log', 118bf215546Sopenharmony_ci output: name + '.log', 119bf215546Sopenharmony_ci command: [cffdump, '--unit-test', args, files('../.gitlab-ci/traces/' + name + '.rd.gz')], 120bf215546Sopenharmony_ci capture: true, 121bf215546Sopenharmony_ci ) 122bf215546Sopenharmony_ci test('cffdump-' + name, 123bf215546Sopenharmony_ci diff, 124bf215546Sopenharmony_ci args: ['-u', files('../.gitlab-ci/reference/' + name + '.log'), log], 125bf215546Sopenharmony_ci suite: 'freedreno', 126bf215546Sopenharmony_ci workdir: meson.source_root() 127bf215546Sopenharmony_ci ) 128bf215546Sopenharmony_ci 129bf215546Sopenharmony_ci endforeach 130bf215546Sopenharmony_ci endif 131bf215546Sopenharmony_ciendif 132bf215546Sopenharmony_ci 133bf215546Sopenharmony_cicrashdec = executable( 134bf215546Sopenharmony_ci 'crashdec', 135bf215546Sopenharmony_ci [ 136bf215546Sopenharmony_ci 'crashdec.c', 137bf215546Sopenharmony_ci 'crashdec.h', 138bf215546Sopenharmony_ci 'crashdec-hfi.c', 139bf215546Sopenharmony_ci 'crashdec-mempool.c', 140bf215546Sopenharmony_ci ], 141bf215546Sopenharmony_ci include_directories: [ 142bf215546Sopenharmony_ci inc_freedreno, 143bf215546Sopenharmony_ci inc_freedreno_rnn, 144bf215546Sopenharmony_ci inc_include, 145bf215546Sopenharmony_ci inc_src, 146bf215546Sopenharmony_ci ], 147bf215546Sopenharmony_ci gnu_symbol_visibility: 'hidden', 148bf215546Sopenharmony_ci dependencies: [], 149bf215546Sopenharmony_ci link_with: [ 150bf215546Sopenharmony_ci libfreedreno_cffdec, 151bf215546Sopenharmony_ci ], 152bf215546Sopenharmony_ci build_by_default: with_tools.contains('freedreno'), 153bf215546Sopenharmony_ci install: install_fd_decode_tools, 154bf215546Sopenharmony_ci) 155bf215546Sopenharmony_ci 156bf215546Sopenharmony_ciif with_tests 157bf215546Sopenharmony_ci crashdec_output = custom_target('crashdec.txt', 158bf215546Sopenharmony_ci output: 'crashdec.txt', 159bf215546Sopenharmony_ci command: [crashdec, '-sf', files('../.gitlab-ci/traces/crash.devcore')], 160bf215546Sopenharmony_ci capture: true 161bf215546Sopenharmony_ci ) 162bf215546Sopenharmony_ci test('crashdec', 163bf215546Sopenharmony_ci diff, 164bf215546Sopenharmony_ci args: ['-u', files('../.gitlab-ci/reference/crash.log'), crashdec_output], 165bf215546Sopenharmony_ci suite: 'freedreno', 166bf215546Sopenharmony_ci workdir: meson.source_root() 167bf215546Sopenharmony_ci ) 168bf215546Sopenharmony_ciendif 169bf215546Sopenharmony_ci 170bf215546Sopenharmony_ciif dep_libarchive.found() 171bf215546Sopenharmony_ci pgmdump = executable( 172bf215546Sopenharmony_ci 'pgmdump', 173bf215546Sopenharmony_ci 'pgmdump.c', 174bf215546Sopenharmony_ci include_directories: [ 175bf215546Sopenharmony_ci inc_freedreno, 176bf215546Sopenharmony_ci inc_include, 177bf215546Sopenharmony_ci inc_src, 178bf215546Sopenharmony_ci ], 179bf215546Sopenharmony_ci gnu_symbol_visibility: 'hidden', 180bf215546Sopenharmony_ci dependencies: [], 181bf215546Sopenharmony_ci link_with: [ 182bf215546Sopenharmony_ci libfreedreno_cffdec, 183bf215546Sopenharmony_ci libfreedreno_io, 184bf215546Sopenharmony_ci libfreedreno_ir2, # for disasm_a2xx 185bf215546Sopenharmony_ci libfreedreno_ir3, # for disasm_a3xx 186bf215546Sopenharmony_ci ], 187bf215546Sopenharmony_ci build_by_default: with_tools.contains('freedreno'), 188bf215546Sopenharmony_ci install: false, 189bf215546Sopenharmony_ci ) 190bf215546Sopenharmony_ci pgmdump2 = executable( 191bf215546Sopenharmony_ci 'pgmdump2', 192bf215546Sopenharmony_ci 'pgmdump2.c', 193bf215546Sopenharmony_ci include_directories: [ 194bf215546Sopenharmony_ci inc_freedreno, 195bf215546Sopenharmony_ci inc_include, 196bf215546Sopenharmony_ci inc_src, 197bf215546Sopenharmony_ci ], 198bf215546Sopenharmony_ci gnu_symbol_visibility: 'hidden', 199bf215546Sopenharmony_ci dependencies: [], 200bf215546Sopenharmony_ci link_with: [ 201bf215546Sopenharmony_ci libfreedreno_cffdec, 202bf215546Sopenharmony_ci libfreedreno_io, 203bf215546Sopenharmony_ci libfreedreno_ir2, # for disasm_a2xx 204bf215546Sopenharmony_ci libfreedreno_ir3, # for disasm_a3xx 205bf215546Sopenharmony_ci ], 206bf215546Sopenharmony_ci build_by_default: with_tools.contains('freedreno'), 207bf215546Sopenharmony_ci install: false, 208bf215546Sopenharmony_ci ) 209bf215546Sopenharmony_ciendif 210