Mesa (main): venus: renderer to store allow_vk_wait_syncs capset

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 16 19:06:12 UTC 2022


Module: Mesa
Branch: main
Commit: 9f9d543b12d1679cb4c3750407cbef8f72b93413
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9f9d543b12d1679cb4c3750407cbef8f72b93413

Author: Yiwei Zhang <zzyiwei at chromium.org>
Date:   Tue May 31 23:26:07 2022 +0000

venus: renderer to store allow_vk_wait_syncs capset

Signed-off-by: Yiwei Zhang <zzyiwei at chromium.org>
Reviewed-by: Ryan Neph <ryanneph at google.com>
Reviewed-by: Chad Versace <chadversary at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16731>

---

 src/virtio/virtio-gpu/venus_hw.h        | 11 ++++++++++-
 src/virtio/vulkan/vn_instance.c         |  2 ++
 src/virtio/vulkan/vn_renderer.h         |  1 +
 src/virtio/vulkan/vn_renderer_virtgpu.c |  2 ++
 src/virtio/vulkan/vn_renderer_vtest.c   |  2 ++
 5 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/virtio/virtio-gpu/venus_hw.h b/src/virtio/virtio-gpu/venus_hw.h
index 3b08cdf9d5d..23a34976505 100644
--- a/src/virtio/virtio-gpu/venus_hw.h
+++ b/src/virtio/virtio-gpu/venus_hw.h
@@ -33,7 +33,9 @@ struct virgl_renderer_capset_venus {
    uint32_t vk_ext_command_serialization_spec_version;
    uint32_t vk_mesa_venus_protocol_spec_version;
 
-   /* TODO revisit this when we bump up wire_format_version to 1 */
+   /* This flag indicates render server config, and will be needed until drm
+    * virtio-gpu blob mem gets fixed to attach_resource before resource_map.
+    */
    uint32_t supports_blob_id_0;
 
    /* Extension number N, where N is defined by the Vulkan spec, corresponds
@@ -45,6 +47,13 @@ struct virgl_renderer_capset_venus {
     * extensions are assumed to be supported by the renderer side protocol.
     */
    uint32_t vk_extension_mask1[32];
+
+   /* The single-threaded renderer cannot afford potential blocking calls. It
+    * also leads to GPU lost if the wait depends on a following command. This
+    * capset allows such blocking calls to passthrough from the clients, and
+    * shifts the responsibilities to the client drivers.
+    */
+   uint32_t allow_vk_wait_syncs;
 };
 #endif
 
diff --git a/src/virtio/vulkan/vn_instance.c b/src/virtio/vulkan/vn_instance.c
index 7b03ab34be3..994a2c5e1d5 100644
--- a/src/virtio/vulkan/vn_instance.c
+++ b/src/virtio/vulkan/vn_instance.c
@@ -293,6 +293,8 @@ vn_instance_init_renderer(struct vn_instance *instance)
              renderer_info->vk_mesa_venus_protocol_spec_version);
       vn_log(instance, "supports blob id 0: %d",
              renderer_info->supports_blob_id_0);
+      vn_log(instance, "allow_vk_wait_syncs: %d",
+             renderer_info->allow_vk_wait_syncs);
    }
 
    return VK_SUCCESS;
diff --git a/src/virtio/vulkan/vn_renderer.h b/src/virtio/vulkan/vn_renderer.h
index 97325e008ae..24abfc961ad 100644
--- a/src/virtio/vulkan/vn_renderer.h
+++ b/src/virtio/vulkan/vn_renderer.h
@@ -68,6 +68,7 @@ struct vn_renderer_info {
    uint32_t supports_blob_id_0;
    /* combined mask for vk_extension_mask1, 2,..., N */
    uint32_t vk_extension_mask[32];
+   uint32_t allow_vk_wait_syncs;
 };
 
 struct vn_renderer_submit_batch {
diff --git a/src/virtio/vulkan/vn_renderer_virtgpu.c b/src/virtio/vulkan/vn_renderer_virtgpu.c
index edbbc6d3487..5c7c82db12f 100644
--- a/src/virtio/vulkan/vn_renderer_virtgpu.c
+++ b/src/virtio/vulkan/vn_renderer_virtgpu.c
@@ -1415,6 +1415,8 @@ virtgpu_init_renderer_info(struct virtgpu *gpu)
    memcpy(info->vk_extension_mask, capset->vk_extension_mask1,
           sizeof(capset->vk_extension_mask1));
 
+   info->allow_vk_wait_syncs = capset->allow_vk_wait_syncs;
+
    if (gpu->bo_blob_mem == VIRTGPU_BLOB_MEM_GUEST_VRAM)
       info->has_guest_vram = true;
 }
diff --git a/src/virtio/vulkan/vn_renderer_vtest.c b/src/virtio/vulkan/vn_renderer_vtest.c
index 026b00b662f..dd20111887d 100644
--- a/src/virtio/vulkan/vn_renderer_vtest.c
+++ b/src/virtio/vulkan/vn_renderer_vtest.c
@@ -951,6 +951,8 @@ vtest_init_renderer_info(struct vtest *vtest)
                  sizeof(capset->vk_extension_mask1));
    memcpy(info->vk_extension_mask, capset->vk_extension_mask1,
           sizeof(capset->vk_extension_mask1));
+
+   info->allow_vk_wait_syncs = capset->allow_vk_wait_syncs;
 }
 
 static void



More information about the mesa-commit mailing list