aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurchetan Singh <gurchetansingh@google.com>2024-02-27 18:23:09 -0800
committerGurchetan Singh <gurchetansingh@google.com>2024-03-05 18:20:47 -0800
commit4c68bbc3ea99997df44bbe098b7ab5c733506931 (patch)
treeef5383cae433e3f834e2f1e6e02b7a6701f28be2
parent53fa4959552db949e9437262d4abc9e9a72d75b7 (diff)
downloadmesa3d-4c68bbc3ea99997df44bbe098b7ab5c733506931.tar.gz
ANDROID: mesa: add Android.bp files
Let's update Mesa in AOSP. This tracks: https://gitlab.freedesktop.org/gurchetansingh/mesa/-/tree/mesa-gfxstream-1 since there is tremendous, irresistable and ravenous demand for gfxstream in Mesa. The idea be tracking upstream and updating frequently, but also adding patches of interest to AOSP use cases. This is possible the Mesa in AOSP is 4 years old. Nobody really uses it for hard production cases (i.e, passing CTS). However, Mesa3d is an important project for FOSS graphics + compute: the situation has to improve. gfxstream is the natural place to start. This also a gigantic maintaince win. With ANGLE being the Vulkan HAL for all of Android, let's just build Vulkan drivers needed by products here [no more Gallium drivers needed]. Right now, the VK runtime/util needed by gfxstream is built. We can get the real gfxstream to depend on it through the magic of Soong. Bug: 327408955 Test: compile Change-Id: I0f30a282742fa79c8c85af82f34909d17a9a99ea
-rw-r--r--Android.bp45
-rw-r--r--src/Android.bp59
-rw-r--r--src/c11/Android.bp26
-rw-r--r--src/c11/impl/Android.bp35
-rw-r--r--src/util/Android.bp166
-rw-r--r--src/util/format/Android.bp88
-rw-r--r--src/vulkan/registry/Android.bp25
-rw-r--r--src/vulkan/runtime/Android.bp281
-rw-r--r--src/vulkan/util/Android.bp252
9 files changed, 919 insertions, 58 deletions
diff --git a/Android.bp b/Android.bp
index 53507da7411..bce936a2ef7 100644
--- a/Android.bp
+++ b/Android.bp
@@ -20,12 +20,12 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
-
soong_namespace {}
// *** THIS PACKAGE HAS SPECIAL LICENSING CONDITIONS. PLEASE
// CONSULT THE OWNERS AND opensource-licensing@google.com BEFORE
// DEPENDING ON IT IN YOUR PROJECT. ***
+
package {
default_applicable_licenses: ["external_mesa3d_license"],
}
@@ -65,16 +65,34 @@ license {
],
}
-build = ["Android.gen.bp"]
+cc_defaults {
+ name: "mesa_version_defaults",
+ cflags: ["-DPACKAGE_VERSION=\"24.2\""],
+}
+
+python_binary_host {
+ name: "git_sha1_gen",
+ main: "bin/git_sha1_gen.py",
+ srcs: [
+ "bin/git_sha1_gen.py",
+ ],
+}
+
+genrule {
+ name: "git_sha1_header",
+ out: ["git_sha1.h"],
+ tools: ["git_sha1_gen"],
+ cmd: "python3 $(location git_sha1_gen) " +
+ "--output $(location git_sha1.h)",
+}
cc_library_headers {
name: "mesa_common_headers",
+ vendor: true,
export_include_dirs: [
"src",
"include",
],
- host_supported: true,
- vendor: true,
visibility: [":__subpackages__"],
}
@@ -82,13 +100,10 @@ cc_library_headers {
cc_defaults {
name: "mesa_common_defaults",
defaults: ["mesa_version_defaults"],
-
// uncomment to keep the debug symbols
// strip: { none: true, },
-
vendor: true,
header_libs: ["mesa_common_headers"],
-
cflags: [
"-Wno-error",
"-Werror=incompatible-pointer-types",
@@ -99,7 +114,6 @@ cc_defaults {
"-Wno-mismatched-tags",
// PACKAGE_VERSION is in mesa_version_defaults
"-DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\"",
-
// XXX: The following __STDC_*_MACROS defines should not be needed.
// It's likely due to a bug elsewhere, but let's temporarily add them
// here to fix the radeonsi build.
@@ -129,7 +143,6 @@ cc_defaults {
"-DHAVE_DL_ITERATE_PHDR",
"-DHAVE_LINUX_FUTEX_H",
"-DHAVE_ENDIAN_H",
- "-DHAVE_ZLIB",
"-DMAJOR_IN_SYSMACROS",
"-DVK_USE_PLATFORM_ANDROID_KHR",
"-fvisibility=hidden",
@@ -144,6 +157,7 @@ cc_defaults {
"-Wno-format",
"-Wno-gnu-variable-sized-type-not-at-end",
"-Wno-implicit-fallthrough",
+ "-Wno-implicit-int",
"-Wno-incompatible-pointer-types",
"-Wno-missing-braces",
"-Wno-overloaded-virtual",
@@ -156,12 +170,13 @@ cc_defaults {
"-Wno-uninitialized",
"-Wno-implicit-const-int-float-conversion",
"-Wno-sync-alignment",
+ "-Wno-implicit-function-declaration",
+ "-Wno-constant-conversion",
"-DHAVE_TIMESPEC_GET",
+ "-DHAVE_STRUCT_TIMESPEC",
+ "-DHAVE_MEMFD_CREATE",
],
-
- // mesa requires at least c99 compiler
- c_std: "c99",
-
+ c_std: "c11",
cppflags: [
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
@@ -169,7 +184,6 @@ cc_defaults {
"-Wno-error=non-virtual-dtor",
"-Wno-non-virtual-dtor",
],
-
arch: {
arm: {
neon: {
@@ -180,7 +194,6 @@ cc_defaults {
cflags: ["-DUSE_AARCH64_ASM"],
},
},
-
multilib: {
lib32: {
cflags: ["-DDEFAULT_DRIVER_DIR=\"/vendor/lib/dri\""],
@@ -189,13 +202,11 @@ cc_defaults {
cflags: ["-DDEFAULT_DRIVER_DIR=\"/vendor/lib64/dri\""],
},
},
-
product_variables: {
platform_sdk_version: {
cflags: ["-DANDROID_API_LEVEL=%d"],
},
},
-
target: {
host: {
cflags: [
diff --git a/src/Android.bp b/src/Android.bp
index 877f065eaa2..5e9cc6ea1f6 100644
--- a/src/Android.bp
+++ b/src/Android.bp
@@ -1,51 +1,28 @@
-// *** THIS PACKAGE HAS SPECIAL LICENSING CONDITIONS. PLEASE
-// CONSULT THE OWNERS AND opensource-licensing@google.com BEFORE
-// DEPENDING ON IT IN YOUR PROJECT. ***
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package {
// See: http://go/android-license-faq
- // A large-scale-change added 'default_applicable_licenses' to import
- // all of the 'license_kinds' from "external_mesa3d_license"
- // to get the below license kinds:
- // SPDX-license-identifier-Apache-2.0
- // SPDX-license-identifier-BSD
- // SPDX-license-identifier-BSL-1.0
- // SPDX-license-identifier-ISC
- // SPDX-license-identifier-MIT
- // SPDX-license-identifier-Unlicense
- // legacy_by_exception_only (by exception only)
- // legacy_notice
- // legacy_unencumbered
default_applicable_licenses: ["external_mesa3d_license"],
}
cc_library_headers {
- name: "libmesa_glsl_utils_includes",
- export_include_dirs: [
- "compiler/nir",
- "mapi",
- "gallium/include",
- "gallium/auxiliary",
- ],
- host_supported: true,
+ name: "libmesa_src_headers",
vendor: true,
- visibility: [":__subpackages__"],
-}
-
-cc_library_headers {
- name: "mesa_mapi_headers",
- export_include_dirs: ["mapi"],
- host_supported: true,
- vendor: true,
- visibility: [":__subpackages__"],
-}
-
-cc_library_headers {
- name: "libmesa_sse41_includes",
export_include_dirs: [
- "mapi",
- "gallium/include",
- "gallium/auxiliary",
+ ".",
],
- vendor: true,
- visibility: [":__subpackages__"],
}
diff --git a/src/c11/Android.bp b/src/c11/Android.bp
new file mode 100644
index 00000000000..52a80a9f9f9
--- /dev/null
+++ b/src/c11/Android.bp
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package {
+ // See: http://go/android-license-faq
+ default_applicable_licenses: ["external_mesa3d_license"],
+}
+
+cc_library_headers {
+ name: "mesa_util_c11_headers",
+ vendor: true,
+ export_include_dirs: ["."],
+}
diff --git a/src/c11/impl/Android.bp b/src/c11/impl/Android.bp
new file mode 100644
index 00000000000..d105b98055c
--- /dev/null
+++ b/src/c11/impl/Android.bp
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package {
+ // See: http://go/android-license-faq
+ default_applicable_licenses: ["external_mesa3d_license"],
+}
+
+cc_library_static {
+ name: "libmesa_util_c11",
+ vendor: true,
+ defaults: [
+ "mesa_common_defaults",
+ ],
+ header_libs: [
+ "mesa_common_headers",
+ ],
+ srcs: [
+ "time.c",
+ "threads_posix.c",
+ ],
+}
diff --git a/src/util/Android.bp b/src/util/Android.bp
new file mode 100644
index 00000000000..8e6ad3b6485
--- /dev/null
+++ b/src/util/Android.bp
@@ -0,0 +1,166 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package {
+ // See: http://go/android-license-faq
+ default_applicable_licenses: ["external_mesa3d_license"],
+}
+
+filegroup {
+ name: "libmesa_drirc",
+ srcs: ["00-mesa-defaults.conf"],
+}
+
+python_binary_host {
+ name: "format_srgb_gen",
+ main: "format_srgb.py",
+ srcs: ["format_srgb.py"],
+}
+
+python_binary_host {
+ name: "driconf_static_gen",
+ main: "driconf_static.py",
+ srcs: ["driconf_static.py"],
+ libs: [
+ "mako",
+ ],
+}
+
+genrule {
+ name: "format_srgb_impl",
+ out: ["format_srgb.c"],
+ tools: ["format_srgb_gen"],
+ cmd: "python3 $(location format_srgb_gen) " +
+ "&> $(location format_srgb.c)",
+}
+
+genrule {
+ name: "driconf_static_header",
+ srcs: [":libmesa_drirc"],
+ out: ["driconf_static.h"],
+ tools: ["driconf_static_gen"],
+ cmd: "python3 $(location driconf_static_gen) " +
+ "$(location :libmesa_drirc) " +
+ "$(location driconf_static.h)",
+}
+
+cc_library_headers {
+ name: "libmesa_util_headers",
+ vendor: true,
+ export_include_dirs: [
+ ".",
+ ],
+}
+
+cc_library_static {
+ name: "libmesa_util",
+ vendor: true,
+ defaults: [
+ "mesa_common_defaults",
+ ],
+ generated_headers: [
+ "driconf_static_header",
+ ],
+ static_libs: [
+ "libmesa_util_c11",
+ ],
+ shared_libs: [
+ "liblog",
+ "libcutils",
+ ],
+ srcs: [
+ "anon_file.c",
+ "bitscan.c",
+ "blob.c",
+ "build_id.c",
+ "compress.c",
+ "crc32.c",
+ "dag.c",
+ "double.c",
+ "disk_cache.c",
+ "disk_cache_os.c",
+ "fast_idiv_by_const.c",
+ "fossilize_db.c",
+ "futex.c",
+ "half_float.c",
+ "hash_table.c",
+ "u_idalloc.c",
+ "log.c",
+ "memstream.c",
+ "mesa-sha1.c",
+ "mesa-blake3.c",
+ "os_time.c",
+ "os_file.c",
+ "os_memory_fd.c",
+ "os_misc.c",
+ "os_socket.c",
+ "perf/u_trace.c",
+ "u_process.c",
+ "u_qsort.cpp",
+ "rwlock.c",
+ "sha1/sha1.c",
+ "ralloc.c",
+ "rand_xor.c",
+ "rb_tree.c",
+ "register_allocate.c",
+ "rgtc.c",
+ "set.c",
+ "simple_mtx.c",
+ "slab.c",
+ "softfloat.c",
+ "sparse_array.c",
+ "string_buffer.c",
+ "strtod.c",
+ "u_atomic.c",
+ "u_call_once.c",
+ "u_dl.c",
+ "u_dynarray.c",
+ "u_hash_table.c",
+ "u_queue.c",
+ "u_thread.c",
+ "u_vector.c",
+ "u_math.c",
+ "u_mm.c",
+ "u_debug.c",
+ "u_debug_memory.c",
+ "u_cpu_detect.c",
+ "u_printf.c",
+ "u_worklist.c",
+ "vl_zscan_data.c",
+ "vma.c",
+ "mesa_cache_db.c",
+ "mesa_cache_db_multipart.c",
+ "xmlconfig.c",
+ ],
+ target: {
+ host: {
+ header_libs: [
+ "mesa_common_headers",
+ ],
+ cflags: [
+ "-DHAVE_PROGRAM_INVOCATION_NAME",
+ ],
+ },
+ android: {
+ header_libs: [
+ "mesa_common_headers",
+ ],
+ cflags: [
+ "-DHAVE_MEMFD_CREATE",
+ ],
+ },
+ },
+}
diff --git a/src/util/format/Android.bp b/src/util/format/Android.bp
new file mode 100644
index 00000000000..653d68a2c96
--- /dev/null
+++ b/src/util/format/Android.bp
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package {
+ // See: http://go/android-license-faq
+ default_applicable_licenses: ["external_mesa3d_license"],
+}
+
+filegroup {
+ name: "libmesa_u_format_csv",
+ srcs: ["u_format.csv"],
+}
+
+python_binary_host {
+ name: "u_format_table_gen",
+ main: "u_format_table.py",
+ srcs: [
+ "u_format_table.py",
+ "u_format_pack.py",
+ "u_format_parse.py",
+ ],
+}
+
+genrule {
+ name: "u_format_pack_header",
+ srcs: [":libmesa_u_format_csv"],
+ out: ["u_format_pack.h"],
+ tools: ["u_format_table_gen"],
+ cmd: "python3 $(location u_format_table_gen) " +
+ "$(location :libmesa_u_format_csv) --header" +
+ "&> $(location u_format_pack.h)",
+}
+
+genrule {
+ name: "u_format_table_impl",
+ srcs: [":libmesa_u_format_csv"],
+ out: ["u_format_table.c"],
+ tools: ["u_format_table_gen"],
+ cmd: "python3 $(location u_format_table_gen) " +
+ "$(location :libmesa_u_format_csv) " +
+ "&> $(location u_format_table.c)",
+}
+
+cc_library_static {
+ name: "libmesa_util_format",
+ vendor: true,
+ defaults: [
+ "mesa_common_defaults",
+ ],
+ header_libs: [
+ "mesa_common_headers",
+ "libmesa_util_headers",
+ ],
+ generated_headers: [
+ "u_format_pack_header",
+ ],
+ generated_sources: [
+ "u_format_table_impl",
+ "format_srgb_impl",
+ ],
+ srcs: [
+ "u_format.c",
+ "u_format_bptc.c",
+ "u_format_etc.c",
+ "u_format_fxt1.c",
+ "u_format_latc.c",
+ "u_format_other.c",
+ "u_format_rgtc.c",
+ "u_format_s3tc.c",
+ "u_format_tests.c",
+ "u_format_unpack_neon.c",
+ "u_format_yuv.c",
+ "u_format_zs.c",
+ ],
+}
diff --git a/src/vulkan/registry/Android.bp b/src/vulkan/registry/Android.bp
new file mode 100644
index 00000000000..067f939a698
--- /dev/null
+++ b/src/vulkan/registry/Android.bp
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package {
+ // See: http://go/android-license-faq
+ default_applicable_licenses: ["external_mesa3d_license"],
+}
+
+filegroup {
+ name: "libmesa_vulkan_xml",
+ srcs: ["vk.xml"],
+}
diff --git a/src/vulkan/runtime/Android.bp b/src/vulkan/runtime/Android.bp
new file mode 100644
index 00000000000..313dfee8939
--- /dev/null
+++ b/src/vulkan/runtime/Android.bp
@@ -0,0 +1,281 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package {
+ // See: http://go/android-license-faq
+ default_applicable_licenses: ["external_mesa3d_license"],
+}
+
+python_binary_host {
+ name: "vk_format_info_gen",
+ main: "vk_format_info_gen.py",
+ srcs: ["vk_format_info_gen.py"],
+ libs: [
+ "mako",
+ ],
+}
+
+genrule {
+ name: "vk_cmd_queue_header",
+ srcs: [":libmesa_vulkan_xml"],
+ out: ["vk_cmd_queue.h"],
+ tools: ["vk_cmd_queue_gen"],
+ cmd: "python3 $(location vk_cmd_queue_gen) --xml " +
+ "$(location :libmesa_vulkan_xml) --out-h " +
+ "$(location vk_cmd_queue.h) --out-c " +
+ "$(genDir)/placeholder.c --beta false",
+}
+
+genrule {
+ name: "vk_cmd_queue_impl",
+ srcs: [":libmesa_vulkan_xml"],
+ out: ["vk_cmd_queue.c"],
+ tools: ["vk_cmd_queue_gen"],
+ cmd: "python3 $(location vk_cmd_queue_gen) --xml " +
+ "$(location :libmesa_vulkan_xml) --out-c " +
+ "$(location vk_cmd_queue.c) --out-h " +
+ "$(genDir)/vk_cmd_queue.h --beta false",
+}
+
+genrule {
+ name: "vk_common_entrypoints_header",
+ srcs: [":libmesa_vulkan_xml"],
+ out: ["vk_common_entrypoints.h"],
+ tools: ["vk_entrypoints_gen"],
+ cmd: "python3 $(location vk_entrypoints_gen) --xml " +
+ "$(location :libmesa_vulkan_xml) --proto --weak --out-h " +
+ "$(location vk_common_entrypoints.h) --out-c " +
+ "$(genDir)/placeholder.c --prefix vk_common --beta false",
+}
+
+genrule {
+ name: "vk_common_entrypoints_impl",
+ srcs: [":libmesa_vulkan_xml"],
+ out: ["vk_common_entrypoints.c"],
+ tools: ["vk_entrypoints_gen"],
+ cmd: "python3 $(location vk_entrypoints_gen) --xml " +
+ "$(location :libmesa_vulkan_xml) --proto --weak --out-h " +
+ "$(genDir)/vk_common_entrypoints.h --out-c " +
+ "$(location vk_common_entrypoints.c) --prefix vk_common " +
+ "--beta false",
+}
+
+genrule {
+ name: "vk_cmd_enqueue_entrypoints_header",
+ srcs: [":libmesa_vulkan_xml"],
+ out: ["vk_cmd_enqueue_entrypoints.h"],
+ tools: ["vk_entrypoints_gen"],
+ cmd: "python3 $(location vk_entrypoints_gen) --xml " +
+ "$(location :libmesa_vulkan_xml) --proto --weak --out-h " +
+ "$(location vk_cmd_enqueue_entrypoints.h) --out-c " +
+ "$(genDir)/placeholder.c --prefix vk_cmd_enqueue " +
+ " --prefix vk_cmd_enqueue_unless_primary --beta false",
+}
+
+genrule {
+ name: "vk_cmd_enqueue_entrypoints_impl",
+ srcs: [":libmesa_vulkan_xml"],
+ out: ["vk_cmd_enqueue_entrypoints.c"],
+ tools: ["vk_entrypoints_gen"],
+ cmd: "python3 $(location vk_entrypoints_gen) --xml " +
+ "$(location :libmesa_vulkan_xml) --proto --weak --out-h " +
+ "$(genDir)/vk_cmd_enqueue_entrypoints.h --out-c " +
+ "$(location vk_cmd_enqueue_entrypoints.c) --prefix vk_cmd_enqueue " +
+ "--prefix vk_cmd_enqueue_unless_primary --beta false",
+}
+
+genrule {
+ name: "vk_dispatch_trampolines_header",
+ srcs: [":libmesa_vulkan_xml"],
+ out: ["vk_dispatch_trampolines.h"],
+ tools: ["vk_dispatch_trampolines_gen"],
+ cmd: "python3 $(location vk_dispatch_trampolines_gen) --xml " +
+ "$(location :libmesa_vulkan_xml) --out-h " +
+ "$(location vk_dispatch_trampolines.h) --out-c " +
+ "$(genDir)/placeholder.c --beta false",
+}
+
+genrule {
+ name: "vk_dispatch_trampolines_impl",
+ srcs: [":libmesa_vulkan_xml"],
+ out: ["vk_dispatch_trampolines.c"],
+ tools: ["vk_dispatch_trampolines_gen"],
+ cmd: "python3 $(location vk_dispatch_trampolines_gen) --xml " +
+ "$(location :libmesa_vulkan_xml) --out-h " +
+ "$(genDir)/vk_dispatch_trampolines.h --out-c " +
+ "$(location vk_dispatch_trampolines.c) --beta false",
+}
+
+genrule {
+ name: "vk_physical_device_features_header",
+ srcs: [":libmesa_vulkan_xml"],
+ out: ["vk_physical_device_features.h"],
+ tools: ["vk_physical_device_features_gen"],
+ cmd: "python3 $(location vk_physical_device_features_gen) --xml " +
+ "$(location :libmesa_vulkan_xml) --out-h " +
+ "$(location vk_physical_device_features.h) --out-c " +
+ "$(genDir)/placeholder.c --beta false",
+}
+
+genrule {
+ name: "vk_physical_device_features_impl",
+ srcs: [":libmesa_vulkan_xml"],
+ out: ["vk_physical_device_features.c"],
+ tools: ["vk_physical_device_features_gen"],
+ cmd: "python3 $(location vk_physical_device_features_gen) --xml " +
+ "$(location :libmesa_vulkan_xml) --out-h " +
+ "$(genDir)/vk_physical_device_features.h --out-c " +
+ "$(location vk_physical_device_features.c) --beta false",
+}
+
+genrule {
+ name: "vk_physical_device_properties_header",
+ srcs: [":libmesa_vulkan_xml"],
+ out: ["vk_physical_device_properties.h"],
+ tools: ["vk_physical_device_properties_gen"],
+ cmd: "python3 $(location vk_physical_device_properties_gen) --xml " +
+ "$(location :libmesa_vulkan_xml) --out-h " +
+ "$(location vk_physical_device_properties.h) --out-c " +
+ "$(genDir)/placeholder.c --beta false",
+}
+
+genrule {
+ name: "vk_physical_device_properties_impl",
+ srcs: [":libmesa_vulkan_xml"],
+ out: ["vk_physical_device_properties.c"],
+ tools: ["vk_physical_device_properties_gen"],
+ cmd: "python3 $(location vk_physical_device_properties_gen) --xml " +
+ "$(location :libmesa_vulkan_xml) --out-h " +
+ "$(genDir)/vk_physical_device_properties.h --out-c " +
+ "$(location vk_physical_device_properties.c) --beta false",
+}
+
+genrule {
+ name: "vk_format_info_header",
+ srcs: [":libmesa_vulkan_xml"],
+ out: ["vk_format_info.h"],
+ tools: ["vk_format_info_gen"],
+ cmd: "python3 $(location vk_format_info_gen) --xml " +
+ "$(location :libmesa_vulkan_xml) --out-h " +
+ "$(location vk_format_info.h) --out-c " +
+ "$(genDir)/placeholder.c",
+}
+
+genrule {
+ name: "vk_format_info_impl",
+ srcs: [":libmesa_vulkan_xml"],
+ out: ["vk_format_info.c"],
+ tools: ["vk_format_info_gen"],
+ cmd: "python3 $(location vk_format_info_gen) --xml " +
+ "$(location :libmesa_vulkan_xml) --out-h " +
+ "$(genDir)/vk_format_info.h --out-c " +
+ "$(location vk_format_info.c)",
+}
+
+cc_library_static {
+ name: "libmesa_vulkan_runtime",
+ vendor: true,
+ defaults: [
+ "mesa_common_defaults",
+ ],
+ header_libs: [
+ "mesa_common_headers",
+ ],
+ static_libs: [
+ "libarect",
+ "libmesa_util",
+ "libmesa_vulkan_util",
+ "libmesa_util_c11",
+ "libmesa_util_format",
+ ],
+ generated_headers: [
+ "vk_cmd_queue_header",
+ "vk_common_entrypoints_header",
+ "vk_cmd_enqueue_entrypoints_header",
+ "vk_dispatch_trampolines_header",
+ "vk_physical_device_features_header",
+ "vk_physical_device_properties_header",
+ "vk_format_info_header",
+ ],
+ generated_sources: [
+ "vk_cmd_queue_impl",
+ "vk_common_entrypoints_impl",
+ "vk_cmd_enqueue_entrypoints_impl",
+ "vk_dispatch_trampolines_impl",
+ "vk_physical_device_features_impl",
+ "vk_physical_device_properties_impl",
+ "vk_format_info_impl",
+ ],
+ srcs: [
+ "rmv/vk_rmv_common.c",
+ "rmv/vk_rmv_exporter.c",
+ "vk_acceleration_structure.c",
+ "vk_blend.c",
+ "vk_buffer.c",
+ "vk_buffer_view.c",
+ "vk_cmd_copy.c",
+ "vk_cmd_enqueue.c",
+ "vk_command_buffer.c",
+ "vk_command_pool.c",
+ "vk_debug_report.c",
+ "vk_debug_utils.c",
+ "vk_deferred_operation.c",
+ "vk_descriptor_set_layout.c",
+ "vk_descriptors.c",
+ "vk_descriptor_update_template.c",
+ "vk_device.c",
+ "vk_device_memory.c",
+ "vk_fence.c",
+ "vk_framebuffer.c",
+ "vk_image.c",
+ "vk_instance.c",
+ "vk_log.c",
+ "vk_object.c",
+ "vk_physical_device.c",
+ "vk_pipeline_layout.c",
+ "vk_query_pool.c",
+ "vk_queue.c",
+ "vk_render_pass.c",
+ "vk_sampler.c",
+ "vk_semaphore.c",
+ "vk_standard_sample_locations.c",
+ "vk_sync.c",
+ "vk_sync_binary.c",
+ "vk_sync_dummy.c",
+ "vk_sync_timeline.c",
+ "vk_video.c",
+ "vk_ycbcr_conversion.c",
+ ],
+ export_include_dirs: [
+ ".",
+ ],
+ target: {
+ android: {
+ shared_libs: [
+ "libnativewindow",
+ "libsync",
+ "libcutils",
+ ],
+ header_libs: [
+ "hwvulkan_headers",
+ "libnativewindow_headers",
+ ],
+ srcs: [
+ "vk_android.c",
+ ],
+ },
+ },
+}
diff --git a/src/vulkan/util/Android.bp b/src/vulkan/util/Android.bp
new file mode 100644
index 00000000000..2ecdcfa7e76
--- /dev/null
+++ b/src/vulkan/util/Android.bp
@@ -0,0 +1,252 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package {
+ // See: http://go/android-license-faq
+ default_applicable_licenses: ["external_mesa3d_license"],
+}
+
+python_binary_host {
+ name: "vk_cmd_queue_gen",
+ main: "vk_cmd_queue_gen.py",
+ srcs: [
+ "vk_cmd_queue_gen.py",
+ "vk_entrypoints.py",
+ "vk_extensions.py",
+ ],
+ libs: [
+ "mako",
+ ],
+}
+
+python_binary_host {
+ name: "vk_entrypoints_gen",
+ main: "vk_entrypoints_gen.py",
+ srcs: [
+ "vk_entrypoints_gen.py",
+ "vk_entrypoints.py",
+ "vk_extensions.py",
+ ],
+ libs: [
+ "mako",
+ ],
+}
+
+python_binary_host {
+ name: "vk_dispatch_trampolines_gen",
+ main: "vk_dispatch_trampolines_gen.py",
+ srcs: [
+ "vk_dispatch_trampolines_gen.py",
+ "vk_entrypoints.py",
+ "vk_extensions.py",
+ ],
+ libs: [
+ "mako",
+ ],
+}
+
+python_binary_host {
+ name: "vk_physical_device_features_gen",
+ main: "vk_physical_device_features_gen.py",
+ srcs: [
+ "vk_physical_device_features_gen.py",
+ "vk_entrypoints.py",
+ "vk_extensions.py",
+ ],
+ libs: [
+ "mako",
+ ],
+}
+
+python_binary_host {
+ name: "vk_physical_device_properties_gen",
+ main: "vk_physical_device_properties_gen.py",
+ srcs: [
+ "vk_physical_device_properties_gen.py",
+ "vk_entrypoints.py",
+ "vk_extensions.py",
+ ],
+ libs: [
+ "mako",
+ ],
+}
+
+python_binary_host {
+ name: "vk_extensions_gen",
+ main: "vk_extensions_gen.py",
+ srcs: [
+ "vk_extensions_gen.py",
+ "vk_extensions.py",
+ ],
+ libs: [
+ "mako",
+ ],
+}
+
+python_binary_host {
+ name: "vk_dispatch_table_gen",
+ main: "vk_dispatch_table_gen.py",
+ srcs: [
+ "vk_dispatch_table_gen.py",
+ "vk_entrypoints.py",
+ "vk_extensions.py",
+ ],
+ libs: [
+ "mako",
+ ],
+}
+
+python_binary_host {
+ name: "gen_enum_to_str",
+ main: "gen_enum_to_str.py",
+ srcs: [
+ "gen_enum_to_str.py",
+ "vk_extensions.py",
+ ],
+ libs: [
+ "mako",
+ ],
+}
+
+python_binary_host {
+ name: "vk_struct_type_cast_gen",
+ main: "vk_struct_type_cast_gen.py",
+ srcs: [
+ "vk_struct_type_cast_gen.py",
+ "vk_extensions.py",
+ ],
+ libs: [
+ "mako",
+ ],
+}
+
+genrule {
+ name: "vk_extensions_header",
+ srcs: [":libmesa_vulkan_xml"],
+ out: ["vk_extensions.h"],
+ tools: ["vk_extensions_gen"],
+ cmd: "python3 $(location vk_extensions_gen) --xml " +
+ "$(location :libmesa_vulkan_xml) --out-h " +
+ "$(location vk_extensions.h)",
+}
+
+genrule {
+ name: "vk_extensions_impl",
+ srcs: [":libmesa_vulkan_xml"],
+ out: ["vk_extensions.c"],
+ tools: ["vk_extensions_gen"],
+ cmd: "python3 $(location vk_extensions_gen) --xml " +
+ "$(location :libmesa_vulkan_xml) --out-c " +
+ "$(location vk_extensions.c)",
+}
+
+genrule {
+ name: "vk_dispatch_table_header",
+ srcs: [":libmesa_vulkan_xml"],
+ out: ["vk_dispatch_table.h"],
+ tools: ["vk_dispatch_table_gen"],
+ cmd: "python3 $(location vk_dispatch_table_gen) --xml " +
+ "$(location :libmesa_vulkan_xml) --out-h " +
+ "$(location vk_dispatch_table.h) --beta false",
+}
+
+genrule {
+ name: "vk_dispatch_table_impl",
+ srcs: [":libmesa_vulkan_xml"],
+ out: ["vk_dispatch_table.c"],
+ tools: ["vk_dispatch_table_gen"],
+ cmd: "python3 $(location vk_dispatch_table_gen) --xml " +
+ "$(location :libmesa_vulkan_xml) --out-c " +
+ "$(location vk_dispatch_table.c) --beta false",
+}
+
+genrule {
+ name: "vk_enum_to_str_header",
+ srcs: [":libmesa_vulkan_xml"],
+ out: [
+ "vk_enum_to_str.h",
+ "vk_enum_defines.h",
+ ],
+ tools: ["gen_enum_to_str"],
+ cmd: "python3 $(location gen_enum_to_str) --xml " +
+ "$(location :libmesa_vulkan_xml) --outdir $(genDir) " +
+ "--beta false",
+}
+
+genrule {
+ name: "vk_enum_to_str_impl",
+ srcs: [":libmesa_vulkan_xml"],
+ out: ["vk_enum_to_str.c"],
+ tools: ["gen_enum_to_str"],
+ cmd: "python3 $(location gen_enum_to_str) --xml " +
+ "$(location :libmesa_vulkan_xml) --outdir $(genDir) " +
+ "--beta false",
+}
+
+genrule {
+ name: "vk_struct_type_cast_header",
+ srcs: [":libmesa_vulkan_xml"],
+ out: ["vk_struct_type_cast.h"],
+ tools: ["vk_struct_type_cast_gen"],
+ cmd: "python3 $(location vk_struct_type_cast_gen) --xml " +
+ "$(location :libmesa_vulkan_xml) --outdir $(genDir) " +
+ "--beta false",
+}
+
+cc_library_static {
+ name: "libmesa_vulkan_util",
+ vendor: true,
+ defaults: [
+ "mesa_common_defaults",
+ ],
+ header_libs: [
+ "mesa_common_headers",
+ ],
+ shared_libs: [
+ "libcutils",
+ ],
+ static_libs: [
+ "libmesa_util",
+ ],
+ cflags: [
+ "-DVK_NO_NIR",
+ ],
+ generated_headers: [
+ "vk_extensions_header",
+ "vk_dispatch_table_header",
+ "vk_enum_to_str_header",
+ "vk_struct_type_cast_header",
+ ],
+ generated_sources: [
+ "vk_extensions_impl",
+ "vk_dispatch_table_impl",
+ "vk_enum_to_str_impl",
+ ],
+ srcs: [
+ "vk_alloc.c",
+ "vk_format.c",
+ "vk_util.c",
+ ],
+ export_include_dirs: [
+ ".",
+ ],
+ export_generated_headers: [
+ "vk_extensions_header",
+ "vk_dispatch_table_header",
+ "vk_enum_to_str_header",
+ "vk_struct_type_cast_header",
+ ],
+}