gfxstream: host: BlobManager --> ExternalObjectManager
We should try to support external sync, along with
external memory so:
find ./ -type f -exec sed -i -e 's/BlobManager/ExternalObjectManager/g' {} \;
find ./ -type f -exec sed -i -e 's/removeDescriptorInfo/removeBlobDescriptorInfo/g' {} \;
find ./ -type f -exec sed -i -e 's/addDescriptorInfo/addBlobDescriptorInfo/g' {} \;
find ./ -type f -exec sed -i -e 's/mDescriptorInfo/mBlobDescriptorInfo/g' {} \;
find ./ -type f -exec sed -i -e 's/ManagedDescriptorInfo/BlobDescriptorInfo/g' {} \;
BUG=350965057
TEST=compile
Change-Id: Id9fe5319ed617638ae8c67f9377f5426fe15cf44
diff --git a/host/vulkan/BufferVk.cpp b/host/vulkan/BufferVk.cpp
index a8ec4f3..234a629 100644
--- a/host/vulkan/BufferVk.cpp
+++ b/host/vulkan/BufferVk.cpp
@@ -45,12 +45,12 @@
return updateBufferFromBytes(mHandle, offset, size, bytes);
}
-std::optional<ManagedDescriptorInfo> BufferVk::exportBlob() {
+std::optional<BlobDescriptorInfo> BufferVk::exportBlob() {
uint32_t streamHandleType = 0;
auto vkHandle = getBufferExtMemoryHandle(mHandle, &streamHandleType);
if (vkHandle != VK_EXT_MEMORY_HANDLE_INVALID) {
ManagedDescriptor descriptor(dupExternalMemory(vkHandle));
- return ManagedDescriptorInfo{
+ return BlobDescriptorInfo{
.descriptor = std::move(descriptor),
.handleType = streamHandleType,
.caching = 0,
diff --git a/host/vulkan/BufferVk.h b/host/vulkan/BufferVk.h
index 1df6b55..231179b 100644
--- a/host/vulkan/BufferVk.h
+++ b/host/vulkan/BufferVk.h
@@ -15,7 +15,7 @@
#include <memory>
#include <vector>
-#include "BlobManager.h"
+#include "ExternalObjectManager.h"
namespace gfxstream {
namespace vk {
@@ -30,7 +30,7 @@
bool updateFromBytes(uint64_t offset, uint64_t size, const void* bytes);
- std::optional<ManagedDescriptorInfo> exportBlob();
+ std::optional<BlobDescriptorInfo> exportBlob();
private:
BufferVk(uint32_t handle);
diff --git a/host/vulkan/ColorBufferVk.cpp b/host/vulkan/ColorBufferVk.cpp
index cd82b15..d432fd2 100644
--- a/host/vulkan/ColorBufferVk.cpp
+++ b/host/vulkan/ColorBufferVk.cpp
@@ -80,10 +80,10 @@
int ColorBufferVk::waitSync() { return waitSyncVkColorBuffer(mHandle); }
-std::optional<ManagedDescriptorInfo> ColorBufferVk::exportBlob() {
+std::optional<BlobDescriptorInfo> ColorBufferVk::exportBlob() {
auto info = exportColorBufferMemory(mHandle);
if (info) {
- return ManagedDescriptorInfo{
+ return BlobDescriptorInfo{
.descriptor = std::move((*info).descriptor),
.handleType = (*info).streamHandleType,
.caching = 0,
diff --git a/host/vulkan/ColorBufferVk.h b/host/vulkan/ColorBufferVk.h
index e7187b9..fec9284 100644
--- a/host/vulkan/ColorBufferVk.h
+++ b/host/vulkan/ColorBufferVk.h
@@ -17,7 +17,7 @@
#include <memory>
#include <vector>
-#include "BlobManager.h"
+#include "ExternalObjectManager.h"
#include "FrameworkFormats.h"
#include "aemu/base/files/Stream.h"
@@ -44,7 +44,7 @@
void onSave(android::base::Stream* stream);
int waitSync();
- std::optional<ManagedDescriptorInfo> exportBlob();
+ std::optional<BlobDescriptorInfo> exportBlob();
private:
ColorBufferVk(uint32_t handle);
diff --git a/host/vulkan/VkCommonOperations.cpp b/host/vulkan/VkCommonOperations.cpp
index 05851be..2178a52 100644
--- a/host/vulkan/VkCommonOperations.cpp
+++ b/host/vulkan/VkCommonOperations.cpp
@@ -25,7 +25,7 @@
#include <sstream>
#include <unordered_set>
-#include "BlobManager.h"
+#include "ExternalObjectManager.h"
#include "VkDecoderGlobalState.h"
#include "VkEmulatedPhysicalDeviceMemory.h"
#include "VkFormatUtils.h"
diff --git a/host/vulkan/VkDecoderGlobalState.cpp b/host/vulkan/VkDecoderGlobalState.cpp
index 40c2918..1ef468d 100644
--- a/host/vulkan/VkDecoderGlobalState.cpp
+++ b/host/vulkan/VkDecoderGlobalState.cpp
@@ -21,7 +21,7 @@
#include <unordered_map>
#include <vector>
-#include "BlobManager.h"
+#include "ExternalObjectManager.h"
#include "FrameBuffer.h"
#include "RenderThreadInfoVk.h"
#include "VkAndroidNativeBuffer.h"
@@ -93,11 +93,10 @@
using android::base::Optional;
using android::base::SharedMemory;
using android::base::StaticLock;
-using android::emulation::ManagedDescriptorInfo;
using emugl::ABORT_REASON_OTHER;
using emugl::FatalError;
using emugl::GfxApiLogger;
-using gfxstream::BlobManager;
+using gfxstream::ExternalObjectManager;
using gfxstream::VulkanInfo;
// TODO(b/261477138): Move to a shared aemu definition
@@ -4600,8 +4599,8 @@
uint32_t ctx_id = mSnapshotState == SnapshotState::Loading
? kTemporaryContextIdForSnapshotLoading
: tInfo->ctx_id;
- auto descriptorInfoOpt =
- BlobManager::get()->removeDescriptorInfo(ctx_id, createBlobInfoPtr->blobId);
+ auto descriptorInfoOpt = ExternalObjectManager::get()->removeBlobDescriptorInfo(
+ ctx_id, createBlobInfoPtr->blobId);
if (descriptorInfoOpt) {
auto rawDescriptorOpt = (*descriptorInfoOpt).descriptor.release();
if (rawDescriptorOpt) {
@@ -5094,9 +5093,9 @@
// We transfer ownership of the shared memory handle to the descriptor info.
// The memory itself is destroyed only when all processes unmap / release their
// handles.
- BlobManager::get()->addDescriptorInfo(ctx_id, hostBlobId,
- info->sharedMemory->releaseHandle(), handleType,
- info->caching, std::nullopt);
+ ExternalObjectManager::get()->addBlobDescriptorInfo(
+ ctx_id, hostBlobId, info->sharedMemory->releaseHandle(), handleType, info->caching,
+ std::nullopt);
} else if (m_emu->features.ExternalBlob.enabled) {
VkResult result;
auto device = unbox_VkDevice(boxed_device);
@@ -5159,9 +5158,9 @@
#endif
ManagedDescriptor managedHandle(handle);
- BlobManager::get()->addDescriptorInfo(ctx_id, hostBlobId, std::move(managedHandle),
- handleType, info->caching,
- std::optional<VulkanInfo>(vulkanInfo));
+ ExternalObjectManager::get()->addBlobDescriptorInfo(
+ ctx_id, hostBlobId, std::move(managedHandle), handleType, info->caching,
+ std::optional<VulkanInfo>(vulkanInfo));
} else if (!info->needUnmap) {
auto device = unbox_VkDevice(boxed_device);
auto vk = dispatch_VkDevice(boxed_device);
@@ -5188,8 +5187,8 @@
"using this blob may be corrupted/offset.",
kPageSizeforBlob, hva, alignedHva);
}
- BlobManager::get()->addMapping(ctx_id, hostBlobId, (void*)(uintptr_t)alignedHva,
- info->caching);
+ ExternalObjectManager::get()->addMapping(ctx_id, hostBlobId,
+ (void*)(uintptr_t)alignedHva, info->caching);
info->virtioGpuMapped = true;
info->hostmemId = hostBlobId;
}