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