[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 07/13] virtio-gpu: Support context-init feature with virglrenderer
From: |
Alex Bennée |
Subject: |
[PULL 07/13] virtio-gpu: Support context-init feature with virglrenderer |
Date: |
Tue, 29 Oct 2024 12:10:24 +0000 |
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>
Message-Id: <20241024210311.118220-8-dmitry.osipenko@collabora.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c
index 753b35ed69..bf87ba4232 100644
--- a/hw/display/virtio-gpu-gl.c
+++ b/hw/display/virtio-gpu-gl.c
@@ -147,6 +147,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);
+#if VIRGL_VERSION_MAJOR >= 1
+ 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 ca6f4d6cbb..b3aa444bcf 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;
+ }
+
+#if VIRGL_VERSION_MAJOR >= 1
+ 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,
--
2.39.5
- [PULL 00/13] virtio-gpu vulkan support, Alex Bennée, 2024/10/29
- [PULL 04/13] virtio-gpu: Handle virtio_gpu_virgl_init() failure, Alex Bennée, 2024/10/29
- [PULL 01/13] virtio-gpu: Use trace events for tracking number of in-flight fences, Alex Bennée, 2024/10/29
- [PULL 05/13] virtio-gpu: Unrealize GL device, Alex Bennée, 2024/10/29
- [PULL 02/13] virtio-gpu: Move fence_poll timer to VirtIOGPUGL, Alex Bennée, 2024/10/29
- [PULL 09/13] virtio-gpu: Add virgl resource management, Alex Bennée, 2024/10/29
- [PULL 07/13] virtio-gpu: Support context-init feature with virglrenderer,
Alex Bennée <=
- [PULL 10/13] virtio-gpu: Support suspension of commands processing, Alex Bennée, 2024/10/29
- [PULL 08/13] virtio-gpu: Don't require udmabuf when blobs and virgl are enabled, Alex Bennée, 2024/10/29
- [PULL 03/13] virtio-gpu: Move print_stats timer to VirtIOGPUGL, Alex Bennée, 2024/10/29
- [PULL 06/13] virtio-gpu: Use pkgconfig version to decide which virgl features are available, Alex Bennée, 2024/10/29
- [PULL 12/13] virtio-gpu: Register capsets dynamically, Alex Bennée, 2024/10/29
- [PULL 13/13] virtio-gpu: Support Venus context, Alex Bennée, 2024/10/29
- [PULL 11/13] virtio-gpu: Handle resource blob commands, Alex Bennée, 2024/10/29
- Re: [PULL 00/13] virtio-gpu vulkan support, Peter Maydell, 2024/10/31