async queue submit (guest)
Bug: 160996822
Change-Id: Ifeabf3de305ce35234cc191b905411f32c19cba7
diff --git a/system/vulkan/func_table.cpp b/system/vulkan/func_table.cpp
index 50e8a62..51913e8 100644
--- a/system/vulkan/func_table.cpp
+++ b/system/vulkan/func_table.cpp
@@ -240,6 +240,7 @@
{
AEMU_SCOPED_TRACE("vkQueueSubmit");
auto vkEnc = HostConnection::get()->vkEncoder();
+ ResourceTracker::get()->syncEncodersForQueue(queue, vkEnc);
VkResult vkQueueSubmit_VkResult_return = (VkResult)0;
auto resources = ResourceTracker::get();
vkQueueSubmit_VkResult_return = resources->on_vkQueueSubmit(vkEnc, VK_SUCCESS, queue, submitCount, pSubmits, fence);
@@ -250,6 +251,7 @@
{
AEMU_SCOPED_TRACE("vkQueueWaitIdle");
auto vkEnc = HostConnection::get()->vkEncoder();
+ ResourceTracker::get()->syncEncodersForQueue(queue, vkEnc);
VkResult vkQueueWaitIdle_VkResult_return = (VkResult)0;
auto resources = ResourceTracker::get();
vkQueueWaitIdle_VkResult_return = resources->on_vkQueueWaitIdle(vkEnc, VK_SUCCESS, queue);
@@ -418,6 +420,7 @@
{
AEMU_SCOPED_TRACE("vkQueueBindSparse");
auto vkEnc = HostConnection::get()->vkEncoder();
+ ResourceTracker::get()->syncEncodersForQueue(queue, vkEnc);
VkResult vkQueueBindSparse_VkResult_return = (VkResult)0;
vkQueueBindSparse_VkResult_return = vkEnc->vkQueueBindSparse(queue, bindInfoCount, pBindInfo, fence);
return vkQueueBindSparse_VkResult_return;
@@ -2258,6 +2261,7 @@
{
AEMU_SCOPED_TRACE("vkQueuePresentKHR");
auto vkEnc = HostConnection::get()->vkEncoder();
+ ResourceTracker::get()->syncEncodersForQueue(queue, vkEnc);
VkResult vkQueuePresentKHR_VkResult_return = (VkResult)0;
vkQueuePresentKHR_VkResult_return = vkEnc->vkQueuePresentKHR(queue, pPresentInfo);
return vkQueuePresentKHR_VkResult_return;
@@ -3751,6 +3755,7 @@
{
AEMU_SCOPED_TRACE("vkQueueSignalReleaseImageANDROID");
auto vkEnc = HostConnection::get()->vkEncoder();
+ ResourceTracker::get()->syncEncodersForQueue(queue, vkEnc);
VkResult vkQueueSignalReleaseImageANDROID_VkResult_return = (VkResult)0;
vkQueueSignalReleaseImageANDROID_VkResult_return = vkEnc->vkQueueSignalReleaseImageANDROID(queue, waitSemaphoreCount, pWaitSemaphores, image, pNativeFenceFd);
return vkQueueSignalReleaseImageANDROID_VkResult_return;
@@ -4633,6 +4638,7 @@
{
AEMU_SCOPED_TRACE("vkQueueBeginDebugUtilsLabelEXT");
auto vkEnc = HostConnection::get()->vkEncoder();
+ ResourceTracker::get()->syncEncodersForQueue(queue, vkEnc);
vkEnc->vkQueueBeginDebugUtilsLabelEXT(queue, pLabelInfo);
}
static void entry_vkQueueEndDebugUtilsLabelEXT(
@@ -4640,6 +4646,7 @@
{
AEMU_SCOPED_TRACE("vkQueueEndDebugUtilsLabelEXT");
auto vkEnc = HostConnection::get()->vkEncoder();
+ ResourceTracker::get()->syncEncodersForQueue(queue, vkEnc);
vkEnc->vkQueueEndDebugUtilsLabelEXT(queue);
}
static void entry_vkQueueInsertDebugUtilsLabelEXT(
@@ -4648,6 +4655,7 @@
{
AEMU_SCOPED_TRACE("vkQueueInsertDebugUtilsLabelEXT");
auto vkEnc = HostConnection::get()->vkEncoder();
+ ResourceTracker::get()->syncEncodersForQueue(queue, vkEnc);
vkEnc->vkQueueInsertDebugUtilsLabelEXT(queue, pLabelInfo);
}
static void entry_vkCmdBeginDebugUtilsLabelEXT(
@@ -4992,6 +5000,7 @@
{
AEMU_SCOPED_TRACE("vkGetQueueCheckpointDataNV");
auto vkEnc = HostConnection::get()->vkEncoder();
+ ResourceTracker::get()->syncEncodersForQueue(queue, vkEnc);
vkEnc->vkGetQueueCheckpointDataNV(queue, pCheckpointDataCount, pCheckpointData);
}
#endif
@@ -5287,6 +5296,48 @@
return vkFreeMemorySyncGOOGLE_VkResult_return;
}
#endif
+#ifdef VK_GOOGLE_async_queue_submit
+static void entry_vkQueueHostSyncGOOGLE(
+ VkQueue queue,
+ uint32_t needHostSync,
+ uint32_t sequenceNumber)
+{
+ AEMU_SCOPED_TRACE("vkQueueHostSyncGOOGLE");
+ auto vkEnc = HostConnection::get()->vkEncoder();
+ ResourceTracker::get()->syncEncodersForQueue(queue, vkEnc);
+ vkEnc->vkQueueHostSyncGOOGLE(queue, needHostSync, sequenceNumber);
+}
+static void entry_vkQueueSubmitAsyncGOOGLE(
+ VkQueue queue,
+ uint32_t submitCount,
+ const VkSubmitInfo* pSubmits,
+ VkFence fence)
+{
+ AEMU_SCOPED_TRACE("vkQueueSubmitAsyncGOOGLE");
+ auto vkEnc = HostConnection::get()->vkEncoder();
+ ResourceTracker::get()->syncEncodersForQueue(queue, vkEnc);
+ vkEnc->vkQueueSubmitAsyncGOOGLE(queue, submitCount, pSubmits, fence);
+}
+static void entry_vkQueueWaitIdleAsyncGOOGLE(
+ VkQueue queue)
+{
+ AEMU_SCOPED_TRACE("vkQueueWaitIdleAsyncGOOGLE");
+ auto vkEnc = HostConnection::get()->vkEncoder();
+ ResourceTracker::get()->syncEncodersForQueue(queue, vkEnc);
+ vkEnc->vkQueueWaitIdleAsyncGOOGLE(queue);
+}
+static void entry_vkQueueBindSparseAsyncGOOGLE(
+ VkQueue queue,
+ uint32_t bindInfoCount,
+ const VkBindSparseInfo* pBindInfo,
+ VkFence fence)
+{
+ AEMU_SCOPED_TRACE("vkQueueBindSparseAsyncGOOGLE");
+ auto vkEnc = HostConnection::get()->vkEncoder();
+ ResourceTracker::get()->syncEncodersForQueue(queue, vkEnc);
+ vkEnc->vkQueueBindSparseAsyncGOOGLE(queue, bindInfoCount, pBindInfo, fence);
+}
+#endif
void* goldfish_vulkan_get_proc_address(const char* name){
#ifdef VK_VERSION_1_0
if (!strcmp(name, "vkCreateInstance"))
@@ -6744,6 +6795,24 @@
return nullptr;
}
#endif
+#ifdef VK_GOOGLE_async_queue_submit
+ if (!strcmp(name, "vkQueueHostSyncGOOGLE"))
+ {
+ return nullptr;
+ }
+ if (!strcmp(name, "vkQueueSubmitAsyncGOOGLE"))
+ {
+ return nullptr;
+ }
+ if (!strcmp(name, "vkQueueWaitIdleAsyncGOOGLE"))
+ {
+ return nullptr;
+ }
+ if (!strcmp(name, "vkQueueBindSparseAsyncGOOGLE"))
+ {
+ return nullptr;
+ }
+#endif
return nullptr;
}
void* goldfish_vulkan_get_instance_proc_address(VkInstance instance, const char* name){
@@ -8298,6 +8367,28 @@
return (void*)dynCheck_entry_vkFreeMemorySyncGOOGLE;
}
#endif
+#ifdef VK_GOOGLE_async_queue_submit
+ if (!strcmp(name, "vkQueueHostSyncGOOGLE"))
+ {
+ bool hasExt = resources->hasInstanceExtension(instance, "VK_GOOGLE_async_queue_submit");
+ return hasExt ? (void*)entry_vkQueueHostSyncGOOGLE : nullptr;
+ }
+ if (!strcmp(name, "vkQueueSubmitAsyncGOOGLE"))
+ {
+ bool hasExt = resources->hasInstanceExtension(instance, "VK_GOOGLE_async_queue_submit");
+ return hasExt ? (void*)entry_vkQueueSubmitAsyncGOOGLE : nullptr;
+ }
+ if (!strcmp(name, "vkQueueWaitIdleAsyncGOOGLE"))
+ {
+ bool hasExt = resources->hasInstanceExtension(instance, "VK_GOOGLE_async_queue_submit");
+ return hasExt ? (void*)entry_vkQueueWaitIdleAsyncGOOGLE : nullptr;
+ }
+ if (!strcmp(name, "vkQueueBindSparseAsyncGOOGLE"))
+ {
+ bool hasExt = resources->hasInstanceExtension(instance, "VK_GOOGLE_async_queue_submit");
+ return hasExt ? (void*)entry_vkQueueBindSparseAsyncGOOGLE : nullptr;
+ }
+#endif
return nullptr;
}
void* goldfish_vulkan_get_device_proc_address(VkDevice device, const char* name){
@@ -9923,6 +10014,28 @@
return hasExt ? (void*)entry_vkFreeMemorySyncGOOGLE : nullptr;
}
#endif
+#ifdef VK_GOOGLE_async_queue_submit
+ if (!strcmp(name, "vkQueueHostSyncGOOGLE"))
+ {
+ bool hasExt = resources->hasDeviceExtension(device, "VK_GOOGLE_async_queue_submit");
+ return hasExt ? (void*)entry_vkQueueHostSyncGOOGLE : nullptr;
+ }
+ if (!strcmp(name, "vkQueueSubmitAsyncGOOGLE"))
+ {
+ bool hasExt = resources->hasDeviceExtension(device, "VK_GOOGLE_async_queue_submit");
+ return hasExt ? (void*)entry_vkQueueSubmitAsyncGOOGLE : nullptr;
+ }
+ if (!strcmp(name, "vkQueueWaitIdleAsyncGOOGLE"))
+ {
+ bool hasExt = resources->hasDeviceExtension(device, "VK_GOOGLE_async_queue_submit");
+ return hasExt ? (void*)entry_vkQueueWaitIdleAsyncGOOGLE : nullptr;
+ }
+ if (!strcmp(name, "vkQueueBindSparseAsyncGOOGLE"))
+ {
+ bool hasExt = resources->hasDeviceExtension(device, "VK_GOOGLE_async_queue_submit");
+ return hasExt ? (void*)entry_vkQueueBindSparseAsyncGOOGLE : nullptr;
+ }
+#endif
return nullptr;
}