summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Lehmann <dadschoorse@gmail.com>2020-02-05 18:06:55 +0000
committerDylan Baker <dylan@pnwbakers.com>2020-02-07 09:20:49 -0800
commitee4a747ef880a24ce8871acbf88c22e646328212 (patch)
tree9227c6023edc406d3d81edb967688a12483295b6
parent632f18ea171c466745b49c34351a6b5bea9e569b (diff)
downloadmesa-ee4a747ef880a24ce8871acbf88c22e646328212.tar.gz
Correctly wait in the fragment stage until all semaphores are signaled
This fixes two issues: - a crash if the application uses more than one semaphore for presenting because the driver expects one stage per semaphore - the swapchain image could be not ready yet if the semaphores aren't signaled, #946 is possible related Cc: <mesa-stable@lists.freedesktop.org> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3718> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3718> (cherry picked from commit 1c79afd94620925cb9e0903f24f91c3ab9ecfcb4)
-rw-r--r--.pick_status.json2
-rw-r--r--src/vulkan/overlay-layer/overlay.cpp12
2 files changed, 11 insertions, 3 deletions
diff --git a/.pick_status.json b/.pick_status.json
index 8a5c6a2c99c..5fee7c2a919 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -247,7 +247,7 @@
"description": "Correctly wait in the fragment stage until all semaphores are signaled",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": null
},
diff --git a/src/vulkan/overlay-layer/overlay.cpp b/src/vulkan/overlay-layer/overlay.cpp
index 652478407e7..96150c0127c 100644
--- a/src/vulkan/overlay-layer/overlay.cpp
+++ b/src/vulkan/overlay-layer/overlay.cpp
@@ -1109,18 +1109,26 @@ static struct overlay_draw *render_swapchain_display(struct swapchain_data *data
device_data->vtable.EndCommandBuffer(draw->command_buffer);
+ VkPipelineStageFlags *stages_wait = (VkPipelineStageFlags*) malloc(sizeof(VkPipelineStageFlags) * n_wait_semaphores);
+ for (unsigned i = 0; i < n_wait_semaphores; i++)
+ {
+ // wait in the fragment stage until the swapchain image is ready
+ stages_wait[i] = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
+ }
+
VkSubmitInfo submit_info = {};
- VkPipelineStageFlags stage_wait = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
submit_info.commandBufferCount = 1;
submit_info.pCommandBuffers = &draw->command_buffer;
- submit_info.pWaitDstStageMask = &stage_wait;
+ submit_info.pWaitDstStageMask = stages_wait;
submit_info.waitSemaphoreCount = n_wait_semaphores;
submit_info.pWaitSemaphores = wait_semaphores;
submit_info.signalSemaphoreCount = 1;
submit_info.pSignalSemaphores = &draw->semaphore;
device_data->vtable.QueueSubmit(device_data->graphic_queue->queue, 1, &submit_info, draw->fence);
+
+ free(stages_wait);
return draw;
}