• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright © 2017-2019 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
21anv_entrypoints = custom_target(
22  'anv_entrypoints',
23  input : [vk_entrypoints_gen, vk_api_xml],
24  output : ['anv_entrypoints.h', 'anv_entrypoints.c'],
25  command : [
26    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
27    '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'anv',
28    '--device-prefix', 'gfx7', '--device-prefix', 'gfx75',
29    '--device-prefix', 'gfx8', '--device-prefix', 'gfx9',
30    '--device-prefix', 'gfx11', '--device-prefix', 'gfx12',
31    '--device-prefix', 'gfx125',
32  ],
33  depend_files : vk_entrypoints_gen_depend_files,
34)
35
36intel_icd = custom_target(
37  'intel_icd',
38  input : [vk_icd_gen, vk_api_xml],
39  output : 'intel_icd.@0@.json'.format(host_machine.cpu()),
40  command : [
41    prog_python, '@INPUT0@',
42    '--api-version', '1.3', '--xml', '@INPUT1@',
43    '--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
44                             'libvulkan_intel.so'),
45    '--out', '@OUTPUT@',
46  ],
47  build_by_default : true,
48  install_dir : with_vulkan_icd_dir,
49  install : true,
50)
51
52if meson.version().version_compare('>= 0.58')
53  _dev_icdname = 'intel_devenv_icd.@0@.json'.format(host_machine.cpu())
54  custom_target(
55    'intel_devenv_icd',
56    input : [vk_icd_gen, vk_api_xml],
57    output : _dev_icdname,
58    command : [
59      prog_python, '@INPUT0@',
60      '--api-version', '1.3', '--xml', '@INPUT1@',
61      '--lib-path', meson.current_build_dir() / 'libvulkan_intel.so',
62      '--out', '@OUTPUT@',
63    ],
64    build_by_default : true,
65  )
66
67  devenv.append('VK_ICD_FILENAMES', meson.current_build_dir() / _dev_icdname)
68endif
69
70libanv_per_hw_ver_libs = []
71anv_per_hw_ver_files = files(
72  'genX_blorp_exec.c',
73  'genX_cmd_buffer.c',
74  'genX_gpu_memcpy.c',
75  'genX_pipeline.c',
76  'genX_query.c',
77  'genX_state.c',
78)
79foreach g : [['70', ['gfx7_cmd_buffer.c']], ['75', ['gfx7_cmd_buffer.c']],
80             ['80', ['gfx8_cmd_buffer.c']], ['90', ['gfx8_cmd_buffer.c']],
81             ['110', ['gfx8_cmd_buffer.c']], ['120', ['gfx8_cmd_buffer.c']],
82             ['125', ['gfx8_cmd_buffer.c']]]
83  _gfx_ver = g[0]
84  libanv_per_hw_ver_libs += static_library(
85    'anv_per_hw_ver@0@'.format(_gfx_ver),
86    [anv_per_hw_ver_files, g[1], anv_entrypoints[0]],
87    include_directories : [
88      inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_compiler, inc_intel,
89    ],
90    c_args : [
91      no_override_init_args, c_sse2_args,
92      '-DGFX_VERx10=@0@'.format(_gfx_ver),
93    ],
94    gnu_symbol_visibility : 'hidden',
95    dependencies : [
96      dep_libdrm, dep_valgrind, idep_nir_headers, idep_genxml,
97      idep_vulkan_util_headers, idep_vulkan_wsi_headers,
98      idep_vulkan_runtime_headers, idep_intel_driver_ds_headers,
99    ],
100  )
101endforeach
102
103libanv_files = files(
104  'anv_acceleration_structure.c',
105  'anv_allocator.c',
106  'anv_android.h',
107  'anv_batch_chain.c',
108  'anv_blorp.c',
109  'anv_bo_sync.c',
110  'anv_cmd_buffer.c',
111  'anv_descriptor_set.c',
112  'anv_device.c',
113  'anv_formats.c',
114  'anv_genX.h',
115  'anv_image.c',
116  'anv_measure.c',
117  'anv_measure.h',
118  'anv_nir.h',
119  'anv_nir_add_base_work_group_id.c',
120  'anv_nir_apply_pipeline_layout.c',
121  'anv_nir_compute_push_layout.c',
122  'anv_nir_lower_multiview.c',
123  'anv_nir_lower_ubo_loads.c',
124  'anv_nir_lower_ycbcr_textures.c',
125  'anv_perf.c',
126  'anv_pipeline.c',
127  'anv_pipeline_cache.c',
128  'anv_private.h',
129  'anv_queue.c',
130  'anv_util.c',
131  'anv_utrace.c',
132  'anv_wsi.c',
133)
134
135anv_deps = [
136  dep_libdrm,
137  dep_valgrind,
138  idep_genxml,
139  idep_nir_headers,
140  idep_vulkan_util_headers,
141  idep_vulkan_runtime_headers,
142  idep_vulkan_wsi_headers,
143]
144anv_flags = [
145  no_override_init_args,
146  c_sse2_args,
147]
148
149anv_cpp_flags = []
150
151if with_platform_x11
152  anv_deps += dep_xcb_dri3
153endif
154
155if with_platform_wayland
156  anv_deps += dep_wayland_client
157endif
158
159if with_xlib_lease
160  anv_deps += [dep_xlib_xrandr]
161endif
162
163if with_platform_android
164  libanv_files += files('anv_android.c')
165else
166  libanv_files += files('anv_android_stubs.c')
167endif
168
169anv_deps += idep_intel_driver_ds_headers
170
171libanv_common = static_library(
172  'anv_common',
173  [
174    libanv_files, anv_entrypoints, sha1_h,
175    gen_xml_pack,
176  ],
177  include_directories : [
178    inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_intel, inc_compiler,
179    inc_util,
180  ],
181  c_args : anv_flags,
182  cpp_args : anv_cpp_flags,
183  gnu_symbol_visibility : 'hidden',
184  dependencies : anv_deps,
185)
186
187libvulkan_intel = shared_library(
188  'vulkan_intel',
189  [files('anv_gem.c'), anv_entrypoints[0]],
190  include_directories : [
191    inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_intel, inc_compiler,
192  ],
193  link_whole : [libanv_common, libanv_per_hw_ver_libs],
194  link_with : [
195    libintel_compiler, libintel_dev, libisl, libblorp, libintel_perf,
196  ],
197  dependencies : [
198    dep_thread, dep_dl, dep_m, anv_deps, idep_libintel_common,
199    idep_nir, idep_genxml, idep_vulkan_util, idep_vulkan_wsi,
200    idep_vulkan_runtime, idep_mesautil, idep_xmlconfig,
201    idep_intel_driver_ds,
202  ],
203  c_args : anv_flags,
204  gnu_symbol_visibility : 'hidden',
205  link_args : [ld_args_build_id, ld_args_bsymbolic, ld_args_gc_sections],
206  install : true,
207)
208
209if with_symbols_check
210  test(
211    'anv symbols check',
212    symbols_check,
213    args : [
214      '--lib', libvulkan_intel,
215      '--symbols-file', vulkan_icd_symbols,
216      symbols_check_args,
217    ],
218    suite : ['intel'],
219  )
220endif
221
222if with_tests
223  libvulkan_intel_test = static_library(
224    'vulkan_intel_test',
225    [files('anv_gem_stubs.c'), anv_entrypoints[0]],
226    include_directories : [
227      inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_intel, inc_compiler,
228    ],
229    link_whole : libanv_common,
230    link_with : [
231      libanv_per_hw_ver_libs, libintel_compiler, libintel_common, libintel_dev,
232      libisl, libblorp, libintel_perf,
233    ],
234    dependencies : [
235      dep_thread, dep_dl, dep_m, anv_deps,
236      idep_nir, idep_vulkan_util, idep_vulkan_wsi, idep_vulkan_runtime,
237      idep_mesautil,
238    ],
239    c_args : anv_flags,
240    gnu_symbol_visibility : 'hidden',
241  )
242
243  foreach t : ['block_pool_no_free', 'block_pool_grow_first',
244               'state_pool_no_free', 'state_pool_free_list_only',
245               'state_pool', 'state_pool_padding']
246    test(
247      'anv_@0@'.format(t),
248      executable(
249        t,
250        ['tests/@0@.c'.format(t), anv_entrypoints[0]],
251        c_args : [ c_sse2_args ],
252        link_with : libvulkan_intel_test,
253        dependencies : [
254          dep_libdrm, dep_thread, dep_m, dep_valgrind,
255          idep_vulkan_util, idep_vulkan_wsi_headers,
256          idep_vulkan_runtime, idep_intel_driver_ds,
257        ],
258        include_directories : [
259          inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_intel, inc_compiler,
260        ],
261      ),
262      suite : ['intel'],
263    )
264  endforeach
265endif
266