[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 16/18] virtio-gpu: use virgl thread sync with the da
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH 16/18] virtio-gpu: use virgl thread sync with the data-plane |
Date: |
Mon, 5 Sep 2016 02:20:37 +0400 |
Let's not use a timer but rather an additional thread to wait for sync.
Signed-off-by: Marc-André Lureau <address@hidden>
---
hw/display/virtio-gpu-3d.c | 22 +++++++++++++++++++---
hw/display/virtio-gpu.c | 2 +-
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
index 728c940..42e62a8 100644
--- a/hw/display/virtio-gpu-3d.c
+++ b/hw/display/virtio-gpu-3d.c
@@ -773,17 +773,33 @@ void virtio_gpu_virgl_dp_destroy(VirtIOGPU *g)
g_free(dp);
}
+static void render_poll_handler(void *opaque)
+{
+ virgl_renderer_poll();
+}
+
int virtio_gpu_virgl_init(VirtIOGPU *g)
{
int ret;
+ int flags = 0;
+
+ if (VIRTIO_GPU_DATA_PLANE_OK(g->dp)) {
+ flags |= VIRGL_RENDERER_THREAD_SYNC;
+ }
- ret = virgl_renderer_init(g, 0, &virtio_gpu_3d_cbs);
+ ret = virgl_renderer_init(g, flags, &virtio_gpu_3d_cbs);
if (ret != 0) {
return ret;
}
- g->fence_poll = timer_new_ms(QEMU_CLOCK_VIRTUAL,
- virtio_gpu_fence_poll, g);
+ if (VIRTIO_GPU_DATA_PLANE_OK(g->dp)) {
+ aio_set_fd_handler(iothread_get_aio_context(g->iothread),
+ virgl_renderer_get_poll_fd(),
+ false, render_poll_handler, NULL, g);
+ } else {
+ g->fence_poll = timer_new_ms(QEMU_CLOCK_VIRTUAL,
+ virtio_gpu_fence_poll, g);
+ }
if (virtio_gpu_stats_enabled(g->conf)) {
g->print_stats = timer_new_ms(QEMU_CLOCK_VIRTUAL,
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 34d4a92..45fc018 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -897,7 +897,7 @@ static void virtio_gpu_handle_ctrl(VirtIODevice *vdev,
VirtQueue *vq)
virtio_gpu_process_cmdq(g);
#ifdef CONFIG_VIRGL
- if (g->use_virgl_renderer) {
+ if (g->use_virgl_renderer && !VIRTIO_GPU_DATA_PLANE_OK(g->dp)) {
virtio_gpu_virgl_fence_poll(g);
}
#endif
--
2.9.0
- [Qemu-devel] [PATCH 05/18] virtio-gpu: start introducing a lock around the display info, (continued)
- [Qemu-devel] [PATCH 05/18] virtio-gpu: start introducing a lock around the display info, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 06/18] virtio-gpu: create a thread context, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 08/18] gl: bind GL api before context creation, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 07/18] gl: allow to keep current context in ctx-create, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 09/18] bitmap: add a simple foreach util, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 11/18] virtio-gpu: use a bh for cursor modifications, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 10/18] virtio-blk: use bitmap_foreach, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 12/18] virtio-gpu: save a pointer from virtio_gpu_ctrl_command, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 14/18] virtio-gpu: batch virtio_notify when using a data-plane, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 13/18] virtio-gpu: add a virgl data-plane, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 16/18] virtio-gpu: use virgl thread sync with the data-plane,
Marc-André Lureau <=
- [Qemu-devel] [PATCH 15/18] virtio-gpu: dispatch to main thread for scanout & flush, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 17/18] virtio-gpu: schedule a bh to unblock the data-plane, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 18/18] virtio-gpu: start/stop the data-plane, Marc-André Lureau, 2016/09/04
- Re: [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread, no-reply, 2016/09/04
- Re: [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread, no-reply, 2016/09/04
- Re: [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread, Gerd Hoffmann, 2016/09/08