All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread
@ 2016-09-04 22:20 Marc-André Lureau
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 01/18] console: skip same-size resize Marc-André Lureau
                   ` (20 more replies)
  0 siblings, 21 replies; 23+ messages in thread
From: Marc-André Lureau @ 2016-09-04 22:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: airlied, kraxel, Marc-André Lureau

Hi,

A while ago, Dave Airlie started implementing a seperate thread for
virgl (although it didn't work for me and was very much in wip
state). I fixed the code so I could test it, and moved it to use qemu
iothread/aio loops, inspired by the dataplane code in the virtio block
devices.

The benchmarks are quite encouraging, since I get from +-25% for
xonotic up to +-100% for glmark. (fwiw, vhost-user-gpu had similar
results too). Finally, I tried to make it acceptable for upstream.

Note that I only manage to get the rendering thread working with
spice/egl, for some reason the GL context creation fails with other
backends (even with gtk/egl, perhaps because having context surfaces
brings additional multi-threading limitations to opengl). I added a
dpy_gl_ctx_is_mt_safe() check for that reason.

Dave Airlie (2):
  virtio-gpu: start splitting scanout/resource flushing
  virtio-gpu: start introducing a lock around the display info

Marc-André Lureau (16):
  console: skip same-size resize
  console: add dpy_gl_ctx_is_mt_safe
  virtio-gpu: add "iothread" property
  virtio-gpu: create a thread context
  gl: allow to keep current context in ctx-create
  gl: bind GL api before context creation
  bitmap: add a simple foreach util
  virtio-blk: use bitmap_foreach
  virtio-gpu: use a bh for cursor modifications
  virtio-gpu: save a pointer from virtio_gpu_ctrl_command
  virtio-gpu: add a virgl data-plane
  virtio-gpu: batch virtio_notify when using a data-plane
  virtio-gpu: dispatch to main thread for scanout & flush
  virtio-gpu: use virgl thread sync with the data-plane
  virtio-gpu: schedule a bh to unblock the data-plane
  virtio-gpu: start/stop the data-plane

 hw/block/dataplane/virtio-blk.c |  29 ++---
 hw/display/virtio-gpu-3d.c      | 252 ++++++++++++++++++++++++++++++++++----
 hw/display/virtio-gpu-pci.c     |   2 +
 hw/display/virtio-gpu.c         | 261 ++++++++++++++++++++++++++++++++++++++--
 hw/display/virtio-vga.c         |  13 ++
 ui/console.c                    |  22 +++-
 ui/egl-context.c                |  27 +++--
 ui/gtk-egl.c                    |   9 +-
 ui/gtk-gl-area.c                |   3 +-
 ui/sdl2-gl.c                    |   7 +-
 ui/spice-display.c              |  11 +-
 include/hw/virtio/virtio-gpu.h  |  55 ++++++++-
 include/qemu/bitmap.h           |  23 ++++
 include/ui/console.h            |  11 +-
 include/ui/gtk.h                |   6 +-
 include/ui/sdl2.h               |   3 +-
 16 files changed, 652 insertions(+), 82 deletions(-)

-- 
2.9.0

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 01/18] console: skip same-size resize
  2016-09-04 22:20 [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread Marc-André Lureau
@ 2016-09-04 22:20 ` Marc-André Lureau
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 02/18] console: add dpy_gl_ctx_is_mt_safe Marc-André Lureau
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Marc-André Lureau @ 2016-09-04 22:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: airlied, kraxel, Marc-André Lureau

virtio-gpu does a set-scanout at each frame (it might be a driver
regression). qemu_console_resize() recreate a surface even if the size
didn't change, and this shows up in profiling reports because the
surface is cleared. With this patch, I get a +15-20% glmark2
improvement.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 ui/console.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/ui/console.c b/ui/console.c
index c24bfe4..2407b48 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -2100,6 +2100,13 @@ void qemu_console_resize(QemuConsole *s, int width, int height)
     DisplaySurface *surface;
 
     assert(s->console_type == GRAPHIC_CONSOLE);
+
+    if (s->surface &&
+        pixman_image_get_width(s->surface->image) == width &&
+        pixman_image_get_height(s->surface->image) == height) {
+        return;
+    }
+
     surface = qemu_create_displaysurface(width, height);
     dpy_gfx_replace_surface(s, surface);
 }
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 02/18] console: add dpy_gl_ctx_is_mt_safe
  2016-09-04 22:20 [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread Marc-André Lureau
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 01/18] console: skip same-size resize Marc-André Lureau
@ 2016-09-04 22:20 ` Marc-André Lureau
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 03/18] virtio-gpu: add "iothread" property Marc-André Lureau
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Marc-André Lureau @ 2016-09-04 22:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: airlied, kraxel, Marc-André Lureau

Not all display backends support various opengl contexts in
multi-threads. Add a field to declare it. For now, only spice/egl has
been tested successfully.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 ui/console.c         | 6 ++++++
 ui/spice-display.c   | 1 +
 include/ui/console.h | 3 ++-
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/ui/console.c b/ui/console.c
index 2407b48..52b204c 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1682,6 +1682,12 @@ bool dpy_cursor_define_supported(QemuConsole *con)
     return false;
 }
 
+bool dpy_gl_ctx_is_mt_safe(QemuConsole *con)
+{
+    assert(con->gl);
+    return con->gl->ops->dpy_gl_ctx_is_mt_safe;
+}
+
 QEMUGLContext dpy_gl_ctx_create(QemuConsole *con,
                                 struct QEMUGLParams *qparams)
 {
diff --git a/ui/spice-display.c b/ui/spice-display.c
index 99132b6..1c916dd 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -916,6 +916,7 @@ static const DisplayChangeListenerOps display_listener_gl_ops = {
     .dpy_gl_ctx_destroy      = qemu_egl_destroy_context,
     .dpy_gl_ctx_make_current = qemu_egl_make_context_current,
     .dpy_gl_ctx_get_current  = qemu_egl_get_current_context,
+    .dpy_gl_ctx_is_mt_safe   = true,
 
     .dpy_gl_scanout          = qemu_spice_gl_scanout,
     .dpy_gl_update           = qemu_spice_gl_update,
diff --git a/include/ui/console.h b/include/ui/console.h
index 2703a3a..2e7bb0e 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -221,7 +221,7 @@ typedef struct DisplayChangeListenerOps {
                            uint32_t x, uint32_t y, uint32_t w, uint32_t h);
     void (*dpy_gl_update)(DisplayChangeListener *dcl,
                           uint32_t x, uint32_t y, uint32_t w, uint32_t h);
-
+    bool dpy_gl_ctx_is_mt_safe; /* the ctx* functions are mt-safe */
 } DisplayChangeListenerOps;
 
 struct DisplayChangeListener {
@@ -296,6 +296,7 @@ QEMUGLContext dpy_gl_ctx_create(QemuConsole *con,
 void dpy_gl_ctx_destroy(QemuConsole *con, QEMUGLContext ctx);
 int dpy_gl_ctx_make_current(QemuConsole *con, QEMUGLContext ctx);
 QEMUGLContext dpy_gl_ctx_get_current(QemuConsole *con);
+bool dpy_gl_ctx_is_mt_safe(QemuConsole *con);
 
 bool console_has_gl(QemuConsole *con);
 
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 03/18] virtio-gpu: add "iothread" property
  2016-09-04 22:20 [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread Marc-André Lureau
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 01/18] console: skip same-size resize Marc-André Lureau
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 02/18] console: add dpy_gl_ctx_is_mt_safe Marc-André Lureau
@ 2016-09-04 22:20 ` Marc-André Lureau
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 04/18] virtio-gpu: start splitting scanout/resource flushing Marc-André Lureau
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Marc-André Lureau @ 2016-09-04 22:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: airlied, kraxel, Marc-André Lureau

For now, this just links the device with an iothread, but doesn't make
use of it yet. (the following commits will create context for it,
messages, and then dispatch virtio queues to run the renderer)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/display/virtio-gpu-pci.c    | 2 ++
 hw/display/virtio-gpu.c        | 6 ++++++
 hw/display/virtio-vga.c        | 2 ++
 include/hw/virtio/virtio-gpu.h | 4 ++++
 4 files changed, 14 insertions(+)

diff --git a/hw/display/virtio-gpu-pci.c b/hw/display/virtio-gpu-pci.c
index 34a724c..df583ed 100644
--- a/hw/display/virtio-gpu-pci.c
+++ b/hw/display/virtio-gpu-pci.c
@@ -58,6 +58,8 @@ static void virtio_gpu_initfn(Object *obj)
 
     virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
                                 TYPE_VIRTIO_GPU);
+    object_property_add_alias(obj, "iothread", OBJECT(&dev->vdev), "iothread",
+                              &error_abort);
 }
 
 static const TypeInfo virtio_gpu_pci_info = {
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 7fe6ed8..78b3453 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -1177,6 +1177,12 @@ static void virtio_gpu_device_unrealize(DeviceState *qdev, Error **errp)
 
 static void virtio_gpu_instance_init(Object *obj)
 {
+    VirtIOGPU *g = VIRTIO_GPU(obj);
+
+    object_property_add_link(obj, "iothread", TYPE_IOTHREAD,
+                             (Object **)&g->iothread,
+                             qdev_prop_allow_set_link_before_realize,
+                             OBJ_PROP_LINK_UNREF_ON_RELEASE, NULL);
 }
 
 static void virtio_gpu_reset(VirtIODevice *vdev)
diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c
index 5b510a1..5ba6daa 100644
--- a/hw/display/virtio-vga.c
+++ b/hw/display/virtio-vga.c
@@ -191,6 +191,8 @@ static void virtio_vga_inst_initfn(Object *obj)
 
     virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
                                 TYPE_VIRTIO_GPU);
