venus: prepare to flush async queue present

This is to ensure external synchronization for queue operations.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39283>
This commit is contained in:
Yiwei Zhang 2026-01-02 23:17:26 -08:00 committed by Marge Bot
parent f216c109be
commit 84e2623300
3 changed files with 22 additions and 0 deletions

View file

@ -23,6 +23,7 @@
#include "vn_physical_device.h"
#include "vn_query_pool.h"
#include "vn_renderer.h"
#include "vn_wsi.h"
/* queue commands */
@ -1083,6 +1084,7 @@ vn_QueueSubmit(VkQueue queue,
VN_TRACE_FUNC();
vn_tls_set_async_pipeline_create();
vn_wsi_flush(vn_queue_from_handle(queue));
struct vn_queue_submission submit = {
.batch_type = VK_STRUCTURE_TYPE_SUBMIT_INFO,
@ -1238,6 +1240,7 @@ vn_QueueSubmit2(VkQueue queue,
struct vn_device *dev = vn_device_from_vk(queue_vk->base.device);
vn_tls_set_async_pipeline_create();
vn_wsi_flush(vn_queue_from_handle(queue));
if (!dev->has_sync2) {
VN_TRACE_SCOPE("2->1");
@ -1447,6 +1450,8 @@ vn_QueueBindSparse(VkQueue queue,
VN_TRACE_FUNC();
VkResult result;
vn_wsi_flush(vn_queue_from_handle(queue));
struct vn_queue_submission submit = {
.batch_type = VK_STRUCTURE_TYPE_BIND_SPARSE_INFO,
.queue_handle = queue,
@ -1496,6 +1501,8 @@ vn_QueueWaitIdle(VkQueue _queue)
struct vn_device *dev = vn_device_from_handle(dev_handle);
VkResult result;
vn_wsi_flush(queue);
/* lazily create queue wait fence for queue idle waiting */
if (queue->wait_fence == VK_NULL_HANDLE) {
const VkFenceCreateInfo create_info = {

View file

@ -323,6 +323,12 @@ vn_wsi_sync_wait(struct vn_device *dev, int fd)
sync_wait(fd, -1);
}
void
vn_wsi_flush(struct vn_queue *queue)
{
/* TODO */
}
static VkPresentInfoKHR *
vn_wsi_clone_present_info(struct vn_device *dev, const VkPresentInfoKHR *pi)
{

View file

@ -38,6 +38,9 @@ vn_wsi_validate_image_format_info(
void
vn_wsi_sync_wait(struct vn_device *dev, int fd);
void
vn_wsi_flush(struct vn_queue *queue);
#else
static inline VkResult
@ -74,6 +77,12 @@ vn_wsi_sync_wait(struct vn_device *dev, int fd)
return;
}
static inline void
vn_wsi_flush(struct vn_queue *queue)
{
return;
}
#endif /* VN_USE_WSI_PLATFORM */
#endif /* VN_WSI_H */