summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNormunds Rieksts <normunds.rieksts+arm@gmail.com>2023-01-10 15:45:09 +0000
committerRosen Zhelev <rosen.zhelev@arm.com>2023-01-10 15:45:09 +0000
commit2ad81d6b971ef0f2fc0c8c36289900f5f7bd7968 (patch)
tree7d65705191514b1b50db29d41746476d288e47fa
parent566a6ee68d46a3a2568ff45123a7add90fa8a192 (diff)
downloadvulkan-wsi-layer-2ad81d6b971ef0f2fc0c8c36289900f5f7bd7968.tar.gz
vulkan-wsi-layer-2ad81d6b971ef0f2fc0c8c36289900f5f7bd7968.tar.bz2
vulkan-wsi-layer-2ad81d6b971ef0f2fc0c8c36289900f5f7bd7968.zip
Fix a bug in queue submission
Fixes a bug in queue submission where the wrong amount of VkPipelineStageFlags were passed to vkQueueSubmit when the number of semaphores to wait on were more than 1. Change-Id: Ic66e0c6a5e4f60659a0fb31c64c565820d4708a8 Signed-off-by: Normunds Rieksts <normunds.rieksts@arm.com>
-rw-r--r--wsi/synchronization.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/wsi/synchronization.cpp b/wsi/synchronization.cpp
index 198ed35..99692bc 100644
--- a/wsi/synchronization.cpp
+++ b/wsi/synchronization.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2022 Arm Limited.
+ * Copyright (c) 2021-2023 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -31,6 +31,8 @@
#include "synchronization.hpp"
#include "layer/private_data.hpp"
+#include <algorithm>
+
namespace wsi
{
@@ -103,10 +105,25 @@ VkResult fence_sync::set_payload(VkQueue queue, const VkSemaphore *sem_payload,
* want to block any future Vulkan queue work on it. So, we pass in BOTTOM_OF_PIPE bit as the
* wait flag.
*/
- VkPipelineStageFlags pipeline_stage_flags = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
+ VkPipelineStageFlags pipeline_stage_flag = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
+ VkPipelineStageFlags *pipeline_stage_flag_data = &pipeline_stage_flag;
+
+ util::vector<VkPipelineStageFlags> pipeline_stage_flags_vector{ util::allocator(
+ dev->get_allocator(), VK_SYSTEM_ALLOCATION_SCOPE_COMMAND) };
+ /* Try to avoid memory allocation for single semaphore */
+ if (sem_count > 1)
+ {
+ if (!pipeline_stage_flags_vector.try_resize(sem_count))
+ {
+ return VK_ERROR_OUT_OF_HOST_MEMORY;
+ }
+ std::fill(pipeline_stage_flags_vector.begin(), pipeline_stage_flags_vector.end(),
+ VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT);
+ pipeline_stage_flag_data = pipeline_stage_flags_vector.data();
+ }
VkSubmitInfo submit_info = {
- VK_STRUCTURE_TYPE_SUBMIT_INFO, nullptr, sem_count, sem_payload, &pipeline_stage_flags, 0, nullptr, 0, nullptr
+ VK_STRUCTURE_TYPE_SUBMIT_INFO, nullptr, sem_count, sem_payload, pipeline_stage_flag_data, 0, nullptr, 0, nullptr
};
result = dev->disp.QueueSubmit(queue, 1, &submit_info, fence);