add emulator feature for using auxilliary memory for vulkan command buffers am: 6398b85371 am: abd5e0a1fc

Original change: https://android-review.googlesource.com/c/device/generic/goldfish-opengl/+/2364012

Change-Id: Ie6c7930be5d12c2928422e2be9b17206bef40333
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/system/OpenglSystemCommon/EmulatorFeatureInfo.h b/system/OpenglSystemCommon/EmulatorFeatureInfo.h
index 67799eb..03f4198 100644
--- a/system/OpenglSystemCommon/EmulatorFeatureInfo.h
+++ b/system/OpenglSystemCommon/EmulatorFeatureInfo.h
@@ -141,6 +141,9 @@
 // HWC multiple display configs
 static const char kHWCMultiConfigs[] = "ANDROID_EMU_hwc_multi_configs";
 
+// Vulkan auxiliary command memory
+static const char kVulkanAuxCommandMemory[] = "ANDROID_EMU_vulkan_aux_command_memory";
+
 // Struct describing available emulator features
 struct EmulatorFeatureInfo {
 
@@ -170,7 +173,8 @@
         hasSyncBufferData(false),
         hasVulkanAsyncQsri(false),
         hasReadColorBufferDma(false),
-        hasHWCMultiConfigs(false)
+        hasHWCMultiConfigs(false),
+        hasVulkanAuxCommandMemory(false)
     { }
 
     SyncImpl syncImpl;
@@ -199,6 +203,7 @@
     bool hasVulkanAsyncQsri;
     bool hasReadColorBufferDma;
     bool hasHWCMultiConfigs;
+    bool hasVulkanAuxCommandMemory; // This feature tracks if vulkan command buffers should be stored in an auxiliary shared memory
 };
 
 enum HostConnectionType {
diff --git a/system/OpenglSystemCommon/HostConnection.cpp b/system/OpenglSystemCommon/HostConnection.cpp
index 08ab275..26c0903 100644
--- a/system/OpenglSystemCommon/HostConnection.cpp
+++ b/system/OpenglSystemCommon/HostConnection.cpp
@@ -727,6 +727,7 @@
         queryAndSetVulkanAsyncQsri(rcEnc);
         queryAndSetReadColorBufferDma(rcEnc);
         queryAndSetHWCMultiConfigs(rcEnc);
+        queryAndSetVulkanAuxCommandBufferMemory(rcEnc);
         queryVersion(rcEnc);
         if (m_processPipe) {
             auto fd = (m_connectionType == HOST_CONNECTION_VIRTIO_GPU_ADDRESS_SPACE) ? m_rendernodeFd : -1;
@@ -1016,6 +1017,12 @@
     }
 }
 
+void HostConnection::queryAndSetVulkanAuxCommandBufferMemory(ExtendedRCEncoderContext* rcEnc) {
+    std::string hostExtensions = queryHostExtensions(rcEnc);
+    rcEnc->featureInfo()->hasVulkanAuxCommandMemory = hostExtensions.find(kVulkanAuxCommandMemory) != std::string::npos;
+}
+
+
 GLint HostConnection::queryVersion(ExtendedRCEncoderContext* rcEnc) {
     GLint version = m_rcEnc->rcGetRendererVersion(m_rcEnc.get());
     return version;
diff --git a/system/OpenglSystemCommon/HostConnection.h b/system/OpenglSystemCommon/HostConnection.h
index 760b7f7..34639cd 100644
--- a/system/OpenglSystemCommon/HostConnection.h
+++ b/system/OpenglSystemCommon/HostConnection.h
@@ -258,6 +258,7 @@
     void queryAndSetVulkanAsyncQsri(ExtendedRCEncoderContext *rcEnc);
     void queryAndSetReadColorBufferDma(ExtendedRCEncoderContext *rcEnc);
     void queryAndSetHWCMultiConfigs(ExtendedRCEncoderContext* rcEnc);
+    void queryAndSetVulkanAuxCommandBufferMemory(ExtendedRCEncoderContext* rcEnc);
     GLint queryVersion(ExtendedRCEncoderContext* rcEnc);
 
 private: