From 43732bb54c89fd322c96e643c0f6a1941cfb08e0 Mon Sep 17 00:00:00 2001 From: Jason Macnak Date: Thu, 20 Jul 2023 13:40:09 -0700 Subject: [PATCH] Update namespace in libandroidemu to gfxstream::guest ... to avoid conflicts when the guest is built for the host for end2end tests. In the future, the differences between libandroidemu and hardware/google/aemu/base/ should be consolidated and there should be a single shared library as there isn't really anything guest/host specific about either of these copies. cvd start --gpu_mode=gfxstream_guest_angle_host_swiftshader Reviewed-by: Aaron Ruby Acked-by: Yonggang Luo Acked-by: Adam Jackson Part-of: --- .../guest/platform/include/VirtGpu.h | 2 +- .../HostVisibleMemoryVirtualization.cpp | 6 ++--- .../HostVisibleMemoryVirtualization.h | 2 +- .../guest/vulkan_enc/ResourceTracker.cpp | 22 +++++++++---------- .../guest/vulkan_enc/VkEncoder.cpp.inl | 2 +- .../guest/vulkan_enc/VulkanStreamGuest.cpp | 4 ++-- .../guest/vulkan_enc/VulkanStreamGuest.h | 4 ++-- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/gfxstream/guest/platform/include/VirtGpu.h b/src/gfxstream/guest/platform/include/VirtGpu.h index 4c9cb8764e2..a1166b5db8d 100644 --- a/src/gfxstream/guest/platform/include/VirtGpu.h +++ b/src/gfxstream/guest/platform/include/VirtGpu.h @@ -157,7 +157,7 @@ VirtGpuDevice* getPlatformVirtGpuDeviceInstance(enum VirtGpuCapset capset = kCap } // namespace platform_internal -// HACK: We can use android::base::EnumFlags, but we'll have to do more guest +// HACK: We can use gfxstream::guest::EnumFlags, but we'll have to do more guest // refactorings to figure out our end goal. We can either depend more on base or // try to transition to something else (b:202552093) [atleast for guests]. constexpr enum VirtGpuBlobFlags operator |(const enum VirtGpuBlobFlags self, diff --git a/src/gfxstream/guest/vulkan_enc/HostVisibleMemoryVirtualization.cpp b/src/gfxstream/guest/vulkan_enc/HostVisibleMemoryVirtualization.cpp index 5f3b23a4c99..a2ca85f6642 100644 --- a/src/gfxstream/guest/vulkan_enc/HostVisibleMemoryVirtualization.cpp +++ b/src/gfxstream/guest/vulkan_enc/HostVisibleMemoryVirtualization.cpp @@ -24,7 +24,7 @@ #include "VkEncoder.h" #include "aemu/base/AndroidSubAllocator.h" -using android::base::guest::SubAllocator; +using gfxstream::guest::SubAllocator; namespace gfxstream { namespace vk { @@ -37,7 +37,7 @@ CoherentMemory::CoherentMemory(VirtGpuBlobMappingPtr blobMapping, uint64_t size, VkDeviceMemory memory) : mSize(size), mBlobMapping(blobMapping), mDevice(device), mMemory(memory) { mAllocator = - std::make_unique(blobMapping->asRawPtr(), mSize, 4096); + std::make_unique(blobMapping->asRawPtr(), mSize, 4096); } CoherentMemory::CoherentMemory(GoldfishAddressSpaceBlockPtr block, uint64_t gpuAddr, uint64_t size, @@ -45,7 +45,7 @@ CoherentMemory::CoherentMemory(GoldfishAddressSpaceBlockPtr block, uint64_t gpuA : mSize(size), mBlock(block), mDevice(device), mMemory(memory) { void* address = block->mmap(gpuAddr); mAllocator = - std::make_unique(address, mSize, kLargestPageSize); + std::make_unique(address, mSize, kLargestPageSize); } CoherentMemory::~CoherentMemory() { diff --git a/src/gfxstream/guest/vulkan_enc/HostVisibleMemoryVirtualization.h b/src/gfxstream/guest/vulkan_enc/HostVisibleMemoryVirtualization.h index bd62386ac11..7ab9c8b96be 100644 --- a/src/gfxstream/guest/vulkan_enc/HostVisibleMemoryVirtualization.h +++ b/src/gfxstream/guest/vulkan_enc/HostVisibleMemoryVirtualization.h @@ -37,7 +37,7 @@ namespace vk { bool isHostVisible(const VkPhysicalDeviceMemoryProperties* memoryProps, uint32_t index); using GoldfishAddressSpaceBlockPtr = std::shared_ptr; -using SubAllocatorPtr = std::unique_ptr; +using SubAllocatorPtr = std::unique_ptr; class CoherentMemory { public: diff --git a/src/gfxstream/guest/vulkan_enc/ResourceTracker.cpp b/src/gfxstream/guest/vulkan_enc/ResourceTracker.cpp index 0e53eba74eb..46db16facf2 100644 --- a/src/gfxstream/guest/vulkan_enc/ResourceTracker.cpp +++ b/src/gfxstream/guest/vulkan_enc/ResourceTracker.cpp @@ -135,11 +135,11 @@ inline_memfd_create(const char *name, unsigned int flags) { #endif #endif -using android::base::Optional; -using android::base::guest::AutoLock; -using android::base::guest::RecursiveLock; -using android::base::guest::Lock; -using android::base::guest::WorkPool; +using gfxstream::guest::Optional; +using gfxstream::guest::AutoLock; +using gfxstream::guest::RecursiveLock; +using gfxstream::guest::Lock; +using gfxstream::guest::WorkPool; namespace gfxstream { namespace vk { @@ -408,10 +408,10 @@ public: struct VkBufferCollectionFUCHSIA_Info { #ifdef VK_USE_PLATFORM_FUCHSIA - android::base::Optional< + gfxstream::guest::Optional< fuchsia_sysmem::wire::BufferCollectionConstraints> constraints; - android::base::Optional properties; + gfxstream::guest::Optional properties; // the index of corresponding createInfo for each image format // constraints in |constraints|. @@ -2566,7 +2566,7 @@ public: if (info_VkBufferCollectionFUCHSIA.find(buffer_collection) != info_VkBufferCollectionFUCHSIA.end()) { info_VkBufferCollectionFUCHSIA[buffer_collection].constraints = - android::base::makeOptional( + gfxstream::guest::makeOptional( std::move(setConstraintsResult.constraints)); info_VkBufferCollectionFUCHSIA[buffer_collection].createInfoIndex = std::move(setConstraintsResult.createInfoIndex); @@ -2632,7 +2632,7 @@ public: if (info_VkBufferCollectionFUCHSIA.find(buffer_collection) != info_VkBufferCollectionFUCHSIA.end()) { info_VkBufferCollectionFUCHSIA[buffer_collection].constraints = - android::base::makeOptional(setConstraintsResult.constraints); + gfxstream::guest::makeOptional(setConstraintsResult.constraints); } return VK_SUCCESS; @@ -2806,7 +2806,7 @@ public: } info_VkBufferCollectionFUCHSIA[collection].properties = - android::base::makeOptional(*pProperties); + gfxstream::guest::makeOptional(*pProperties); // We only do a shallow copy so we should remove all pNext pointers. info_VkBufferCollectionFUCHSIA[collection].properties->pNext = @@ -5281,7 +5281,7 @@ public: if (result.ok() && result->status == ZX_OK) { auto& info = result->buffer_collection_info; if (index < info.buffer_count) { - vmo = android::base::makeOptional( + vmo = gfxstream::guest::makeOptional( std::move(info.buffers[index].vmo)); } } else { diff --git a/src/gfxstream/guest/vulkan_enc/VkEncoder.cpp.inl b/src/gfxstream/guest/vulkan_enc/VkEncoder.cpp.inl index 97bc8696e6a..646e6b0ff44 100644 --- a/src/gfxstream/guest/vulkan_enc/VkEncoder.cpp.inl +++ b/src/gfxstream/guest/vulkan_enc/VkEncoder.cpp.inl @@ -60,7 +60,7 @@ struct EncoderAutoLock { VkEncoder* mEnc; }; -VkEncoder::VkEncoder(IOStream* stream, android::base::guest::HealthMonitor<>* healthMonitor) +VkEncoder::VkEncoder(IOStream* stream, gfxstream::guest::HealthMonitor<>* healthMonitor) : mImpl(new VkEncoder::Impl(stream)), mHealthMonitor(healthMonitor) {} void VkEncoder::flush() { mImpl->flush(); } diff --git a/src/gfxstream/guest/vulkan_enc/VulkanStreamGuest.cpp b/src/gfxstream/guest/vulkan_enc/VulkanStreamGuest.cpp index 3c11670e35e..921f0d4087e 100644 --- a/src/gfxstream/guest/vulkan_enc/VulkanStreamGuest.cpp +++ b/src/gfxstream/guest/vulkan_enc/VulkanStreamGuest.cpp @@ -67,7 +67,7 @@ void VulkanStreamGuest::loadStringInPlaceWithStreamPtr(char** forOutput, uint8_t uint32_t len; memcpy(&len, *streamPtr, sizeof(uint32_t)); *streamPtr += sizeof(uint32_t); - android::base::Stream::fromBe32((uint8_t*)&len); + gfxstream::guest::Stream::fromBe32((uint8_t*)&len); alloc((void**)forOutput, len + 1); @@ -83,7 +83,7 @@ void VulkanStreamGuest::loadStringArrayInPlaceWithStreamPtr(char*** forOutput, u uint32_t count; memcpy(&count, *streamPtr, sizeof(uint32_t)); *streamPtr += sizeof(uint32_t); - android::base::Stream::fromBe32((uint8_t*)&count); + gfxstream::guest::Stream::fromBe32((uint8_t*)&count); if (!count) { *forOutput = nullptr; return; diff --git a/src/gfxstream/guest/vulkan_enc/VulkanStreamGuest.h b/src/gfxstream/guest/vulkan_enc/VulkanStreamGuest.h index 48c5a61306b..89c4e0d171e 100644 --- a/src/gfxstream/guest/vulkan_enc/VulkanStreamGuest.h +++ b/src/gfxstream/guest/vulkan_enc/VulkanStreamGuest.h @@ -37,7 +37,7 @@ class IOStream; namespace gfxstream { namespace vk { -class VulkanStreamGuest : public android::base::Stream { +class VulkanStreamGuest : public gfxstream::guest::Stream { public: VulkanStreamGuest(IOStream* stream); ~VulkanStreamGuest(); @@ -78,7 +78,7 @@ public: uint8_t* reserve(size_t size); private: - android::base::BumpPool mPool; + gfxstream::guest::BumpPool mPool; std::vector mWriteBuffer; IOStream* mStream = nullptr; DefaultHandleMapping mDefaultHandleMapping;