• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_linux_drm.h',
75  'ac_shadowed_regs.c',
76  'ac_shadowed_regs.h',
77  'ac_spm.c',
78  'ac_spm.h',
79  'ac_sqtt.c',
80  'ac_sqtt.h',
81  'ac_rgp.c',
82  'ac_rgp.h',
83  'ac_msgpack.c',
84  'ac_msgpack.h',
85  'amd_family.c',
86  'ac_parse_ib.c',
87  'ac_perfcounter.c',
88  'ac_perfcounter.h',
89  'ac_pm4.c',
90  'ac_pm4.h',
91  'ac_vcn_av1_default.h',
92  'ac_vcn_dec.c',
93  'ac_vcn_enc.c',
94  'nir/ac_nir.c',
95  'nir/ac_nir.h',
96  'nir/ac_nir_helpers.h',
97  'nir/ac_nir_opt_outputs.c',
98  'nir/ac_nir_cull.c',
99  'nir/ac_nir_create_gs_copy_shader.c',
100  'nir/ac_nir_lower_esgs_io_to_mem.c',
101  'nir/ac_nir_lower_global_access.c',
102  'nir/ac_nir_lower_image_opcodes_cdna.c',
103  'nir/ac_nir_lower_intrinsics_to_args.c',
104  'nir/ac_nir_lower_legacy_gs.c',
105  'nir/ac_nir_lower_legacy_vs.c',
106  'nir/ac_nir_lower_mem_access_bit_sizes.c',
107  'nir/ac_nir_lower_resinfo.c',
108  'nir/ac_nir_lower_taskmesh_io_to_mem.c',
109  'nir/ac_nir_lower_tess_io_to_mem.c',
110  'nir/ac_nir_lower_tex.c',
111  'nir/ac_nir_lower_ngg.c',
112  'nir/ac_nir_lower_ngg_mesh.c',
113  'nir/ac_nir_lower_ps_early.c',
114  'nir/ac_nir_lower_ps_late.c',
115  'nir/ac_nir_lower_sin_cos.c',
116  'nir/ac_nir_meta.h',
117  'nir/ac_nir_meta_cs_blit.c',
118  'nir/ac_nir_meta_cs_clear_copy_buffer.c',
119  'nir/ac_nir_meta_ps_resolve.c',
120  'nir/ac_nir_opt_pack_half.c',
121  'nir/ac_nir_opt_shared_append.c',
122  'nir/ac_nir_prerast_utils.c',
123)
124
125if not with_platform_windows
126  amd_common_files += files(
127    'ac_linux_drm.c',
128  )
129endif
130
131link_with = []
132c_args = ['-DADDR_FASTCALL=']
133if with_amdgpu_virtio
134  c_args += ['-DHAVE_AMDGPU_VIRTIO', '-DENABLE_DRM_AMDGPU']
135  amd_common_files += files(
136    'virtio/amdgpu_virtio.c',
137    'virtio/amdgpu_virtio_bo.c',
138    'virtio/amdgpu_virtio_device.c',
139    'virtio/amdgpu_virtio_private.h',
140    'virtio/amdgpu_virtio_proto.h')
141  link_with += libvdrm
142endif
143
144if dep_elf.found()
145  amd_common_files += files(
146    'ac_rtld.c',
147    'ac_rtld.h',
148    'ac_rgp_elf_object_pack.c',
149  )
150endif
151
152libamd_common = static_library(
153  'amd_common',
154  [amd_common_files, sid_tables_h, amdgfxregs_h, gfx10_format_table_c],
155  include_directories : [
156    inc_include, inc_src, inc_amd, inc_virtio_gpu,
157  ],
158  dependencies : [dep_llvm.partial_dependency(compile_args: true, includes: true)] + [
159    dep_thread, dep_elf, dep_libdrm_amdgpu, dep_valgrind,
160    idep_mesautil, idep_nir_headers, idep_nir
161  ],
162  link_with: [ link_with ],
163  gnu_symbol_visibility : 'hidden',
164  c_args : c_args
165)
166
167idep_amdgfxregs_h = declare_dependency(sources : [amdgfxregs_h])
168
169executable(
170  'ac_ib_parser',
171  ['ac_ib_parser.c'],
172  link_with: [libamd_common],
173  include_directories : [
174    inc_amd, inc_include, inc_src,
175  ],
176  dependencies : [idep_amdgfxregs_h, idep_mesautil, idep_nir_headers],
177)
178
179if with_tests and not with_platform_windows
180  test(
181    'ac_surface_modifier_test',
182    executable(
183      'ac_surface_modifier_test',
184      ['ac_surface_modifier_test.c'],
185      link_with: [libamd_common, libamdgpu_addrlib],
186      include_directories : [
187        inc_amd, inc_include, inc_src,
188      ],
189      c_args : cpp_args_addrlib,
190      dependencies: [idep_amdgfxregs_h, dep_libdrm_amdgpu, idep_mesautil],
191    ),
192    suite: ['amd']
193  )
194
195  # Limit this to only a few architectures for the Gitlab CI.
196  if ['x86', 'x86_64', 'aarch64'].contains(host_machine.cpu_family())
197    test(
198      'ac_surface_meta_address_test',
199      executable(
200        'ac_surface_meta_address_test',
201        ['ac_surface_meta_address_test.c'],
202        link_with: [libamd_common, libamdgpu_addrlib],
203        include_directories : [
204          inc_amd, inc_include, inc_src,
205        ],
206        c_args : cpp_args_addrlib,
207        dependencies: [idep_amdgfxregs_h, dep_libdrm_amdgpu, idep_mesautil, dep_openmp],
208      ),
209      suite: ['amd']
210    )
211  endif
212endif
213