Vulkan: Always enable mVirtualBlockMutex

Ported from an upstream ANGLE change in the Chromium Gerrit (see:
https://chromium-review.googlesource.com/c/angle/angle/+/3855203).

This addresses an issue when multiple threads both try to use the
Vulkan Memory Allocator at the same time.  In particular, the issue is
when one thread is allocating and another thread is doing a free.

Test: Port from Chromium Gerrit
Bug: 236098131
Bug: 254137707
Change-Id: I0fda61e5db3ff60f776b8d4917a9f10dafed6b1a
Merged-In: I4294a13726367d73ba2255cfea9663d625cd8e36
diff --git a/src/libANGLE/renderer/vulkan/vk_utils.cpp b/src/libANGLE/renderer/vulkan/vk_utils.cpp
index 7285841..0a2fb13 100644
--- a/src/libANGLE/renderer/vulkan/vk_utils.cpp
+++ b/src/libANGLE/renderer/vulkan/vk_utils.cpp
@@ -1618,7 +1618,6 @@
     ASSERT(!mBuffer.valid());
     ASSERT(!mDeviceMemory.valid());
 
-    mVirtualBlockMutex.init(renderer->isAsyncCommandQueueEnabled());
     ANGLE_VK_TRY(context, mVirtualBlock.init(renderer->getDevice(), flags, size));
 
     mBuffer              = std::move(buffer);
@@ -1664,7 +1663,7 @@
 
 void BufferBlock::free(VkDeviceSize offset)
 {
-    std::lock_guard<ConditionalMutex> lock(mVirtualBlockMutex);
+    std::unique_lock<std::mutex> lock(mVirtualBlockMutex);
     mVirtualBlock.free(offset);
 }
 
diff --git a/src/libANGLE/renderer/vulkan/vk_utils.h b/src/libANGLE/renderer/vulkan/vk_utils.h
index a53c8a4..37f07ac 100644
--- a/src/libANGLE/renderer/vulkan/vk_utils.h
+++ b/src/libANGLE/renderer/vulkan/vk_utils.h
@@ -945,9 +945,7 @@
     int32_t getAndIncrementEmptyCounter();
 
   private:
-    // Protect multi-thread access to mVirtualBlock, which could be possible when asyncCommandQueue
-    // is enabled.
-    ConditionalMutex mVirtualBlockMutex;
+    mutable std::mutex mVirtualBlockMutex;
     VirtualBlock mVirtualBlock;
 
     Buffer mBuffer;
@@ -1025,7 +1023,7 @@
 
 ANGLE_INLINE VkBool32 BufferBlock::isEmpty()
 {
-    std::lock_guard<ConditionalMutex> lock(mVirtualBlockMutex);
+    std::unique_lock<std::mutex> lock(mVirtualBlockMutex);
     return vma::IsVirtualBlockEmpty(mVirtualBlock.getHandle());
 }
 
@@ -1054,7 +1052,7 @@
                                             VkDeviceSize alignment,
                                             VkDeviceSize *offsetOut)
 {
-    std::lock_guard<ConditionalMutex> lock(mVirtualBlockMutex);
+    std::unique_lock<std::mutex> lock(mVirtualBlockMutex);
     mCountRemainsEmpty = 0;
     return mVirtualBlock.allocate(size, alignment, offsetOut);
 }