xref: /aosp_15_r20/external/mesa3d/src/amd/common/meson.build (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1# Copyright © 2017 Intel Corporation
2# SPDX-License-Identifier: MIT
3
4amd_json_files = [
5  # Generated:
6  '../registers/gfx6.json',
7  '../registers/gfx7.json',
8  '../registers/gfx8.json',
9  '../registers/gfx81.json',
10  '../registers/gfx9.json',
11  '../registers/gfx940.json',
12  '../registers/gfx10.json',
13  '../registers/gfx103.json',
14  '../registers/gfx11.json',
15  '../registers/gfx115.json',
16  '../registers/gfx12.json',
17
18  # Manually written:
19  '../registers/pkt3.json',
20  '../registers/gfx10-rsrc.json',
21  '../registers/gfx11-rsrc.json',
22  '../registers/gfx12-rsrc.json',
23  '../registers/registers-manually-defined.json',
24]
25
26sid_tables_h = custom_target(
27  'sid_tables_h',
28  input : ['sid_tables.py', 'sid.h'] + amd_json_files,
29  output : 'sid_tables.h',
30  command : [prog_python, '@INPUT@'],
31  capture : true,
32)
33
34amdgfxregs_h = custom_target(
35  'amdgfxregs_h',
36  input : ['../registers/makeregheader.py'] + amd_json_files,
37  output : 'amdgfxregs.h',
38  command : [prog_python, '@INPUT@', '--sort', 'address', '--guard', 'AMDGFXREGS_H'],
39  capture : true,
40)
41
42gfx10_format_table_c = custom_target(
43  'gfx10_format_table.c',
44  input : files(
45    'gfx10_format_table.py',
46    '../../util/format/u_format.yaml', '../registers/gfx10-rsrc.json', '../registers/gfx11-rsrc.json'
47  ),
48  output : 'gfx10_format_table.c',
49  command : [prog_python, '@INPUT@'],
50  capture : true,
51  depend_files : ['../registers/regdb.py']
52)
53
54amd_common_files = files(
55  'ac_binary.c',
56  'ac_binary.h',
57  'ac_cmdbuf.c',
58  'ac_cmdbuf.h',
59  'ac_shader_args.c',
60  'ac_shader_args.h',
61  'ac_shader_util.c',
62  'ac_shader_util.h',
63  'ac_gather_context_rolls.c',
64  'ac_gpu_info.c',
65  'ac_gpu_info.h',
66  'ac_surface.c',
67  'ac_surface.h',
68  'ac_debug.c',
69  'ac_debug.h',
70  'ac_descriptors.c',
71  'ac_descriptors.h',
72  'ac_formats.c',
73  'ac_formats.h',
74  'ac_shadowed_regs.c',
75  'ac_shadowed_regs.h',
76  'ac_spm.c',
77  'ac_spm.h',
78  'ac_sqtt.c',
79  'ac_sqtt.h',
80  'ac_rgp.c',
81  'ac_rgp.h',
82  'ac_msgpack.c',
83  'ac_msgpack.h',
84  'ac_nir.c',
85  'ac_nir.h',
86  'ac_nir_helpers.h',
87  'ac_nir_opt_outputs.c',
88  'ac_nir_cull.c',
89  'ac_nir_lower_esgs_io_to_mem.c',
90  'ac_nir_lower_global_access.c',
91  'ac_nir_lower_image_opcodes_cdna.c',
92  'ac_nir_lower_resinfo.c',
93  'ac_nir_lower_subdword_loads.c',
94  'ac_nir_lower_taskmesh_io_to_mem.c',
95  'ac_nir_lower_tess_io_to_mem.c',
96  'ac_nir_lower_tex.c',
97  'ac_nir_lower_ngg.c',
98  'ac_nir_lower_ps.c',
99  'ac_nir_meta.h',
100  'ac_nir_meta_cs_blit.c',
101  'ac_nir_meta_cs_clear_copy_buffer.c',
102  'ac_nir_meta_ps_resolve.c',
103  'ac_nir_opt_shared_append.c',
104  'amd_family.c',
105  'ac_parse_ib.c',
106  'ac_perfcounter.c',
107  'ac_perfcounter.h',
108  'ac_pm4.c',
109  'ac_pm4.h',
110  'ac_vcn_av1_default.h',
111  'ac_vcn_dec.c',
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