+    object_property_add_alias(obj, "iothread", OBJECT(&dev->vdev), "iothread",
+                              &error_abort);
 }
 
 static TypeInfo virtio_vga_info = {
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index 20d1cd6..270aaf5 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -20,6 +20,7 @@
 #include "hw/virtio/virtio.h"
 #include "hw/pci/pci.h"
 #include "qemu/log.h"
+#include "sysemu/iothread.h"
 
 #include "standard-headers/linux/virtio_gpu.h"
 #define TYPE_VIRTIO_GPU "virtio-gpu-device"
@@ -109,6 +110,9 @@ typedef struct VirtIOGPU {
     bool use_virgl_renderer;
     bool renderer_inited;
     int renderer_blocked;
+
+    IOThread *iothread;
+
     QEMUTimer *fence_poll;
     QEMUTimer *print_stats;
 
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 04/18] virtio-gpu: start splitting scanout/resource flushing
  2016-09-04 22:20 [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread Marc-André Lureau
                   ` (2 preceding siblings ...)
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 03/18] virtio-gpu: add "iothread" property Marc-André Lureau
@ 2016-09-04 22:20 ` Marc-André Lureau
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 05/18] virtio-gpu: start introducing a lock around the display info Marc-André Lureau
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Marc-André Lureau @ 2016-09-04 22:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: airlied, kraxel, Marc-André Lureau

From: Dave Airlie <airlied@redhat.com>

This is preparatory work for introducing a thread.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/display/virtio-gpu-3d.c     | 68 +++++++++++++++++++++++++++++++-----------
 include/hw/virtio/virtio-gpu.h | 20 +++++++++++++
 2 files changed, 71 insertions(+), 17 deletions(-)

diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
index 758d33a..036d943 100644
--- a/hw/display/virtio-gpu-3d.c
+++ b/hw/display/virtio-gpu-3d.c
@@ -118,22 +118,59 @@ static void virtio_gpu_rect_update(VirtIOGPU *g, int idx, int x, int y,
     dpy_gl_update(g->scanout[idx].con, x, y, width, height);
 }
 
+static void virtio_gpu_do_resource_flush(VirtIOGPU *g,
+                                         struct virtio_gpu_thread_flush *fl)
+{
+    int i;
+
+    for (i = 0; i < fl->num_flushes; i++) {
+        virtio_gpu_rect_update(g, fl->idx[i],
+                               fl->r.x, fl->r.y,
+                               fl->r.width, fl->r.height);
+    }
+}
+
 static void virgl_cmd_resource_flush(VirtIOGPU *g,
                                      struct virtio_gpu_ctrl_command *cmd)
 {
     struct virtio_gpu_resource_flush rf;
+    struct virtio_gpu_thread_msg msg;
     int i;
 
     VIRTIO_GPU_FILL_CMD(rf);
     trace_virtio_gpu_cmd_res_flush(rf.resource_id,
                                    rf.r.width, rf.r.height, rf.r.x, rf.r.y);
 
+    msg.u.fl.r = rf.r;
+    msg.u.fl.num_flushes = 0;
     for (i = 0; i < g->conf.max_outputs; i++) {
         if (g->scanout[i].resource_id != rf.resource_id) {
             continue;
         }
-        virtio_gpu_rect_update(g, i, rf.r.x, rf.r.y, rf.r.width, rf.r.height);
+        msg.u.fl.idx[msg.u.fl.num_flushes++] = i;
+    }
+    virtio_gpu_do_resource_flush(g, &msg.u.fl);
+}
+
+static void virtio_gpu_do_set_scanout(VirtIOGPU *g,
+                                      struct virtio_gpu_set_scanout_info *info)
+
+{
+    if (info->tex_id) {
+        qemu_console_resize(g->scanout[info->idx].con,
+                            info->r.width, info->r.height);
+
+        dpy_gl_scanout(g->scanout[info->idx].con, info->tex_id,
+                       info->flags & 1 /* FIXME: Y_0_TOP */,
+                       info->width, info->height,
+                       info->r.x, info->r.y, info->r.width, info->r.height);
+    } else {
+        if (info->idx != 0)
+            dpy_gfx_replace_surface(g->scanout[info->idx].con, NULL);
+        dpy_gl_scanout(g->scanout[info->idx].con, 0, false,
+                       0, 0, 0, 0, 0, 0);
     }
+    g->scanout[info->idx].resource_id = info->resource_id;
 }
 
 static void virgl_cmd_set_scanout(VirtIOGPU *g,
@@ -141,7 +178,7 @@ static void virgl_cmd_set_scanout(VirtIOGPU *g,
 {
     struct virtio_gpu_set_scanout ss;
     struct virgl_renderer_resource_info info;
-    int ret;
+    struct virtio_gpu_thread_msg msg;
 
     VIRTIO_GPU_FILL_CMD(ss);
     trace_virtio_gpu_cmd_set_scanout(ss.scanout_id, ss.resource_id,
@@ -156,9 +193,13 @@ static void virgl_cmd_set_scanout(VirtIOGPU *g,
     g->enable = 1;
 
     memset(&info, 0, sizeof(info));
+    memset(&msg, 0, sizeof(msg));
 
+    msg.u.ss.r = ss.r;
+    msg.u.ss.idx = ss.scanout_id;
+    msg.u.ss.resource_id = ss.resource_id;
     if (ss.resource_id && ss.r.width && ss.r.height) {
-        ret = virgl_renderer_resource_get_info(ss.resource_id, &info);
+        int ret = virgl_renderer_resource_get_info(ss.resource_id, &info);
         if (ret == -1) {
             qemu_log_mask(LOG_GUEST_ERROR,
                           "%s: illegal resource specified %d\n",
@@ -166,21 +207,14 @@ static void virgl_cmd_set_scanout(VirtIOGPU *g,
             cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID;
             return;
         }
-        qemu_console_resize(g->scanout[ss.scanout_id].con,
-                            ss.r.width, ss.r.height);
-        virgl_renderer_force_ctx_0();
-        dpy_gl_scanout(g->scanout[ss.scanout_id].con, info.tex_id,
-                       info.flags & 1 /* FIXME: Y_0_TOP */,
-                       info.width, info.height,
-                       ss.r.x, ss.r.y, ss.r.width, ss.r.height);
-    } else {
-        if (ss.scanout_id != 0) {
-            dpy_gfx_replace_surface(g->scanout[ss.scanout_id].con, NULL);
-        }
-        dpy_gl_scanout(g->scanout[ss.scanout_id].con, 0, false,
-                       0, 0, 0, 0, 0, 0);
+
+        msg.u.ss.tex_id = info.tex_id;
+        msg.u.ss.width = info.width;
+        msg.u.ss.height = info.height;
+        msg.u.ss.flags = info.flags;
+        msg.u.ss.resource_id = ss.resource_id;
     }
-    g->scanout[ss.scanout_id].resource_id = ss.resource_id;
+    virtio_gpu_do_set_scanout(g, &msg.u.ss);
 }
 
 static void virgl_cmd_submit_3d(VirtIOGPU *g,
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index 270aaf5..85d554d 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -83,6 +83,26 @@ struct virtio_gpu_ctrl_command {
     QTAILQ_ENTRY(virtio_gpu_ctrl_command) next;
 };
 
+struct virtio_gpu_thread_msg {
+    uint32_t id;
+    union {
+        struct virtio_gpu_set_scanout_info {
+            struct virtio_gpu_rect r;
+            uint32_t idx;
+            uint32_t tex_id;
+            uint32_t flags;
+            uint32_t resource_id;
+            uint32_t width;
+            uint32_t height;
+        } ss;
+        struct virtio_gpu_thread_flush {
+            struct virtio_gpu_rect r;
+            int num_flushes;
+            uint32_t idx[VIRTIO_GPU_MAX_SCANOUTS];
+        } fl;
+    } u;
+};
+
 typedef struct VirtIOGPU {
     VirtIODevice parent_obj;
 
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 05/18] virtio-gpu: start introducing a lock around the display info
  2016-09-04 22:20 [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread Marc-André Lureau
                   ` (3 preceding siblings ...)
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 04/18] virtio-gpu: start splitting scanout/resource flushing Marc-André Lureau
@ 2016-09-04 22:20 ` Marc-André Lureau
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 06/18] virtio-gpu: create a thread context Marc-André Lureau
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Marc-André Lureau @ 2016-09-04 22:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: airlied, kraxel, Marc-André Lureau

From: Dave Airlie <airlied@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/display/virtio-gpu-3d.c     | 6 ++++++
 hw/display/virtio-gpu.c        | 8 ++++++++
 include/hw/virtio/virtio-gpu.h | 2 ++
 3 files changed, 16 insertions(+)

diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
index 036d943..6381e78 100644
--- a/hw/display/virtio-gpu-3d.c
+++ b/hw/display/virtio-gpu-3d.c
@@ -123,11 +123,13 @@ static void virtio_gpu_do_resource_flush(VirtIOGPU *g,
 {
     int i;
 
+    qemu_mutex_lock(&g->display_info_lock);
     for (i = 0; i < fl->num_flushes; i++) {
         virtio_gpu_rect_update(g, fl->idx[i],
                                fl->r.x, fl->r.y,
                                fl->r.width, fl->r.height);
     }
+    qemu_mutex_unlock(&g->display_info_lock);
 }
 
 static void virgl_cmd_resource_flush(VirtIOGPU *g,
@@ -141,6 +143,7 @@ static void virgl_cmd_resource_flush(VirtIOGPU *g,
     trace_virtio_gpu_cmd_res_flush(rf.resource_id,
                                    rf.r.width, rf.r.height, rf.r.x, rf.r.y);
 
+    qemu_mutex_lock(&g->display_info_lock);
     msg.u.fl.r = rf.r;
     msg.u.fl.num_flushes = 0;
     for (i = 0; i < g->conf.max_outputs; i++) {
@@ -149,6 +152,7 @@ static void virgl_cmd_resource_flush(VirtIOGPU *g,
         }
         msg.u.fl.idx[msg.u.fl.num_flushes++] = i;
     }
+    qemu_mutex_unlock(&g->display_info_lock);
     virtio_gpu_do_resource_flush(g, &msg.u.fl);
 }
 
@@ -156,6 +160,7 @@ static void virtio_gpu_do_set_scanout(VirtIOGPU *g,
                                       struct virtio_gpu_set_scanout_info *info)
 
 {
+    qemu_mutex_lock(&g->display_info_lock);
     if (info->tex_id) {
         qemu_console_resize(g->scanout[info->idx].con,
                             info->r.width, info->r.height);
@@ -171,6 +176,7 @@ static void virtio_gpu_do_set_scanout(VirtIOGPU *g,
                        0, 0, 0, 0, 0, 0);
     }
     g->scanout[info->idx].resource_id = info->resource_id;
+    qemu_mutex_unlock(&g->display_info_lock);
 }
 
 static void virgl_cmd_set_scanout(VirtIOGPU *g,
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 78b3453..157b9ba 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -102,6 +102,8 @@ static void update_cursor(VirtIOGPU *g, struct virtio_gpu_update_cursor *cursor)
     if (cursor->pos.scanout_id >= g->conf.max_outputs) {
         return;
     }
+
+    qemu_mutex_lock(&g->display_info_lock);
     s = &g->scanout[cursor->pos.scanout_id];
 
     trace_virtio_gpu_update_cursor(cursor->pos.scanout_id,
@@ -131,6 +133,7 @@ static void update_cursor(VirtIOGPU *g, struct virtio_gpu_update_cursor *cursor)
     }
     dpy_mouse_set(s->con, cursor->pos.x, cursor->pos.y,
                   cursor->resource_id ? 1 : 0);
+    qemu_mutex_unlock(&g->display_info_lock);
 }
 
 static void virtio_gpu_get_config(VirtIODevice *vdev, uint8_t *config)
@@ -230,6 +233,7 @@ virtio_gpu_fill_display_info(VirtIOGPU *g,
 {
     int i;
 
+    qemu_mutex_lock(&g->display_info_lock);
     for (i = 0; i < g->conf.max_outputs; i++) {
         if (g->enabled_output_bitmask & (1 << i)) {
             dpy_info->pmodes[i].enabled = 1;
@@ -237,6 +241,7 @@ virtio_gpu_fill_display_info(VirtIOGPU *g,
             dpy_info->pmodes[i].r.height = g->req_state[i].height;
         }
     }
+    qemu_mutex_unlock(&g->display_info_lock);
 }
 
 void virtio_gpu_get_display_info(VirtIOGPU *g,
@@ -915,6 +920,7 @@ static int virtio_gpu_ui_info(void *opaque, uint32_t idx, QemuUIInfo *info)
         return -1;
     }
 
+    qemu_mutex_lock(&g->display_info_lock);
     g->req_state[idx].x = info->xoff;
     g->req_state[idx].y = info->yoff;
     g->req_state[idx].width = info->width;
@@ -926,6 +932,7 @@ static int virtio_gpu_ui_info(void *opaque, uint32_t idx, QemuUIInfo *info)
         g->enabled_output_bitmask &= ~(1 << idx);
     }
 
+    qemu_mutex_unlock(&g->display_info_lock);
     /* send event to guest */
     virtio_gpu_notify_event(g, VIRTIO_GPU_EVENT_DISPLAY);
     return 0;
@@ -1149,6 +1156,7 @@ static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
     QTAILQ_INIT(&g->cmdq);
     QTAILQ_INIT(&g->fenceq);
 
+    qemu_mutex_init(&g->display_info_lock);
     g->enabled_output_bitmask = 1;
     g->qdev = qdev;
 
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index 85d554d..834ef4f 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -120,6 +120,8 @@ typedef struct VirtIOGPU {
     QTAILQ_HEAD(, virtio_gpu_ctrl_command) cmdq;
     QTAILQ_HEAD(, virtio_gpu_ctrl_command) fenceq;
 
+    /* lock protects scanout and req_state */
+    QemuMutex display_info_lock;
     struct virtio_gpu_scanout scanout[VIRTIO_GPU_MAX_SCANOUTS];
     struct virtio_gpu_requested_state req_state[VIRTIO_GPU_MAX_SCANOUTS];
 
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 06/18] virtio-gpu: create a thread context
  2016-09-04 22:20 [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread Marc-André Lureau
                   ` (4 preceding siblings ...)
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 05/18] virtio-gpu: start introducing a lock around the display info Marc-André Lureau
@ 2016-09-04 22:20 ` Marc-André Lureau
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 07/18] gl: allow to keep current context in ctx-create Marc-André Lureau
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Marc-André Lureau @ 2016-09-04 22:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: airlied, kraxel, Marc-André Lureau

Create a thread-specific opengl context for the renderer. This avoids
having to synchronize a single context between the rendering and display
threads.

The display must support calling gl_ctx* functions from a different
thread later on, return an error if it doesn't.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/display/virtio-gpu.c        | 19 +++++++++++++++++++
 hw/display/virtio-vga.c        | 11 +++++++++++
 ui/console.c                   |  4 ++++
 include/hw/virtio/virtio-gpu.h |  1 +
 include/ui/console.h           |  1 +
 5 files changed, 36 insertions(+)

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 157b9ba..a238090 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -954,12 +954,31 @@ static void virtio_gpu_gl_block(void *opaque, bool block)
     }
 }
 
+static void virtio_gpu_gl_register(DisplayChangeListener *dcl,
+                                   void *hw, Error **errp)
+{
+    VirtIOGPU *g = hw;
+    QEMUGLParams qparams = {
+        .major_ver = 2,
+    };
+
+    if (g->iothread && !dpy_gl_ctx_is_mt_safe(dcl->con)) {
+        error_setg(errp, "The display does not support a rendering thread");
+        return;
+    }
+
+    if (g->iothread && !g->thread_ctx) {
+        g->thread_ctx = dpy_gl_ctx_create(dcl->con, &qparams);
+    }
+}
+
 const GraphicHwOps virtio_gpu_ops = {
     .invalidate = virtio_gpu_invalidate_display,
     .gfx_update = virtio_gpu_update_display,
     .text_update = virtio_gpu_text_update,
     .ui_info = virtio_gpu_ui_info,
     .gl_block = virtio_gpu_gl_block,
+    .gl_register = virtio_gpu_gl_register,
 };
 
 static const VMStateDescription vmstate_virtio_gpu_scanout = {
diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c
index 5ba6daa..bf4048b 100644
--- a/hw/display/virtio-vga.c
+++ b/hw/display/virtio-vga.c
@@ -76,12 +76,23 @@ static void virtio_vga_gl_block(void *opaque, bool block)
     }
 }
 
+static void virtio_vga_gl_register(DisplayChangeListener *dcl,
+                                   void *hw, Error **errp)
+{
+    VirtIOVGA *vvga = hw;
+
+    if (virtio_gpu_ops.gl_register) {
+        virtio_gpu_ops.gl_register(dcl, &vvga->vdev, errp);
+    }
+}
+
 static const GraphicHwOps virtio_vga_ops = {
     .invalidate = virtio_vga_invalidate_display,
     .gfx_update = virtio_vga_update_display,
     .text_update = virtio_vga_text_update,
     .ui_info = virtio_vga_ui_info,
     .gl_block = virtio_vga_gl_block,
+    .gl_register = virtio_vga_gl_register,
 };
 
 static const VMStateDescription vmstate_virtio_vga = {
diff --git a/ui/console.c b/ui/console.c
index 52b204c..a2e410e 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1414,6 +1414,10 @@ void register_displaychangelistener(DisplayChangeListener *dcl)
         }
     }
     text_console_update_cursor(NULL);
+
+    if (con->hw_ops->gl_register) {
+        con->hw_ops->gl_register(dcl, con->hw, &error_fatal);
+    }
 }
 
 void update_displaychangelistener(DisplayChangeListener *dcl,
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index 834ef4f..406a4e8 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -134,6 +134,7 @@ typedef struct VirtIOGPU {
     int renderer_blocked;
 
     IOThread *iothread;
+    QEMUGLContext thread_ctx;
 
     QEMUTimer *fence_poll;
     QEMUTimer *print_stats;
diff --git a/include/ui/console.h b/include/ui/console.h
index 2e7bb0e..ed5975f 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -367,6 +367,7 @@ typedef struct GraphicHwOps {
     void (*update_interval)(void *opaque, uint64_t interval);
     int (*ui_info)(void *opaque, uint32_t head, QemuUIInfo *info);
     void (*gl_block)(void *opaque, bool block);
+    void (*gl_register)(DisplayChangeListener *dcl, void *hw, Error **errp);
 } GraphicHwOps;
 
 QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head,
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 07/18] gl: allow to keep current context in ctx-create
  2016-09-04 22:20 [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread Marc-André Lureau
                   ` (5 preceding siblings ...)
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 06/18] virtio-gpu: create a thread context Marc-André Lureau
@ 2016-09-04 22:20 ` Marc-André Lureau
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 08/18] gl: bind GL api before context creation Marc-André Lureau
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Marc-André Lureau @ 2016-09-04 22:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: airlied, kraxel, Marc-André Lureau

Each thread may have its own context (having the same context shared
with several threads is wrong).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/display/virtio-gpu-3d.c |  9 ++++++++-
 hw/display/virtio-gpu.c    |  2 +-
 ui/console.c               |  5 +++--
 ui/gtk-egl.c               |  9 ++++++---
 ui/gtk-gl-area.c           |  3 ++-
 ui/sdl2-gl.c               |  7 +++++--
 ui/spice-display.c         | 10 +++++++---
 include/ui/console.h       |  6 ++++--
 include/ui/gtk.h           |  6 ++++--
 include/ui/sdl2.h          |  3 ++-
 10 files changed, 42 insertions(+), 18 deletions(-)

diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
index 6381e78..8f068b5 100644
--- a/hw/display/virtio-gpu-3d.c
+++ b/hw/display/virtio-gpu-3d.c
@@ -543,11 +543,18 @@ virgl_create_context(void *opaque, int scanout_idx,
     VirtIOGPU *g = opaque;
     QEMUGLContext ctx;
     QEMUGLParams qparams;
+    bool make_current = true;
 
     qparams.major_ver = params->major_ver;
     qparams.minor_ver = params->minor_ver;
 
-    ctx = dpy_gl_ctx_create(g->scanout[scanout_idx].con, &qparams);
+    if (g->thread_ctx) {
+        dpy_gl_ctx_make_current(g->scanout[scanout_idx].con, g->thread_ctx);
+        make_current = false;
+    }
+
+    ctx = dpy_gl_ctx_create(g->scanout[scanout_idx].con,
+                            &qparams, make_current);
     return (virgl_renderer_gl_context)ctx;
 }
 
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index a238090..9a768c5 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -968,7 +968,7 @@ static void virtio_gpu_gl_register(DisplayChangeListener *dcl,
     }
 
     if (g->iothread && !g->thread_ctx) {
-        g->thread_ctx = dpy_gl_ctx_create(dcl->con, &qparams);
+        g->thread_ctx = dpy_gl_ctx_create(dcl->con, &qparams, true);
     }
 }
 
diff --git a/ui/console.c b/ui/console.c
index a2e410e..5174a3f 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1693,10 +1693,11 @@ bool dpy_gl_ctx_is_mt_safe(QemuConsole *con)
 }
 
 QEMUGLContext dpy_gl_ctx_create(QemuConsole *con,
-                                struct QEMUGLParams *qparams)
+                                struct QEMUGLParams *qparams,
+                                bool make_current)
 {
     assert(con->gl);
-    return con->gl->ops->dpy_gl_ctx_create(con->gl, qparams);
+    return con->gl->ops->dpy_gl_ctx_create(con->gl, qparams, make_current);
 }
 
 void dpy_gl_ctx_destroy(QemuConsole *con, QEMUGLContext ctx)
diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
index 3f5d328..5bc0ef4 100644
--- a/ui/gtk-egl.c
+++ b/ui/gtk-egl.c
@@ -161,12 +161,15 @@ void gd_egl_switch(DisplayChangeListener *dcl,
 }
 
 QEMUGLContext gd_egl_create_context(DisplayChangeListener *dcl,
-                                    QEMUGLParams *params)
+                                    QEMUGLParams *params,
+                                    bool make_current)
 {
     VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
 
-    eglMakeCurrent(qemu_egl_display, vc->gfx.esurface,
-                   vc->gfx.esurface, vc->gfx.ectx);
+    if (make_current) {
+        eglMakeCurrent(qemu_egl_display, vc->gfx.esurface,
+                       vc->gfx.esurface, vc->gfx.ectx);
+    }
     return qemu_egl_create_context(dcl, params);
 }
 
diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c
index 0df5a36..2eacd48 100644
--- a/ui/gtk-gl-area.c
+++ b/ui/gtk-gl-area.c
@@ -145,7 +145,8 @@ void gd_gl_area_switch(DisplayChangeListener *dcl,
 }
 
 QEMUGLContext gd_gl_area_create_context(DisplayChangeListener *dcl,
-                                        QEMUGLParams *params)
+                                        QEMUGLParams *params,
+                                        bool make_curent)
 {
     VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
     GdkWindow *window;
diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c
index 039645d..3a744be 100644
--- a/ui/sdl2-gl.c
+++ b/ui/sdl2-gl.c
@@ -139,14 +139,17 @@ void sdl2_gl_redraw(struct sdl2_console *scon)
 }
 
 QEMUGLContext sdl2_gl_create_context(DisplayChangeListener *dcl,
-                                     QEMUGLParams *params)
+                                     QEMUGLParams *params,
+                                     bool make_current)
 {
     struct sdl2_console *scon = container_of(dcl, struct sdl2_console, dcl);
     SDL_GLContext ctx;
 
     assert(scon->opengl);
 
-    SDL_GL_MakeCurrent(scon->real_window, scon->winctx);
+    if (make_current) {
+        SDL_GL_MakeCurrent(scon->real_window, scon->winctx);
+    }
 
     SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);
     SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK,
diff --git a/ui/spice-display.c b/ui/spice-display.c
index 1c916dd..15a322d 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -851,10 +851,14 @@ static void qemu_spice_gl_block_timer(void *opaque)
 }
 
 static QEMUGLContext qemu_spice_gl_create_context(DisplayChangeListener *dcl,
-                                                  QEMUGLParams *params)
+                                                  QEMUGLParams *params,
+                                                  bool make_current)
 {
-    eglMakeCurrent(qemu_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE,
-                   qemu_egl_rn_ctx);
+    if (make_current) {
+        eglMakeCurrent(qemu_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE,
+                       qemu_egl_rn_ctx);
+    }
+
     return qemu_egl_create_context(dcl, params);
 }
 
