• 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_gs.c',
113  'nir/ac_nir_lower_ngg_mesh.c',
114  'nir/ac_nir_lower_ps_early.c',
115  'nir/ac_nir_lower_ps_late.c',
116  'nir/ac_nir_lower_sin_cos.c',
117  'nir/ac_nir_meta.h',
118  'nir/ac_nir_meta_cs_blit.c',
119  'nir/ac_nir_meta_cs_clear_copy_buffer.c',
120  'nir/ac_nir_meta_ps_resolve.c',
121  'nir/ac_nir_opt_pack_half.c',
122  'nir/ac_nir_opt_shared_append.c',
123  'nir/ac_nir_prerast_utils.c',
124)
125
126if not with_platform_windows
127  amd_common_files += files(
128    'ac_linux_drm.c',
129  )
130endif
131
132link_with = []
133c_args = ['-DADDR_FASTCALL=']
134if with_amdgpu_virtio
135  c_args += ['-DHAVE_AMDGPU_VIRTIO', '-DENABLE_DRM_AMDGPU']
136  amd_common_files += files(
137    'virtio/amdgpu_virtio.c',
138    'virtio/amdgpu_virtio_bo.c',
139    'virtio/amdgpu_virtio_device.c',
140    'virtio/amdgpu_virtio_private.h',
141    'virtio/amdgpu_virtio_proto.h')
142  link_with += libvdrm
143endif
144
145if dep_elf.found()
146  amd_common_files += files(
147    'ac_rtld.c',
148    'ac_rtld.h',
149    'ac_rgp_elf_object_pack.c',
150  )
151endif
152
153libamd_common = static_library(
154  'amd_common',
155  [amd_common_files, sid_tables_h, amdgfxregs_h, gfx10_format_table_c],
156  include_directories : [
157    inc_include, inc_src, inc_amd, inc_virtio_gpu,
158  ],
159  dependencies : [dep_llvm.partial_dependency(compile_args: true, includes: true)] + [
160    dep_thread, dep_elf, dep_libdrm_amdgpu, dep_valgrind,
161    idep_mesautil, idep_nir_headers, idep_nir
162  ],
163  link_with: [ link_with ],
164  gnu_symbol_visibility : 'hidden',
165  c_args : c_args
166)
167
168idep_amdgfxregs_h = declare_dependency(sources : [amdgfxregs_h])
169
170executable(
171  'ac_ib_parser',
172  ['ac_ib_parser.c'],
173  link_with: [libamd_common],
174  include_directories : [
175    inc_amd, inc_include, inc_src,
176  ],
177  dependencies : [idep_amdgfxregs_h, idep_mesautil, idep_nir_headers],
178)
179
180if with_tests and not with_platform_windows
181  test(
182    'ac_surface_modifier_test',
183    executable(
184      'ac_surface_modifier_test',
185      ['ac_surface_modifier_test.c'],
186      link_with: [libamd_common, libamdgpu_addrlib],
187      include_directories : [
188        inc_amd, inc_include, inc_src,
189      ],
190      c_args : cpp_args_addrlib,
191      dependencies: [idep_amdgfxregs_h, dep_libdrm_amdgpu, idep_mesautil],
192    ),
193    suite: ['amd']
194  )
195
196  # Limit this to only a few architectures for the Gitlab CI.
197  if ['x86', 'x86_64', 'aarch64'].contains(host_machine.cpu_family())
198    test(
199      'ac_surface_meta_address_test',
200      executable(
201        'ac_surface_meta_address_test',
202        ['ac_surface_meta_address_test.c'],
203        link_with: [libamd_common, libamdgpu_addrlib],
204        include_directories : [
205          inc_amd, inc_include, inc_src,
206        ],
207        c_args : cpp_args_addrlib,
208        dependencies: [idep_amdgfxregs_h, dep_libdrm_amdgpu, idep_mesautil, dep_openmp],
209      ),
210      suite: ['amd']
211    )
212  endif
213endif
214