Returns a valid fd in vkGetFenceFdKHR for signaled VkFence

ANGLE will directly use the fd returned from vkGetFenceFdKHR to
implement eglDupNativeFenceFDANDROID, which will return -1 if
vkGetFenceFdKHR returns a -1 fd, but -1 should be only returned when
error occurs. From the spec:

    Accepted by the <attrib_list> parameter of eglCreateSyncKHR, and returned
    by eglDupNativeFenceFDANDROID in the event of an error:

    EGL_NO_NATIVE_FENCE_FD_ANDROID         -1

This change will fix the bug for ANGLE.

Bug: b/210049299

Test: run the emulator and the game, the video plays
Change-Id: I758de1b4160ddf77866e2adfd593a68b02d34b40
diff --git a/system/vulkan_enc/ResourceTracker.cpp b/system/vulkan_enc/ResourceTracker.cpp
index 139310d..8f636c2 100644
--- a/system/vulkan_enc/ResourceTracker.cpp
+++ b/system/vulkan_enc/ResourceTracker.cpp
@@ -5412,19 +5412,17 @@
 
         VkResult currentFenceStatus = enc->vkGetFenceStatus(device, pGetFdInfo->fence, true /* do lock */);
 
-        if (VK_SUCCESS == currentFenceStatus) { // Fence already signaled
-            ALOGV("%s: VK_SUCCESS: already signaled\n", __func__);
-            *pFd = -1;
-            return VK_SUCCESS;
-        }
-
         if (VK_ERROR_DEVICE_LOST == currentFenceStatus) { // Other error
             ALOGV("%s: VK_ERROR_DEVICE_LOST: Other error\n", __func__);
             *pFd = -1;
             return VK_ERROR_DEVICE_LOST;
         }
 
-        if (VK_NOT_READY == currentFenceStatus) { // Fence unsignaled; create fd here
+        if (VK_NOT_READY == currentFenceStatus || VK_SUCCESS == currentFenceStatus) {
+            // Fence is valid. We also create a new sync fd for a signaled
+            // fence, because ANGLE will use the returned fd directly to
+            // implement eglDupNativeFenceFDANDROID, where -1 is only returned
+            // when error occurs.
             AutoLock<RecursiveLock> lock(mLock);
 
             auto it = info_VkFence.find(pGetFdInfo->fence);