android_external_mesa3d/src/gfxstream/guest/vulkan/Android.bp
Jason Macnak ee57f856c8 Enable perfetto in mesa targets
Bug: b/440065361
Test: Capture guest and host trace and inspect in perfetto UI
Change-Id: Icad207776552f5b06398ee58872cfe85ef4eb2fc
2025-08-22 20:35:44 +00:00

132 lines
4.2 KiB
Text

/*
* 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_shared {
name: "vulkan.ranchu",
defaults: [
"mesa_gfxstream_guest_cc_defaults",
"mesa_common_defaults",
"mesa_platform_virtgpu_defaults",
],
generated_headers: [
"git_sha1_header",
"vk_cmd_queue_header",
"vk_physical_device_features_header",
"vk_physical_device_properties_header",
"spirv_info_header",
],
header_libs: [
"mesa_compiler_headers",
"mesa_common_headers",
"libnativewindow_headers",
"mesa_vulkan_enc_headers",
"mesa_gfxstream_aemu_headers",
],
static_libs: [
"mesa_compiler",
"mesa_util_c11",
"mesa_vulkan_util",
"mesa_vulkan_runtime",
"mesa_vulkan_wsi",
"mesa_gfxstream_vulkan_entrypoints",
"mesa_util",
"mesa_util_format",
"mesa_goldfish_address_space",
"libringbuffer",
"libqemupipe.ranchu",
"libarect",
"libperfetto_client_experimental",
"mesa_gfxstream_aemu",
"mesa_gfxstream_guest_android",
"mesa_gfxstream_connection_manager",
"libgfxstream_rcEnc_static",
"libgfxstream_androidemu_static",
],
shared_libs: [
"liblog",
"libcutils",
"libbase",
"libdrm",
"libOpenglCodecCommon",
],
cflags: [
"-DLOG_TAG=\"goldfish_vulkan\"",
"-DVK_NO_PROTOTYPES",
"-fstrict-aliasing",
"-fvisibility=hidden",
"-Wno-missing-field-initializers",
"-Wno-unused-function",
"-Wno-unused-parameter",
"-Wno-cast-calling-convention",
],
ldflags: [
// Mesa always adds Bsymbolic when available (see 'ld_args_bsymbolic' in Meson build). Duplicate that
// behavior here. '--gc-sections' has stronger justification: this lets drivers drop
// shared code unused by that specific driver (particularly relevant for Vulkan drivers).
"-Wl,-Bsymbolic",
"-Wl,--gc-sections",
],
srcs: [
"gfxstream_vk_device.cpp",
"gfxstream_vk_cmd.cpp",
"gfxstream_vk_wsi.cpp",
":mesa_vulkan_enc_impl",
],
target: {
android: {
relative_install_path: "hw",
// It has been observed that the linker is stripping the hardware module info (HMI)
// symbol in the "android surfaceless" build. A few have workarounds been observed:
//
// - adding vk_android_hal.c directly to srcs of vulkan.ranchu works.
// - adding some code that references the HMI symbol, like printing its address, to
// code in vulkan.ranchu, works.
// - telling the linker explicitly to look for HMI symbol in one of its inputs through
// the -Wl,--undefined=HMI flag works
//
// This is what is done here. This is not observed in the normal Android
// (non-surfaceless) build.
ldflags: ["-Wl,--undefined=HMI"],
static_libs: [
"mesa_u_gralloc",
],
header_libs: [
"hwvulkan_headers",
"libnativebase_headers",
],
shared_libs: [
"libsync",
"libhardware",
"libnativewindow",
"libhidlbase",
"libutils",
],
},
host: {
cflags: [
"-DEND2END_TESTS",
],
static_libs: [
"mesa_vulkan_mapper",
],
},
},
}