thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
Pablo Greco e6a3ae
From 6bf01418f12a88167ec2a3244ca7b245a53c60ae Mon Sep 17 00:00:00 2001
Pablo Greco e6a3ae
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
Pablo Greco e6a3ae
Date: Wed, 16 Oct 2019 13:53:27 +0100
Pablo Greco e6a3ae
Subject: [PATCH 1/2] virtio-gpu: block both 2d and 3d rendering
Pablo Greco e6a3ae
MIME-Version: 1.0
Pablo Greco e6a3ae
Content-Type: text/plain; charset=UTF-8
Pablo Greco e6a3ae
Content-Transfer-Encoding: 8bit
Pablo Greco e6a3ae
Pablo Greco e6a3ae
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Pablo Greco e6a3ae
Message-id: <20191016135327.23601-1-marcandre.lureau@redhat.com>
Pablo Greco e6a3ae
Patchwork-id: 91814
Pablo Greco e6a3ae
O-Subject: [RHEL-8.2.0 qemu-kvm PATCH] virtio-gpu: block both 2d and 3d rendering
Pablo Greco e6a3ae
Bugzilla: 1674324
Pablo Greco e6a3ae
RH-Acked-by: John Snow <jsnow@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
Pablo Greco e6a3ae
Pablo Greco e6a3ae
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1674324
Pablo Greco e6a3ae
BRANCH: rhel-8.2.0
Pablo Greco e6a3ae
UPSTREAM: ad341aacbf4b119a88e0f9d5a1f753d6ed0fdd86
Pablo Greco e6a3ae
BREW: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=24095898
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Now that 2d commands are translated to 3d rendering, qemu must stop
Pablo Greco e6a3ae
sending 3d updates (from 2d) to Spice as well.
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Fixes:
Pablo Greco e6a3ae
https://bugzilla.redhat.com/show_bug.cgi?id=1674324
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Cc: cfergeau@redhat.com
Pablo Greco e6a3ae
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Pablo Greco e6a3ae
Reviewed-by: Christophe Fergeau <cfergeau@redhat.com>
Pablo Greco e6a3ae
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Pablo Greco e6a3ae
Message-id: 20190221114330.17968-4-marcandre.lureau@redhat.com
Pablo Greco e6a3ae
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Pablo Greco e6a3ae
Pablo Greco e6a3ae
(cherry picked from commit ad341aacbf4b119a88e0f9d5a1f753d6ed0fdd86)
Pablo Greco e6a3ae
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Pablo Greco e6a3ae
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
Pablo Greco e6a3ae
---
Pablo Greco e6a3ae
 hw/display/virtio-gpu-3d.c     | 21 ---------------------
Pablo Greco e6a3ae
 hw/display/virtio-gpu.c        | 27 ++++++++++++++++++++++-----
Pablo Greco e6a3ae
 include/hw/virtio/virtio-gpu.h |  1 -
Pablo Greco e6a3ae
 3 files changed, 22 insertions(+), 27 deletions(-)
Pablo Greco e6a3ae
Pablo Greco e6a3ae
diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
Pablo Greco e6a3ae
index 55d7640..9654c04 100644
Pablo Greco e6a3ae
--- a/hw/display/virtio-gpu-3d.c
Pablo Greco e6a3ae
+++ b/hw/display/virtio-gpu-3d.c
Pablo Greco e6a3ae
@@ -404,11 +404,6 @@ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g,
Pablo Greco e6a3ae
 {
Pablo Greco e6a3ae
     VIRTIO_GPU_FILL_CMD(cmd->cmd_hdr);
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
-    cmd->waiting = g->renderer_blocked;
Pablo Greco e6a3ae
-    if (cmd->waiting) {
Pablo Greco e6a3ae
-        return;
Pablo Greco e6a3ae
-    }
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
     virgl_renderer_force_ctx_0();
Pablo Greco e6a3ae
     switch (cmd->cmd_hdr.type) {
Pablo Greco e6a3ae
     case VIRTIO_GPU_CMD_CTX_CREATE:
Pablo Greco e6a3ae
@@ -604,22 +599,6 @@ void virtio_gpu_virgl_reset(VirtIOGPU *g)
Pablo Greco e6a3ae
     }
Pablo Greco e6a3ae
 }
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
-void virtio_gpu_gl_block(void *opaque, bool block)
Pablo Greco e6a3ae
-{
Pablo Greco e6a3ae
-    VirtIOGPU *g = opaque;
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-    if (block) {
Pablo Greco e6a3ae
-        g->renderer_blocked++;
Pablo Greco e6a3ae
-    } else {
Pablo Greco e6a3ae
-        g->renderer_blocked--;
Pablo Greco e6a3ae
-    }
Pablo Greco e6a3ae
-    assert(g->renderer_blocked >= 0);
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-    if (g->renderer_blocked == 0) {
Pablo Greco e6a3ae
-        virtio_gpu_process_cmdq(g);
Pablo Greco e6a3ae
-    }
Pablo Greco e6a3ae
-}
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
 int virtio_gpu_virgl_init(VirtIOGPU *g)
