meson: convert hw/vfio
[qemu.git] / hw / display / vhost-user-vga.c
1 /*
2 * vhost-user VGA device
3 *
4 * Copyright Red Hat, Inc. 2018
5 *
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
8 *
9 */
10
11 #include "qemu/osdep.h"
12 #include "qapi/error.h"
13 #include "virtio-vga.h"
14
15 #define TYPE_VHOST_USER_VGA "vhost-user-vga"
16
17 #define VHOST_USER_VGA(obj) \
18 OBJECT_CHECK(VhostUserVGA, (obj), TYPE_VHOST_USER_VGA)
19
20 typedef struct VhostUserVGA {
21 VirtIOVGABase parent_obj;
22
23 VhostUserGPU vdev;
24 } VhostUserVGA;
25
26 static void vhost_user_vga_inst_initfn(Object *obj)
27 {
28 VhostUserVGA *dev = VHOST_USER_VGA(obj);
29
30 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
31 TYPE_VHOST_USER_GPU);
32
33 VIRTIO_VGA_BASE(dev)->vgpu = VIRTIO_GPU_BASE(&dev->vdev);
34
35 object_property_add_alias(obj, "chardev",
36 OBJECT(&dev->vdev), "chardev");
37 }
38
39 static const VirtioPCIDeviceTypeInfo vhost_user_vga_info = {
40 .generic_name = TYPE_VHOST_USER_VGA,
41 .parent = TYPE_VIRTIO_VGA_BASE,
42 .instance_size = sizeof(struct VhostUserVGA),
43 .instance_init = vhost_user_vga_inst_initfn,
44 };
45
46 static void vhost_user_vga_register_types(void)
47 {
48 virtio_pci_types_register(&vhost_user_vga_info);
49 }
50
51 type_init(vhost_user_vga_register_types)