1# Copyright (C) 2023 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15config("common_config") { 16 defines = [ 17 "LOG_TAG=\"gfxstream_vulkan\"", 18 "GOLDFISH_NO_GL", 19 "VK_GFXSTREAM_STRUCTURE_TYPE_EXT", 20 "VK_USE_PLATFORM_FUCHSIA", 21 "PAGE_SIZE=4096", 22 ] 23 24 include_dirs = [ 25 "../common/opengl/include", 26 "android-emu", 27 "GoldfishAddressSpace/include", 28 "iostream/include", 29 "gralloc_cb/include", 30 "qemupipe/include", 31 "qemupipe/include-types", 32 "OpenglCodecCommon", 33 "OpenglSystemCommon", 34 "renderControl_enc", 35 "vulkan_enc", 36 "platform/include", 37 ] 38 39 if (target_os == "fuchsia") { 40 include_dirs += [ "fuchsia/include" ] 41 } 42 43 cflags_cc = [ 44 "-Wno-conversion", 45 "-Wno-newline-eof", 46 "-Wno-pessimizing-move", 47 "-Wno-sign-compare", 48 "-Wno-unused-function", 49 "-Wno-unused-value", 50 "-Wno-unused-variable", 51 "-Wno-unused-but-set-parameter", 52 "-Wno-unused-but-set-variable", 53 ] 54} 55 56# These sources require access to the Fuchsia goldfish protocols. 57source_set("goldfish_srcs") { 58 configs += [ ":common_config" ] 59 60 sources = [ 61 "vulkan/goldfish_vulkan.cpp", 62 "vulkan_enc/ResourceTracker.cpp", 63 "vulkan_enc/ResourceTracker.h", 64 ] 65 66 public_deps = [ 67 "//sdk/fidl/fuchsia.hardware.goldfish:fuchsia.hardware.goldfish_cpp", 68 "//sdk/fidl/fuchsia.logger:fuchsia.logger_cpp", 69 "//sdk/fidl/fuchsia.sysmem:fuchsia.sysmem_cpp", 70 "//third_party/Vulkan-Headers:vulkan_headers", 71 "//third_party/mesa/include:drm-uapi", 72 "//zircon/system/ulib/async:async-cpp", 73 "//zircon/system/ulib/async-loop:async-loop-cpp", 74 "//zircon/system/ulib/syslog:syslog-static", 75 "//zircon/system/ulib/trace:trace-with-static-engine", 76 "//zircon/system/ulib/trace-provider:trace-provider-with-static-engine", 77 "//zircon/system/ulib/zx", 78 "//zircon/system/ulib/zxio", 79 ] 80 81 defines = [ 82 "QEMU_PIPE_PATH=\"/loader-gpu-devices/class/goldfish-pipe/000\"", 83 "GOLDFISH_ADDRESS_SPACE_DEVICE_NAME=\"/loader-gpu-devices/class/goldfish-address-space/000\"", 84 ] 85} 86 87loadable_module("libvulkan_gfxstream") { 88 configs += [ ":common_config" ] 89 90 sources = [ 91 "GoldfishAddressSpace/AddressSpaceStream.cpp", 92 "GoldfishAddressSpace/VirtioGpuAddressSpaceStream.cpp", 93 "OpenglCodecCommon/ChecksumCalculator.cpp", 94 "OpenglCodecCommon/ChecksumCalculator.h", 95 "OpenglCodecCommon/glUtils.cpp", 96 "OpenglCodecCommon/glUtils.h", 97 "OpenglSystemCommon/HostConnection.cpp", 98 "OpenglSystemCommon/HostConnection.h", 99 "OpenglSystemCommon/ProcessPipe.cpp", 100 "OpenglSystemCommon/ProcessPipe.h", 101 "OpenglSystemCommon/QemuPipeStream.h", 102 "OpenglSystemCommon/QemuPipeStream.cpp", 103 "OpenglSystemCommon/ThreadInfo.cpp", 104 "OpenglSystemCommon/ThreadInfo.h", 105 "OpenglSystemCommon/VirtioGpuPipeStream.cpp", 106 "android-emu/aemu/base/AlignedBuf.cpp", 107 "android-emu/aemu/base/AlignedBuf.h", 108 "android-emu/aemu/base/Allocator.h", 109 "android-emu/aemu/base/AndroidHealthMonitor.cpp", 110 "android-emu/aemu/base/AndroidHealthMonitor.h", 111 "android-emu/aemu/base/AndroidHealthMonitorConsumer.h", 112 "android-emu/aemu/base/AndroidHealthMonitorConsumerBasic.cpp", 113 "android-emu/aemu/base/AndroidHealthMonitorConsumerBasic.h", 114 "android-emu/aemu/base/AndroidSubAllocator.cpp", 115 "android-emu/aemu/base/AndroidSubAllocator.h", 116 "android-emu/aemu/base/BumpPool.h", 117 "android-emu/aemu/base/Pool.cpp", 118 "android-emu/aemu/base/Pool.h", 119 "android-emu/aemu/base/Process.cpp", 120 "android-emu/aemu/base/Process.h", 121 "android-emu/aemu/base/Tracing.cpp", 122 "android-emu/aemu/base/Tracing.h", 123 "android-emu/aemu/base/files/MemStream.cpp", 124 "android-emu/aemu/base/files/MemStream.h", 125 "android-emu/aemu/base/files/Stream.cpp", 126 "android-emu/aemu/base/files/Stream.h", 127 "android-emu/aemu/base/files/StreamSerializing.cpp", 128 "android-emu/aemu/base/files/StreamSerializing.h", 129 "android-emu/aemu/base/fit/Defer.h", 130 "android-emu/aemu/base/fit/Function.h", 131 "android-emu/aemu/base/fit/FunctionInternal.h", 132 "android-emu/aemu/base/fit/Nullable.h", 133 "android-emu/aemu/base/fit/ThreadChecker.h", 134 "android-emu/aemu/base/fit/ThreadSafety.h", 135 "android-emu/aemu/base/fit/UtilityInternal.h", 136 "android-emu/aemu/base/ring_buffer.c", 137 "android-emu/aemu/base/synchronization/AndroidConditionVariable.h", 138 "android-emu/aemu/base/synchronization/AndroidLock.h", 139 "android-emu/aemu/base/synchronization/AndroidMessageChannel.cpp", 140 "android-emu/aemu/base/synchronization/AndroidMessageChannel.h", 141 "android-emu/aemu/base/testing/TestClock.h", 142 "android-emu/aemu/base/threads/AndroidFunctorThread.cpp", 143 "android-emu/aemu/base/threads/AndroidFunctorThread.h", 144 "android-emu/aemu/base/threads/AndroidThread.h", 145 "android-emu/aemu/base/threads/AndroidThreadStore.h", 146 "android-emu/aemu/base/threads/AndroidThreadTypes.h", 147 "android-emu/aemu/base/threads/AndroidThread_pthread.cpp", 148 "android-emu/aemu/base/threads/AndroidWorkPool.cpp", 149 "android-emu/aemu/base/threads/AndroidWorkPool.h", 150 "gralloc_cb/include/gralloc_cb_bp.h", 151 "platform/VirtGpu.cpp", 152 "platform/include/VirtGpu.h", 153 "platform/stub/StubSync.cpp", 154 "platform/stub/StubVirtGpuBlob.cpp", 155 "platform/stub/StubVirtGpuBlobMapping.cpp", 156 "platform/stub/StubVirtGpuDevice.cpp", 157 "qemupipe/include-types/qemu_pipe_types_bp.h", 158 "qemupipe/include/qemu_pipe_bp.h", 159 "qemupipe/qemu_pipe_common.cpp", 160 "qemupipe/qemu_pipe_guest.cpp", 161 "renderControl_enc/renderControl_enc.cpp", 162 "renderControl_enc/renderControl_enc.h", 163 "vulkan_enc/CommandBufferStagingStream.cpp", 164 "vulkan_enc/CommandBufferStagingStream.h", 165 "vulkan_enc/DescriptorSetVirtualization.cpp", 166 "vulkan_enc/DescriptorSetVirtualization.h", 167 "vulkan_enc/HostVisibleMemoryVirtualization.cpp", 168 "vulkan_enc/HostVisibleMemoryVirtualization.h", 169 "vulkan_enc/Resources.cpp", 170 "vulkan_enc/Resources.h", 171 "vulkan_enc/Validation.cpp", 172 "vulkan_enc/Validation.h", 173 "vulkan_enc/VkEncoder.cpp", 174 "vulkan_enc/VkEncoder.h", 175 "vulkan_enc/VulkanHandleMapping.cpp", 176 "vulkan_enc/VulkanHandleMapping.h", 177 "vulkan_enc/VulkanStreamGuest.cpp", 178 "vulkan_enc/VulkanStreamGuest.h", 179 "vulkan_enc/func_table.cpp", 180 "vulkan_enc/func_table.h", 181 "vulkan_enc/goldfish_vk_counting_guest.cpp", 182 "vulkan_enc/goldfish_vk_counting_guest.h", 183 "vulkan_enc/goldfish_vk_deepcopy_guest.cpp", 184 "vulkan_enc/goldfish_vk_deepcopy_guest.h", 185 "vulkan_enc/goldfish_vk_extension_structs_guest.cpp", 186 "vulkan_enc/goldfish_vk_extension_structs_guest.h", 187 "vulkan_enc/goldfish_vk_marshaling_guest.cpp", 188 "vulkan_enc/goldfish_vk_marshaling_guest.h", 189 "vulkan_enc/goldfish_vk_reserved_marshaling_guest.cpp", 190 "vulkan_enc/goldfish_vk_reserved_marshaling_guest.h", 191 "vulkan_enc/goldfish_vk_transform_guest.cpp", 192 "vulkan_enc/goldfish_vk_transform_guest.h", 193 "vulkan_enc/vulkan_gfxstream.h", 194 "vulkan_enc/vulkan_gfxstream_structure_type.h", 195 ] 196 197 if (target_os == "fuchsia") { 198 sources -= [ 199 "OpenglSystemCommon/QemuPipeStream.cpp", 200 "qemupipe/qemu_pipe_common.cpp", 201 "qemupipe/qemu_pipe_guest.cpp", 202 "platform/stub/StubVirtGpuBlob.cpp", 203 "platform/stub/StubVirtGpuBlobMapping.cpp", 204 "platform/stub/StubVirtGpuDevice.cpp", 205 ] 206 sources += [ 207 "OpenglSystemCommon/TraceProviderFuchsia.cpp", 208 "OpenglSystemCommon/TraceProviderFuchsia.h", 209 "fuchsia/fuchsia_stdio.cc", 210 "fuchsia/port.cc", 211 "fuchsia/service_connector.cc", 212 "platform/fuchsia/FuchsiaVirtGpuBlob.cpp", 213 "platform/fuchsia/FuchsiaVirtGpuBlobMapping.cpp", 214 "platform/fuchsia/FuchsiaVirtGpuDevice.cpp", 215 ] 216 217 include_dirs = [ 218 "fuchsia/include", 219 "platform/include", 220 "//third_party/Vulkan-Headers/include", 221 ] 222 223 deps = [ 224 ":goldfish_srcs", 225 "//sdk/fidl/fuchsia.logger:fuchsia.logger_cpp", 226 "//sdk/fidl/fuchsia.sysmem:fuchsia.sysmem_cpp", 227 "//src/zircon/lib/zircon", 228 "//zircon/system/ulib/trace:trace-with-static-engine", 229 "//zircon/system/ulib/zx", 230 "//zircon/system/ulib/zxio", 231 ] 232 233 public_deps = [ "//third_party/Vulkan-Headers:vulkan_headers" ] 234 235 # Vulkan ICDs on Fuchsia are only allowed to depend on (parts of) libc 236 # and libzircon, and no other shared libraries. 237 assert_no_deps = [ 238 "//sdk/lib/fdio", 239 "//zircon/system/ulib/async-default", 240 ] 241 } 242} 243