1b8e80941Smrg# Copyright © 2017 Broadcom
2b8e80941Smrg#
3b8e80941Smrg# Permission is hereby granted, free of charge, to any person obtaining a copy
4b8e80941Smrg# of this software and associated documentation files (the "Software"), to deal
5b8e80941Smrg# in the Software without restriction, including without limitation the rights
6b8e80941Smrg# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7b8e80941Smrg# copies of the Software, and to permit persons to whom the Software is
8b8e80941Smrg# furnished to do so, subject to the following conditions:
9b8e80941Smrg#
10b8e80941Smrg# The above copyright notice and this permission notice shall be included in
11b8e80941Smrg# all copies or substantial portions of the Software.
12b8e80941Smrg#
13b8e80941Smrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14b8e80941Smrg# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15b8e80941Smrg# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16b8e80941Smrg# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17b8e80941Smrg# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18b8e80941Smrg# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19b8e80941Smrg# SOFTWARE.
20b8e80941Smrg
21b8e80941Smrgfiles_libvc4 = files(
22b8e80941Smrg  'kernel/vc4_drv.h',
23b8e80941Smrg  'kernel/vc4_gem.c',
24b8e80941Smrg  'kernel/vc4_packet.h',
25b8e80941Smrg  'kernel/vc4_render_cl.c',
26b8e80941Smrg  'kernel/vc4_validate.c',
27b8e80941Smrg  'kernel/vc4_validate_shaders.c',
28b8e80941Smrg  'vc4_blit.c',
29b8e80941Smrg  'vc4_bufmgr.c',
30b8e80941Smrg  'vc4_bufmgr.h',
31b8e80941Smrg  'vc4_cl.c',
32b8e80941Smrg  'vc4_cl_dump.c',
33b8e80941Smrg  'vc4_cl_dump.h',
34b8e80941Smrg  'vc4_cl.h',
35b8e80941Smrg  'vc4_context.c',
36b8e80941Smrg  'vc4_context.h',
37b8e80941Smrg  'vc4_draw.c',
38b8e80941Smrg  'vc4_emit.c',
39b8e80941Smrg  'vc4_fence.c',
40b8e80941Smrg  'vc4_formats.c',
41b8e80941Smrg  'vc4_job.c',
42b8e80941Smrg  'vc4_nir_lower_blend.c',
43b8e80941Smrg  'vc4_nir_lower_io.c',
44b8e80941Smrg  'vc4_nir_lower_txf_ms.c',
45b8e80941Smrg  'vc4_opt_algebraic.c',
46b8e80941Smrg  'vc4_opt_constant_folding.c',
47b8e80941Smrg  'vc4_opt_copy_propagation.c',
48b8e80941Smrg  'vc4_opt_dead_code.c',
49b8e80941Smrg  'vc4_opt_peephole_sf.c',
50b8e80941Smrg  'vc4_opt_small_immediates.c',
51b8e80941Smrg  'vc4_opt_vpm.c',
52b8e80941Smrg  'vc4_opt_coalesce_ff_writes.c',
53b8e80941Smrg  'vc4_program.c',
54b8e80941Smrg  'vc4_qir.c',
55b8e80941Smrg  'vc4_qir_emit_uniform_stream_resets.c',
56b8e80941Smrg  'vc4_qir_live_variables.c',
57b8e80941Smrg  'vc4_qir_lower_uniforms.c',
58b8e80941Smrg  'vc4_qir_schedule.c',
59b8e80941Smrg  'vc4_qir_validate.c',
60b8e80941Smrg  'vc4_qir.h',
61b8e80941Smrg  'vc4_qpu.c',
62b8e80941Smrg  'vc4_qpu_defines.h',
63b8e80941Smrg  'vc4_qpu_disasm.c',
64b8e80941Smrg  'vc4_qpu_emit.c',
65b8e80941Smrg  'vc4_qpu.h',
66b8e80941Smrg  'vc4_qpu_schedule.c',
67b8e80941Smrg  'vc4_qpu_validate.c',
68b8e80941Smrg  'vc4_query.c',
69b8e80941Smrg  'vc4_register_allocate.c',
70b8e80941Smrg  'vc4_reorder_uniforms.c',
71b8e80941Smrg  'vc4_resource.c',
72b8e80941Smrg  'vc4_resource.h',
73b8e80941Smrg  'vc4_screen.c',
74b8e80941Smrg  'vc4_screen.h',
75b8e80941Smrg  'vc4_simulator.c',
76b8e80941Smrg  'vc4_simulator_validate.h',
77b8e80941Smrg  'vc4_state.c',
78b8e80941Smrg  'vc4_tiling.c',
79b8e80941Smrg  'vc4_tiling_lt.c',
80b8e80941Smrg  'vc4_tiling.h',
81b8e80941Smrg  'vc4_uniforms.c',
82b8e80941Smrg)
83b8e80941Smrg
84b8e80941Smrgvc4_c_args = []
85b8e80941Smrg
86b8e80941Smrglibvc4_neon = []
87b8e80941Smrgif host_machine.cpu_family() == 'arm'
88b8e80941Smrg  libvc4_neon = static_library(
89b8e80941Smrg    'vc4_neon',
90b8e80941Smrg    'vc4_tiling_lt_neon.c',
91b8e80941Smrg    include_directories : [
92b8e80941Smrg      inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_broadcom
93b8e80941Smrg    ],
94b8e80941Smrg    c_args : '-mfpu=neon',
95b8e80941Smrg  )
96b8e80941Smrg  vc4_c_args += '-DUSE_ARM_ASM'
97b8e80941Smrgendif
98b8e80941Smrg
99b8e80941Smrgif dep_simpenrose.found()
100b8e80941Smrg  vc4_c_args += '-DUSE_VC4_SIMULATOR'
101b8e80941Smrgendif
102b8e80941Smrg
103b8e80941Smrglibvc4 = static_library(
104b8e80941Smrg  'vc4',
105b8e80941Smrg  [files_libvc4, v3d_xml_pack],
106b8e80941Smrg  include_directories : [
107b8e80941Smrg    inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_broadcom,
108b8e80941Smrg    inc_gallium_drivers,
109b8e80941Smrg  ],
110b8e80941Smrg  link_with: libvc4_neon,
111b8e80941Smrg  c_args : [c_vis_args, vc4_c_args],
112b8e80941Smrg  cpp_args : [cpp_vis_args],
113b8e80941Smrg  dependencies : [dep_simpenrose, dep_libdrm, dep_valgrind, idep_nir_headers],
114b8e80941Smrg  build_by_default : false,
115b8e80941Smrg)
116b8e80941Smrg
117b8e80941Smrgdriver_vc4 = declare_dependency(
118b8e80941Smrg  compile_args : '-DGALLIUM_VC4',
119b8e80941Smrg  link_with : [libvc4, libvc4winsys, libbroadcom_cle, libbroadcom_v3d],
120b8e80941Smrg  dependencies : idep_nir,
121b8e80941Smrg)
122