aboutsummaryrefslogtreecommitdiffstats
path: root/system/OpenglSystemCommon
diff options
context:
space:
mode:
authorLingfeng Yang <lfy@google.com>2020-04-14 19:24:41 -0700
committerLingfeng Yang <lfy@google.com>2020-04-14 19:42:47 -0700
commit2f39a1fc053a55f1dfac5640ee19f79673358bd5 (patch)
treed0ee837bb327ef903f48d35d53ab5c1e818ed3fa /system/OpenglSystemCommon
parenta6d41d353657b0bfb3884d17c0fd1c486af02bf7 (diff)
downloaddevice_generic_goldfish-opengl-2f39a1fc053a55f1dfac5640ee19f79673358bd5.tar.gz
device_generic_goldfish-opengl-2f39a1fc053a55f1dfac5640ee19f79673358bd5.tar.bz2
device_generic_goldfish-opengl-2f39a1fc053a55f1dfac5640ee19f79673358bd5.zip
vulkan: always tear down host visible memory blocks properly (guest)
Test: Chrome Fuchsia cc_unittests don't flake Change-Id: I2e736dfb3d940b604970a4e62b5447a34734dea3
Diffstat (limited to 'system/OpenglSystemCommon')
-rw-r--r--system/OpenglSystemCommon/EmulatorFeatureInfo.h7
-rw-r--r--system/OpenglSystemCommon/HostConnection.cpp8
-rw-r--r--system/OpenglSystemCommon/HostConnection.h1
3 files changed, 15 insertions, 1 deletions
diff --git a/system/OpenglSystemCommon/EmulatorFeatureInfo.h b/system/OpenglSystemCommon/EmulatorFeatureInfo.h
index 9142ac9a..626048fd 100644
--- a/system/OpenglSystemCommon/EmulatorFeatureInfo.h
+++ b/system/OpenglSystemCommon/EmulatorFeatureInfo.h
@@ -102,6 +102,9 @@ static const char kVirtioGpuNext[] = "ANDROID_EMU_virtio_gpu_next";
static const char kHasSharedSlotsHostMemoryAllocator[] = "ANDROID_EMU_has_shared_slots_host_memory_allocator";
+// Vulkan free memory sync
+static const char kVulkanFreeMemorySync[] = "ANDROID_EMU_vulkan_free_memory_sync";
+
// Struct describing available emulator features
struct EmulatorFeatureInfo {
@@ -119,7 +122,8 @@ struct EmulatorFeatureInfo {
hasYUVCache (false),
hasAsyncUnmapBuffer (false),
hasVirtioGpuNext (false),
- hasSharedSlotsHostMemoryAllocator(false)
+ hasSharedSlotsHostMemoryAllocator(false),
+ hasVulkanFreeMemorySync(false)
{ }
SyncImpl syncImpl;
@@ -136,6 +140,7 @@ struct EmulatorFeatureInfo {
bool hasAsyncUnmapBuffer;
bool hasVirtioGpuNext;
bool hasSharedSlotsHostMemoryAllocator;
+ bool hasVulkanFreeMemorySync;
};
enum HostConnectionType {
diff --git a/system/OpenglSystemCommon/HostConnection.cpp b/system/OpenglSystemCommon/HostConnection.cpp
index a67a7248..fbb946f8 100644
--- a/system/OpenglSystemCommon/HostConnection.cpp
+++ b/system/OpenglSystemCommon/HostConnection.cpp
@@ -615,6 +615,7 @@ ExtendedRCEncoderContext *HostConnection::rcEncoder()
queryAndSetAsyncUnmapBuffer(m_rcEnc);
queryAndSetVirtioGpuNext(m_rcEnc);
queryHasSharedSlotsHostMemoryAllocator(m_rcEnc);
+ queryAndSetVulkanFreeMemorySync(m_rcEnc);
if (m_processPipe) {
m_processPipe->processPipeInit(m_connectionType, m_rcEnc);
}
@@ -825,3 +826,10 @@ void HostConnection::queryHasSharedSlotsHostMemoryAllocator(ExtendedRCEncoderCon
rcEnc->featureInfo()->hasSharedSlotsHostMemoryAllocator = true;
}
}
+
+void HostConnection::queryAndSetVulkanFreeMemorySync(ExtendedRCEncoderContext *rcEnc) {
+ const std::string& glExtensions = queryGLExtensions(rcEnc);
+ if (glExtensions.find(kVulkanFreeMemorySync) != std::string::npos) {
+ rcEnc->featureInfo()->hasVulkanFreeMemorySync = true;
+ }
+}
diff --git a/system/OpenglSystemCommon/HostConnection.h b/system/OpenglSystemCommon/HostConnection.h
index 08ec7daa..02c86815 100644
--- a/system/OpenglSystemCommon/HostConnection.h
+++ b/system/OpenglSystemCommon/HostConnection.h
@@ -205,6 +205,7 @@ private:
void queryAndSetAsyncUnmapBuffer(ExtendedRCEncoderContext *rcEnc);
void queryAndSetVirtioGpuNext(ExtendedRCEncoderContext *rcEnc);
void queryHasSharedSlotsHostMemoryAllocator(ExtendedRCEncoderContext *rcEnc);
+ void queryAndSetVulkanFreeMemorySync(ExtendedRCEncoderContext *rcEnc);
private:
HostConnectionType m_connectionType;