summary refs log tree commit diff stats
path: root/hw/display
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2018-07-02 18:24:43 +0200
committerGerd Hoffmann <kraxel@redhat.com>2018-07-03 11:19:39 +0200
commit1fccd7c5a9a722a9cbf1bc91693f4618034f01ac (patch)
treea8ae22f79aaedb01f468059129880c8728e9f1ad /hw/display
parentc806cfa036a7ec991170eb9899f3a676bfcc3253 (diff)
downloadfocaccia-qemu-1fccd7c5a9a722a9cbf1bc91693f4618034f01ac.tar.gz
focaccia-qemu-1fccd7c5a9a722a9cbf1bc91693f4618034f01ac.zip
virtio-gpu: disable scanout when backing resource is destroyed
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20180702162443.16796-4-kraxel@redhat.com
Diffstat (limited to 'hw/display')
-rw-r--r--hw/display/virtio-gpu.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 336dc59007..08cd567218 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -430,6 +430,16 @@ static void virtio_gpu_disable_scanout(VirtIOGPU *g, int scanout_id)
 static void virtio_gpu_resource_destroy(VirtIOGPU *g,
                                         struct virtio_gpu_simple_resource *res)
 {
+    int i;
+
+    if (res->scanout_bitmask) {
+        for (i = 0; i < g->conf.max_outputs; i++) {
+            if (res->scanout_bitmask & (1 << i)) {
+                virtio_gpu_disable_scanout(g, i);
+            }
+        }
+    }
+
     pixman_image_unref(res->image);
     virtio_gpu_cleanup_mapping(res);
     QTAILQ_REMOVE(&g->reslist, res, next);