diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2015-12-01 13:18:38 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2016-02-03 10:41:36 +0100 |
commit | 0c55a1cfd35c1f1b10cc448d05c1e4ef3a0768d1 (patch) | |
tree | f5fd764077da3b3d02870ea9eef706ffecd7ad30 | |
parent | 3eb769fd1cf15f16ca796ab5618efe89b23aa625 (diff) | |
download | qemu-0c55a1cfd35c1f1b10cc448d05c1e4ef3a0768d1.zip qemu-0c55a1cfd35c1f1b10cc448d05c1e4ef3a0768d1.tar.gz qemu-0c55a1cfd35c1f1b10cc448d05c1e4ef3a0768d1.tar.bz2 |
virtio-gpu: add support to enable/disable command processing
So we can stop rendering for a while in case we have to.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-rw-r--r-- | hw/display/virtio-gpu-3d.c | 3 | ||||
-rw-r--r-- | hw/display/virtio-gpu.c | 5 | ||||
-rw-r--r-- | include/hw/virtio/virtio-gpu.h | 2 |
3 files changed, 8 insertions, 2 deletions
diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c index e13122d..6f646b1 100644 --- a/hw/display/virtio-gpu-3d.c +++ b/hw/display/virtio-gpu-3d.c @@ -554,7 +554,8 @@ static void virtio_gpu_fence_poll(void *opaque) VirtIOGPU *g = opaque; virgl_renderer_poll(); - if (g->inflight) { + virtio_gpu_process_cmdq(g); + if (!QTAILQ_EMPTY(&g->cmdq) || !QTAILQ_EMPTY(&g->fenceq)) { timer_mod(g->fence_poll, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 10); } } diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index a2ec7cb..af9b757 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -755,7 +755,7 @@ static void virtio_gpu_handle_cursor_cb(VirtIODevice *vdev, VirtQueue *vq) qemu_bh_schedule(g->cursor_bh); } -static void virtio_gpu_process_cmdq(VirtIOGPU *g) +void virtio_gpu_process_cmdq(VirtIOGPU *g) { struct virtio_gpu_ctrl_command *cmd; @@ -765,6 +765,9 @@ static void virtio_gpu_process_cmdq(VirtIOGPU *g) /* process command */ VIRGL(g, virtio_gpu_virgl_process_cmd, virtio_gpu_simple_process_cmd, g, cmd); + if (cmd->waiting) { + break; + } QTAILQ_REMOVE(&g->cmdq, cmd, next); if (virtio_gpu_stats_enabled(g->conf)) { g->stats.requests++; diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index f7e7a52..f6cae0b 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -76,6 +76,7 @@ struct virtio_gpu_ctrl_command { VirtQueue *vq; struct virtio_gpu_ctrl_hdr cmd_hdr; uint32_t error; + bool waiting; bool finished; QTAILQ_ENTRY(virtio_gpu_ctrl_command) next; }; @@ -152,6 +153,7 @@ int virtio_gpu_create_mapping_iov(struct virtio_gpu_resource_attach_backing *ab, struct virtio_gpu_ctrl_command *cmd, struct iovec **iov); void virtio_gpu_cleanup_mapping_iov(struct iovec *iov, uint32_t count); +void virtio_gpu_process_cmdq(VirtIOGPU *g); /* virtio-gpu-3d.c */ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g, |