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