• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
25afuc_parser = custom_target(
26  'parser.[ch]',
27  input: 'parser.y',
28  output: ['parser.c', 'parser.h'],
29  command: [
30    prog_bison, '@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'
31  ]
32)
33
34afuc_lexer = custom_target(
35  'lexer.c',
36  input: 'lexer.l',
37  output: 'lexer.c',
38  command: [
39    prog_flex, '-o', '@OUTPUT@', '@INPUT@'
40  ]
41)
42
43encode_h = custom_target(
44  'encode.h',
45  input: ['afuc.xml'],
46  output: 'encode.h',
47  command: [
48    prog_isaspec_encode, '--xml', '@INPUT@', '--out-h', '@OUTPUT@'
49  ],
50)
51
52asm = executable(
53  'afuc-asm',
54  [
55    'asm.c',
56    'util.c',
57    'util.h',
58    afuc_lexer,
59    afuc_parser,
60    encode_h,
61  ],
62  include_directories: [
63    inc_freedreno_rnn, inc_include, inc_src, inc_util,
64  ],
65  link_with: [
66    libfreedreno_rnn,
67  ],
68  dependencies: [],
69  build_by_default : with_tools.contains('freedreno'),
70  install: install_fd_decode_tools,
71)
72if with_tests
73  asm_fw = custom_target('afuc_test.fw',
74    output: 'afuc_test.fw',
75    command: [asm, '-g', '6', files('../.gitlab-ci/traces/afuc_test.asm'), '@OUTPUT@'],
76  )
77  test('afuc-asm',
78    diff,
79    args: ['-u', files('../.gitlab-ci/reference/afuc_test.fw'), asm_fw],
80    suite: 'freedreno',
81    workdir: dir_source_root
82  )
83endif
84
85afuc_isa = custom_target(
86  'afuc-isa',
87  input: ['afuc.xml'],
88  output: ['afuc-isa.c', 'afuc-isa.h'],
89  command: [
90    prog_isaspec_decode, '--xml', '@INPUT@',
91    '--out-c', '@OUTPUT0@', '--out-h', '@OUTPUT1@',
92  ],
93)
94
95# Disasm requires mmaping >4GB
96if cc.sizeof('size_t') > 4
97  disasm = executable(
98    'afuc-disasm',
99    [
100      'disasm.c',
101      'emu.c',
102      'emu.h',
103      'emu-ds.c',
104      'emu-regs.c',
105      'emu-ui.c',
106      'util.c',
107      'util.h',
108      afuc_isa,
109    ],
110    include_directories: [
111      inc_freedreno,
112      inc_freedreno_rnn,
113      inc_include,
114      inc_src,
115      inc_util,
116    ],
117    link_with: [
118      libfreedreno_rnn,
119    ],
120    dependencies: [idep_mesautil, idep_isaspec_decode],
121    build_by_default : with_tools.contains('freedreno'),
122    install: install_fd_decode_tools,
123  )
124
125  if with_tests
126    disasm_fw = custom_target('afuc_test.asm',
127      output: 'afuc_test.asm',
128      command: [disasm, '-u', files('../.gitlab-ci/reference/afuc_test.fw'), '-g', '630'],
129      capture: true
130    )
131    test('afuc-disasm',
132      diff,
133      args: ['-u', files('../.gitlab-ci/reference/afuc_test.asm'), disasm_fw],
134      suite: 'freedreno',
135      workdir: dir_source_root
136    )
137  endif
138endif
139