[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v13 06/13] virtio-gpu: Support context-init feature with virglren
From: |
Dmitry Osipenko |
Subject: |
[PATCH v13 06/13] virtio-gpu: Support context-init feature with virglrenderer |
Date: |
Mon, 27 May 2024 06:02:26 +0300 |
From: Huang Rui <ray.huang@amd.com>
Patch "virtio-gpu: CONTEXT_INIT feature" has added the context_init
feature flags. Expose this feature and support creating virglrenderer
context with flags using context_id if libvirglrenderer is new enough.
Originally-by: Antonio Caggiano <antonio.caggiano@collabora.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Antonio Caggiano <quic_acaggian@quicinc.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
---
hw/display/virtio-gpu-gl.c | 4 ++++
hw/display/virtio-gpu-virgl.c | 20 ++++++++++++++++++--
meson.build | 1 +
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c
index 7978b2985e17..9822d79c5e81 100644
--- a/hw/display/virtio-gpu-gl.c
+++ b/hw/display/virtio-gpu-gl.c
@@ -140,6 +140,10 @@ static void virtio_gpu_gl_device_realize(DeviceState
*qdev, Error **errp)
VIRTIO_GPU_BASE(g)->virtio_config.num_capsets =
virtio_gpu_virgl_get_num_capsets(g);
+#ifdef HAVE_VIRGL_CONTEXT_CREATE_WITH_FLAGS
+ g->parent_obj.conf.flags |= 1 << VIRTIO_GPU_FLAG_CONTEXT_INIT_ENABLED;
+#endif
+
virtio_gpu_device_realize(qdev, errp);
}
diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c
index 66c4aab9b283..4b2d4a643e30 100644
--- a/hw/display/virtio-gpu-virgl.c
+++ b/hw/display/virtio-gpu-virgl.c
@@ -106,8 +106,24 @@ static void virgl_cmd_context_create(VirtIOGPU *g,
trace_virtio_gpu_cmd_ctx_create(cc.hdr.ctx_id,
cc.debug_name);
- virgl_renderer_context_create(cc.hdr.ctx_id, cc.nlen,
- cc.debug_name);
+ if (cc.context_init) {
+ if (!virtio_gpu_context_init_enabled(g->parent_obj.conf)) {
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: context_init disabled",
+ __func__);
+ cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
+ return;
+ }
+
+#ifdef HAVE_VIRGL_CONTEXT_CREATE_WITH_FLAGS
+ virgl_renderer_context_create_with_flags(cc.hdr.ctx_id,
+ cc.context_init,
+ cc.nlen,
+ cc.debug_name);
+ return;
+#endif
+ }
+
+ virgl_renderer_context_create(cc.hdr.ctx_id, cc.nlen, cc.debug_name);
}
static void virgl_cmd_context_destroy(VirtIOGPU *g,
diff --git a/meson.build b/meson.build
index de97d2426bde..65fddfbbc3a7 100644
--- a/meson.build
+++ b/meson.build
@@ -2310,6 +2310,7 @@ config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
config_host_data.set('CONFIG_VNC_SASL', sasl.found())
if virgl.version().version_compare('>=1.0.0')
config_host_data.set('HAVE_VIRGL_D3D_INFO_EXT', 1)
+ config_host_data.set('HAVE_VIRGL_CONTEXT_CREATE_WITH_FLAGS', 1)
endif
config_host_data.set('CONFIG_VIRTFS', have_virtfs)
config_host_data.set('CONFIG_VTE', vte.found())
--
2.44.0
- [PATCH v13 00/13] Support blob memory and venus on qemu, Dmitry Osipenko, 2024/05/26
- [PATCH v13 01/13] virtio-gpu: Move fence_poll timer to VirtIOGPUGL, Dmitry Osipenko, 2024/05/26
- [PATCH v13 02/13] virtio-gpu: Move print_stats timer to VirtIOGPUGL, Dmitry Osipenko, 2024/05/26
- [PATCH v13 03/13] virtio-gpu: Handle virtio_gpu_virgl_init() failure, Dmitry Osipenko, 2024/05/26
- [PATCH v13 04/13] virtio-gpu: Unrealize GL device, Dmitry Osipenko, 2024/05/26
- [PATCH v13 05/13] virtio-gpu: Use pkgconfig version to decide which virgl features are available, Dmitry Osipenko, 2024/05/26
- [PATCH v13 06/13] virtio-gpu: Support context-init feature with virglrenderer,
Dmitry Osipenko <=
- [PATCH v13 07/13] virtio-gpu: Don't require udmabuf when blobs and virgl are enabled, Dmitry Osipenko, 2024/05/26
- [PATCH v13 08/13] virtio-gpu: Add virgl resource management, Dmitry Osipenko, 2024/05/26
- [PATCH v13 10/13] virtio-gpu: Support suspension of commands processing, Dmitry Osipenko, 2024/05/26
- [PATCH v13 09/13] virtio-gpu: Support blob scanout using dmabuf fd, Dmitry Osipenko, 2024/05/26
- [PATCH v13 11/13] virtio-gpu: Handle resource blob commands, Dmitry Osipenko, 2024/05/26
- [PATCH v13 12/13] virtio-gpu: Register capsets dynamically, Dmitry Osipenko, 2024/05/26
- [PATCH v13 13/13] virtio-gpu: Support Venus context, Dmitry Osipenko, 2024/05/26