Thread safe releaseQueue
authorMarcin Zając <marcin.zajac@mobica.com>
Tue, 17 May 2022 16:46:08 +0000 (18:46 +0200)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Thu, 2 Jun 2022 22:40:38 +0000 (22:40 +0000)
Failure discovered on ARM platform coused by commandBuffer
deleter being called after queues.releaseQueue()
is now protected by mutex lock

Components: Vulkan

Affects:
dEQP-VK.synchronization.internally_synchronized_objects.*

VK-GL-CTS issue: 3688

Change-Id: Ib743dd52a3ed5cc066268aa0618c2b770e2524dc

external/vulkancts/modules/vulkan/synchronization/vktSynchronizationInternallySynchronizedObjectsTests.cpp

index 50116fe..bb7ee1b 100644 (file)
@@ -163,9 +163,10 @@ public:
                return false;
        }
 
-       void                    releaseQueue                    (const deUint32& queueFamilyIndex, const int& queueIndex)
+       void                    releaseQueue                    (const deUint32& queueFamilyIndex, const int& queueIndex, Move<VkCommandBuffer>& commandBuffer)
        {
                m_mutex.lock();
+               commandBuffer = Move<VkCommandBuffer>();
                m_queues[queueFamilyIndex].available[queueIndex] = true;
                m_mutex.unlock();
        }
@@ -406,7 +407,7 @@ TestStatus executeComputePipeline (const Context& context, const VkPipeline& pip
 
                // Wait for command buffer execution finish
                submitCommandsAndWait(vk, device, queue, *cmdBuffer);
-               queues.releaseQueue(queueFamilyIndex, queueIndex);
+               queues.releaseQueue(queueFamilyIndex, queueIndex, cmdBuffer);
 
                {
                        const Allocation& resultAlloc = resultBuffer.getAllocation();
@@ -500,7 +501,7 @@ TestStatus executeGraphicPipeline (const Context& context, const VkPipeline& pip
 
                // Wait for command buffer execution finish
                submitCommandsAndWait(vk, device, queue, *cmdBuffer);
-               queues.releaseQueue(queueFamilyIndex, queueIndex);
+               queues.releaseQueue(queueFamilyIndex, queueIndex, cmdBuffer);
 
                {
                        const Allocation& resultAlloc = resultBuffer.getAllocation();