Jason Macnak | 73d4eae | 2023-07-19 13:51:47 -0700 | [diff] [blame] | 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 | |
| 17 | package { |
| 18 | // See: http://go/android-license-faq |
| 19 | default_applicable_licenses: ["hardware_google_gfxstream_license"], |
| 20 | } |
| 21 | |
Gurchetan Singh | c4444b8 | 2023-09-19 08:06:20 -0700 | [diff] [blame] | 22 | genrule { |
| 23 | name: "gfxstream_vk_entrypoints_header", |
Gurchetan Singh | 6d28bf0 | 2024-02-22 18:03:36 -0800 | [diff] [blame] | 24 | srcs: [":libmesa_vulkan_xml_gfxstream"], |
Gurchetan Singh | c4444b8 | 2023-09-19 08:06:20 -0700 | [diff] [blame] | 25 | out: ["gfxstream_vk_entrypoints.h"], |
Gurchetan Singh | 6d28bf0 | 2024-02-22 18:03:36 -0800 | [diff] [blame] | 26 | tools: ["vk_entrypoints_gen_gfxstream"], |
| 27 | cmd: "python3 $(location vk_entrypoints_gen_gfxstream) --xml " + |
| 28 | "$(location :libmesa_vulkan_xml_gfxstream) --proto --weak --out-h " + |
Gurchetan Singh | c4444b8 | 2023-09-19 08:06:20 -0700 | [diff] [blame] | 29 | "$(location gfxstream_vk_entrypoints.h) --out-c " + |
| 30 | "$(genDir)/placeholder.c --prefix gfxstream_vk --beta false", |
| 31 | } |
Jason Macnak | 459dd87 | 2023-09-13 08:27:41 -0700 | [diff] [blame] | 32 | |
Gurchetan Singh | c4444b8 | 2023-09-19 08:06:20 -0700 | [diff] [blame] | 33 | genrule { |
| 34 | name: "gfxstream_vk_entrypoints_impl", |
Gurchetan Singh | 6d28bf0 | 2024-02-22 18:03:36 -0800 | [diff] [blame] | 35 | srcs: [":libmesa_vulkan_xml_gfxstream"], |
Gurchetan Singh | c4444b8 | 2023-09-19 08:06:20 -0700 | [diff] [blame] | 36 | out: ["gfxstream_vk_entrypoints.c"], |
Gurchetan Singh | 6d28bf0 | 2024-02-22 18:03:36 -0800 | [diff] [blame] | 37 | tools: ["vk_entrypoints_gen_gfxstream"], |
| 38 | cmd: "python3 $(location vk_entrypoints_gen_gfxstream) --xml " + |
| 39 | "$(location :libmesa_vulkan_xml_gfxstream) --proto --weak --out-h " + |
Gurchetan Singh | c4444b8 | 2023-09-19 08:06:20 -0700 | [diff] [blame] | 40 | "$(genDir)/gfxstream_vk_entrypoints.h --out-c " + |
| 41 | "$(location gfxstream_vk_entrypoints.c) --prefix gfxstream_vk " + |
| 42 | "--beta false", |
| 43 | } |
| 44 | |
| 45 | cc_library_static { |
| 46 | name: "libgfxstream_guest_vulkan_entrypoints", |
Jason Macnak | 650c0c0 | 2023-07-20 16:06:53 -0700 | [diff] [blame] | 47 | host_supported: true, |
Jason Macnak | 73d4eae | 2023-07-19 13:51:47 -0700 | [diff] [blame] | 48 | vendor: true, |
| 49 | defaults: [ |
Gurchetan Singh | c4444b8 | 2023-09-19 08:06:20 -0700 | [diff] [blame] | 50 | "mesa_common_defaults_gfxstream", |
Jason Macnak | 73d4eae | 2023-07-19 13:51:47 -0700 | [diff] [blame] | 51 | ], |
| 52 | header_libs: [ |
Gurchetan Singh | c4444b8 | 2023-09-19 08:06:20 -0700 | [diff] [blame] | 53 | "mesa_common_headers_gfxstream", |
Jason Macnak | 73d4eae | 2023-07-19 13:51:47 -0700 | [diff] [blame] | 54 | ], |
| 55 | static_libs: [ |
Gurchetan Singh | c4444b8 | 2023-09-19 08:06:20 -0700 | [diff] [blame] | 56 | "libmesa_vulkan_util_gfxstream", |
Jason Macnak | 73d4eae | 2023-07-19 13:51:47 -0700 | [diff] [blame] | 57 | ], |
Gurchetan Singh | c4444b8 | 2023-09-19 08:06:20 -0700 | [diff] [blame] | 58 | shared_libs: [ |
| 59 | "libcutils", |
Jason Macnak | 73d4eae | 2023-07-19 13:51:47 -0700 | [diff] [blame] | 60 | ], |
Gurchetan Singh | c4444b8 | 2023-09-19 08:06:20 -0700 | [diff] [blame] | 61 | generated_headers: [ |
| 62 | "gfxstream_vk_entrypoints_header", |
| 63 | ], |
| 64 | generated_sources: [ |
| 65 | "gfxstream_vk_entrypoints_impl", |
| 66 | ], |
| 67 | ldflags: [ |
| 68 | "-Wl,-Bsymbolic", |
| 69 | "-Wl,--gc-sections", |
| 70 | ], |
| 71 | export_generated_headers: [ |
| 72 | "gfxstream_vk_entrypoints_header", |
| 73 | ], |
| 74 | } |
| 75 | |
| 76 | cc_library_headers { |
| 77 | name: "vulkan_enc_headers", |
| 78 | export_include_dirs: ["."], |
| 79 | host_supported: true, |
| 80 | vendor_available: true, |
| 81 | } |
| 82 | |
| 83 | filegroup { |
| 84 | name: "vulkan_enc_impl", |
Jason Macnak | 73d4eae | 2023-07-19 13:51:47 -0700 | [diff] [blame] | 85 | srcs: [ |
| 86 | "AndroidHardwareBuffer.cpp", |
| 87 | "CommandBufferStagingStream.cpp", |
| 88 | "DescriptorSetVirtualization.cpp", |
| 89 | "func_table.cpp", |
| 90 | "goldfish_vk_counting_guest.cpp", |
| 91 | "goldfish_vk_deepcopy_guest.cpp", |
| 92 | "goldfish_vk_extension_structs_guest.cpp", |
| 93 | "goldfish_vk_marshaling_guest.cpp", |
| 94 | "goldfish_vk_reserved_marshaling_guest.cpp", |
| 95 | "goldfish_vk_transform_guest.cpp", |
| 96 | "HostVisibleMemoryVirtualization.cpp", |
| 97 | "Resources.cpp", |
| 98 | "ResourceTracker.cpp", |
| 99 | "Validation.cpp", |
| 100 | "VkEncoder.cpp", |
| 101 | "VulkanHandleMapping.cpp", |
| 102 | "VulkanStreamGuest.cpp", |
Gurchetan Singh | c4444b8 | 2023-09-19 08:06:20 -0700 | [diff] [blame] | 103 | "gfxstream_vk_private.cpp", |
| 104 | ], |
| 105 | } |
| 106 | |
| 107 | cc_defaults { |
| 108 | name: "libgfxstream_guest_vulkan_encoder_defaults", |
| 109 | host_supported: true, |
| 110 | vendor: true, |
| 111 | defaults: [ |
| 112 | "libgfxstream_guest_cc_defaults", |
| 113 | ], |
| 114 | header_libs: [ |
Jason Macnak | b808eeb | 2024-02-27 10:03:39 -0800 | [diff] [blame] | 115 | "libgfxstream_vulkan_headers", |
Jason Macnak | abe57a8 | 2024-02-02 17:02:21 -0800 | [diff] [blame] | 116 | "libOpenglSystemCommonHeaders", |
Gurchetan Singh | c4444b8 | 2023-09-19 08:06:20 -0700 | [diff] [blame] | 117 | "libgfxstream_guest_iostream", |
| 118 | "libnativewindow_headers", |
| 119 | "mesa_common_headers_gfxstream", |
| 120 | ], |
| 121 | generated_headers: [ |
Gurchetan Singh | 6d28bf0 | 2024-02-22 18:03:36 -0800 | [diff] [blame] | 122 | "vk_cmd_queue_header_gfxstream", |
| 123 | "vk_physical_device_features_header_gfxstream", |
| 124 | "vk_physical_device_properties_header_gfxstream", |
| 125 | "u_format_pack_header_gfxstream", |
Gurchetan Singh | c4444b8 | 2023-09-19 08:06:20 -0700 | [diff] [blame] | 126 | ], |
| 127 | shared_libs: [ |
| 128 | "libcutils", |
| 129 | "liblog", |
| 130 | "libOpenglCodecCommon", |
| 131 | ], |
| 132 | static_libs: [ |
| 133 | "libarect", |
| 134 | "libdrm", |
Jason Macnak | b808eeb | 2024-02-27 10:03:39 -0800 | [diff] [blame] | 135 | "libgfxstream_androidemu_static", |
Gurchetan Singh | c4444b8 | 2023-09-19 08:06:20 -0700 | [diff] [blame] | 136 | "libGoldfishAddressSpace", |
Gurchetan Singh | c4444b8 | 2023-09-19 08:06:20 -0700 | [diff] [blame] | 137 | "libmesa_vulkan_util_gfxstream", |
| 138 | "libmesa_vulkan_runtime_gfxstream", |
Jason Macnak | abe57a8 | 2024-02-02 17:02:21 -0800 | [diff] [blame] | 139 | "libgfxstream_guest_android", |
Gurchetan Singh | c4444b8 | 2023-09-19 08:06:20 -0700 | [diff] [blame] | 140 | "libgfxstream_guest_vulkan_entrypoints", |
| 141 | "libmesa_util_gfxstream", |
| 142 | "libmesa_util_format_gfxstream", |
| 143 | "libmesa_util_c11_gfxstream", |
| 144 | ], |
| 145 | cflags: [ |
| 146 | "-DLOG_TAG=\"goldfish_vulkan\"", |
Gurchetan Singh | c4444b8 | 2023-09-19 08:06:20 -0700 | [diff] [blame] | 147 | "-DVK_ANDROID_native_buffer", |
| 148 | "-DVK_EXT_device_memory_report", |
| 149 | "-DVK_GOOGLE_gfxstream", |
| 150 | "-DVK_NO_PROTOTYPES", |
| 151 | "-DVK_USE_PLATFORM_ANDROID_KHR", |
| 152 | "-fstrict-aliasing", |
| 153 | "-Werror", |
| 154 | "-Wno-missing-field-initializers", |
| 155 | "-Wno-unused-parameter", |
| 156 | "-DHAVE_PTHREAD=1", |
| 157 | "-DHAVE_TIMESPEC_GET", |
| 158 | "-DHAVE_STRUCT_TIMESPEC", |
| 159 | ], |
| 160 | srcs: [ |
| 161 | ":vulkan_enc_impl", |
Jason Macnak | 73d4eae | 2023-07-19 13:51:47 -0700 | [diff] [blame] | 162 | ], |
| 163 | export_include_dirs: [ |
| 164 | ".", |
| 165 | ], |
Gurchetan Singh | c4444b8 | 2023-09-19 08:06:20 -0700 | [diff] [blame] | 166 | ldflags: [ |
| 167 | // Mesa always adds Bsymbolic when available (see 'ld_args_bsymbolic' in Meson build). Duplicate that |
| 168 | // behavior here. '--gc-sections' has stronger justification: this lets drivers drop |
| 169 | // shared code unused by that specific driver (particularly relevant for Vulkan drivers). |
| 170 | "-Wl,-Bsymbolic", |
| 171 | "-Wl,--gc-sections", |
| 172 | ], |
Jason Macnak | 650c0c0 | 2023-07-20 16:06:53 -0700 | [diff] [blame] | 173 | target: { |
| 174 | android: { |
| 175 | shared_libs: [ |
| 176 | "libnativewindow", |
| 177 | ], |
| 178 | header_libs: [ |
| 179 | "hwvulkan_headers", |
| 180 | ], |
Gurchetan Singh | c4444b8 | 2023-09-19 08:06:20 -0700 | [diff] [blame] | 181 | }, |
| 182 | }, |
Gurchetan Singh | fa4dfda | 2023-09-18 17:11:24 -0700 | [diff] [blame] | 183 | } |
Jason Macnak | 459dd87 | 2023-09-13 08:27:41 -0700 | [diff] [blame] | 184 | |
Gurchetan Singh | c4444b8 | 2023-09-19 08:06:20 -0700 | [diff] [blame] | 185 | cc_library_static { |
Jason Macnak | 459dd87 | 2023-09-13 08:27:41 -0700 | [diff] [blame] | 186 | name: "libvulkan_enc", |
| 187 | defaults: [ |
| 188 | "libgfxstream_guest_vulkan_encoder_defaults", |
| 189 | ], |
| 190 | static_libs: [ |
| 191 | "libplatform", |
| 192 | ], |
| 193 | } |
| 194 | |
Gurchetan Singh | c4444b8 | 2023-09-19 08:06:20 -0700 | [diff] [blame] | 195 | cc_library_static { |
Jason Macnak | 459dd87 | 2023-09-13 08:27:41 -0700 | [diff] [blame] | 196 | name: "libgfxstream_guest_vulkan_encoder_with_host", |
| 197 | defaults: [ |
| 198 | "libgfxstream_guest_vulkan_encoder_defaults", |
| 199 | ], |
Jason Macnak | abe57a8 | 2024-02-02 17:02:21 -0800 | [diff] [blame] | 200 | static_libs: [ |
Jason Macnak | b808eeb | 2024-02-27 10:03:39 -0800 | [diff] [blame] | 201 | "libgfxstream_platform_rutabaga", |
Jason Macnak | abe57a8 | 2024-02-02 17:02:21 -0800 | [diff] [blame] | 202 | ], |
| 203 | export_static_lib_headers: [ |
Jason Macnak | b808eeb | 2024-02-27 10:03:39 -0800 | [diff] [blame] | 204 | "libgfxstream_platform_rutabaga", |
Jason Macnak | 459dd87 | 2023-09-13 08:27:41 -0700 | [diff] [blame] | 205 | ], |
| 206 | target: { |
| 207 | host: { |
| 208 | compile_multilib: "64", |
| 209 | }, |
| 210 | android: { |
| 211 | compile_multilib: "64", |
| 212 | }, |
| 213 | }, |
| 214 | } |