• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright © 2017 Intel Corporation
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
21amd_json_files = [
22  # Generated:
23  '../registers/gfx6.json',
24  '../registers/gfx7.json',
25  '../registers/gfx8.json',
26  '../registers/gfx81.json',
27  '../registers/gfx9.json',
28  '../registers/gfx940.json',
29  '../registers/gfx10.json',
30  '../registers/gfx103.json',
31  '../registers/gfx11.json',
32  '../registers/gfx115.json',
33
34  # Manually written:
35  '../registers/pkt3.json',
36  '../registers/gfx10-rsrc.json',
37  '../registers/gfx11-rsrc.json',
38  '../registers/registers-manually-defined.json',
39]
40
41sid_tables_h = custom_target(
42  'sid_tables_h',
43  input : ['sid_tables.py', 'sid.h'] + amd_json_files,
44  output : 'sid_tables.h',
45  command : [prog_python, '@INPUT@'],
46  capture : true,
47)
48
49amdgfxregs_h = custom_target(
50  'amdgfxregs_h',
51  input : ['../registers/makeregheader.py'] + amd_json_files,
52  output : 'amdgfxregs.h',
53  command : [prog_python, '@INPUT@', '--sort', 'address', '--guard', 'AMDGFXREGS_H'],
54  capture : true,
55)
56
57gfx10_format_table_c = custom_target(
58  'gfx10_format_table.c',
59  input : files(
60    'gfx10_format_table.py',
61    '../../util/format/u_format.csv', '../registers/gfx10-rsrc.json', '../registers/gfx11-rsrc.json'
62  ),
63  output : 'gfx10_format_table.c',
64  command : [prog_python, '@INPUT@'],
65  capture : true,
66  depend_files : ['../registers/regdb.py']
67)
68
69amd_common_files = files(
70  'ac_binary.c',
71  'ac_binary.h',
72  'ac_shader_args.c',
73  'ac_shader_args.h',
74  'ac_shader_util.c',
75  'ac_shader_util.h',
76  'ac_gather_context_rolls.c',
77  'ac_gpu_info.c',
78  'ac_gpu_info.h',
79  'ac_surface.c',
80  'ac_surface.h',
81  'ac_debug.c',
82  'ac_debug.h',
83  'ac_shadowed_regs.c',
84  'ac_shadowed_regs.h',
85  'ac_spm.c',
86  'ac_spm.h',
87  'ac_sqtt.c',
88  'ac_sqtt.h',
89  'ac_rgp.c',
90  'ac_rgp.h',
91  'ac_msgpack.c',
92  'ac_msgpack.h',
93  'ac_nir.c',
94  'ac_nir.h',
95  'ac_nir_opt_outputs.c',
96  'ac_nir_cull.c',
97  'ac_nir_lower_esgs_io_to_mem.c',
98  'ac_nir_lower_global_access.c',
99  'ac_nir_lower_image_opcodes_cdna.c',
100  'ac_nir_lower_resinfo.c',
101  'ac_nir_lower_subdword_loads.c',
102  'ac_nir_lower_taskmesh_io_to_mem.c',
103  'ac_nir_lower_tess_io_to_mem.c',
104  'ac_nir_lower_tex.c',
105  'ac_nir_lower_ngg.c',
106  'ac_nir_lower_ps.c',
107  'amd_family.c',
108  'ac_parse_ib.c',
109  'ac_perfcounter.c',
110  'ac_perfcounter.h',
111  'ac_vcn_av1_default.h',
112)
113
114if dep_elf.found()
115  amd_common_files += files(
116    'ac_rtld.c',
117    'ac_rtld.h',
118    'ac_rgp_elf_object_pack.c',
119  )
120endif
121
122libamd_common = static_library(
123  'amd_common',
124  [amd_common_files, sid_tables_h, amdgfxregs_h, gfx10_format_table_c],
125  include_directories : [
126    inc_include, inc_src, inc_amd,
127  ],
128  dependencies : [
129    dep_thread, dep_elf, dep_libdrm_amdgpu, dep_valgrind,
130    idep_mesautil, idep_nir_headers, idep_nir
131  ],
132  gnu_symbol_visibility : 'hidden',
133  c_args : ['-DADDR_FASTCALL=']
134)
135
136idep_amdgfxregs_h = declare_dependency(sources : [amdgfxregs_h])
137
138executable(
139  'ac_ib_parser',
140  ['ac_ib_parser.c'],
141  link_with: [libamd_common],
142  include_directories : [
143    inc_amd, inc_include, inc_src,
144  ],
145  dependencies : [idep_amdgfxregs_h, idep_mesautil, idep_nir_headers],
146)
147
148if with_tests and not with_platform_windows
149  test(
150    'ac_surface_modifier_test',
151    executable(
152      'ac_surface_modifier_test',
153      ['ac_surface_modifier_test.c'],
154      link_with: [libamd_common, libamdgpu_addrlib],
155      include_directories : [
156        inc_amd, inc_include, inc_src,
157      ],
158      dependencies: [idep_amdgfxregs_h, dep_libdrm_amdgpu, idep_mesautil],
159    ),
160    suite: ['amd']
161  )
162
163  # Limit this to only a few architectures for the Gitlab CI.
164  if ['x86', 'x86_64', 'aarch64'].contains(host_machine.cpu_family())
165    test(
166      'ac_surface_meta_address_test',
167      executable(
168        'ac_surface_meta_address_test',
169        ['ac_surface_meta_address_test.c'],
170        link_with: [libamd_common, libamdgpu_addrlib],
171        include_directories : [
172          inc_amd, inc_include, inc_src,
173        ],
174        dependencies: [idep_amdgfxregs_h, dep_libdrm_amdgpu, idep_mesautil, dep_openmp],
175      ),
176      suite: ['amd']
177    )
178  endif
179endif
180