]> git.proxmox.com Git - mirror_qemu.git/commitdiff
virtio-gpu: disable scanout when backing resource is destroyed
authorGerd Hoffmann <kraxel@redhat.com>
Mon, 2 Jul 2018 16:24:43 +0000 (18:24 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 3 Jul 2018 09:19:39 +0000 (11:19 +0200)
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

hw/display/virtio-gpu.c

index 336dc5900762f2790fb8dff0d7d7e45ab4c0801f..08cd5672187a9abe8ec773dabe19a171f4992af0 100644 (file)
@@ -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);