diff --git a/include/ui/console.h b/include/ui/console.h
index ed5975f..a1891b7 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -208,7 +208,8 @@ typedef struct DisplayChangeListenerOps {
                               QEMUCursor *cursor);
 
     QEMUGLContext (*dpy_gl_ctx_create)(DisplayChangeListener *dcl,
-                                       QEMUGLParams *params);
+                                       QEMUGLParams *params,
+                                       bool make_current);
     void (*dpy_gl_ctx_destroy)(DisplayChangeListener *dcl,
                                QEMUGLContext ctx);
     int (*dpy_gl_ctx_make_current)(DisplayChangeListener *dcl,
@@ -292,7 +293,8 @@ void dpy_gl_update(QemuConsole *con,
                    uint32_t x, uint32_t y, uint32_t w, uint32_t h);
 
 QEMUGLContext dpy_gl_ctx_create(QemuConsole *con,
-                                QEMUGLParams *params);
+                                QEMUGLParams *params,
+                                bool make_current);
 void dpy_gl_ctx_destroy(QemuConsole *con, QEMUGLContext ctx);
 int dpy_gl_ctx_make_current(QemuConsole *con, QEMUGLContext ctx);
 QEMUGLContext dpy_gl_ctx_get_current(QemuConsole *con);
diff --git a/include/ui/gtk.h b/include/ui/gtk.h
index 42ca0fe..c1240be 100644
--- a/include/ui/gtk.h
+++ b/include/ui/gtk.h
@@ -98,7 +98,8 @@ void gd_egl_refresh(DisplayChangeListener *dcl);
 void gd_egl_switch(DisplayChangeListener *dcl,
                    DisplaySurface *surface);
 QEMUGLContext gd_egl_create_context(DisplayChangeListener *dcl,
-                                    QEMUGLParams *params);
+                                    QEMUGLParams *params,
+                                    bool make_current);
 void gd_egl_scanout(DisplayChangeListener *dcl,
                     uint32_t backing_id, bool backing_y_0_top,
                     uint32_t backing_width, uint32_t backing_height,
@@ -119,7 +120,8 @@ void gd_gl_area_refresh(DisplayChangeListener *dcl);
 void gd_gl_area_switch(DisplayChangeListener *dcl,
                        DisplaySurface *surface);
 QEMUGLContext gd_gl_area_create_context(DisplayChangeListener *dcl,
-                                        QEMUGLParams *params);
+                                        QEMUGLParams *params,
+                                        bool make_current);
 void gd_gl_area_destroy_context(DisplayChangeListener *dcl,
                                 QEMUGLContext ctx);
 void gd_gl_area_scanout(DisplayChangeListener *dcl,
diff --git a/include/ui/sdl2.h b/include/ui/sdl2.h
index 683bb6a..64d1b25 100644
--- a/include/ui/sdl2.h
+++ b/include/ui/sdl2.h
@@ -56,7 +56,8 @@ void sdl2_gl_refresh(DisplayChangeListener *dcl);
 void sdl2_gl_redraw(struct sdl2_console *scon);
 
 QEMUGLContext sdl2_gl_create_context(DisplayChangeListener *dcl,
-                                     QEMUGLParams *params);
+                                     QEMUGLParams *params,
+                                     bool make_current);
 void sdl2_gl_destroy_context(DisplayChangeListener *dcl, QEMUGLContext ctx);
 int sdl2_gl_make_context_current(DisplayChangeListener *dcl,
                                  QEMUGLContext ctx);
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 08/18] gl: bind GL api before context creation
  2016-09-04 22:20 [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread Marc-André Lureau
                   ` (6 preceding siblings ...)
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 07/18] gl: allow to keep current context in ctx-create Marc-André Lureau
@ 2016-09-04 22:20 ` Marc-André Lureau
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 09/18] bitmap: add a simple foreach util Marc-André Lureau
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Marc-André Lureau @ 2016-09-04 22:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: airlied, kraxel, Marc-André Lureau

EGL API binding is per-thread. Make sure an API is bound when creating a
context, creating one from a new thread will not fail for missing API.

virgl requires opengl, and qemu has no complete gles support so far it
seems, so take it by default.

While at it, fix indentation to please check-patch.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/display/virtio-gpu-3d.c |  8 ++++----
 ui/egl-context.c           | 27 ++++++++++++++++-----------
 include/ui/console.h       |  1 +
 3 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
index 8f068b5..e7115bf 100644
--- a/hw/display/virtio-gpu-3d.c
+++ b/hw/display/virtio-gpu-3d.c
@@ -542,12 +542,12 @@ virgl_create_context(void *opaque, int scanout_idx,
 {
     VirtIOGPU *g = opaque;
     QEMUGLContext ctx;
-    QEMUGLParams qparams;
+    QEMUGLParams qparams = {
+        .major_ver = params->major_ver,
+        .minor_ver = params->minor_ver
+    };
     bool make_current = true;
 
-    qparams.major_ver = params->major_ver;
-    qparams.minor_ver = params->minor_ver;
-
     if (g->thread_ctx) {
         dpy_gl_ctx_make_current(g->scanout[scanout_idx].con, g->thread_ctx);
         make_current = false;
diff --git a/ui/egl-context.c b/ui/egl-context.c
index 3a02b68..70530fb 100644
--- a/ui/egl-context.c
+++ b/ui/egl-context.c
@@ -5,16 +5,21 @@
 QEMUGLContext qemu_egl_create_context(DisplayChangeListener *dcl,
                                       QEMUGLParams *params)
 {
-   EGLContext ctx;
-   EGLint ctx_att[] = {
-      EGL_CONTEXT_CLIENT_VERSION, params->major_ver,
-      EGL_CONTEXT_MINOR_VERSION_KHR, params->minor_ver,
-      EGL_NONE
-   };
+    EGLContext ctx;
+    EGLint ctx_att[] = {
+        EGL_CONTEXT_CLIENT_VERSION, params->major_ver,
+        EGL_CONTEXT_MINOR_VERSION_KHR, params->minor_ver,
+        EGL_NONE
+    };
+    EGLenum api = params->gles ? EGL_OPENGL_ES_API : EGL_OPENGL_API;
 
-   ctx = eglCreateContext(qemu_egl_display, qemu_egl_config,
-                          eglGetCurrentContext(), ctx_att);
-   return ctx;
+    if (!eglBindAPI(api)) {
+        return NULL;
+    }
+
+    ctx = eglCreateContext(qemu_egl_display, qemu_egl_config,
+                           eglGetCurrentContext(), ctx_att);
+    return ctx;
 }
 
 void qemu_egl_destroy_context(DisplayChangeListener *dcl, QEMUGLContext ctx)
@@ -25,8 +30,8 @@ void qemu_egl_destroy_context(DisplayChangeListener *dcl, QEMUGLContext ctx)
 int qemu_egl_make_context_current(DisplayChangeListener *dcl,
                                   QEMUGLContext ctx)
 {
-   return eglMakeCurrent(qemu_egl_display,
-                         EGL_NO_SURFACE, EGL_NO_SURFACE, ctx);
+    return eglMakeCurrent(qemu_egl_display,
+                          EGL_NO_SURFACE, EGL_NO_SURFACE, ctx);
 }
 
 QEMUGLContext qemu_egl_get_current_context(DisplayChangeListener *dcl)
diff --git a/include/ui/console.h b/include/ui/console.h
index a1891b7..a076b0f 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -178,6 +178,7 @@ typedef struct QEMUGLParams QEMUGLParams;
 struct QEMUGLParams {
     int major_ver;
     int minor_ver;
+    int gles;
 };
 
 typedef struct DisplayChangeListenerOps {
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 09/18] bitmap: add a simple foreach util
  2016-09-04 22:20 [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread Marc-André Lureau
                   ` (7 preceding siblings ...)
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 08/18] gl: bind GL api before context creation Marc-André Lureau
@ 2016-09-04 22:20 ` Marc-André Lureau
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 10/18] virtio-blk: use bitmap_foreach Marc-André Lureau
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Marc-André Lureau @ 2016-09-04 22:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: airlied, kraxel, Marc-André Lureau

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 include/qemu/bitmap.h | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/include/qemu/bitmap.h b/include/qemu/bitmap.h
index ec5146f..33bb294 100644
--- a/include/qemu/bitmap.h
+++ b/include/qemu/bitmap.h
@@ -223,6 +223,29 @@ static inline int bitmap_intersects(const unsigned long *src1,
     }
 }
 
+static inline void bitmap_foreach(unsigned long *bitmap, int size,
+                                  void (*cb)(int i, void *opaque),
+                                  void *opaque)
+{
+    unsigned long lbitmap[BITS_TO_LONGS(size)];
+    unsigned j;
+
+    memcpy(lbitmap, bitmap, sizeof(lbitmap));
+    memset(bitmap, 0, sizeof(lbitmap));
+
+    for (j = 0; j < size; j += BITS_PER_LONG) {
+        unsigned long bits = lbitmap[j];
+
+        while (bits != 0) {
+            unsigned i = j + ctzl(bits);
+
+            (*cb)(i, opaque);
+
+            bits &= bits - 1; /* clear right-most bit */
+        }
+    }
+}
+
 void bitmap_set(unsigned long *map, long i, long len);
 void bitmap_set_atomic(unsigned long *map, long i, long len);
 void bitmap_clear(unsigned long *map, long start, long nr);
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 10/18] virtio-blk: use bitmap_foreach
  2016-09-04 22:20 [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread Marc-André Lureau
                   ` (8 preceding siblings ...)
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 09/18] bitmap: add a simple foreach util Marc-André Lureau
@ 2016-09-04 22:20 ` Marc-André Lureau
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 11/18] virtio-gpu: use a bh for cursor modifications Marc-André Lureau
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Marc-André Lureau @ 2016-09-04 22:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: airlied, kraxel, Marc-André Lureau

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/block/dataplane/virtio-blk.c | 29 +++++++++++------------------
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
index 704a763..dce2675 100644
--- a/hw/block/dataplane/virtio-blk.c
+++ b/hw/block/dataplane/virtio-blk.c
@@ -51,30 +51,23 @@ void virtio_blk_data_plane_notify(VirtIOBlockDataPlane *s, VirtQueue *vq)
     qemu_bh_schedule(s->bh);
 }
 
