[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 17/20] virtio-gpu: avoid re-entering cmdq processing
From: |
marcandre . lureau |
Subject: |
[PATCH v2 17/20] virtio-gpu: avoid re-entering cmdq processing |
Date: |
Thu, 4 Feb 2021 14:52:29 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
The next patch will notify the GL context got flush, which will resume
the queue processing. However, if this happens within the caller
context, it will end up with a stack overflow flush/update loop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
include/hw/virtio/virtio-gpu.h | 1 +
hw/display/virtio-gpu.c | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index 4f3dbf79f9..0043268e90 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -148,6 +148,7 @@ struct VirtIOGPU {
uint64_t hostmem;
+ bool processing_cmdq;
bool renderer_inited;
bool renderer_reset;
QEMUTimer *fence_poll;
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 0e833a462b..7eb4265a6d 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -814,6 +814,10 @@ void virtio_gpu_process_cmdq(VirtIOGPU *g)
{
struct virtio_gpu_ctrl_command *cmd;
+ if (g->processing_cmdq) {
+ return;
+ }
+ g->processing_cmdq = true;
while (!QTAILQ_EMPTY(&g->cmdq)) {
cmd = QTAILQ_FIRST(&g->cmdq);
@@ -843,6 +847,7 @@ void virtio_gpu_process_cmdq(VirtIOGPU *g)
g_free(cmd);
}
}
+ g->processing_cmdq = false;
}
static void virtio_gpu_gl_unblock(VirtIOGPUBase *b)
--
2.29.0
- [PATCH v2 07/20] ui: add gd_gl_area_scanout_disable, (continued)
- [PATCH v2 07/20] ui: add gd_gl_area_scanout_disable, marcandre . lureau, 2021/02/04
- [PATCH v2 08/20] ui: annotate DCLOps callback requirements, marcandre . lureau, 2021/02/04
- [PATCH v2 09/20] ui: remove console_has_gl_dmabuf(), marcandre . lureau, 2021/02/04
- [PATCH v2 10/20] vhost-user-gpu: add a configuration flag for dmabuf usage, marcandre . lureau, 2021/02/04
- [PATCH v2 11/20] ui: add an optional get_flags callback to GraphicHwOps, marcandre . lureau, 2021/02/04
- [PATCH v2 12/20] ui: add a DCLOps callback to check dmabuf support, marcandre . lureau, 2021/02/04
- [PATCH v2 13/20] ui: check hw requirements during DCL registration, marcandre . lureau, 2021/02/04
- [PATCH v2 14/20] ui: add qemu_egl_has_dmabuf helper, marcandre . lureau, 2021/02/04
- [PATCH v2 15/20] ui: check gtk-egl dmabuf support, marcandre . lureau, 2021/02/04
- [PATCH v2 16/20] ui: add egl dmabuf import to gtkglarea, marcandre . lureau, 2021/02/04
- [PATCH v2 17/20] virtio-gpu: avoid re-entering cmdq processing,
marcandre . lureau <=
- [PATCH v2 18/20] display/ui: add a callback to indicate GL state is flushed, marcandre . lureau, 2021/02/04
- [PATCH v2 19/20] chardev: check if the chardev is registered for yanking, marcandre . lureau, 2021/02/04
- [PATCH v2 20/20] tests: add some virtio-gpu & vhost-user-gpu acceptance test, marcandre . lureau, 2021/02/04