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 <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
This commit is contained in:
Jason Macnak
2023-07-20 13:40:09 -07:00
committed by Marge Bot
parent 7acf5eaa88
commit 43732bb54c
7 changed files with 21 additions and 21 deletions
@@ -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,
@@ -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<android::base::guest::SubAllocator>(blobMapping->asRawPtr(), mSize, 4096);
std::make_unique<gfxstream::guest::SubAllocator>(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<android::base::guest::SubAllocator>(address, mSize, kLargestPageSize);
std::make_unique<gfxstream::guest::SubAllocator>(address, mSize, kLargestPageSize);
}
CoherentMemory::~CoherentMemory() {
@@ -37,7 +37,7 @@ namespace vk {
bool isHostVisible(const VkPhysicalDeviceMemoryProperties* memoryProps, uint32_t index);
using GoldfishAddressSpaceBlockPtr = std::shared_ptr<GoldfishAddressSpaceBlock>;
using SubAllocatorPtr = std::unique_ptr<android::base::guest::SubAllocator>;
using SubAllocatorPtr = std::unique_ptr<gfxstream::guest::SubAllocator>;
class CoherentMemory {
public:
@@ -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<VkBufferCollectionPropertiesFUCHSIA> properties;
gfxstream::guest::Optional<VkBufferCollectionPropertiesFUCHSIA> 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 {
@@ -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(); }
@@ -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;
@@ -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<uint8_t> mWriteBuffer;
IOStream* mStream = nullptr;
DefaultHandleMapping mDefaultHandleMapping;