qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/4] virtio-gpu fixes (resend)
@ 2019-02-21 11:43 Marc-André Lureau
  2019-02-21 11:43 ` [Qemu-devel] [PATCH 1/4] virtio-gpu: remove unused qdev Marc-André Lureau
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Marc-André Lureau @ 2019-02-21 11:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: kraxel

Hi,

Here are a few patches that were in the vhost-user-gpu series, but are
worth to consider separately. In particular, "virtio-gpu: block both
2d and 3d rendering" fixes a bug reported on RH bugzilla recently.

Marc-André Lureau (4):
  virtio-gpu: remove unused qdev
  virtio-gpu: remove unused config_size
  virtio-gpu: block both 2d and 3d rendering
  virtio-gpu: remove useless 'waiting' field

 include/hw/virtio/virtio-gpu.h |  5 -----
 hw/display/virtio-gpu-3d.c     | 21 ---------------------
 hw/display/virtio-gpu.c        | 31 ++++++++++++++++++++++---------
 3 files changed, 22 insertions(+), 35 deletions(-)

-- 
2.21.0.rc1

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

* [Qemu-devel] [PATCH 1/4] virtio-gpu: remove unused qdev
  2019-02-21 11:43 [Qemu-devel] [PATCH 0/4] virtio-gpu fixes (resend) Marc-André Lureau
@ 2019-02-21 11:43 ` Marc-André Lureau
  2019-02-21 16:46   ` Christophe Fergeau
  2019-02-21 17:36   ` Philippe Mathieu-Daudé
  2019-02-21 11:43 ` [Qemu-devel] [PATCH 2/4] virtio-gpu: remove unused config_size Marc-André Lureau
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 12+ messages in thread
From: Marc-André Lureau @ 2019-02-21 11:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: kraxel

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

diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index c8c599f1b9..c7cb821ae3 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -97,7 +97,6 @@ typedef struct VirtIOGPU {
     int enable;
 
     int config_size;
-    DeviceState *qdev;
 
     QTAILQ_HEAD(, virtio_gpu_simple_resource) reslist;
     QTAILQ_HEAD(, virtio_gpu_ctrl_command) cmdq;
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index c6fab56f9b..a52c2aed0e 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -1268,7 +1268,6 @@ static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
     QTAILQ_INIT(&g->fenceq);
 
     g->enabled_output_bitmask = 1;
-    g->qdev = qdev;
 
     for (i = 0; i < g->conf.max_outputs; i++) {
         g->scanout[i].con =
-- 
2.21.0.rc1

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

* [Qemu-devel] [PATCH 2/4] virtio-gpu: remove unused config_size
  2019-02-21 11:43 [Qemu-devel] [PATCH 0/4] virtio-gpu fixes (resend) Marc-André Lureau
  2019-02-21 11:43 ` [Qemu-devel] [PATCH 1/4] virtio-gpu: remove unused qdev Marc-André Lureau
