@@ -67,7 +67,7 @@ softmmu_ss.add(when: [pixman, 'CONFIG_ATI_VGA'], if_true: files('ati.c', 'ati_2d
if config_all_devices.has_key('CONFIG_VIRTIO_GPU')
virtio_gpu_ss = ss.source_set()
virtio_gpu_ss.add(when: 'CONFIG_VIRTIO_GPU',
- if_true: [files('virtio-gpu-base.c', 'virtio-gpu.c'), pixman])
+ if_true: [files('virtio-gpu-base.c', 'virtio-gpu.c'), pixman, virgl])
virtio_gpu_ss.add(when: 'CONFIG_LINUX', if_true: files('virtio-gpu-udmabuf.c'),
if_false: files('virtio-gpu-udmabuf-stubs.c'))
virtio_gpu_ss.add(when: 'CONFIG_VHOST_USER_GPU', if_true: files('vhost-user-gpu.c'))
@@ -636,23 +636,6 @@ static void virgl_cmd_resource_map_blob(VirtIOGPU *g,
virtio_gpu_ctrl_response(g, cmd, &resp.hdr, sizeof(resp));
}
-int virtio_gpu_virgl_resource_unmap(VirtIOGPU *g,
- struct virtio_gpu_simple_resource *res)
-{
- if (!res->mapped) {
- qemu_log_mask(LOG_GUEST_ERROR, "%s: resource already unmapped %d\n",
- __func__, res->resource_id);
- return VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID;
- }
-
- memory_region_set_enabled(&res->region, false);
- memory_region_del_subregion(&g->parent_obj.hostmem, &res->region);
- object_unparent(OBJECT(&res->region));
-
- res->mapped = NULL;
- return virgl_renderer_resource_unmap(res->resource_id);
-}
-
static void virgl_cmd_resource_unmap_blob(VirtIOGPU *g,
struct virtio_gpu_ctrl_command *cmd)
{
@@ -31,6 +31,8 @@
#include "qapi/error.h"
#include "qemu/error-report.h"
+#include <virglrenderer.h>
+
#define VIRTIO_GPU_VM_VERSION 1
static struct virtio_gpu_simple_resource *
@@ -873,6 +875,23 @@ void virtio_gpu_cleanup_mapping_iov(VirtIOGPU *g,
g_free(iov);
}
+int virtio_gpu_virgl_resource_unmap(VirtIOGPU *g,
+ struct virtio_gpu_simple_resource *res)
+{
+ if (!res->mapped) {
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: resource already unmapped %d\n",
+ __func__, res->resource_id);
+ return VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID;
+ }
+
+ memory_region_set_enabled(&res->region, false);
+ memory_region_del_subregion(&g->parent_obj.hostmem, &res->region);
+ object_unparent(OBJECT(&res->region));
+
+ res->mapped = NULL;
+ return virgl_renderer_resource_unmap(res->resource_id);
+}
+
static void virtio_gpu_cleanup_mapping(VirtIOGPU *g,
struct virtio_gpu_simple_resource *res)
{