aboutsummaryrefslogtreecommitdiff
path: root/hw/display/virtio-gpu-gl.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/display/virtio-gpu-gl.c')
-rw-r--r--hw/display/virtio-gpu-gl.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c
index b1035e119c..6cc4313b1a 100644
--- a/hw/display/virtio-gpu-gl.c
+++ b/hw/display/virtio-gpu-gl.c
@@ -51,12 +51,7 @@ static void virtio_gpu_gl_update_cursor_data(VirtIOGPU *g,
static void virtio_gpu_gl_flushed(VirtIOGPUBase *b)
{
VirtIOGPU *g = VIRTIO_GPU(b);
- VirtIOGPUGL *gl = VIRTIO_GPU_GL(b);
- if (gl->renderer_reset) {
- gl->renderer_reset = false;
- virtio_gpu_virgl_reset(g);
- }
virtio_gpu_process_cmdq(g);
}
@@ -74,6 +69,10 @@ static void virtio_gpu_gl_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
virtio_gpu_virgl_init(g);
gl->renderer_inited = true;
}
+ if (gl->renderer_reset) {
+ gl->renderer_reset = false;
+ virtio_gpu_virgl_reset(g);
+ }
cmd = virtqueue_pop(vq, sizeof(struct virtio_gpu_ctrl_command));
while (cmd) {
@@ -95,12 +94,13 @@ static void virtio_gpu_gl_reset(VirtIODevice *vdev)
virtio_gpu_reset(vdev);
- if (gl->renderer_inited) {
- if (g->parent_obj.renderer_blocked) {
- gl->renderer_reset = true;
- } else {
- virtio_gpu_virgl_reset(g);
- }
+ /*
+ * GL functions must be called with the associated GL context in main
+ * thread, and when the renderer is unblocked.
+ */
+ if (gl->renderer_inited && !gl->renderer_reset) {
+ virtio_gpu_virgl_reset_scanout(g);
+ gl->renderer_reset = true;
}
}