@ 2019-02-21 11:43 ` Marc-André Lureau
  2019-02-21 16:51   ` Christophe Fergeau
  2019-02-21 17:37   ` Philippe Mathieu-Daudé
  2019-02-21 11:43 ` [Qemu-devel] [PATCH 3/4] virtio-gpu: block both 2d and 3d rendering Marc-André Lureau
  2019-02-21 11:43 ` [Qemu-devel] [PATCH 4/4] virtio-gpu: remove useless 'waiting' field Marc-André Lureau
  3 siblings, 2 replies; 12+ messages in thread
From: Marc-André Lureau @ 2019-02-21 11:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: kraxel

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

diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index c7cb821ae3..a1cecd1df8 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -96,8 +96,6 @@ typedef struct VirtIOGPU {
 
     int enable;
 
-    int config_size;
-
     QTAILQ_HEAD(, virtio_gpu_simple_resource) reslist;
     QTAILQ_HEAD(, virtio_gpu_ctrl_command) cmdq;
     QTAILQ_HEAD(, virtio_gpu_ctrl_command) fenceq;
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index a52c2aed0e..8f4351420b 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -1238,10 +1238,9 @@ static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
         }
     }
 
-    g->config_size = sizeof(struct virtio_gpu_config);
     g->virtio_config.num_scanouts = cpu_to_le32(g->conf.max_outputs);
     virtio_init(VIRTIO_DEVICE(g), "virtio-gpu", VIRTIO_ID_GPU,
-                g->config_size);
+                sizeof(struct virtio_gpu_config));
 
     g->req_state[0].width = g->conf.xres;
     g->req_state[0].height = g->conf.yres;
-- 
2.21.0.rc1

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

* [Qemu-devel] [PATCH 3/4] virtio-gpu: block both 2d and 3d rendering
  2019-02-21 11:43 [Qemu-devel] [PATCH 0/4] virtio-gpu fixes (resend) Marc-André Lureau
  2019-02-21 11:43 ` [Qemu-devel] [PATCH 1/4] virtio-gpu: remove unused qdev Marc-André Lureau
  2019-02-21 11:43 ` [Qemu-devel] [PATCH 2/4] virtio-gpu: remove unused config_size Marc-André Lureau
@ 2019-02-21 11:43 ` Marc-André Lureau
  2019-02-21 16:53   ` Christophe Fergeau
  2019-02-21 11:43 ` [Qemu-devel] [PATCH 4/4] virtio-gpu: remove useless 'waiting' field Marc-André Lureau
  3 siblings, 1 reply; 12+ messages in thread
From: Marc-André Lureau @ 2019-02-21 11:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: kraxel

Now that 2d commands are translated to 3d rendering, qemu must stop
sending 3d updates (from 2d) to Spice as well.

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1674324

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

diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index a1cecd1df8..f8cd8ee96f 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -169,7 +169,6 @@ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g,
                                   struct virtio_gpu_ctrl_command *cmd);
 void virtio_gpu_virgl_fence_poll(VirtIOGPU *g);
 void virtio_gpu_virgl_reset(VirtIOGPU *g);
-void virtio_gpu_gl_block(void *opaque, bool block);
 int virtio_gpu_virgl_init(VirtIOGPU *g);
 int virtio_gpu_virgl_get_num_capsets(VirtIOGPU *g);
 #endif
diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
index bc6e99c943..cb83479ed2 100644
--- a/hw/display/virtio-gpu-3d.c
+++ b/hw/display/virtio-gpu-3d.c
@@ -404,11 +404,6 @@ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g,
 {
     VIRTIO_GPU_FILL_CMD(cmd->cmd_hdr);
 
-    cmd->waiting = g->renderer_blocked;
-    if (cmd->waiting) {
-        return;
-    }
-
     virgl_renderer_force_ctx_0();
     switch (cmd->cmd_hdr.type) {
     case VIRTIO_GPU_CMD_CTX_CREATE:
@@ -604,22 +599,6 @@ void virtio_gpu_virgl_reset(VirtIOGPU *g)
     }
 }
 