-static void notify_guest_bh(void *opaque)
+static void notify_vq(int i, void *opaque)
 {
     VirtIOBlockDataPlane *s = opaque;
-    unsigned nvqs = s->conf->num_queues;
-    unsigned long bitmap[BITS_TO_LONGS(nvqs)];
-    unsigned j;
-
-    memcpy(bitmap, s->batch_notify_vqs, sizeof(bitmap));
-    memset(s->batch_notify_vqs, 0, sizeof(bitmap));
+    VirtQueue *vq = virtio_get_queue(s->vdev, i);
 
-    for (j = 0; j < nvqs; j += BITS_PER_LONG) {
-        unsigned long bits = bitmap[j];
+    if (virtio_should_notify(s->vdev, vq)) {
+        event_notifier_set(virtio_queue_get_guest_notifier(vq));
+    }
 
-        while (bits != 0) {
-            unsigned i = j + ctzl(bits);
-            VirtQueue *vq = virtio_get_queue(s->vdev, i);
+}
 
-            if (virtio_should_notify(s->vdev, vq)) {
-                event_notifier_set(virtio_queue_get_guest_notifier(vq));
-            }
+static void notify_guest_bh(void *opaque)
+{
+    VirtIOBlockDataPlane *s = opaque;
+    unsigned nvqs = s->conf->num_queues;
 
-            bits &= bits - 1; /* clear right-most bit */
-        }
-    }
+    bitmap_foreach(s->batch_notify_vqs, nvqs, notify_vq, s);
 }
 
 /* Context: QEMU global mutex held */
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 11/18] virtio-gpu: use a bh for cursor modifications
  2016-09-04 22:20 [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread Marc-André Lureau
                   ` (9 preceding siblings ...)
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 10/18] virtio-blk: use bitmap_foreach Marc-André Lureau
@ 2016-09-04 22:20 ` Marc-André Lureau
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 12/18] virtio-gpu: save a pointer from virtio_gpu_ctrl_command Marc-André Lureau
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Marc-André Lureau @ 2016-09-04 22:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: airlied, kraxel, Marc-André Lureau

This will allow to schedule the bh from the iothread, and with the
bitmaps, it will batch the cursors modifications.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/display/virtio-gpu.c        | 50 +++++++++++++++++++++++++++++++++++++++---
 include/hw/virtio/virtio-gpu.h |  3 +++
 2 files changed, 50 insertions(+), 3 deletions(-)

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 9a768c5..ff33d83 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -94,6 +94,37 @@ static void update_cursor_data_virgl(VirtIOGPU *g,
 
 #endif
 
+/* called with display_info_lock */
+static void scanout_set_cursor(int i, void *opaque)
+{
+    VirtIOGPU *g = opaque;
+    struct virtio_gpu_scanout *s = &g->scanout[i];
+
+    dpy_mouse_set(s->con, s->cursor.pos.x, s->cursor.pos.y,
+                  s->cursor.resource_id ? 1 : 0);
+}
+
+/* called with display_info_lock */
+static void scanout_define_cursor(int i, void *opaque)
+{
+    VirtIOGPU *g = opaque;
+    struct virtio_gpu_scanout *s = &g->scanout[i];
+
+    dpy_cursor_define(s->con, s->current_cursor);
+}
+
+static void virtio_gpu_update_cursor_bh(void *opaque)
+{
+    VirtIOGPU *g = opaque;
+
+    qemu_mutex_lock(&g->display_info_lock);
+    bitmap_foreach(g->define_cursor_bitmap, g->conf.max_outputs,
+                   scanout_define_cursor, g);
+    bitmap_foreach(g->set_cursor_bitmap, g->conf.max_outputs,
+                   scanout_set_cursor, g);
+    qemu_mutex_unlock(&g->display_info_lock);
+}
+
 static void update_cursor(VirtIOGPU *g, struct virtio_gpu_update_cursor *cursor)
 {
     struct virtio_gpu_scanout *s;
@@ -124,15 +155,19 @@ static void update_cursor(VirtIOGPU *g, struct virtio_gpu_update_cursor *cursor)
             VIRGL(g, update_cursor_data_virgl, update_cursor_data_simple,
                   g, s, cursor->resource_id);
         }
-        dpy_cursor_define(s->con, s->current_cursor);
 
         s->cursor = *cursor;
+
+        set_bit(cursor->pos.scanout_id, g->define_cursor_bitmap);
     } else {
         s->cursor.pos.x = cursor->pos.x;
         s->cursor.pos.y = cursor->pos.y;
+        s->cursor.resource_id = cursor->resource_id;
     }
-    dpy_mouse_set(s->con, cursor->pos.x, cursor->pos.y,
-                  cursor->resource_id ? 1 : 0);
+
+    set_bit(cursor->pos.scanout_id, g->set_cursor_bitmap);
+    qemu_bh_schedule(g->update_cursor_bh);
+
     qemu_mutex_unlock(&g->display_info_lock);
 }
 
@@ -1171,6 +1206,10 @@ static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
 
     g->ctrl_bh = qemu_bh_new(virtio_gpu_ctrl_bh, g);
     g->cursor_bh = qemu_bh_new(virtio_gpu_cursor_bh, g);
+    g->update_cursor_bh = qemu_bh_new(virtio_gpu_update_cursor_bh, g);
+    g->set_cursor_bitmap = bitmap_new(g->conf.max_outputs);
+    g->define_cursor_bitmap = bitmap_new(g->conf.max_outputs);
+
     QTAILQ_INIT(&g->reslist);
     QTAILQ_INIT(&g->cmdq);
     QTAILQ_INIT(&g->fenceq);
@@ -1196,6 +1235,11 @@ static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
 static void virtio_gpu_device_unrealize(DeviceState *qdev, Error **errp)
 {
     VirtIOGPU *g = VIRTIO_GPU(qdev);
+
+    qemu_bh_delete(g->update_cursor_bh);
+    g_free(g->set_cursor_bitmap);
+    g_free(g->define_cursor_bitmap);
+
     if (g->migration_blocker) {
         migrate_del_blocker(g->migration_blocker);
         error_free(g->migration_blocker);
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index 406a4e8..8bddc93 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -108,8 +108,11 @@ typedef struct VirtIOGPU {
 
     QEMUBH *ctrl_bh;
     QEMUBH *cursor_bh;
+    QEMUBH *update_cursor_bh;
     VirtQueue *ctrl_vq;
     VirtQueue *cursor_vq;
+    unsigned long *define_cursor_bitmap;
+    unsigned long *set_cursor_bitmap;
 
     int enable;
 
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 12/18] virtio-gpu: save a pointer from virtio_gpu_ctrl_command
  2016-09-04 22:20 [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread Marc-André Lureau
                   ` (10 preceding siblings ...)
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 11/18] virtio-gpu: use a bh for cursor modifications Marc-André Lureau
@ 2016-09-04 22:20 ` Marc-André Lureau
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 13/18] virtio-gpu: add a virgl data-plane Marc-André Lureau
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Marc-André Lureau @ 2016-09-04 22:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: airlied, kraxel, Marc-André Lureau

There is no much point in storing the vq when it can be accessed easily.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/display/virtio-gpu.c        | 7 ++++---
 include/hw/virtio/virtio-gpu.h | 1 -
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index ff33d83..5fca1e7 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -233,6 +233,8 @@ void virtio_gpu_ctrl_response(VirtIOGPU *g,
                               struct virtio_gpu_ctrl_hdr *resp,
                               size_t resp_len)
 {
+    VirtIODevice *vdev = VIRTIO_DEVICE(g);
+    VirtQueue *vq = virtio_get_queue(vdev, 0);
     size_t s;
 
     if (cmd->cmd_hdr.flags & VIRTIO_GPU_FLAG_FENCE) {
@@ -246,8 +248,8 @@ void virtio_gpu_ctrl_response(VirtIOGPU *g,
                       "%s: response size incorrect %zu vs %zu\n",
                       __func__, s, resp_len);
     }
-    virtqueue_push(cmd->vq, &cmd->elem, s);
-    virtio_notify(VIRTIO_DEVICE(g), cmd->vq);
+    virtqueue_push(vq, &cmd->elem, s);
+    virtio_notify(VIRTIO_DEVICE(g), vq);
     cmd->finished = true;
 }
 
@@ -875,7 +877,6 @@ static void virtio_gpu_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
 
     cmd = virtqueue_pop(vq, sizeof(struct virtio_gpu_ctrl_command));
     while (cmd) {
-        cmd->vq = vq;
         cmd->error = 0;
         cmd->finished = false;
         cmd->waiting = false;
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index 8bddc93..d8f9b12 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -75,7 +75,6 @@ struct virtio_gpu_conf {
 
 struct virtio_gpu_ctrl_command {
     VirtQueueElement elem;
-    VirtQueue *vq;
     struct virtio_gpu_ctrl_hdr cmd_hdr;
     uint32_t error;
     bool waiting;
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 13/18] virtio-gpu: add a virgl data-plane
  2016-09-04 22:20 [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread Marc-André Lureau
                   ` (11 preceding siblings ...)
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 12/18] virtio-gpu: save a pointer from virtio_gpu_ctrl_command Marc-André Lureau
@ 2016-09-04 22:20 ` Marc-André Lureau
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 14/18] virtio-gpu: batch virtio_notify when using a data-plane Marc-André Lureau
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Marc-André Lureau @ 2016-09-04 22:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: airlied, kraxel, Marc-André Lureau

Add a thread "data-plane" structure and callback functions. This is
inspired by virtio-blk data-plane.

The following commits will use and start the data-plane.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/display/virtio-gpu-3d.c     | 103 +++++++++++++++++++++++++++++++++++++++++
 hw/display/virtio-gpu.c        |  13 ++++++
 include/hw/virtio/virtio-gpu.h |  23 +++++++++
 3 files changed, 139 insertions(+)

diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
index e7115bf..6dd44d6 100644
--- a/hw/display/virtio-gpu-3d.c
+++ b/hw/display/virtio-gpu-3d.c
@@ -16,6 +16,7 @@
 #include "qemu/iov.h"
 #include "trace.h"
 #include "hw/virtio/virtio.h"
+#include "hw/virtio/virtio-bus.h"
 #include "hw/virtio/virtio-gpu.h"
 #include "qapi/error.h"
 
@@ -632,6 +633,108 @@ void virtio_gpu_virgl_reset(VirtIOGPU *g)
     }
 }
 
+static void virtio_gpu_from_thread_read(EventNotifier *n)
+{
+    VirtIOGPUDataPlane *dp = container_of(n, VirtIOGPUDataPlane,
+                                          thread_to_qemu);
+    VirtIOGPU *g = dp->gpu;
+    struct virtio_gpu_thread_msg *qmsg;
+
+    event_notifier_test_and_clear(n);
+
+    qemu_mutex_lock(&dp->thread_msg_lock);
+    qmsg = &dp->thread_msg;
+    qemu_mutex_unlock(&dp->thread_msg_lock);
+
+    switch (qmsg->id) {
+    case VIRTIO_GPU_CMD_SET_SCANOUT:
+        virtio_gpu_do_set_scanout(g, &qmsg->u.ss);
+        break;
+    case VIRTIO_GPU_CMD_RESOURCE_FLUSH:
+        virtio_gpu_do_resource_flush(g, &qmsg->u.fl);
+        break;
+    default:
+        fprintf(stderr, "unknown msg received %d\n", qmsg->id);
+    }
+    event_notifier_set(&dp->qemu_to_thread_ack);
+}
+
+static void notify_guest_vq(int i, void *opaque)
+{
+    VirtIOGPU *g = opaque;
+    VirtIODevice *vdev = VIRTIO_DEVICE(g);
+    VirtQueue *vq = virtio_get_queue(vdev, i);
+
+    if (virtio_should_notify(vdev, vq)) {
+        event_notifier_set(virtio_queue_get_guest_notifier(vq));
+    }
+}
+
+static void notify_guest_bh(void *opaque)
+{
+    VirtIOGPUDataPlane *dp = opaque;
+    VirtIOGPU *g = dp->gpu;
+
+    bitmap_foreach(dp->batch_notify_vqs, 2, notify_guest_vq, g);
+}
+
+static void thread_process_bh(void *opaque)
+{
+    VirtIOGPU *g = opaque;
+
+    virtio_gpu_process_cmdq(g);
+}
+
+int virtio_gpu_virgl_dp_create(VirtIOGPU *g, Error **errp)
+{
+    VirtIODevice *vdev = VIRTIO_DEVICE(g);
+    BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));
+    VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
+    VirtIOGPUDataPlane *dp;
+    AioContext *ctx;
+
+    /* Don't try if transport does not support notifiers. */
+    if (!k->set_guest_notifiers || !k->ioeventfd_started) {
+        error_setg(errp,
+                   "device is incompatible with dataplane "
+                   "(transport does not support notifiers)");
+        return -1;
+    }
+
+    dp = g_new0(VirtIOGPUDataPlane, 1);
+    qemu_mutex_init(&dp->thread_msg_lock);
+    ctx = iothread_get_aio_context(g->iothread);
+    dp->thread_process_bh = aio_bh_new(ctx, thread_process_bh, g);
+    dp->notify_guest_bh = aio_bh_new(ctx, notify_guest_bh, dp);
+    dp->batch_notify_vqs = bitmap_new(2);
+
+    event_notifier_init(&dp->thread_to_qemu, 0);
+    event_notifier_init(&dp->qemu_to_thread_ack, 0);
+
+    event_notifier_set_handler(&dp->thread_to_qemu, true,
+                               virtio_gpu_from_thread_read);
+    dp->gpu = g;
+    g->dp = dp;
+
+    return 0;
+}
+
+void virtio_gpu_virgl_dp_destroy(VirtIOGPU *g)
+{
+    VirtIOGPUDataPlane *dp = g->dp;
+
+    if (!dp) {
+        return;
+    }
+
+    g_free(dp->batch_notify_vqs);
+    qemu_bh_delete(dp->notify_guest_bh);
+    qemu_bh_delete(dp->thread_process_bh);
+    event_notifier_cleanup(&dp->thread_to_qemu);
+    event_notifier_cleanup(&dp->qemu_to_thread_ack);
+    g_free(dp);
+}
+
 int virtio_gpu_virgl_init(VirtIOGPU *g)
 {
     int ret;
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 5fca1e7..816f37c 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -1200,6 +1200,16 @@ static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
         g->ctrl_vq   = virtio_add_queue(vdev, 256, virtio_gpu_handle_ctrl_cb);
         g->cursor_vq = virtio_add_queue(vdev, 16, virtio_gpu_handle_cursor_cb);
         g->virtio_config.num_capsets = 1;
+#if defined(CONFIG_VIRGL)
+        {
+            Error *err = NULL;
+            if (g->iothread && virtio_gpu_virgl_dp_create(g, &err) != 0) {
+                error_propagate(errp, err);
+                virtio_cleanup(vdev);
+                return;
+            }
+        }
+#endif
     } else {
         g->ctrl_vq   = virtio_add_queue(vdev, 64, virtio_gpu_handle_ctrl_cb);
         g->cursor_vq = virtio_add_queue(vdev, 16, virtio_gpu_handle_cursor_cb);
@@ -1237,6 +1247,9 @@ static void virtio_gpu_device_unrealize(DeviceState *qdev, Error **errp)
 {
     VirtIOGPU *g = VIRTIO_GPU(qdev);
 
+#if defined(CONFIG_VIRGL)
+    virtio_gpu_virgl_dp_destroy(g);
+#endif
     qemu_bh_delete(g->update_cursor_bh);
     g_free(g->set_cursor_bitmap);
     g_free(g->define_cursor_bitmap);
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index d8f9b12..82d1e45 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -102,6 +102,26 @@ struct virtio_gpu_thread_msg {
     } u;
 };
 
+typedef struct VirtIOGPU VirtIOGPU;
+
+typedef struct VirtIOGPUDataPlane {
+    VirtIOGPU *gpu;
+    bool starting;
+    bool started;
+    bool disabled;
+    bool stopping;
+    QEMUBH *notify_guest_bh;
+    unsigned long *batch_notify_vqs;
+    QEMUBH *thread_process_bh;
+
+    EventNotifier thread_to_qemu;
+    EventNotifier qemu_to_thread_ack;
+    struct virtio_gpu_thread_msg thread_msg;
+    QemuMutex thread_msg_lock;
+} VirtIOGPUDataPlane;
+
+#define VIRTIO_GPU_DATA_PLANE_OK(dp) ((dp) && (dp)->started && !(dp)->disabled)
+
 typedef struct VirtIOGPU {
     VirtIODevice parent_obj;
 
@@ -137,6 +157,7 @@ typedef struct VirtIOGPU {
 
     IOThread *iothread;
     QEMUGLContext thread_ctx;
+    VirtIOGPUDataPlane *dp;
 
     QEMUTimer *fence_poll;
     QEMUTimer *print_stats;
@@ -194,5 +215,7 @@ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g,
 void virtio_gpu_virgl_fence_poll(VirtIOGPU *g);
 void virtio_gpu_virgl_reset(VirtIOGPU *g);
 int virtio_gpu_virgl_init(VirtIOGPU *g);
+int virtio_gpu_virgl_dp_create(VirtIOGPU *g, Error **errp);
+void virtio_gpu_virgl_dp_destroy(VirtIOGPU *g);
 
 #endif
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 14/18] virtio-gpu: batch virtio_notify when using a data-plane
  2016-09-04 22:20 [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread Marc-André Lureau
                   ` (12 preceding siblings ...)
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 13/18] virtio-gpu: add a virgl data-plane Marc-André Lureau
@ 2016-09-04 22:20 ` Marc-André Lureau
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 15/18] virtio-gpu: dispatch to main thread for scanout & flush Marc-André Lureau
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Marc-André Lureau @ 2016-09-04 22:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: airlied, kraxel, Marc-André Lureau

Use a helper to call virtio notify. If the dataplane is running,
set the notify bit and schedule the bh.

(note: this could eventually be good in non-dataplane too)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/display/virtio-gpu.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 816f37c..34d4a92 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -228,6 +228,16 @@ virtio_gpu_find_resource(VirtIOGPU *g, uint32_t resource_id)
     return NULL;
 }
 
+static void virtio_gpu_notify_vq(VirtIOGPU *g, VirtQueue *vq)
+{
+    if (VIRTIO_GPU_DATA_PLANE_OK(g->dp)) {
+        set_bit(virtio_get_queue_index(vq), g->dp->batch_notify_vqs);
+        qemu_bh_schedule(g->dp->notify_guest_bh);
+    } else {
+        virtio_notify(VIRTIO_DEVICE(g), vq);
+    }
+}
+
 void virtio_gpu_ctrl_response(VirtIOGPU *g,
                               struct virtio_gpu_ctrl_command *cmd,
                               struct virtio_gpu_ctrl_hdr *resp,
@@ -249,7 +259,7 @@ void virtio_gpu_ctrl_response(VirtIOGPU *g,
                       __func__, s, resp_len);
     }
     virtqueue_push(vq, &cmd->elem, s);
-    virtio_notify(VIRTIO_DEVICE(g), vq);
+    virtio_gpu_notify_vq(g, vq);
     cmd->finished = true;
 }
 
