venus: place wsi submissions on corresponding ring_idx

With implicit fencing, the image has a fence that blocks scanout until
rendering is complete. virtgpu doesn't support implicit fencing yet, but
Sommelier (a VM Wayland compositor) does the wait by exposing the bo as
a GEM handle and waiting on all fences in userspace with a
DRM_IOCTL_VIRTGPU_WAIT before issuing the wl_surface commit.
During vkQueueSubmit involving wsi images, we follow with an empty
renderer submission on the corresonding ring_idx to install a fence
on the appropriate virtgpu fence context after the last rendering
submission.

Signed-off-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19691>
This commit is contained in:
Ryan Neph 2022-08-22 16:32:14 -07:00 committed by Marge Bot
parent c957d08600
commit 2c1a7f877c

View file

@ -511,10 +511,16 @@ vn_QueueSubmit(VkQueue queue_h,
if (submit.wsi_mem) {
/* XXX this is always false and kills the performance */
if (dev->instance->renderer->info.has_implicit_fencing) {
vn_renderer_submit(dev->renderer, &(const struct vn_renderer_submit){
.bos = &submit.wsi_mem->base_bo,
.bo_count = 1,
});
vn_renderer_submit(dev->renderer,
&(const struct vn_renderer_submit){
.bos = &submit.wsi_mem->base_bo,
.bo_count = 1,
.batches =
&(struct vn_renderer_submit_batch){
.ring_idx = queue->ring_idx,
},
.batch_count = 1,
});
} else {
vn_queue_wait_idle_before_present(queue);
}
@ -683,10 +689,16 @@ vn_QueueSubmit2(VkQueue queue_h,
vn_device_memory_from_handle(wsi_info->memory);
assert(!wsi_mem->base_memory && wsi_mem->base_bo);
vn_renderer_submit(dev->renderer, &(const struct vn_renderer_submit){
.bos = &wsi_mem->base_bo,
.bo_count = 1,
});
vn_renderer_submit(dev->renderer,
&(const struct vn_renderer_submit){
.bos = &wsi_mem->base_bo,
.bo_count = 1,
.batches =
&(struct vn_renderer_submit_batch){
.ring_idx = queue->ring_idx,
},
.batch_count = 1,
});
} else {
vn_queue_wait_idle_before_present(queue);
}