-void virtio_gpu_gl_block(void *opaque, bool block)
-{
-    VirtIOGPU *g = opaque;
-
-    if (block) {
-        g->renderer_blocked++;
-    } else {
-        g->renderer_blocked--;
-    }
-    assert(g->renderer_blocked >= 0);
-
-    if (g->renderer_blocked == 0) {
-        virtio_gpu_process_cmdq(g);
-    }
-}
-
 int virtio_gpu_virgl_init(VirtIOGPU *g)
 {
     int ret;
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 8f4351420b..7ada4b83ac 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -889,12 +889,15 @@ void virtio_gpu_process_cmdq(VirtIOGPU *g)
     while (!QTAILQ_EMPTY(&g->cmdq)) {
         cmd = QTAILQ_FIRST(&g->cmdq);
 
-        /* process command */
-        VIRGL(g, virtio_gpu_virgl_process_cmd, virtio_gpu_simple_process_cmd,
-              g, cmd);
+        cmd->waiting = g->renderer_blocked;
         if (cmd->waiting) {
             break;
         }
+
+        /* process command */
+        VIRGL(g, virtio_gpu_virgl_process_cmd, virtio_gpu_simple_process_cmd,
+              g, cmd);
+
         QTAILQ_REMOVE(&g->cmdq, cmd, next);
         if (virtio_gpu_stats_enabled(g->conf)) {
             g->stats.requests++;
@@ -1030,14 +1033,28 @@ static int virtio_gpu_ui_info(void *opaque, uint32_t idx, QemuUIInfo *info)
     return 0;
 }
 
+static void virtio_gpu_gl_block(void *opaque, bool block)
+{
+    VirtIOGPU *g = opaque;
+
+    if (block) {
+        g->renderer_blocked++;
+    } else {
+        g->renderer_blocked--;
+    }
+    assert(g->renderer_blocked >= 0);
+
+    if (g->renderer_blocked == 0) {
+        virtio_gpu_process_cmdq(g);
+    }
+}
+
 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,
-#ifdef CONFIG_VIRGL
     .gl_block = virtio_gpu_gl_block,
-#endif
 };
 
 static const VMStateDescription vmstate_virtio_gpu_scanout = {
-- 
2.21.0.rc1

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

* [Qemu-devel] [PATCH 4/4] virtio-gpu: remove useless 'waiting' field
  2019-02-21 11:43 [Qemu-devel] [PATCH 0/4] virtio-gpu fixes (resend) Marc-André Lureau
                   ` (2 preceding siblings ...)
  2019-02-21 11:43 ` [Qemu-devel] [PATCH 3/4] virtio-gpu: block both 2d and 3d rendering Marc-André Lureau
@ 2019-02-21 11:43 ` Marc-André Lureau
  2019-02-21 16:53   ` Christophe Fergeau
  2019-02-21 17:38   ` Philippe Mathieu-Daudé
  3 siblings, 2 replies; 12+ messages in thread
From: Marc-André Lureau @ 2019-02-21 11:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: kraxel

Let's check renderer_blocked instead directly.

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

diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index f8cd8ee96f..26a6698266 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -81,7 +81,6 @@ struct virtio_gpu_ctrl_command {
     VirtQueue *vq;
     struct virtio_gpu_ctrl_hdr cmd_hdr;
     uint32_t error;
-    bool waiting;
     bool finished;
     QTAILQ_ENTRY(virtio_gpu_ctrl_command) next;
 };
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 7ada4b83ac..0baa9ac0ad 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -889,8 +889,7 @@ void virtio_gpu_process_cmdq(VirtIOGPU *g)
     while (!QTAILQ_EMPTY(&g->cmdq)) {
         cmd = QTAILQ_FIRST(&g->cmdq);
 
-        cmd->waiting = g->renderer_blocked;
-        if (cmd->waiting) {
+        if (g->renderer_blocked) {
             break;
         }
 
@@ -939,7 +938,6 @@ static void virtio_gpu_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
         cmd->vq = vq;
         cmd->error = 0;
         cmd->finished = false;
-        cmd->waiting = false;
         QTAILQ_INSERT_TAIL(&g->cmdq, cmd, next);
         cmd = virtqueue_pop(vq, sizeof(struct virtio_gpu_ctrl_command));
     }
-- 
2.21.0.rc1

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

* Re: [Qemu-devel] [PATCH 1/4] virtio-gpu: remove unused qdev
  2019-02-21 11:43 ` [Qemu-devel] [PATCH 1/4] virtio-gpu: remove unused qdev Marc-André Lureau
@ 2019-02-21 16:46   ` Christophe Fergeau
  2019-02-21 17:36   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 12+ messages in thread
From: Christophe Fergeau @ 2019-02-21 16:46 UTC (permalink / raw)
  To: Marc-André Lureau; +Cc: qemu-devel, kraxel

[-- Attachment #1: Type: text/plain, Size: 1249 bytes --]


Reviewed-by: Christophe Fergeau <cfergeau@redhat.com>

On Thu, Feb 21, 2019 at 12:43:27PM +0100, Marc-André Lureau wrote:
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  include/hw/virtio/virtio-gpu.h | 1 -
>  hw/display/virtio-gpu.c        | 1 -
>  2 files changed, 2 deletions(-)
> 
> diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
> index c8c599f1b9..c7cb821ae3 100644
> --- a/include/hw/virtio/virtio-gpu.h
> +++ b/include/hw/virtio/virtio-gpu.h
> @@ -97,7 +97,6 @@ typedef struct VirtIOGPU {
>      int enable;
>  
>      int config_size;
> -    DeviceState *qdev;
>  
>      QTAILQ_HEAD(, virtio_gpu_simple_resource) reslist;
>      QTAILQ_HEAD(, virtio_gpu_ctrl_command) cmdq;
> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
> index c6fab56f9b..a52c2aed0e 100644
> --- a/hw/display/virtio-gpu.c
> +++ b/hw/display/virtio-gpu.c
> @@ -1268,7 +1268,6 @@ static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
>      QTAILQ_INIT(&g->fenceq);
>  
>      g->enabled_output_bitmask = 1;
> -    g->qdev = qdev;
>  
>      for (i = 0; i < g->conf.max_outputs; i++) {
>          g->scanout[i].con =
> -- 
> 2.21.0.rc1
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [Qemu-devel] [PATCH 2/4] virtio-gpu: remove unused config_size
  2019-02-21 11:43 ` [Qemu-devel] [PATCH 2/4] virtio-gpu: remove unused config_size Marc-André Lureau
@ 2019-02-21 16:51   ` Christophe Fergeau
  2019-02-21 17:37   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 12+ messages in thread
From: Christophe Fergeau @ 2019-02-21 16:51 UTC (permalink / raw)
  To: Marc-André Lureau; +Cc: qemu-devel, kraxel

[-- Attachment #1: Type: text/plain, Size: 1529 bytes --]

Reviewed-by: Christophe Fergeau <cfergeau@redhat.com>

On Thu, Feb 21, 2019 at 12:43:28PM +0100, Marc-André Lureau wrote:
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  include/hw/virtio/virtio-gpu.h | 2 --
>  hw/display/virtio-gpu.c        | 3 +--
>  2 files changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
> index c7cb821ae3..a1cecd1df8 100644
> --- a/include/hw/virtio/virtio-gpu.h
> +++ b/include/hw/virtio/virtio-gpu.h
> @@ -96,8 +96,6 @@ typedef struct VirtIOGPU {
>  
>      int enable;
>  
> -    int config_size;
> -
>      QTAILQ_HEAD(, virtio_gpu_simple_resource) reslist;
>      QTAILQ_HEAD(, virtio_gpu_ctrl_command) cmdq;
>      QTAILQ_HEAD(, virtio_gpu_ctrl_command) fenceq;
> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
> index a52c2aed0e..8f4351420b 100644
> --- a/hw/display/virtio-gpu.c
> +++ b/hw/display/virtio-gpu.c
> @@ -1238,10 +1238,9 @@ static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
>          }
>      }
>  
> -    g->config_size = sizeof(struct virtio_gpu_config);
>      g->virtio_config.num_scanouts = cpu_to_le32(g->conf.max_outputs);
>      virtio_init(VIRTIO_DEVICE(g), "virtio-gpu", VIRTIO_ID_GPU,
> -                g->config_size);
> +                sizeof(struct virtio_gpu_config));
>  
>      g->req_state[0].width = g->conf.xres;
>      g->req_state[0].height = g->conf.yres;
> -- 
> 2.21.0.rc1
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [Qemu-devel] [PATCH 3/4] virtio-gpu: block both 2d and 3d rendering
  2019-02-21 11:43 ` [Qemu-devel] [PATCH 3/4] virtio-gpu: block both 2d and 3d rendering Marc-André Lureau
@ 2019-02-21 16:53   ` Christophe Fergeau
  0 siblings, 0 replies; 12+ messages in thread
From: Christophe Fergeau @ 2019-02-21 16:53 UTC (permalink / raw)
  To: Marc-André Lureau; +Cc: qemu-devel, kraxel

[-- Attachment #1: Type: text/plain, Size: 4306 bytes --]

I came up with the same fix while looking at that bug before seeing
Marc-André's patch.
Then I tested Marc-André's patch.
So for this patch,

Reviewed-by: Christophe Fergeau <cfergeau@redhat.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>

On Thu, Feb 21, 2019 at 12:43:29PM +0100, Marc-André Lureau wrote:
> Now that 2d commands are translated to 3d rendering, qemu must stop
> sending 3d updates (from 2d) to Spice as well.
> 
> Fixes:
> https://bugzilla.redhat.com/show_bug.cgi?id=1674324
> 
> Cc: cfergeau@redhat.com
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  include/hw/virtio/virtio-gpu.h |  1 -
>  hw/display/virtio-gpu-3d.c     | 21 ---------------------
>  hw/display/virtio-gpu.c        | 27 ++++++++++++++++++++++-----
>  3 files changed, 22 insertions(+), 27 deletions(-)
> 
> diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
> index a1cecd1df8..f8cd8ee96f 100644
> --- a/include/hw/virtio/virtio-gpu.h
> +++ b/include/hw/virtio/virtio-gpu.h
> @@ -169,7 +169,6 @@ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g,
>                                    struct virtio_gpu_ctrl_command *cmd);
>  void virtio_gpu_virgl_fence_poll(VirtIOGPU *g);
>  void virtio_gpu_virgl_reset(VirtIOGPU *g);
> -void virtio_gpu_gl_block(void *opaque, bool block);
>  int virtio_gpu_virgl_init(VirtIOGPU *g);
>  int virtio_gpu_virgl_get_num_capsets(VirtIOGPU *g);
>  #endif
> diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
> index bc6e99c943..cb83479ed2 100644
> --- a/hw/display/virtio-gpu-3d.c
> +++ b/hw/display/virtio-gpu-3d.c
> @@ -404,11 +404,6 @@ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g,
>  {
>      VIRTIO_GPU_FILL_CMD(cmd->cmd_hdr);
>  
> -    cmd->waiting = g->renderer_blocked;
> -    if (cmd->waiting) {
> -        return;
> -    }
> -
>      virgl_renderer_force_ctx_0();
>      switch (cmd->cmd_hdr.type) {
>      case VIRTIO_GPU_CMD_CTX_CREATE:
> @@ -604,22 +599,6 @@ void virtio_gpu_virgl_reset(VirtIOGPU *g)
>      }
>  }
>  
> -void virtio_gpu_gl_block(void *opaque, bool block)
> -{
> -    VirtIOGPU *g = opaque;
> -
> -    if (block) {
> -        g->renderer_blocked++;
> -    } else {
> -        g->renderer_blocked--;
> -    }
> -    assert(g->renderer_blocked >= 0);
> -
> -    if (g->renderer_blocked == 0) {
> -        virtio_gpu_process_cmdq(g);
> -    }
> -}
> -
>  int virtio_gpu_virgl_init(VirtIOGPU *g)
>  {
>      int ret;
> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
> index 8f4351420b..7ada4b83ac 100644
> --- a/hw/display/virtio-gpu.c
> +++ b/hw/display/virtio-gpu.c
> @@ -889,12 +889,15 @@ void virtio_gpu_process_cmdq(VirtIOGPU *g)
>      while (!QTAILQ_EMPTY(&g->cmdq)) {
>          cmd = QTAILQ_FIRST(&g->cmdq);
>  
> -        /* process command */
> -        VIRGL(g, virtio_gpu_virgl_process_cmd, virtio_gpu_simple_process_cmd,
> -              g, cmd);
> +        cmd->waiting = g->renderer_blocked;
>          if (cmd->waiting) {
>              break;
>          }
> +
> +        /* process command */
> +        VIRGL(g, virtio_gpu_virgl_process_cmd, virtio_gpu_simple_process_cmd,
> +              g, cmd);
> +
>          QTAILQ_REMOVE(&g->cmdq, cmd, next);
>          if (virtio_gpu_stats_enabled(g->conf)) {
>              g->stats.requests++;
> @@ -1030,14 +1033,28 @@ static int virtio_gpu_ui_info(void *opaque, uint32_t idx, QemuUIInfo *info)
>      return 0;
>  }
>  
> +static void virtio_gpu_gl_block(void *opaque, bool block)
> +{
> +    VirtIOGPU *g = opaque;
> +
> +    if (block) {
> +        g->renderer_blocked++;
> +    } else {
> +        g->renderer_blocked--;
> +    }
> +    assert(g->renderer_blocked >= 0);
> +
> +    if (g->renderer_blocked == 0) {
> +        virtio_gpu_process_cmdq(g);
> +    }
> +}
> +
>  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,
> -#ifdef CONFIG_VIRGL
>      .gl_block = virtio_gpu_gl_block,
> -#endif
>  };
>  
>  static const VMStateDescription vmstate_virtio_gpu_scanout = {
> -- 
> 2.21.0.rc1
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [Qemu-devel] [PATCH 4/4] virtio-gpu: remove useless 'waiting' field
  2019-02-21 11:43 ` [Qemu-devel] [PATCH 4/4] virtio-gpu: remove useless 'waiting' field Marc-André Lureau
@ 2019-02-21 16:53   ` Christophe Fergeau
  2019-02-21 17:38   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 12+ messages in thread
From: Christophe Fergeau @ 2019-02-21 16:53 UTC (permalink / raw)
  To: Marc-André Lureau; +Cc: qemu-devel, kraxel

[-- Attachment #1: Type: text/plain, Size: 1715 bytes --]


Reviewed-by: Christophe Fergeau <cfergeau@redhat.com>

On Thu, Feb 21, 2019 at 12:43:30PM +0100, Marc-André Lureau wrote:
> Let's check renderer_blocked instead directly.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  include/hw/virtio/virtio-gpu.h | 1 -
>  hw/display/virtio-gpu.c        | 4 +---
>  2 files changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
> index f8cd8ee96f..26a6698266 100644
> --- a/include/hw/virtio/virtio-gpu.h
> +++ b/include/hw/virtio/virtio-gpu.h
> @@ -81,7 +81,6 @@ struct virtio_gpu_ctrl_command {
>      VirtQueue *vq;
>      struct virtio_gpu_ctrl_hdr cmd_hdr;
>      uint32_t error;
> -    bool waiting;
>      bool finished;
>      QTAILQ_ENTRY(virtio_gpu_ctrl_command) next;
>  };
> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
> index 7ada4b83ac..0baa9ac0ad 100644
> --- a/hw/display/virtio-gpu.c
> +++ b/hw/display/virtio-gpu.c
> @@ -889,8 +889,7 @@ void virtio_gpu_process_cmdq(VirtIOGPU *g)
>      while (!QTAILQ_EMPTY(&g->cmdq)) {
>          cmd = QTAILQ_FIRST(&g->cmdq);
>  
> -        cmd->waiting = g->renderer_blocked;
> -        if (cmd->waiting) {
> +        if (g->renderer_blocked) {
>              break;
>          }
>  
> @@ -939,7 +938,6 @@ static void virtio_gpu_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
>          cmd->vq = vq;
>          cmd->error = 0;
>          cmd->finished = false;
> -        cmd->waiting = false;
>          QTAILQ_INSERT_TAIL(&g->cmdq, cmd, next);
>          cmd = virtqueue_pop(vq, sizeof(struct virtio_gpu_ctrl_command));
>      }
> -- 
> 2.21.0.rc1
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [Qemu-devel] [PATCH 1/4] virtio-gpu: remove unused qdev
  2019-02-21 11:43 ` [Qemu-devel] [PATCH 1/4] virtio-gpu: remove unused qdev Marc-André Lureau
  2019-02-21 16:46   ` Christophe Fergeau
@ 2019-02-21 17:36   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-02-21 17:36 UTC (permalink / raw)
  To: Marc-André Lureau, qemu-devel; +Cc: kraxel

On 2/21/19 12:43 PM, Marc-André Lureau wrote:
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  include/hw/virtio/virtio-gpu.h | 1 -
>  hw/display/virtio-gpu.c        | 1 -
>  2 files changed, 2 deletions(-)
> 
> diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
> index c8c599f1b9..c7cb821ae3 100644
> --- a/include/hw/virtio/virtio-gpu.h
> +++ b/include/hw/virtio/virtio-gpu.h
> @@ -97,7 +97,6 @@ typedef struct VirtIOGPU {
>      int enable;
>  
>      int config_size;
> -    DeviceState *qdev;
>  
>      QTAILQ_HEAD(, virtio_gpu_simple_resource) reslist;
>      QTAILQ_HEAD(, virtio_gpu_ctrl_command) cmdq;
> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
> index c6fab56f9b..a52c2aed0e 100644
> --- a/hw/display/virtio-gpu.c
> +++ b/hw/display/virtio-gpu.c
> @@ -1268,7 +1268,6 @@ static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
>      QTAILQ_INIT(&g->fenceq);
>  
>      g->enabled_output_bitmask = 1;
> -    g->qdev = qdev;
>  
>      for (i = 0; i < g->conf.max_outputs; i++) {
>          g->scanout[i].con =
> 

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

* Re: [Qemu-devel] [PATCH 2/4] virtio-gpu: remove unused config_size
  2019-02-21 11:43 ` [Qemu-devel] [PATCH 2/4] virtio-gpu: remove unused config_size Marc-André Lureau
  2019-02-21 16:51   ` Christophe Fergeau
@ 2019-02-21 17:37   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-02-21 17:37 UTC (permalink / raw)
  To: Marc-André Lureau, qemu-devel; +Cc: kraxel

On 2/21/19 12:43 PM, Marc-André Lureau wrote:
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  include/hw/virtio/virtio-gpu.h | 2 --
>  hw/display/virtio-gpu.c        | 3 +--
>  2 files changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
> index c7cb821ae3..a1cecd1df8 100644
> --- a/include/hw/virtio/virtio-gpu.h
> +++ b/include/hw/virtio/virtio-gpu.h
> @@ -96,8 +96,6 @@ typedef struct VirtIOGPU {
>  
>      int enable;
>  
> -    int config_size;
> -
>      QTAILQ_HEAD(, virtio_gpu_simple_resource) reslist;
>      QTAILQ_HEAD(, virtio_gpu_ctrl_command) cmdq;
>      QTAILQ_HEAD(, virtio_gpu_ctrl_command) fenceq;
> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
> index a52c2aed0e..8f4351420b 100644
> --- a/hw/display/virtio-gpu.c
> +++ b/hw/display/virtio-gpu.c
> @@ -1238,10 +1238,9 @@ static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
>          }
>      }
>  
> -    g->config_size = sizeof(struct virtio_gpu_config);
>      g->virtio_config.num_scanouts = cpu_to_le32(g->conf.max_outputs);
>      virtio_init(VIRTIO_DEVICE(g), "virtio-gpu", VIRTIO_ID_GPU,
> -                g->config_size);

Well, it is "used" but we can simplify.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> +                sizeof(struct virtio_gpu_config));
>  
>      g->req_state[0].width = g->conf.xres;
>      g->req_state[0].height = g->conf.yres;
> 

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

* Re: [Qemu-devel] [PATCH 4/4] virtio-gpu: remove useless 'waiting' field
  2019-02-21 11:43 ` [Qemu-devel] [PATCH 4/4] virtio-gpu: remove useless 'waiting' field Marc-André Lureau
  2019-02-21 16:53   ` Christophe Fergeau
@ 2019-02-21 17:38   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-02-21 17:38 UTC (permalink / raw)
  To: Marc-André Lureau, qemu-devel; +Cc: kraxel

On 2/21/19 12:43 PM, Marc-André Lureau wrote:
> Let's check renderer_blocked instead directly.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  include/hw/virtio/virtio-gpu.h | 1 -
>  hw/display/virtio-gpu.c        | 4 +---
>  2 files changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
> index f8cd8ee96f..26a6698266 100644
> --- a/include/hw/virtio/virtio-gpu.h
> +++ b/include/hw/virtio/virtio-gpu.h
> @@ -81,7 +81,6 @@ struct virtio_gpu_ctrl_command {
>      VirtQueue *vq;
>      struct virtio_gpu_ctrl_hdr cmd_hdr;
>      uint32_t error;
> -    bool waiting;
>      bool finished;
>      QTAILQ_ENTRY(virtio_gpu_ctrl_command) next;
>  };
> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
> index 7ada4b83ac..0baa9ac0ad 100644
> --- a/hw/display/virtio-gpu.c
> +++ b/hw/display/virtio-gpu.c
> @@ -889,8 +889,7 @@ void virtio_gpu_process_cmdq(VirtIOGPU *g)
>      while (!QTAILQ_EMPTY(&g->cmdq)) {
>          cmd = QTAILQ_FIRST(&g->cmdq);
>  
> -        cmd->waiting = g->renderer_blocked;
> -        if (cmd->waiting) {
> +        if (g->renderer_blocked) {
>              break;
>          }
>  
> @@ -939,7 +938,6 @@ static void virtio_gpu_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
>          cmd->vq = vq;
>          cmd->error = 0;
>          cmd->finished = false;
> -        cmd->waiting = false;
>          QTAILQ_INSERT_TAIL(&g->cmdq, cmd, next);
>          cmd = virtqueue_pop(vq, sizeof(struct virtio_gpu_ctrl_command));
>      }
> 

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

end of thread, other threads:[~2019-02-21 17:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-21 11:43 [Qemu-devel] [PATCH 0/4] virtio-gpu fixes (resend) Marc-André Lureau
2019-02-21 11:43 ` [Qemu-devel] [PATCH 1/4] virtio-gpu: remove unused qdev Marc-André Lureau
2019-02-21 16:46   ` Christophe Fergeau
2019-02-21 17:36   ` Philippe Mathieu-Daudé
2019-02-21 11:43 ` [Qemu-devel] [PATCH 2/4] virtio-gpu: remove unused config_size Marc-André Lureau
2019-02-21 16:51   ` Christophe Fergeau
2019-02-21 17:37   ` Philippe Mathieu-Daudé
2019-02-21 11:43 ` [Qemu-devel] [PATCH 3/4] virtio-gpu: block both 2d and 3d rendering Marc-André Lureau
2019-02-21 16:53   ` Christophe Fergeau
2019-02-21 11:43 ` [Qemu-devel] [PATCH 4/4] virtio-gpu: remove useless 'waiting' field Marc-André Lureau
2019-02-21 16:53   ` Christophe Fergeau
2019-02-21 17:38   ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).