1/*
2 * Copyright (C) 2023 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package {
18    // See: http://go/android-license-faq
19    default_applicable_licenses: ["hardware_google_gfxstream_license"],
20}
21
22python_binary_host {
23    name: "vk_format_info_gen_gfxstream",
24    main: "vk_format_info_gen.py",
25    srcs: ["vk_format_info_gen.py"],
26    libs: [
27        "mako",
28    ],
29}
30
31genrule {
32    name: "vk_cmd_queue_header_gfxstream",
33    srcs: [":libmesa_vulkan_xml_gfxstream"],
34    out: ["vk_cmd_queue.h"],
35    tools: ["vk_cmd_queue_gen_gfxstream"],
36    cmd: "python3 $(location vk_cmd_queue_gen_gfxstream) --xml " +
37        "$(location :libmesa_vulkan_xml_gfxstream) --out-h " +
38        "$(location vk_cmd_queue.h) --out-c " +
39        "$(genDir)/placeholder.c --beta false",
40}
41
42genrule {
43    name: "vk_cmd_queue_impl_gfxstream",
44    srcs: [":libmesa_vulkan_xml_gfxstream"],
45    out: ["vk_cmd_queue.c"],
46    tools: ["vk_cmd_queue_gen_gfxstream"],
47    cmd: "python3 $(location vk_cmd_queue_gen_gfxstream) --xml " +
48        "$(location :libmesa_vulkan_xml_gfxstream) --out-c " +
49        "$(location vk_cmd_queue.c) --out-h " +
50        "$(genDir)/vk_cmd_queue.h --beta false",
51}
52
53genrule {
54    name: "vk_common_entrypoints_header_gfxstream",
55    srcs: [":libmesa_vulkan_xml_gfxstream"],
56    out: ["vk_common_entrypoints.h"],
57    tools: ["vk_entrypoints_gen_gfxstream"],
58    cmd: "python3 $(location vk_entrypoints_gen_gfxstream) --xml " +
59        "$(location :libmesa_vulkan_xml_gfxstream) --proto --weak --out-h " +
60        "$(location vk_common_entrypoints.h) --out-c " +
61        "$(genDir)/placeholder.c --prefix vk_common --beta false",
62}
63
64genrule {
65    name: "vk_common_entrypoints_impl_gfxstream",
66    srcs: [":libmesa_vulkan_xml_gfxstream"],
67    out: ["vk_common_entrypoints.c"],
68    tools: ["vk_entrypoints_gen_gfxstream"],
69    cmd: "python3 $(location vk_entrypoints_gen_gfxstream) --xml " +
70        "$(location :libmesa_vulkan_xml_gfxstream) --proto --weak --out-h " +
71        "$(genDir)/vk_common_entrypoints.h --out-c " +
72        "$(location vk_common_entrypoints.c) --prefix vk_common " +
73        "--beta false",
74}
75
76genrule {
77    name: "vk_cmd_enqueue_entrypoints_header_gfxstream",
78    srcs: [":libmesa_vulkan_xml_gfxstream"],
79    out: ["vk_cmd_enqueue_entrypoints.h"],
80    tools: ["vk_entrypoints_gen_gfxstream"],
81    cmd: "python3 $(location vk_entrypoints_gen_gfxstream) --xml " +
82        "$(location :libmesa_vulkan_xml_gfxstream) --proto --weak --out-h " +
83        "$(location vk_cmd_enqueue_entrypoints.h) --out-c " +
84        "$(genDir)/placeholder.c --prefix vk_cmd_enqueue " +
85        " --prefix vk_cmd_enqueue_unless_primary --beta false",
86}
87
88genrule {
89    name: "vk_cmd_enqueue_entrypoints_impl_gfxstream",
90    srcs: [":libmesa_vulkan_xml_gfxstream"],
91    out: ["vk_cmd_enqueue_entrypoints.c"],
92    tools: ["vk_entrypoints_gen_gfxstream"],
93    cmd: "python3 $(location vk_entrypoints_gen_gfxstream) --xml " +
94        "$(location :libmesa_vulkan_xml_gfxstream) --proto --weak --out-h " +
95        "$(genDir)/vk_cmd_enqueue_entrypoints.h --out-c " +
96        "$(location vk_cmd_enqueue_entrypoints.c) --prefix vk_cmd_enqueue " +
97        "--prefix vk_cmd_enqueue_unless_primary --beta false",
98}
99
100genrule {
101    name: "vk_dispatch_trampolines_header_gfxstream",
102    srcs: [":libmesa_vulkan_xml_gfxstream"],
103    out: ["vk_dispatch_trampolines.h"],
104    tools: ["vk_dispatch_trampolines_gen_gfxstream"],
105    cmd: "python3 $(location vk_dispatch_trampolines_gen_gfxstream) --xml " +
106        "$(location :libmesa_vulkan_xml_gfxstream) --out-h " +
107        "$(location vk_dispatch_trampolines.h) --out-c " +
108        "$(genDir)/placeholder.c --beta false",
109}
110
111genrule {
112    name: "vk_dispatch_trampolines_impl_gfxstream",
113    srcs: [":libmesa_vulkan_xml_gfxstream"],
114    out: ["vk_dispatch_trampolines.c"],
115    tools: ["vk_dispatch_trampolines_gen_gfxstream"],
116    cmd: "python3 $(location vk_dispatch_trampolines_gen_gfxstream) --xml " +
117        "$(location :libmesa_vulkan_xml_gfxstream)  --out-h " +
118        "$(genDir)/vk_dispatch_trampolines.h --out-c " +
119        "$(location vk_dispatch_trampolines.c) --beta false",
120}
121
122genrule {
123    name: "vk_physical_device_features_header_gfxstream",
124    srcs: [":libmesa_vulkan_xml_gfxstream"],
125    out: ["vk_physical_device_features.h"],
126    tools: ["vk_physical_device_features_gen_gfxstream"],
127    cmd: "python3 $(location vk_physical_device_features_gen_gfxstream) --xml " +
128        "$(location :libmesa_vulkan_xml_gfxstream) --out-h " +
129        "$(location vk_physical_device_features.h) --out-c " +
130        "$(genDir)/placeholder.c --beta false",
131}
132
133genrule {
134    name: "vk_physical_device_features_impl_gfxstream",
135    srcs: [":libmesa_vulkan_xml_gfxstream"],
136    out: ["vk_physical_device_features.c"],
137    tools: ["vk_physical_device_features_gen_gfxstream"],
138    cmd: "python3 $(location vk_physical_device_features_gen_gfxstream) --xml " +
139        "$(location :libmesa_vulkan_xml_gfxstream) --out-h " +
140        "$(genDir)/vk_physical_device_features.h --out-c " +
141        "$(location vk_physical_device_features.c) --beta false",
142}
143
144genrule {
145    name: "vk_physical_device_properties_header_gfxstream",
146    srcs: [":libmesa_vulkan_xml_gfxstream"],
147    out: ["vk_physical_device_properties.h"],
148    tools: ["vk_physical_device_properties_gen_gfxstream"],
149    cmd: "python3 $(location vk_physical_device_properties_gen_gfxstream) --xml " +
150        "$(location :libmesa_vulkan_xml_gfxstream) --out-h " +
151        "$(location vk_physical_device_properties.h) --out-c " +
152        "$(genDir)/placeholder.c --beta false",
153}
154
155genrule {
156    name: "vk_physical_device_properties_impl_gfxstream",
157    srcs: [":libmesa_vulkan_xml_gfxstream"],
158    out: ["vk_physical_device_properties.c"],
159    tools: ["vk_physical_device_properties_gen_gfxstream"],
160    cmd: "python3 $(location vk_physical_device_properties_gen_gfxstream) --xml " +
161        "$(location :libmesa_vulkan_xml_gfxstream) --out-h " +
162        "$(genDir)/vk_physical_device_properties.h --out-c " +
163        "$(location vk_physical_device_properties.c) --beta false",
164}
165
166genrule {
167    name: "vk_format_info_header_gfxstream",
168    srcs: [":libmesa_vulkan_xml_gfxstream"],
169    out: ["vk_format_info.h"],
170    tools: ["vk_format_info_gen_gfxstream"],
171    cmd: "python3 $(location vk_format_info_gen_gfxstream) --xml " +
172        "$(location :libmesa_vulkan_xml_gfxstream) --out-h " +
173        "$(location vk_format_info.h) --out-c " +
174        "$(genDir)/placeholder.c",
175}
176
177genrule {
178    name: "vk_format_info_impl_gfxstream",
179    srcs: [":libmesa_vulkan_xml_gfxstream"],
180    out: ["vk_format_info.c"],
181    tools: ["vk_format_info_gen_gfxstream"],
182    cmd: "python3 $(location vk_format_info_gen_gfxstream) --xml " +
183        "$(location :libmesa_vulkan_xml_gfxstream) --out-h " +
184        "$(genDir)/vk_format_info.h --out-c " +
185        "$(location vk_format_info.c)",
186}
187
188cc_library_static {
189    name: "libmesa_vulkan_runtime_gfxstream",
190    host_supported: true,
191    vendor: true,
192    defaults: [
193        "mesa_common_defaults_gfxstream",
194    ],
195    header_libs: [
196        "mesa_common_headers_gfxstream",
197    ],
198    static_libs: [
199        "libarect",
200        "libmesa_util_gfxstream",
201        "libmesa_vulkan_util_gfxstream",
202        "libmesa_util_c11_gfxstream",
203        "libmesa_util_format_gfxstream",
204    ],
205    cflags: [
206        "-DVK_NO_NIR",
207    ],
208    generated_headers: [
209        "vk_cmd_queue_header_gfxstream",
210        "vk_common_entrypoints_header_gfxstream",
211        "vk_cmd_enqueue_entrypoints_header_gfxstream",
212        "vk_dispatch_trampolines_header_gfxstream",
213        "vk_physical_device_features_header_gfxstream",
214        "vk_physical_device_properties_header_gfxstream",
215        "vk_format_info_header_gfxstream",
216    ],
217    generated_sources: [
218        "vk_cmd_queue_impl_gfxstream",
219        "vk_common_entrypoints_impl_gfxstream",
220        "vk_cmd_enqueue_entrypoints_impl_gfxstream",
221        "vk_dispatch_trampolines_impl_gfxstream",
222        "vk_physical_device_features_impl_gfxstream",
223        "vk_physical_device_properties_impl_gfxstream",
224        "vk_format_info_impl_gfxstream",
225    ],
226    srcs: [
227        "rmv/vk_rmv_common.c",
228        "rmv/vk_rmv_exporter.c",
229        "vk_acceleration_structure.c",
230        "vk_blend.c",
231        "vk_buffer.c",
232        "vk_buffer_view.c",
233        "vk_cmd_copy.c",
234        "vk_cmd_enqueue.c",
235        "vk_command_buffer.c",
236        "vk_command_pool.c",
237        "vk_debug_report.c",
238        "vk_debug_utils.c",
239        "vk_deferred_operation.c",
240        "vk_descriptor_set_layout.c",
241        "vk_descriptors.c",
242        "vk_descriptor_update_template.c",
243        "vk_device.c",
244        "vk_device_memory.c",
245        "vk_fence.c",
246        "vk_framebuffer.c",
247        "vk_graphics_state.c",
248        "vk_image.c",
249        "vk_instance.c",
250        "vk_log.c",
251        "vk_object.c",
252        "vk_physical_device.c",
253        "vk_pipeline_layout.c",
254        "vk_query_pool.c",
255        "vk_queue.c",
256        "vk_render_pass.c",
257        "vk_sampler.c",
258        "vk_semaphore.c",
259        "vk_standard_sample_locations.c",
260        "vk_sync.c",
261        "vk_sync_binary.c",
262        "vk_sync_dummy.c",
263        "vk_sync_timeline.c",
264        "vk_synchronization2.c",
265        "vk_video.c",
266        "vk_ycbcr_conversion.c",
267    ],
268    export_include_dirs: [
269        ".",
270    ],
271    target: {
272        android: {
273            shared_libs: [
274                "libnativewindow",
275                "libsync",
276                "libcutils",
277            ],
278            header_libs: [
279                "hwvulkan_headers",
280                "libnativewindow_headers",
281            ],
282            srcs: [
283                "vk_android.c",
284            ],
285        },
286    },
287}
288