@@ -925,7 +935,7 @@ static void virtio_gpu_handle_cursor(VirtIODevice *vdev, VirtQueue *vq)
             update_cursor(g, &cursor_info);
         }
         virtqueue_push(vq, elem, 0);
-        virtio_notify(vdev, vq);
+        virtio_gpu_notify_vq(g, vq);
         g_free(elem);
     }
 }
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 15/18] virtio-gpu: dispatch to main thread for scanout & flush
  2016-09-04 22:20 [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread Marc-André Lureau
                   ` (13 preceding siblings ...)
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 14/18] virtio-gpu: batch virtio_notify when using a data-plane Marc-André Lureau
@ 2016-09-04 22:20 ` Marc-André Lureau
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 16/18] virtio-gpu: use virgl thread sync with the data-plane Marc-André Lureau
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Marc-André Lureau @ 2016-09-04 22:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: airlied, kraxel, Marc-André Lureau

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/display/virtio-gpu-3d.c | 44 +++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 41 insertions(+), 3 deletions(-)

diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
index 6dd44d6..728c940 100644
--- a/hw/display/virtio-gpu-3d.c
+++ b/hw/display/virtio-gpu-3d.c
@@ -19,6 +19,7 @@
 #include "hw/virtio/virtio-bus.h"
 #include "hw/virtio/virtio-gpu.h"
 #include "qapi/error.h"
+#include "ui/egl-context.h"
 
 #ifdef CONFIG_VIRGL
 
@@ -26,6 +27,32 @@
 
 static struct virgl_renderer_callbacks virtio_gpu_3d_cbs;
 
+static void event_notifier_wait(EventNotifier *e)
+{
+    int fd = event_notifier_get_fd(e);
+    fd_set rfds;
+    int max_fd = fd + 1;
+
+    FD_ZERO(&rfds);
+    FD_SET(fd, &rfds);
+    select(max_fd, &rfds, NULL, NULL, NULL);
+
+    event_notifier_test_and_clear(e);
+}
+
+static void virtio_gpu_write_msg(VirtIOGPU *g,
+                                 struct virtio_gpu_thread_msg *msg)
+{
+    VirtIOGPUDataPlane *dp = g->dp;
+
+    qemu_mutex_lock(&dp->thread_msg_lock);
+    dp->thread_msg = *msg;
+    qemu_mutex_unlock(&dp->thread_msg_lock);
+
+    event_notifier_set(&dp->thread_to_qemu);
+    event_notifier_wait(&dp->qemu_to_thread_ack);
+}
+
 static void virgl_cmd_create_resource_2d(VirtIOGPU *g,
                                          struct virtio_gpu_ctrl_command *cmd)
 {
@@ -154,7 +181,13 @@ static void virgl_cmd_resource_flush(VirtIOGPU *g,
         msg.u.fl.idx[msg.u.fl.num_flushes++] = i;
     }
     qemu_mutex_unlock(&g->display_info_lock);
-    virtio_gpu_do_resource_flush(g, &msg.u.fl);
+
+    if (VIRTIO_GPU_DATA_PLANE_OK(g->dp)) {
+        msg.id = VIRTIO_GPU_CMD_RESOURCE_FLUSH;
+        virtio_gpu_write_msg(g, &msg);
+    } else {
+        virtio_gpu_do_resource_flush(g, &msg.u.fl);
+    }
 }
 
 static void virtio_gpu_do_set_scanout(VirtIOGPU *g,
@@ -214,14 +247,19 @@ static void virgl_cmd_set_scanout(VirtIOGPU *g,
             cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID;
             return;
         }
-
         msg.u.ss.tex_id = info.tex_id;
         msg.u.ss.width = info.width;
         msg.u.ss.height = info.height;
         msg.u.ss.flags = info.flags;
         msg.u.ss.resource_id = ss.resource_id;
     }
-    virtio_gpu_do_set_scanout(g, &msg.u.ss);
+
+    if (VIRTIO_GPU_DATA_PLANE_OK(g->dp)) {
+        msg.id = VIRTIO_GPU_CMD_SET_SCANOUT;
+        virtio_gpu_write_msg(g, &msg);
+    } else {
+        virtio_gpu_do_set_scanout(g, &msg.u.ss);
+    }
 }
 
 static void virgl_cmd_submit_3d(VirtIOGPU *g,
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 16/18] virtio-gpu: use virgl thread sync with the data-plane
  2016-09-04 22:20 [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread Marc-André Lureau
                   ` (14 preceding siblings ...)
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 15/18] virtio-gpu: dispatch to main thread for scanout & flush Marc-André Lureau
@ 2016-09-04 22:20 ` Marc-André Lureau
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 17/18] virtio-gpu: schedule a bh to unblock " Marc-André Lureau
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Marc-André Lureau @ 2016-09-04 22:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: airlied, kraxel, Marc-André Lureau

Let's not use a timer but rather an additional thread to wait for sync.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 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

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 17/18] virtio-gpu: schedule a bh to unblock the data-plane
  2016-09-04 22:20 [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread Marc-André Lureau
                   ` (15 preceding siblings ...)
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 16/18] virtio-gpu: use virgl thread sync with the data-plane Marc-André Lureau
@ 2016-09-04 22:20 ` Marc-André Lureau
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 18/18] virtio-gpu: start/stop " Marc-André Lureau
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Marc-André Lureau @ 2016-09-04 22:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: airlied, kraxel, Marc-André Lureau

