vulkan: Drop implicit sync support
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

This gets rid of the internal wsi_memory_signal_submit_info structure
used to indicate implicit sync through vkQueueSubmit() as well as the
handling in vk_queue.c and vk_device::create_sync_for_memory.  Nothing
is using any of this anymore.

Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36783>
This commit is contained in:
Faith Ekstrand 2025-08-14 17:28:25 -04:00
parent 16520cfdf1
commit 1b2acf9006
5 changed files with 0 additions and 109 deletions

View file

@ -41,7 +41,6 @@ extern "C" {
struct vk_acceleration_structure_build_ops;
struct vk_command_buffer_ops;
struct vk_device_shader_ops;
struct vk_sync;
enum vk_queue_submit_mode {
/** Submits happen immediately
@ -218,29 +217,6 @@ struct vk_device {
/** Period of VK_TIME_DOMAIN_DEVICE_KHR */
uint64_t device_time_domain_period;
/** Creates a vk_sync that wraps a memory object
*
* This is always a one-shot object so it need not track any additional
* state. Since it's intended for synchronizing between processes using
* implicit synchronization mechanisms, no such tracking would be valid
* anyway.
*
* If `signal_memory` is set, the resulting vk_sync will be used to signal
* the memory object from a queue ``via vk_queue_submit::signals``. The common
* code guarantees that, by the time vkQueueSubmit() returns, the signal
* operation has been submitted to the kernel via the driver's
* ``vk_queue::driver_submit`` hook. This means that any vkQueueSubmit() call
* which needs implicit synchronization may block.
*
* If `signal_memory` is not set, it can be assumed that memory object
* already has a signal operation pending from some other process and we
* need only wait on it.
*/
VkResult (*create_sync_for_memory)(struct vk_device *device,
VkDeviceMemory memory,
bool signal_memory,
struct vk_sync **sync_out);
/* Set by vk_device_set_drm_fd() */
struct util_sync_provider *sync;

View file

@ -42,8 +42,6 @@
#include "vk_sync_timeline.h"
#include "vk_util.h"
#include "vulkan/wsi/wsi_common.h"
static VkResult
vk_queue_start_submit_thread(struct vk_queue *queue);
@ -204,9 +202,6 @@ vk_queue_submit_cleanup(struct vk_queue *queue,
vk_sync_destroy(queue->base.device, submit->_wait_temps[i]);
}
if (submit->_mem_signal_temp != NULL)
vk_sync_destroy(queue->base.device, submit->_mem_signal_temp);
if (submit->_wait_points != NULL) {
for (uint32_t i = 0; i < submit->wait_count; i++) {
if (unlikely(submit->_wait_points[i] != NULL)) {
@ -359,28 +354,6 @@ vk_queue_submit_add_sync_signal(struct vk_queue *queue,
};
}
static VkResult MUST_CHECK
vk_queue_submit_add_mem_signal(struct vk_queue *queue,
struct vk_queue_submit *submit,
VkDeviceMemory memory)
{
assert(submit->_mem_signal_temp == NULL);
VkResult result;
struct vk_sync *mem_sync;
result = queue->base.device->create_sync_for_memory(queue->base.device,
memory, true,
&mem_sync);
if (unlikely(result != VK_SUCCESS))
return result;
submit->_mem_signal_temp = mem_sync;
vk_queue_submit_add_sync_signal(queue, submit, mem_sync, 0);
return VK_SUCCESS;
}
static void
vk_queue_submit_add_fence_signal(struct vk_queue *queue,
struct vk_queue_submit *submit,
@ -483,9 +456,6 @@ vk_queue_submits_merge(struct vk_queue *queue,
if (vk_queue_submit_has_bind(first) != vk_queue_submit_has_bind(second))
return NULL;
if (first->_mem_signal_temp)
return NULL;
if (first->perf_pass_index != second->perf_pass_index)
return NULL;
@ -569,9 +539,6 @@ vk_queue_submits_merge(struct vk_queue *queue,
typed_memcpy(merged->_wait_temps, first->_wait_temps, first->wait_count);
typed_memcpy(&merged->_wait_temps[first->wait_count], second->_wait_temps, second->wait_count);
assert(first->_mem_signal_temp == NULL);
merged->_mem_signal_temp = second->_mem_signal_temp;
if (queue->base.device->timeline_mode == VK_DEVICE_TIMELINE_MODE_EMULATED) {
typed_memcpy(merged->_wait_points,
first->_wait_points, first->wait_count);
@ -951,14 +918,7 @@ vk_queue_submit_create(struct vk_queue *queue,
for (uint32_t i = 0; i < info->image_bind_count; ++i)
sparse_memory_image_bind_entry_count += info->image_binds[i].bindCount;
const struct wsi_memory_signal_submit_info *mem_signal =
vk_find_struct_const(info->pNext, WSI_MEMORY_SIGNAL_SUBMIT_INFO_MESA);
bool signal_mem_sync = mem_signal != NULL &&
mem_signal->memory != VK_NULL_HANDLE &&
queue->base.device->create_sync_for_memory != NULL;
uint32_t signal_count = info->signal_count +
signal_mem_sync +
(info->fence != NULL);
struct vk_queue_submit *submit =
@ -1008,13 +968,6 @@ vk_queue_submit_create(struct vk_queue *queue,
goto fail;
}
if (signal_mem_sync) {
result = vk_queue_submit_add_mem_signal(queue, submit,
mem_signal->memory);
if (unlikely(result != VK_SUCCESS))
goto fail;
}
if (info->fence != NULL)
vk_queue_submit_add_fence_signal(queue, submit, info->fence);
@ -1186,25 +1139,8 @@ vk_queue_submit(struct vk_queue *queue,
}
}
/* If we're signaling a memory object, we have to ensure that
* vkQueueSubmit does not return until the kernel submission has
* happened. Otherwise, we may get a race between this process
* and whatever is going to wait on the object where the other
* process may wait before we've submitted our work. Drain the
* queue now to avoid this. It's the responsibility of the caller
* to ensure that any vkQueueSubmit which signals a memory object
* has fully resolved dependencies.
*/
const bool needs_drain = submit->_mem_signal_temp;
vk_queue_push_submit(queue, submit);
if (needs_drain) {
result = vk_queue_drain(queue);
if (unlikely(result != VK_SUCCESS))
return result;
}
return VK_SUCCESS;
case VK_QUEUE_SUBMIT_MODE_THREADED_ON_DEMAND:

View file

@ -244,7 +244,6 @@ struct vk_queue_submit {
bool _has_binary_permanent_semaphore_wait;
struct vk_sync **_wait_temps;
struct vk_sync *_mem_signal_temp;
struct vk_sync_timeline_point **_wait_points;
struct vk_sync_timeline_point **_signal_points;
};

View file

@ -374,7 +374,6 @@ vk_common_QueueSubmit(
STACK_ARRAY(VkSubmitInfo2, submit_info_2, submitCount);
STACK_ARRAY(VkPerformanceQuerySubmitInfoKHR, perf_query_submit_info, submitCount);
STACK_ARRAY(struct wsi_memory_signal_submit_info, wsi_mem_submit_info, submitCount);
uint32_t n_wait_semaphores = 0;
uint32_t n_command_buffers = 0;
@ -491,15 +490,6 @@ vk_common_QueueSubmit(
__vk_append_struct(&submit_info_2[s], &perf_query_submit_info[s]);
}
const struct wsi_memory_signal_submit_info *mem_signal_info =
vk_find_struct_const(pSubmits[s].pNext,
WSI_MEMORY_SIGNAL_SUBMIT_INFO_MESA);
if (mem_signal_info) {
wsi_mem_submit_info[s] = *mem_signal_info;
wsi_mem_submit_info[s].pNext = NULL;
__vk_append_struct(&submit_info_2[s], &wsi_mem_submit_info[s]);
}
n_wait_semaphores += pSubmits[s].waitSemaphoreCount;
n_command_buffers += pSubmits[s].commandBufferCount;
n_signal_semaphores += pSubmits[s].signalSemaphoreCount;
@ -515,7 +505,6 @@ vk_common_QueueSubmit(
STACK_ARRAY_FINISH(signal_semaphores);
STACK_ARRAY_FINISH(submit_info_2);
STACK_ARRAY_FINISH(perf_query_submit_info);
STACK_ARRAY_FINISH(wsi_mem_submit_info);
return result;
}

View file

@ -50,12 +50,10 @@ extern const struct vk_device_entrypoint_table wsi_device_entrypoints;
#define VK_STRUCTURE_TYPE_WSI_IMAGE_CREATE_INFO_MESA (VkStructureType)1000001002
#define VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA (VkStructureType)1000001003
#define VK_STRUCTURE_TYPE_WSI_SURFACE_SUPPORTED_COUNTERS_MESA (VkStructureType)1000001005
#define VK_STRUCTURE_TYPE_WSI_MEMORY_SIGNAL_SUBMIT_INFO_MESA (VkStructureType)1000001006
#define VK_STRUCTURE_TYPE_WSI_IMAGE_CREATE_INFO_MESA_cast struct wsi_image_create_info
#define VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA_cast struct wsi_memory_allocate_info
#define VK_STRUCTURE_TYPE_WSI_SURFACE_SUPPORTED_COUNTERS_MESA_cast struct wsi_surface_supported_counters
#define VK_STRUCTURE_TYPE_WSI_MEMORY_SIGNAL_SUBMIT_INFO_MESA_cast struct wsi_memory_signal_submit_info
/* This is always chained to VkImageCreateInfo when a wsi image is created.
* It indicates that the image can be transitioned to/from
@ -85,13 +83,6 @@ struct wsi_surface_supported_counters {
};
/* To be chained into VkSubmitInfo */
struct wsi_memory_signal_submit_info {
VkStructureType sType;
const void *pNext;
VkDeviceMemory memory;
};
struct wsi_interface;
struct vk_instance;