aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-11-09 00:05:10 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-11-09 00:05:10 +0000
commitb4697d7c49c2bc27cf7e566bc3b3f8378f98bc01 (patch)
tree73123f27053dde80c33634cc8a2053e07af5403c
parent9fc26d0747fda35ce8f6b252cf88328f77a7b45a (diff)
parent6a93b8c817d5f91635d0f264f90d7129bb2806fd (diff)
downloadangle-android13-qpr2-s2-release.tar.gz
Change-Id: I84cc54c8ef4819a82bd71b93c87136785d475182
-rw-r--r--src/libANGLE/renderer/vulkan/vk_utils.cpp3
-rw-r--r--src/libANGLE/renderer/vulkan/vk_utils.h8
2 files changed, 4 insertions, 7 deletions
diff --git a/src/libANGLE/renderer/vulkan/vk_utils.cpp b/src/libANGLE/renderer/vulkan/vk_utils.cpp
index 7285841ad3..0a2fb137f1 100644
--- a/src/libANGLE/renderer/vulkan/vk_utils.cpp
+++ b/src/libANGLE/renderer/vulkan/vk_utils.cpp
@@ -1618,7 +1618,6 @@ angle::Result BufferBlock::init(Context *context,
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::unmap(const VkDevice device)
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 a53c8a462f..37f07acc36 100644
--- a/src/libANGLE/renderer/vulkan/vk_utils.h
+++ b/src/libANGLE/renderer/vulkan/vk_utils.h
@@ -945,9 +945,7 @@ class BufferBlock final : angle::NonCopyable
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 VkDeviceSize BufferBlock::getMemorySize() const
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 @@ ANGLE_INLINE VkResult BufferBlock::allocate(VkDeviceSize size,
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);
}