If the virtqueues is waiting to be processed, make sure to wake it up.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/display/virtio-gpu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 45fc018..a37d5f2 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -996,7 +996,11 @@ static void virtio_gpu_gl_block(void *opaque, bool block)
     assert(g->renderer_blocked >= 0);
 
     if (g->renderer_blocked == 0) {
-        virtio_gpu_process_cmdq(g);
+        if (VIRTIO_GPU_DATA_PLANE_OK(g->dp)) {
+            qemu_bh_schedule(g->dp->thread_process_bh);
+        } else {
+            virtio_gpu_process_cmdq(g);
+        }
     }
 }
 
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 18/18] virtio-gpu: start/stop the data-plane
  2016-09-04 22:20 [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread Marc-André Lureau
                   ` (16 preceding siblings ...)
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 17/18] virtio-gpu: schedule a bh to unblock " Marc-André Lureau
@ 2016-09-04 22:20 ` Marc-André Lureau
  2016-09-04 22:46 ` [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread no-reply
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Marc-André Lureau @ 2016-09-04 22:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: airlied, kraxel, Marc-André Lureau

Use aio thread context to dispatch the queues.

This code has been written based on virtio-blk data-plane setup.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/display/virtio-gpu.c        | 138 ++++++++++++++++++++++++++++++++++++++++-
 include/hw/virtio/virtio-gpu.h |   1 +
 2 files changed, 137 insertions(+), 2 deletions(-)

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index a37d5f2..c732607 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -22,12 +22,18 @@
 #include "migration/migration.h"
 #include "qemu/log.h"
 #include "qapi/error.h"
+#include "ui/egl-context.h"
 
 #define VIRTIO_GPU_VM_VERSION 1
 
 static struct virtio_gpu_simple_resource*
 virtio_gpu_find_resource(VirtIOGPU *g, uint32_t resource_id);
 
+static void
+virtio_gpu_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq);
+static void
+virtio_gpu_handle_cursor(VirtIODevice *vdev, VirtQueue *vq);
+
 #ifdef CONFIG_VIRGL
 #include <virglrenderer.h>
 #define VIRGL(_g, _virgl, _simple, ...)                     \
@@ -824,9 +830,129 @@ static void virtio_gpu_simple_process_cmd(VirtIOGPU *g,
     }
 }
 
+static void data_plane_handle_ctrl_cb(VirtIODevice *vdev, VirtQueue *q)
+{
+    VirtIOGPU *g = VIRTIO_GPU(vdev);
+    virtio_gpu_handle_ctrl(&g->parent_obj, q);
+}
+
+static void data_plane_handle_cursor_cb(VirtIODevice *vdev, VirtQueue *q)
+{
+    VirtIOGPU *g = VIRTIO_GPU(vdev);
+    virtio_gpu_handle_cursor(&g->parent_obj, q);
+}
+
+static void virtio_gpu_data_plane_start(VirtIODevice *vdev)
+{
+    VirtIOGPU *g = VIRTIO_GPU(vdev);
+    VirtIOGPUDataPlane *dp = g->dp;
+    BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));
+    VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
+    int i, r;
+
+    if (dp->started || dp->starting) {
+        return;
+    }
+
+    dp->starting = true;
+
+    /* Set up guest notifier (irq) */
+    r = k->set_guest_notifiers(qbus->parent, 2, true);
+    if (r != 0) {
+        fprintf(stderr, "virtio-gpu failed to set guest notifier (%d), "
+                "ensure -enable-kvm is set\n", r);
+        goto fail_guest_notifiers;
+    }
+
+    /* Set up virtqueue notify */
+    for (i = 0; i < 2; i++) {
+        r = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, true);
+        if (r != 0) {
+            fprintf(stderr, "virtio-gpu failed to set host notifier (%d)\n", r);
+            while (i--) {
+                virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false);
+            }
+            goto fail_guest_notifiers;
+        }
+    }
+
+    dp->starting = false;
+    dp->started = true;
+
+    /* Kick right away to begin processing requests already in vring */
+    for (i = 0; i < 2; i++) {
+        VirtQueue *vq = virtio_get_queue(vdev, i);
+
+        event_notifier_set(virtio_queue_get_host_notifier(vq));
+    }
+
+    AioContext *ctx = iothread_get_aio_context(g->iothread);
+    /* Get this show started by hooking up our callbacks */
+    aio_context_acquire(ctx);
+    virtio_queue_aio_set_host_notifier_handler(virtio_get_queue(vdev, 0), ctx,
+                                               data_plane_handle_ctrl_cb);
+    virtio_queue_aio_set_host_notifier_handler(virtio_get_queue(vdev, 1), ctx,
+                                               data_plane_handle_cursor_cb);
+    aio_context_release(ctx);
+    return;
+
+fail_guest_notifiers:
+    dp->disabled = true;
+    dp->starting = false;
+    dp->started = true;
+}
+
+void virtio_gpu_data_plane_stop(VirtIOGPUDataPlane *dp)
+{
+    VirtIOGPU *g = dp->gpu;
+    BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(g)));
+    VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
+    AioContext *ctx = iothread_get_aio_context(g->iothread);
+    unsigned i;
+
+    if (!dp->started || dp->stopping) {
+        return;
+    }
+
+    if (dp->disabled) {
+        dp->disabled = false;
+        dp->started = false;
+        return;
+    }
+    dp->stopping = true;
+
+    /* Get this show started by hooking up our callbacks */
+    aio_context_acquire(ctx);
+    /* Stop notifications for new requests from guest */
+    for (i = 0; i < 2; i++) {
+        VirtQueue *vq = virtio_get_queue(VIRTIO_DEVICE(g), i);
+
+        virtio_queue_aio_set_host_notifier_handler(vq, ctx, NULL);
+    }
+    aio_context_release(ctx);
+
+    for (i = 0; i < 2; i++) {
+        virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false);
+    }
+
+    /* Clean up guest notifier (irq) */
+    k->set_guest_notifiers(qbus->parent, 2, false);
+
+    dp->started = false;
+    dp->stopping = false;
+}
+
 static void virtio_gpu_handle_ctrl_cb(VirtIODevice *vdev, VirtQueue *vq)
 {
     VirtIOGPU *g = VIRTIO_GPU(vdev);
+
+    if (g->dp) {
+        virtio_gpu_data_plane_start(vdev);
+        if (!g->dp->disabled) {
+            return;
+        }
+    }
+
     qemu_bh_schedule(g->ctrl_bh);
 }
 
@@ -1210,9 +1336,13 @@ static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
     }
 
     if (virtio_gpu_virgl_enabled(g->conf)) {
+        VirtQueue *(*add_queue)(VirtIODevice *vdev, int queue_size,
+                                  VirtIOHandleOutput handle_output) =
+            g->iothread ? virtio_add_queue_aio : virtio_add_queue;
+
         /* use larger control queue in 3d mode */
-        g->ctrl_vq   = virtio_add_queue(vdev, 256, virtio_gpu_handle_ctrl_cb);
-        g->cursor_vq = virtio_add_queue(vdev, 16, virtio_gpu_handle_cursor_cb);
+        g->ctrl_vq   = add_queue(vdev, 256, virtio_gpu_handle_ctrl_cb);
+        g->cursor_vq = add_queue(vdev, 16, virtio_gpu_handle_cursor_cb);
         g->virtio_config.num_capsets = 1;
 #if defined(CONFIG_VIRGL)
         {
@@ -1290,6 +1420,10 @@ static void virtio_gpu_reset(VirtIODevice *vdev)
     struct virtio_gpu_simple_resource *res, *tmp;
     int i;
 
+    if (g->dp) {
+        virtio_gpu_data_plane_stop(g->dp);
+    }
+
     g->enable = 0;
 
     QTAILQ_FOREACH_SAFE(res, &g->reslist, next, tmp) {
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index 82d1e45..26ff9d1 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -217,5 +217,6 @@ void virtio_gpu_virgl_reset(VirtIOGPU *g);
 int virtio_gpu_virgl_init(VirtIOGPU *g);
 int virtio_gpu_virgl_dp_create(VirtIOGPU *g, Error **errp);
 void virtio_gpu_virgl_dp_destroy(VirtIOGPU *g);
+void virtio_gpu_data_plane_stop(VirtIOGPUDataPlane *dp);
 
 #endif
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread
  2016-09-04 22:20 [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread Marc-André Lureau
                   ` (17 preceding siblings ...)
  2016-09-04 22:20 ` [Qemu-devel] [PATCH 18/18] virtio-gpu: start/stop " Marc-André Lureau
@ 2016-09-04 22:46 ` no-reply
  2016-09-04 22:48 ` no-reply
  2016-09-08  6:01 ` Gerd Hoffmann
  20 siblings, 0 replies; 23+ messages in thread
From: no-reply @ 2016-09-04 22:46 UTC (permalink / raw)
  To: marcandre.lureau; +Cc: famz, qemu-devel, airlied, kraxel

Hi,

Your series seems to have some coding style problems. See output below for
more information:

Subject: [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread
Type: series
Message-id: 20160904222039.11460-1-marcandre.lureau@redhat.com

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

# Useful git options
git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git show --no-patch --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]         patchew/20160904222039.11460-1-marcandre.lureau@redhat.com -> patchew/20160904222039.11460-1-marcandre.lureau@redhat.com
Switched to a new branch 'test'
8abc39d virtio-gpu: start/stop the data-plane
f75ff94 virtio-gpu: schedule a bh to unblock the data-plane
43e0ecf virtio-gpu: use virgl thread sync with the data-plane
e3a2562 virtio-gpu: dispatch to main thread for scanout & flush
2549b27 virtio-gpu: batch virtio_notify when using a data-plane
e9855b7 virtio-gpu: add a virgl data-plane
7bd9911 virtio-gpu: save a pointer from virtio_gpu_ctrl_command
fd2ff41 virtio-gpu: use a bh for cursor modifications
a24e803 virtio-blk: use bitmap_foreach
d0f8002 bitmap: add a simple foreach util
944536e gl: bind GL api before context creation
1f37504 gl: allow to keep current context in ctx-create
a2b4c5f virtio-gpu: create a thread context
2823f8f virtio-gpu: start introducing a lock around the display info
8874c04 virtio-gpu: start splitting scanout/resource flushing
f86af9a virtio-gpu: add "iothread" property
5cf1883 console: add dpy_gl_ctx_is_mt_safe
9bc3d8c console: skip same-size resize

=== OUTPUT BEGIN ===
Checking PATCH 1/18: console: skip same-size resize...
Checking PATCH 2/18: console: add dpy_gl_ctx_is_mt_safe...
Checking PATCH 3/18: virtio-gpu: add "iothread" property...
Checking PATCH 4/18: virtio-gpu: start splitting scanout/resource flushing...
ERROR: braces {} are necessary for all arms of this statement
#70: FILE: hw/display/virtio-gpu-3d.c:168:
+        if (info->idx != 0)
[...]

total: 1 errors, 0 warnings, 136 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 5/18: virtio-gpu: start introducing a lock around the display info...
Checking PATCH 6/18: virtio-gpu: create a thread context...
Checking PATCH 7/18: gl: allow to keep current context in ctx-create...
Checking PATCH 8/18: gl: bind GL api before context creation...
Checking PATCH 9/18: bitmap: add a simple foreach util...
Checking PATCH 10/18: virtio-blk: use bitmap_foreach...
Checking PATCH 11/18: virtio-gpu: use a bh for cursor modifications...
Checking PATCH 12/18: virtio-gpu: save a pointer from virtio_gpu_ctrl_command...
Checking PATCH 13/18: virtio-gpu: add a virgl data-plane...
Checking PATCH 14/18: virtio-gpu: batch virtio_notify when using a data-plane...
Checking PATCH 15/18: virtio-gpu: dispatch to main thread for scanout & flush...
Checking PATCH 16/18: virtio-gpu: use virgl thread sync with the data-plane...
Checking PATCH 17/18: virtio-gpu: schedule a bh to unblock the data-plane...
Checking PATCH 18/18: virtio-gpu: start/stop the data-plane...
=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread
  2016-09-04 22:20 [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread Marc-André Lureau
                   ` (18 preceding siblings ...)
  2016-09-04 22:46 ` [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread no-reply
@ 2016-09-04 22:48 ` no-reply
  2016-09-08  6:01 ` Gerd Hoffmann
  20 siblings, 0 replies; 23+ messages in thread
From: no-reply @ 2016-09-04 22:48 UTC (permalink / raw)
  To: marcandre.lureau; +Cc: famz, qemu-devel, airlied, kraxel

Hi,

Your series failed automatic build test. Please find the testing commands and
their output below. If you have docker installed, you can probably reproduce it
locally.

Subject: [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread
Type: series
Message-id: 20160904222039.11460-1-marcandre.lureau@redhat.com

=== TEST SCRIPT BEGIN ===
#!/bin/bash
set -e
git submodule update --init dtc
make J=8 docker-test-quick@centos6
make J=8 docker-test-mingw@fedora
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
8abc39d virtio-gpu: start/stop the data-plane
f75ff94 virtio-gpu: schedule a bh to unblock the data-plane
43e0ecf virtio-gpu: use virgl thread sync with the data-plane
e3a2562 virtio-gpu: dispatch to main thread for scanout & flush
2549b27 virtio-gpu: batch virtio_notify when using a data-plane
e9855b7 virtio-gpu: add a virgl data-plane
7bd9911 virtio-gpu: save a pointer from virtio_gpu_ctrl_command
fd2ff41 virtio-gpu: use a bh for cursor modifications
a24e803 virtio-blk: use bitmap_foreach
d0f8002 bitmap: add a simple foreach util
944536e gl: bind GL api before context creation
1f37504 gl: allow to keep current context in ctx-create
a2b4c5f virtio-gpu: create a thread context
2823f8f virtio-gpu: start introducing a lock around the display info
8874c04 virtio-gpu: start splitting scanout/resource flushing
f86af9a virtio-gpu: add "iothread" property
5cf1883 console: add dpy_gl_ctx_is_mt_safe
9bc3d8c console: skip same-size resize

=== OUTPUT BEGIN ===
Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc'
Cloning into 'dtc'...
Submodule path 'dtc': checked out '65cc4d2748a2c2e6f27f1cf39e07a5dbabd80ebf'
  BUILD centos6
  ARCHIVE qemu.tgz
  ARCHIVE dtc.tgz
  COPY RUNNER
  RUN test-quick in centos6
No C++ compiler available; disabling C++ specific optional code
Install prefix    /tmp/qemu-test/src/tests/docker/install
BIOS directory    /tmp/qemu-test/src/tests/docker/install/share/qemu
binary directory  /tmp/qemu-test/src/tests/docker/install/bin
library directory /tmp/qemu-test/src/tests/docker/install/lib
module directory  /tmp/qemu-test/src/tests/docker/install/lib/qemu
libexec directory /tmp/qemu-test/src/tests/docker/install/libexec
include directory /tmp/qemu-test/src/tests/docker/install/include
config directory  /tmp/qemu-test/src/tests/docker/install/etc
local state directory   /tmp/qemu-test/src/tests/docker/install/var
Manual directory  /tmp/qemu-test/src/tests/docker/install/share/man
ELF interp prefix /usr/gnemul/qemu-%M
Source path       /tmp/qemu-test/src
C compiler        cc
Host C compiler   cc
C++ compiler      
Objective-C compiler cc
ARFLAGS           rv
CFLAGS            -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include   -g 
QEMU_CFLAGS       -I/usr/include/pixman-1    -fPIE -DPIE -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common  -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-all
LDFLAGS           -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m64 -g 
make              make
install           install
python            python -B
smbd              /usr/sbin/smbd
module support    no
host CPU          x86_64
host big endian   no
target list       x86_64-softmmu aarch64-softmmu
tcg debug enabled no
gprof enabled     no
sparse enabled    no
strip binaries    yes
profiler          no
static build      no
pixman            system
SDL support       yes (1.2.14)
GTK support       no 
GTK GL support    no
VTE support       no 
TLS priority      NORMAL
GNUTLS support    no
GNUTLS rnd        no
libgcrypt         no
libgcrypt kdf     no
nettle            no 
nettle kdf        no
libtasn1          no
curses support    no
virgl support     no
curl support      no
mingw32 support   no
Audio drivers     oss
Block whitelist (rw) 
Block whitelist (ro) 
VirtFS support    no
VNC support       yes
VNC SASL support  no
VNC JPEG support  no
VNC PNG support   no
xen support       no
brlapi support    no
bluez  support    no
Documentation     no
PIE               yes
vde support       no
netmap support    no
Linux AIO support no
ATTR/XATTR support yes
Install blobs     yes
KVM support       yes
RDMA support      no
TCG interpreter   no
fdt support       yes
preadv support    yes
fdatasync         yes
madvise           yes
posix_madvise     yes
uuid support      no
libcap-ng support no
vhost-net support yes
vhost-scsi support yes
Trace backends    log
spice support     no 
rbd support       no
xfsctl support    no
smartcard support no
libusb            no
usb net redir     no
OpenGL support    no
OpenGL dmabufs    no
libiscsi support  no
libnfs support    no
build guest agent yes
QGA VSS support   no
QGA w32 disk info no
QGA MSI support   no
seccomp support   no
coroutine backend ucontext
coroutine pool    yes
GlusterFS support no
Archipelago support no
gcov              gcov
gcov enabled      no
TPM support       yes
libssh2 support   no
TPM passthrough   yes
QOM debugging     yes
vhdx              no
lzo support       no
snappy support    no
bzip2 support     no
NUMA host support no
tcmalloc support  no
jemalloc support  no
avx2 optimization no
  GEN   x86_64-softmmu/config-devices.mak.tmp
  GEN   aarch64-softmmu/config-devices.mak.tmp
  GEN   config-host.h
  GEN   qemu-options.def
  GEN   qmp-commands.h
  GEN   qapi-types.h
  GEN   qapi-visit.h
  GEN   qapi-event.h
  GEN   x86_64-softmmu/config-devices.mak
  GEN   aarch64-softmmu/config-devices.mak
  GEN   qmp-introspect.h
  GEN   tests/test-qapi-types.h
  GEN   tests/test-qapi-visit.h
  GEN   tests/test-qmp-commands.h
  GEN   tests/test-qapi-event.h
  GEN   tests/test-qmp-introspect.h
  GEN   config-all-devices.mak
  GEN   trace/generated-events.h
  GEN   trace/generated-tracers.h
  GEN   trace/generated-tcg-tracers.h
  GEN   trace/generated-helpers-wrappers.h
  GEN   trace/generated-helpers.h
  CC    tests/qemu-iotests/socket_scm_helper.o
  GEN   qga/qapi-generated/qga-qapi-types.h
  GEN   qga/qapi-generated/qga-qapi-visit.h
  GEN   qga/qapi-generated/qga-qmp-commands.h
  GEN   qga/qapi-generated/qga-qapi-types.c
  GEN   qga/qapi-generated/qga-qapi-visit.c
  GEN   qga/qapi-generated/qga-qmp-marshal.c
  GEN   qmp-introspect.c
  GEN   qapi-types.c
  GEN   qapi-visit.c
  GEN   qapi-event.c
  CC    qapi/qapi-visit-core.o
  CC    qapi/qapi-dealloc-visitor.o
  CC    qapi/qmp-input-visitor.o
  CC    qapi/qmp-output-visitor.o
  CC    qapi/qmp-registry.o
  CC    qapi/qmp-dispatch.o
  CC    qapi/string-input-visitor.o
  CC    qapi/string-output-visitor.o
  CC    qapi/opts-visitor.o
  CC    qapi/qapi-clone-visitor.o
  CC    qapi/qmp-event.o
  CC    qapi/qapi-util.o
  CC    qobject/qnull.o
  CC    qobject/qint.o
  CC    qobject/qstring.o
  CC    qobject/qdict.o
  CC    qobject/qlist.o
  CC    qobject/qfloat.o
  CC    qobject/qbool.o
  CC    qobject/qjson.o
  CC    qobject/qobject.o
  CC    qobject/json-lexer.o
  CC    qobject/json-streamer.o
  CC    qobject/json-parser.o
  GEN   trace/generated-events.c
  CC    trace/control.o
  CC    trace/qmp.o
  CC    util/osdep.o
  CC    util/cutils.o
  CC    util/unicode.o
  CC    util/qemu-timer-common.o
  CC    util/event_notifier-posix.o
  CC    util/compatfd.o
  CC    util/mmap-alloc.o
  CC    util/oslib-posix.o
  CC    util/qemu-openpty.o
  CC    util/qemu-thread-posix.o
  CC    util/memfd.o
  CC    util/envlist.o
  CC    util/path.o
  CC    util/module.o
  CC    util/bitmap.o
  CC    util/bitops.o
  CC    util/hbitmap.o
  CC    util/fifo8.o
  CC    util/acl.o
  CC    util/error.o
  CC    util/qemu-error.o
  CC    util/id.o
  CC    util/iov.o
  CC    util/qemu-config.o
  CC    util/qemu-sockets.o
  CC    util/uri.o
  CC    util/notify.o
  CC    util/qemu-option.o
  CC    util/qemu-progress.o
  CC    util/hexdump.o
  CC    util/crc32c.o
  CC    util/throttle.o
  CC    util/getauxval.o
  CC    util/readline.o
  CC    util/rfifolock.o
  CC    util/rcu.o
  CC    util/qemu-coroutine.o
  CC    util/qemu-coroutine-lock.o
  CC    util/qemu-coroutine-io.o
  CC    util/qemu-coroutine-sleep.o
  CC    util/coroutine-ucontext.o
  CC    util/buffer.o
  CC    util/timed-average.o
  CC    util/base64.o
  CC    util/qdist.o
  CC    util/log.o
  CC    util/qht.o
  CC    util/range.o
/tmp/qemu-test/src/util/qht.c: In function ‘qht_reset_size’:
/tmp/qemu-test/src/util/qht.c:413: warning: ‘new’ may be used uninitialized in this function
  CC    crypto/pbkdf-stub.o
  CC    stubs/arch-query-cpu-def.o
  CC    stubs/bdrv-next-monitor-owned.o
  CC    stubs/blk-commit-all.o
  CC    stubs/blockdev-close-all-bdrv-states.o
  CC    stubs/clock-warp.o
  CC    stubs/cpu-get-clock.o
  CC    stubs/cpu-get-icount.o
  CC    stubs/dump.o
  CC    stubs/fdset-add-fd.o
  CC    stubs/fdset-find-fd.o
  CC    stubs/fdset-get-fd.o
  CC    stubs/fdset-remove-fd.o
  CC    stubs/gdbstub.o
  CC    stubs/get-fd.o
  CC    stubs/get-next-serial.o
  CC    stubs/get-vm-name.o
  CC    stubs/iothread-lock.o
  CC    stubs/is-daemonized.o
  CC    stubs/machine-init-done.o
  CC    stubs/migr-blocker.o
  CC    stubs/mon-is-qmp.o
  CC    stubs/mon-printf.o
  CC    stubs/monitor-init.o
  CC    stubs/notify-event.o
  CC    stubs/qtest.o
  CC    stubs/replay.o
  CC    stubs/replay-user.o
  CC    stubs/reset.o
  CC    stubs/runstate-check.o
  CC    stubs/set-fd-handler.o
  CC    stubs/slirp.o
  CC    stubs/sysbus.o
  CC    stubs/trace-control.o
  CC    stubs/uuid.o
  CC    stubs/vm-stop.o
  CC    stubs/vmstate.o
  CC    stubs/cpus.o
  CC    stubs/kvm.o
  CC    stubs/qmp_pc_dimm_device_list.o
  CC    stubs/target-monitor-defs.o
  CC    stubs/target-get-monitor-def.o
  CC    stubs/vhost.o
  CC    stubs/iohandler.o
  CC    stubs/smbios_type_38.o
  CC    stubs/ipmi.o
  CC    stubs/pc_madt_cpu_entry.o
  CC    contrib/ivshmem-client/ivshmem-client.o
  CC    contrib/ivshmem-client/main.o
  CC    contrib/ivshmem-server/ivshmem-server.o
  CC    contrib/ivshmem-server/main.o
  CC    qemu-nbd.o
  CC    async.o
  CC    thread-pool.o
  CC    block.o
  CC    blockjob.o
  CC    main-loop.o
  CC    iohandler.o
  CC    qemu-timer.o
  CC    aio-posix.o
  CC    qemu-io-cmds.o
  CC    block/raw_bsd.o
  CC    block/qcow.o
  CC    block/vdi.o
  CC    block/vmdk.o
  CC    block/cloop.o
  CC    block/bochs.o
  CC    block/vpc.o
  CC    block/vvfat.o
  CC    block/qcow2.o
  CC    block/qcow2-refcount.o
  CC    block/qcow2-cluster.o
  CC    block/qcow2-snapshot.o
  CC    block/qcow2-cache.o
  CC    block/qed.o
  CC    block/qed-gencb.o
  CC    block/qed-l2-cache.o
  CC    block/qed-table.o
  CC    block/qed-cluster.o
  CC    block/qed-check.o
  CC    block/quorum.o
  CC    block/parallels.o
  CC    block/blkdebug.o
  CC    block/blkverify.o
  CC    block/blkreplay.o
  CC    block/block-backend.o
  CC    block/snapshot.o
  CC    block/qapi.o
  CC    block/raw-posix.o
  CC    block/null.o
  CC    block/mirror.o
  CC    block/commit.o
  CC    block/io.o
  CC    block/throttle-groups.o
  CC    block/nbd.o
  CC    block/nbd-client.o
  CC    block/sheepdog.o
  CC    block/accounting.o
  CC    block/dirty-bitmap.o
  CC    block/write-threshold.o
  CC    block/crypto.o
  CC    nbd/server.o
  CC    nbd/client.o
  CC    nbd/common.o
  CC    block/dmg.o
  CC    crypto/init.o
  CC    crypto/hash.o
  CC    crypto/hash-glib.o
  CC    crypto/aes.o
  CC    crypto/desrfb.o
  CC    crypto/cipher.o
  CC    crypto/tlscreds.o
  CC    crypto/tlscredsanon.o
  CC    crypto/tlscredsx509.o
  CC    crypto/tlssession.o
  CC    crypto/secret.o
  CC    crypto/random-platform.o
  CC    crypto/pbkdf.o
  CC    crypto/ivgen.o
  CC    crypto/ivgen-essiv.o
  CC    crypto/ivgen-plain.o
  CC    crypto/ivgen-plain64.o
  CC    crypto/afsplit.o
  CC    crypto/xts.o
  CC    crypto/block.o
  CC    crypto/block-qcow.o
  CC    crypto/block-luks.o
  CC    io/channel.o
  CC    io/channel-buffer.o
  CC    io/channel-command.o
  CC    io/channel-file.o
  CC    io/channel-socket.o
  CC    io/channel-tls.o
  CC    io/channel-watch.o
  CC    io/channel-websock.o
  CC    io/channel-util.o
  CC    io/task.o
  CC    qom/object.o
  CC    qom/container.o
  CC    qom/qom-qobject.o
  CC    qom/object_interfaces.o
  GEN   qemu-img-cmds.h
  CC    qemu-io.o
  CC    qemu-bridge-helper.o
  CC    blockdev.o
  CC    blockdev-nbd.o
  CC    iothread.o
  CC    qdev-monitor.o
  CC    device-hotplug.o
  CC    os-posix.o
  CC    qemu-char.o
  CC    page_cache.o
  CC    accel.o
  CC    bt-host.o
  CC    bt-vhci.o
  CC    dma-helpers.o
  CC    vl.o
  CC    tpm.o
  CC    device_tree.o
  GEN   qmp-marshal.c
  CC    qmp.o
  CC    hmp.o
  CC    tcg-runtime.o
  CC    audio/audio.o
  CC    audio/noaudio.o
  CC    audio/wavaudio.o
  CC    audio/mixeng.o
  CC    audio/sdlaudio.o
  CC    audio/ossaudio.o
  CC    audio/wavcapture.o
  CC    backends/rng.o
  CC    backends/rng-egd.o
  CC    backends/rng-random.o
  CC    backends/msmouse.o
  CC    backends/testdev.o
  CC    backends/tpm.o
  CC    backends/hostmem.o
  CC    backends/hostmem-ram.o
  CC    backends/hostmem-file.o
  CC    block/stream.o
  CC    block/backup.o
  CC    disas/arm.o
  CC    disas/i386.o
  CC    fsdev/qemu-fsdev-dummy.o
  CC    fsdev/qemu-fsdev-opts.o
  CC    hw/acpi/core.o
  CC    hw/acpi/piix4.o
  CC    hw/acpi/pcihp.o
  CC    hw/acpi/ich9.o
  CC    hw/acpi/tco.o
  CC    hw/acpi/cpu_hotplug.o
  CC    hw/acpi/memory_hotplug.o
  CC    hw/acpi/memory_hotplug_acpi_table.o
  CC    hw/acpi/cpu.o
  CC    hw/acpi/acpi_interface.o
  CC    hw/acpi/bios-linker-loader.o
  CC    hw/acpi/aml-build.o
  CC    hw/acpi/ipmi.o
  CC    hw/audio/sb16.o
  CC    hw/audio/es1370.o
  CC    hw/audio/ac97.o
  CC    hw/audio/fmopl.o
  CC    hw/audio/adlib.o
  CC    hw/audio/gus.o
  CC    hw/audio/gusemu_hal.o
  CC    hw/audio/gusemu_mixer.o
  CC    hw/audio/cs4231a.o
  CC    hw/audio/intel-hda.o
  CC    hw/audio/hda-codec.o
  CC    hw/audio/pcspk.o
  CC    hw/audio/wm8750.o
  CC    hw/audio/pl041.o
  CC    hw/audio/lm4549.o
  CC    hw/audio/marvell_88w8618.o
  CC    hw/block/block.o
  CC    hw/block/cdrom.o
  CC    hw/block/hd-geometry.o
  CC    hw/block/fdc.o
  CC    hw/block/m25p80.o
  CC    hw/block/nand.o
  CC    hw/block/pflash_cfi01.o
  CC    hw/block/pflash_cfi02.o
  CC    hw/block/ecc.o
  CC    hw/block/onenand.o
  CC    hw/block/nvme.o
  CC    hw/bt/core.o
  CC    hw/bt/l2cap.o
  CC    hw/bt/sdp.o
  CC    hw/bt/hci.o
  CC    hw/bt/hid.o
  CC    hw/bt/hci-csr.o
  CC    hw/char/ipoctal232.o
  CC    hw/char/parallel.o
  CC    hw/char/pl011.o
  CC    hw/char/serial.o
  CC    hw/char/serial-isa.o
  CC    hw/char/serial-pci.o
  CC    hw/char/virtio-console.o
  CC    hw/char/cadence_uart.o
  CC    hw/char/debugcon.o
  CC    hw/char/imx_serial.o
  CC    hw/core/qdev.o
  CC    hw/core/qdev-properties.o
  CC    hw/core/bus.o
  CC    hw/core/fw-path-provider.o
  CC    hw/core/irq.o
  CC    hw/core/hotplug.o
  CC    hw/core/ptimer.o
  CC    hw/core/sysbus.o
  CC    hw/core/machine.o
  CC    hw/core/null-machine.o
  CC    hw/core/loader.o
  CC    hw/core/qdev-properties-system.o
  CC    hw/core/register.o
  CC    hw/core/platform-bus.o
  CC    hw/display/ads7846.o
  CC    hw/display/cirrus_vga.o
  CC    hw/display/ssd0303.o
  CC    hw/display/pl110.o
  CC    hw/display/ssd0323.o
  CC    hw/display/vga-pci.o
  CC    hw/display/vga-isa.o
  CC    hw/display/vmware_vga.o
  CC    hw/display/blizzard.o
  CC    hw/display/exynos4210_fimd.o
  CC    hw/display/framebuffer.o
  CC    hw/display/tc6393xb.o
  CC    hw/dma/pl080.o
  CC    hw/dma/pl330.o
  CC    hw/dma/i8257.o
  CC    hw/dma/xlnx-zynq-devcfg.o
  CC    hw/gpio/max7310.o
  CC    hw/gpio/pl061.o
  CC    hw/gpio/zaurus.o
  CC    hw/gpio/gpio_key.o
  CC    hw/i2c/core.o
  CC    hw/i2c/smbus.o
  CC    hw/i2c/smbus_eeprom.o
  CC    hw/i2c/i2c-ddc.o
  CC    hw/i2c/versatile_i2c.o
  CC    hw/i2c/smbus_ich9.o
  CC    hw/i2c/pm_smbus.o
  CC    hw/i2c/bitbang_i2c.o
  CC    hw/i2c/exynos4210_i2c.o
  CC    hw/i2c/imx_i2c.o
  CC    hw/i2c/aspeed_i2c.o
  CC    hw/ide/core.o
  CC    hw/ide/atapi.o
  CC    hw/ide/qdev.o
  CC    hw/ide/pci.o
  CC    hw/ide/isa.o
  CC    hw/ide/piix.o
  CC    hw/ide/microdrive.o
  CC    hw/ide/ahci.o
  CC    hw/ide/ich.o
  CC    hw/input/hid.o
  CC    hw/input/lm832x.o
  CC    hw/input/pckbd.o
  CC    hw/input/pl050.o
  CC    hw/input/ps2.o
  CC    hw/input/stellaris_input.o
  CC    hw/input/tsc2005.o
  CC    hw/input/vmmouse.o
  CC    hw/input/virtio-input-hid.o
  CC    hw/input/virtio-input.o
  CC    hw/input/virtio-input-host.o
  CC    hw/intc/i8259_common.o
  CC    hw/intc/i8259.o
  CC    hw/intc/pl190.o
  CC    hw/intc/imx_avic.o
  CC    hw/intc/realview_gic.o
  CC    hw/intc/ioapic_common.o
  CC    hw/intc/arm_gic_common.o
  CC    hw/intc/arm_gic.o
  CC    hw/intc/arm_gicv2m.o
  CC    hw/intc/arm_gicv3_common.o
  CC    hw/intc/arm_gicv3.o
  CC    hw/intc/arm_gicv3_dist.o
  CC    hw/intc/arm_gicv3_redist.o
  CC    hw/ipack/ipack.o
  CC    hw/ipack/tpci200.o
  CC    hw/ipmi/ipmi.o
  CC    hw/ipmi/ipmi_bmc_sim.o
  CC    hw/ipmi/ipmi_bmc_extern.o
  CC    hw/ipmi/isa_ipmi_kcs.o
  CC    hw/ipmi/isa_ipmi_bt.o
  CC    hw/isa/isa-bus.o
  CC    hw/isa/apm.o
  CC    hw/mem/pc-dimm.o
  CC    hw/mem/nvdimm.o
  CC    hw/misc/applesmc.o
  CC    hw/misc/max111x.o
  CC    hw/misc/tmp105.o
  CC    hw/misc/debugexit.o
  CC    hw/misc/sga.o
  CC    hw/misc/pc-testdev.o
  CC    hw/misc/pci-testdev.o
  CC    hw/misc/arm_l2x0.o
  CC    hw/misc/arm_integrator_debug.o
  CC    hw/misc/a9scu.o
  CC    hw/misc/arm11scu.o
  CC    hw/net/ne2000.o
  CC    hw/net/eepro100.o
  CC    hw/net/pcnet-pci.o
  CC    hw/net/pcnet.o
  CC    hw/net/e1000.o
  CC    hw/net/e1000x_common.o
  CC    hw/net/net_tx_pkt.o
  CC    hw/net/net_rx_pkt.o
  CC    hw/net/e1000e.o
  CC    hw/net/e1000e_core.o
  CC    hw/net/rtl8139.o
  CC    hw/net/vmxnet3.o
  CC    hw/net/smc91c111.o
  CC    hw/net/lan9118.o
  CC    hw/net/ne2000-isa.o
  CC    hw/net/xgmac.o
  CC    hw/net/allwinner_emac.o
  CC    hw/net/imx_fec.o
  CC    hw/net/cadence_gem.o
  CC    hw/net/stellaris_enet.o
  CC    hw/net/rocker/rocker.o
  CC    hw/net/rocker/rocker_fp.o
  CC    hw/net/rocker/rocker_desc.o
  CC    hw/net/rocker/rocker_world.o
  CC    hw/net/rocker/rocker_of_dpa.o
  CC    hw/nvram/eeprom93xx.o
  CC    hw/nvram/fw_cfg.o
  CC    hw/pci-bridge/pci_bridge_dev.o
  CC    hw/pci-bridge/pci_expander_bridge.o
  CC    hw/pci-bridge/xio3130_upstream.o
  CC    hw/pci-bridge/xio3130_downstream.o
  CC    hw/pci-bridge/ioh3420.o
  CC    hw/pci-bridge/i82801b11.o
  CC    hw/pci-host/pam.o
  CC    hw/pci-host/versatile.o
  CC    hw/pci-host/piix.o
  CC    hw/pci-host/q35.o
  CC    hw/pci-host/gpex.o
  CC    hw/pci/pci.o
/tmp/qemu-test/src/hw/nvram/fw_cfg.c: In function ‘fw_cfg_dma_transfer’:
/tmp/qemu-test/src/hw/nvram/fw_cfg.c:330: warning: ‘read’ may be used uninitialized in this function
  CC    hw/pci/pci_bridge.o
  CC    hw/pci/msix.o
  CC    hw/pci/msi.o
  CC    hw/pci/shpc.o
  CC    hw/pci/slotid_cap.o
  CC    hw/pci/pci_host.o
  CC    hw/pci/pcie_host.o
  CC    hw/pci/pcie.o
  CC    hw/pci/pcie_aer.o
  CC    hw/pci/pcie_port.o
  CC    hw/pci/pci-stub.o
  CC    hw/pcmcia/pcmcia.o
  CC    hw/scsi/scsi-disk.o
  CC    hw/scsi/scsi-generic.o
  CC    hw/scsi/scsi-bus.o
  CC    hw/scsi/lsi53c895a.o
  CC    hw/scsi/mptsas.o
  CC    hw/scsi/mptconfig.o
  CC    hw/scsi/mptendian.o
  CC    hw/scsi/megasas.o
  CC    hw/scsi/vmw_pvscsi.o
  CC    hw/scsi/esp.o
  CC    hw/scsi/esp-pci.o
  CC    hw/sd/pl181.o
  CC    hw/sd/ssi-sd.o
  CC    hw/sd/sd.o
  CC    hw/sd/core.o
  CC    hw/sd/sdhci.o
  CC    hw/smbios/smbios.o
  CC    hw/smbios/smbios_type_38.o
  CC    hw/ssi/pl022.o
  CC    hw/ssi/ssi.o
  CC    hw/ssi/xilinx_spips.o
  CC    hw/ssi/aspeed_smc.o
  CC    hw/timer/arm_timer.o
  CC    hw/timer/arm_mptimer.o
  CC    hw/timer/a9gtimer.o
  CC    hw/timer/cadence_ttc.o
  CC    hw/timer/ds1338.o
  CC    hw/timer/hpet.o
  CC    hw/timer/i8254_common.o
  CC    hw/timer/i8254.o
  CC    hw/timer/pl031.o
  CC    hw/timer/twl92230.o
  CC    hw/timer/imx_epit.o
  CC    hw/timer/imx_gpt.o
  CC    hw/timer/stm32f2xx_timer.o
  CC    hw/timer/aspeed_timer.o
  CC    hw/tpm/tpm_tis.o
  CC    hw/tpm/tpm_passthrough.o
  CC    hw/tpm/tpm_util.o
  CC    hw/usb/core.o
  CC    hw/usb/combined-packet.o
  CC    hw/usb/bus.o
  CC    hw/usb/libhw.o
  CC    hw/usb/desc.o
  CC    hw/usb/desc-msos.o
  CC    hw/usb/hcd-uhci.o
  CC    hw/usb/hcd-ohci.o
  CC    hw/usb/hcd-ehci.o
  CC    hw/usb/hcd-ehci-pci.o
  CC    hw/usb/hcd-ehci-sysbus.o
  CC    hw/usb/hcd-xhci.o
  CC    hw/usb/hcd-musb.o
  CC    hw/usb/dev-hub.o
  CC    hw/usb/dev-hid.o
  CC    hw/usb/dev-wacom.o
  CC    hw/usb/dev-storage.o
  CC    hw/usb/dev-uas.o
  CC    hw/usb/dev-audio.o
  CC    hw/usb/dev-serial.o
  CC    hw/usb/dev-network.o
  CC    hw/usb/dev-bluetooth.o
  CC    hw/usb/dev-smartcard-reader.o
  CC    hw/usb/dev-mtp.o
  CC    hw/usb/host-stub.o
  CC    hw/virtio/virtio-rng.o
  CC    hw/virtio/virtio-pci.o
  CC    hw/virtio/virtio-bus.o
  CC    hw/virtio/virtio-mmio.o
  CC    hw/watchdog/watchdog.o
  CC    hw/watchdog/wdt_i6300esb.o
  CC    hw/watchdog/wdt_ib700.o
In file included from /tmp/qemu-test/src/hw/virtio/virtio-pci.h:28,
                 from /tmp/qemu-test/src/hw/virtio/virtio-pci.c:37:
/tmp/qemu-test/src/include/hw/virtio/virtio-gpu.h:174: error: redefinition of typedef ‘VirtIOGPU’
/tmp/qemu-test/src/include/hw/virtio/virtio-gpu.h:105: note: previous declaration of ‘VirtIOGPU’ was here
make: *** [hw/virtio/virtio-pci.o] Error 1
make: *** Waiting for unfinished jobs....
tests/docker/Makefile.include:104: recipe for target 'docker-run-test-quick@centos6' failed
make: *** [docker-run-test-quick@centos6] Error 1
=== OUTPUT END ===

Test command exited with code: 2


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread
  2016-09-04 22:20 [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread Marc-André Lureau
                   ` (19 preceding siblings ...)
  2016-09-04 22:48 ` no-reply
@ 2016-09-08  6:01 ` Gerd Hoffmann
  2016-09-08  6:38   ` Marc-André Lureau
  20 siblings, 1 reply; 23+ messages in thread
From: Gerd Hoffmann @ 2016-09-08  6:01 UTC (permalink / raw)
  To: Marc-André Lureau; +Cc: qemu-devel, airlied

  Hi,

> The benchmarks are quite encouraging, since I get from +-25% for
> xonotic up to +-100% for glmark. (fwiw, vhost-user-gpu had similar
> results too). Finally, I tried to make it acceptable for upstream.

Hmm, I don't feel like adding too many modes to virgl ...

With vhost-user-gpu giving us simliar benefits I'd prefer to focus on
that, for the additional security benefits (sandboxing the separate
process).

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread
  2016-09-08  6:01 ` Gerd Hoffmann
@ 2016-09-08  6:38   ` Marc-André Lureau
  0 siblings, 0 replies; 23+ messages in thread
From: Marc-André Lureau @ 2016-09-08  6:38 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: Marc-André Lureau, qemu-devel, airlied

Hi

----- Original Message -----
> Hi,
> 
> > The benchmarks are quite encouraging, since I get from +-25% for
> > xonotic up to +-100% for glmark. (fwiw, vhost-user-gpu had similar
> > results too). Finally, I tried to make it acceptable for upstream.
> 
> Hmm, I don't feel like adding too many modes to virgl ...
> 
> With vhost-user-gpu giving us simliar benefits I'd prefer to focus on
> that, for the additional security benefits (sandboxing the separate
> process).

Makes sense, I wanted to have a fair comparison between the two. vhost-user-gpu will probably take longer to happen, since it changes the way qemu must be managed. I also expect a lag in vhost-user whenever virtio ring/dataplane gets optimization in qemu, that will need to be adapted for vhost-user.
 So the benefit of having a virgl thread in qemu is that it is less complicated than vhost-user-gpu, it brings immediate performance boost, and it serves as a comparison point. I can keep it in a branch, but it would be nice to consider this as an "experimental" option too. 

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2016-09-08  6:39 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-04 22:20 [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread Marc-André Lureau
2016-09-04 22:20 ` [Qemu-devel] [PATCH 01/18] console: skip same-size resize Marc-André Lureau
2016-09-04 22:20 ` [Qemu-devel] [PATCH 02/18] console: add dpy_gl_ctx_is_mt_safe Marc-André Lureau
2016-09-04 22:20 ` [Qemu-devel] [PATCH 03/18] virtio-gpu: add "iothread" property Marc-André Lureau
2016-09-04 22:20 ` [Qemu-devel] [PATCH 04/18] virtio-gpu: start splitting scanout/resource flushing Marc-André Lureau
2016-09-04 22:20 ` [Qemu-devel] [PATCH 05/18] virtio-gpu: start introducing a lock around the display info Marc-André Lureau
2016-09-04 22:20 ` [Qemu-devel] [PATCH 06/18] virtio-gpu: create a thread context Marc-André Lureau
2016-09-04 22:20 ` [Qemu-devel] [PATCH 07/18] gl: allow to keep current context in ctx-create Marc-André Lureau
2016-09-04 22:20 ` [Qemu-devel] [PATCH 08/18] gl: bind GL api before context creation Marc-André Lureau
2016-09-04 22:20 ` [Qemu-devel] [PATCH 09/18] bitmap: add a simple foreach util Marc-André Lureau
2016-09-04 22:20 ` [Qemu-devel] [PATCH 10/18] virtio-blk: use bitmap_foreach Marc-André Lureau
2016-09-04 22:20 ` [Qemu-devel] [PATCH 11/18] virtio-gpu: use a bh for cursor modifications Marc-André Lureau
2016-09-04 22:20 ` [Qemu-devel] [PATCH 12/18] virtio-gpu: save a pointer from virtio_gpu_ctrl_command Marc-André Lureau
2016-09-04 22:20 ` [Qemu-devel] [PATCH 13/18] virtio-gpu: add a virgl data-plane Marc-André Lureau
2016-09-04 22:20 ` [Qemu-devel] [PATCH 14/18] virtio-gpu: batch virtio_notify when using a data-plane Marc-André Lureau
2016-09-04 22:20 ` [Qemu-devel] [PATCH 15/18] virtio-gpu: dispatch to main thread for scanout & flush Marc-André Lureau
2016-09-04 22:20 ` [Qemu-devel] [PATCH 16/18] virtio-gpu: use virgl thread sync with the data-plane Marc-André Lureau
2016-09-04 22:20 ` [Qemu-devel] [PATCH 17/18] virtio-gpu: schedule a bh to unblock " Marc-André Lureau
2016-09-04 22:20 ` [Qemu-devel] [PATCH 18/18] virtio-gpu: start/stop " Marc-André Lureau
2016-09-04 22:46 ` [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread no-reply
2016-09-04 22:48 ` no-reply
2016-09-08  6:01 ` Gerd Hoffmann
2016-09-08  6:38   ` Marc-André Lureau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.