On 2026/08/25 19:20, Marc-André Lureau wrote:
Disable scanouts referencing a resource being unreferenced.
Fixes: 9d9e152136bd ("virtio-gpu: add 3d mode and virgl rendering support.")
Signed-off-by: Marc-André Lureau <[email protected]>
---
hw/display/virtio-gpu-virgl.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c
index e2ad27343da5..8b27fe3980d6 100644
--- a/hw/display/virtio-gpu-virgl.c
+++ b/hw/display/virtio-gpu-virgl.c
@@ -412,6 +412,7 @@ virtio_gpu_virgl_resource_unref(VirtIOGPU *g,
{
struct iovec *res_iovs = NULL;
int num_iovs = 0;
+ int i;
#if VIRGL_VERSION_MAJOR >= 1
int ret;
@@ -424,6 +425,12 @@ virtio_gpu_virgl_resource_unref(VirtIOGPU *g,
}
#endif
+ for (i = 0; i < g->parent_obj.conf.max_outputs; i++) {
+ if (g->parent_obj.scanout[i].resource_id == res->base.resource_id) {
+ virtio_gpu_disable_scanout(g, i);
This invokes synchronous frontend callbacks. GTK/EGL can finish with
EGL_NO_CONTEXT, while GLArea leaves its widget context current. The
function then calls virgl_renderer_resource_unref(), which directly
performs GL object deletion.
Please add virgl_renderer_force_ctx_0() after the complete disable loop,
before detach/unref. This guarantees a valid renderer context and
resynchronizes virglrenderer’s cached context state. Without it,
guest-triggered RESOURCE_UNREF can cause undefined GL calls or host
GPU-resource leakage.
Regards,
Akihiko Odaki
+ }
+ }
+
virgl_renderer_resource_detach_iov(res->base.resource_id,
&res_iovs,
&num_iovs);