Vulkan semaphore opaque fd support

This CL adds Vulkan semaphore opaque fd support. It associates guest fd
with host fd by creating a guest mem file and write the host fd into it.
However, they are not 1 to 1 especially when dup() is used on guest fd,
which results in fd leaks.

It fixes dEQP VK must-pass opaque_fd tests, though.

BUG: 123905820

+ Patch up on_vkCreateSemaphore to keep extension structs when
on Android.

Change-Id: Id7d2b4e0e66d08db51d4407883ace819ec1c1a32
diff --git a/system/vulkan/func_table.cpp b/system/vulkan/func_table.cpp
index 970b642..943ac96 100644
--- a/system/vulkan/func_table.cpp
+++ b/system/vulkan/func_table.cpp
@@ -2431,7 +2431,8 @@
     AEMU_SCOPED_TRACE("vkImportSemaphoreFdKHR");
     auto vkEnc = HostConnection::get()->vkEncoder();
     VkResult vkImportSemaphoreFdKHR_VkResult_return = (VkResult)0;
-    vkImportSemaphoreFdKHR_VkResult_return = vkEnc->vkImportSemaphoreFdKHR(device, pImportSemaphoreFdInfo);
+    auto resources = ResourceTracker::get();
+    vkImportSemaphoreFdKHR_VkResult_return = resources->on_vkImportSemaphoreFdKHR(vkEnc, VK_SUCCESS, device, pImportSemaphoreFdInfo);
     return vkImportSemaphoreFdKHR_VkResult_return;
 }
 static VkResult entry_vkGetSemaphoreFdKHR(
@@ -2442,7 +2443,8 @@
     AEMU_SCOPED_TRACE("vkGetSemaphoreFdKHR");
     auto vkEnc = HostConnection::get()->vkEncoder();
     VkResult vkGetSemaphoreFdKHR_VkResult_return = (VkResult)0;
-    vkGetSemaphoreFdKHR_VkResult_return = vkEnc->vkGetSemaphoreFdKHR(device, pGetFdInfo, pFd);
+    auto resources = ResourceTracker::get();
+    vkGetSemaphoreFdKHR_VkResult_return = resources->on_vkGetSemaphoreFdKHR(vkEnc, VK_SUCCESS, device, pGetFdInfo, pFd);
     return vkGetSemaphoreFdKHR_VkResult_return;
 }
 #endif