yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-virtio-gpu-block-both-2d-and-3d-rendering.patch

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