···159 COMP_TRACE_MARKER();
160 struct vk_bundle *vk = &r->c->base.vk;
161162- os_mutex_lock(&vk->queue_mutex);
163- vk->vkQueueWaitIdle(vk->main_queue.queue);
164- os_mutex_unlock(&vk->queue_mutex);
165}
166167static void
···665 * us avoid taking a lot of locks. The queue lock will be taken by
666 * @ref vk_cmd_submit_locked tho.
667 */
668- ret = vk_cmd_submit_locked(vk, &vk->main_queue, 1, &comp_submit_info, r->fences[r->acquired_buffer]);
669670 // We have now completed the submit, even if we failed.
671 comp_target_mark_submit_end(ct, frame_id, os_monotonic_get_ns());
···741 assert(!comp_frame_is_invalid_locked(&r->c->frame.rendering));
742 uint64_t render_complete_signal_value = (uint64_t)r->c->frame.rendering.id;
743744- ret = comp_target_present( //
745- r->c->target, //
746- r->c->base.vk.main_queue.queue, //
747- r->acquired_buffer, //
748- render_complete_signal_value, //
749- desired_present_time_ns, //
750- present_slop_ns); //
751 r->acquired_buffer = -1;
752753 if (ret == VK_ERROR_OUT_OF_DATE_KHR || ret == VK_SUBOPTIMAL_KHR) {
···159 COMP_TRACE_MARKER();
160 struct vk_bundle *vk = &r->c->base.vk;
161162+ vk_queue_lock(vk->main_queue);
163+ vk->vkQueueWaitIdle(vk->main_queue->queue);
164+ vk_queue_unlock(vk->main_queue);
165}
166167static void
···665 * us avoid taking a lot of locks. The queue lock will be taken by
666 * @ref vk_cmd_submit_locked tho.
667 */
668+ ret = vk_cmd_submit_locked(vk, vk->main_queue, 1, &comp_submit_info, r->fences[r->acquired_buffer]);
669670 // We have now completed the submit, even if we failed.
671 comp_target_mark_submit_end(ct, frame_id, os_monotonic_get_ns());
···741 assert(!comp_frame_is_invalid_locked(&r->c->frame.rendering));
742 uint64_t render_complete_signal_value = (uint64_t)r->c->frame.rendering.id;
743744+ ret = comp_target_present( //
745+ r->c->target, //
746+ r->c->base.vk.main_queue->queue, //
747+ r->acquired_buffer, //
748+ render_complete_signal_value, //
749+ desired_present_time_ns, //
750+ present_slop_ns); //
751 r->acquired_buffer = -1;
752753 if (ret == VK_ERROR_OUT_OF_DATE_KHR || ret == VK_SUBOPTIMAL_KHR) {
+3-3
src/xrt/compositor/main/comp_target_swapchain.c
···682 // Can we create swapchains from the surface on this device and queue.
683 ret = vk->vkGetPhysicalDeviceSurfaceSupportKHR( //
684 vk->physical_device, // physicalDevice
685- vk->main_queue.family_index, // queueFamilyIndex
686 cts->surface.handle, // surface
687 &supported); // pSupported
688 if (ret != VK_SUCCESS) {
···923924925 // Need to take the queue lock for present.
926- os_mutex_lock(&vk->queue_mutex);
927 VkResult ret = vk->vkQueuePresentKHR(queue, &present_info);
928- os_mutex_unlock(&vk->queue_mutex);
929930931#ifdef VK_EXT_display_control
···682 // Can we create swapchains from the surface on this device and queue.
683 ret = vk->vkGetPhysicalDeviceSurfaceSupportKHR( //
684 vk->physical_device, // physicalDevice
685+ vk->main_queue->family_index, // queueFamilyIndex
686 cts->surface.handle, // surface
687 &supported); // pSupported
688 if (ret != VK_SUCCESS) {
···923924925 // Need to take the queue lock for present.
926+ vk_queue_lock(vk->main_queue);
927 VkResult ret = vk->vkQueuePresentKHR(queue, &present_info);
928+ vk_queue_unlock(vk->main_queue);
929930931#ifdef VK_EXT_display_control
+6-6
src/xrt/compositor/main/comp_window_peek.c
···266267 struct vk_bundle *vk = get_vk(w);
268269- os_mutex_lock(&vk->queue_mutex);
270 vk->vkDeviceWaitIdle(vk->device);
271- os_mutex_unlock(&vk->queue_mutex);
272273 vk_cmd_pool_lock(&w->pool);
274 vk->vkFreeCommandBuffers(vk->device, w->pool.pool, 1, &w->cmd);
···434 };
435436 // Done writing commands, submit to queue.
437- ret = vk_cmd_submit_locked(vk, &vk->main_queue, 1, &submit, VK_NULL_HANDLE);
438439 // Done submitting commands, unlock pool.
440 vk_cmd_pool_unlock(&w->pool);
···456 .pResults = NULL,
457 };
458459- os_mutex_lock(&vk->queue_mutex);
460- ret = vk->vkQueuePresentKHR(vk->main_queue.queue, &present);
461- os_mutex_unlock(&vk->queue_mutex);
462463 if (ret != VK_SUCCESS) {
464 VK_ERROR(vk, "Error: could not present to queue.\n");
···266267 struct vk_bundle *vk = get_vk(w);
268269+ vk_queue_lock(vk->main_queue);
270 vk->vkDeviceWaitIdle(vk->device);
271+ vk_queue_unlock(vk->main_queue);
272273 vk_cmd_pool_lock(&w->pool);
274 vk->vkFreeCommandBuffers(vk->device, w->pool.pool, 1, &w->cmd);
···434 };
435436 // Done writing commands, submit to queue.
437+ ret = vk_cmd_submit_locked(vk, vk->main_queue, 1, &submit, VK_NULL_HANDLE);
438439 // Done submitting commands, unlock pool.
440 vk_cmd_pool_unlock(&w->pool);
···456 .pResults = NULL,
457 };
458459+ vk_queue_lock(vk->main_queue);
460+ ret = vk->vkQueuePresentKHR(vk->main_queue->queue, &present);
461+ vk_queue_unlock(vk->main_queue);
462463 if (ret != VK_SUCCESS) {
464 VK_ERROR(vk, "Error: could not present to queue.\n");
+2-2
src/xrt/compositor/render/render_resources.c
···595 VkCommandPoolCreateInfo command_pool_info = {
596 .sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
597 .flags = VK_COMMAND_POOL_CREATE_TRANSIENT_BIT,
598- .queueFamilyIndex = vk->main_queue.family_index,
599 };
600601 ret = vk->vkCreateCommandPool(vk->device, &command_pool_info, NULL, &r->cmd_pool);
···657 r->mock.color.image); // dst
658 VK_CHK_WITH_RET(ret, "prepare_mock_image_locked", false);
659660- ret = vk_cmd_end_submit_wait_and_free_cmd_buffer_locked(vk, &vk->main_queue, r->cmd_pool, cmd);
661 VK_CHK_WITH_RET(ret, "vk_cmd_end_submit_wait_and_free_cmd_buffer_locked", false);
662663 // No need to wait, submit waits on the fence.
···595 VkCommandPoolCreateInfo command_pool_info = {
596 .sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
597 .flags = VK_COMMAND_POOL_CREATE_TRANSIENT_BIT,
598+ .queueFamilyIndex = vk->main_queue->family_index,
599 };
600601 ret = vk->vkCreateCommandPool(vk->device, &command_pool_info, NULL, &r->cmd_pool);
···657 r->mock.color.image); // dst
658 VK_CHK_WITH_RET(ret, "prepare_mock_image_locked", false);
659660+ ret = vk_cmd_end_submit_wait_and_free_cmd_buffer_locked(vk, vk->main_queue, r->cmd_pool, cmd);
661 VK_CHK_WITH_RET(ret, "vk_cmd_end_submit_wait_and_free_cmd_buffer_locked", false);
662663 // No need to wait, submit waits on the fence.
+2-2
src/xrt/compositor/util/comp_swapchain.c
···283 * validation doesn't complain. This is done during image destruction so
284 * isn't time critical.
285 */
286- os_mutex_lock(&vk->queue_mutex);
287 vk->vkDeviceWaitIdle(vk->device);
288- os_mutex_unlock(&vk->queue_mutex);
289290 // The field array_size is shared, only reset once both are freed.
291 image_view_array_cleanup(vk, image->array_size, &image->views.alpha);
···283 * validation doesn't complain. This is done during image destruction so
284 * isn't time critical.
285 */
286+ vk_queue_lock(vk->main_queue);
287 vk->vkDeviceWaitIdle(vk->device);
288+ vk_queue_unlock(vk->main_queue);
289290 // The field array_size is shared, only reset once both are freed.
291 image_view_array_cleanup(vk, image->array_size, &image->views.alpha);