Pablo Greco e6a3ae
 {
Pablo Greco e6a3ae
     int ret;
Pablo Greco e6a3ae
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
Pablo Greco e6a3ae
index 07712d0..416ef80 100644
Pablo Greco e6a3ae
--- a/hw/display/virtio-gpu.c
Pablo Greco e6a3ae
+++ b/hw/display/virtio-gpu.c
Pablo Greco e6a3ae
@@ -888,12 +888,15 @@ void virtio_gpu_process_cmdq(VirtIOGPU *g)
Pablo Greco e6a3ae
     while (!QTAILQ_EMPTY(&g->cmdq)) {
Pablo Greco e6a3ae
         cmd = QTAILQ_FIRST(&g->cmdq);
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
-        /* process command */
Pablo Greco e6a3ae
-        VIRGL(g, virtio_gpu_virgl_process_cmd, virtio_gpu_simple_process_cmd,
Pablo Greco e6a3ae
-              g, cmd);
Pablo Greco e6a3ae
+        cmd->waiting = g->renderer_blocked;
Pablo Greco e6a3ae
         if (cmd->waiting) {
Pablo Greco e6a3ae
             break;
Pablo Greco e6a3ae
         }
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+        /* process command */
Pablo Greco e6a3ae
+        VIRGL(g, virtio_gpu_virgl_process_cmd, virtio_gpu_simple_process_cmd,
Pablo Greco e6a3ae
+              g, cmd);
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
         QTAILQ_REMOVE(&g->cmdq, cmd, next);
Pablo Greco e6a3ae
         if (virtio_gpu_stats_enabled(g->conf)) {
Pablo Greco e6a3ae
             g->stats.requests++;
Pablo Greco e6a3ae
@@ -1029,14 +1032,28 @@ static int virtio_gpu_ui_info(void *opaque, uint32_t idx, QemuUIInfo *info)
Pablo Greco e6a3ae
     return 0;
Pablo Greco e6a3ae
 }
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
+static void virtio_gpu_gl_block(void *opaque, bool block)
Pablo Greco e6a3ae
+{
Pablo Greco e6a3ae
+    VirtIOGPU *g = opaque;
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+    if (block) {
Pablo Greco e6a3ae
+        g->renderer_blocked++;
Pablo Greco e6a3ae
+    } else {
Pablo Greco e6a3ae
+        g->renderer_blocked--;
Pablo Greco e6a3ae
+    }
Pablo Greco e6a3ae
+    assert(g->renderer_blocked >= 0);
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+    if (g->renderer_blocked == 0) {
Pablo Greco e6a3ae
+        virtio_gpu_process_cmdq(g);
Pablo Greco e6a3ae
+    }
Pablo Greco e6a3ae
+}
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
 const GraphicHwOps virtio_gpu_ops = {
Pablo Greco e6a3ae
     .invalidate = virtio_gpu_invalidate_display,
Pablo Greco e6a3ae
     .gfx_update = virtio_gpu_update_display,
Pablo Greco e6a3ae
     .text_update = virtio_gpu_text_update,
Pablo Greco e6a3ae
     .ui_info = virtio_gpu_ui_info,
Pablo Greco e6a3ae
-#ifdef CONFIG_VIRGL
Pablo Greco e6a3ae
     .gl_block = virtio_gpu_gl_block,
Pablo Greco e6a3ae
-#endif
Pablo Greco e6a3ae
 };
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 static const VMStateDescription vmstate_virtio_gpu_scanout = {
Pablo Greco e6a3ae
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
Pablo Greco e6a3ae
index f95f8ce..bbeddd7 100644
Pablo Greco e6a3ae
--- a/include/hw/virtio/virtio-gpu.h
Pablo Greco e6a3ae
+++ b/include/hw/virtio/virtio-gpu.h
Pablo Greco e6a3ae
@@ -171,7 +171,6 @@ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g,
Pablo Greco e6a3ae
                                   struct virtio_gpu_ctrl_command *cmd);
Pablo Greco e6a3ae
 void virtio_gpu_virgl_fence_poll(VirtIOGPU *g);
Pablo Greco e6a3ae
 void virtio_gpu_virgl_reset(VirtIOGPU *g);
Pablo Greco e6a3ae
-void virtio_gpu_gl_block(void *opaque, bool block);
Pablo Greco e6a3ae
 int virtio_gpu_virgl_init(VirtIOGPU *g);
Pablo Greco e6a3ae
 int virtio_gpu_virgl_get_num_capsets(VirtIOGPU *g);
Pablo Greco e6a3ae
 #endif
Pablo Greco e6a3ae
-- 
Pablo Greco e6a3ae
1.8.3.1
Pablo Greco e6a3ae