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