mac_newworld: Turn CORE99_VIA_CONFIG defines into an enum
[qemu/armbru.git] / hw / display / vhost-user-vga.c
blob0c146080fd2c15ff9fd86338164e3969a3e1c355
1 /*
2 * vhost-user VGA device
4 * Copyright Red Hat, Inc. 2018
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.
9 */
11 #include "qemu/osdep.h"
12 #include "qapi/error.h"
13 #include "virtio-vga.h"
14 #include "qom/object.h"
16 #define TYPE_VHOST_USER_VGA "vhost-user-vga"
18 typedef struct VhostUserVGA VhostUserVGA;
19 DECLARE_INSTANCE_CHECKER(VhostUserVGA, VHOST_USER_VGA,
20 TYPE_VHOST_USER_VGA)
22 struct VhostUserVGA {
23 VirtIOVGABase parent_obj;
25 VhostUserGPU vdev;
28 static void vhost_user_vga_inst_initfn(Object *obj)
30 VhostUserVGA *dev = VHOST_USER_VGA(obj);
32 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
33 TYPE_VHOST_USER_GPU);
35 VIRTIO_VGA_BASE(dev)->vgpu = VIRTIO_GPU_BASE(&dev->vdev);
37 object_property_add_alias(obj, "chardev",
38 OBJECT(&dev->vdev), "chardev");
41 static const VirtioPCIDeviceTypeInfo vhost_user_vga_info = {
42 .generic_name = TYPE_VHOST_USER_VGA,
43 .parent = TYPE_VIRTIO_VGA_BASE,
44 .instance_size = sizeof(VhostUserVGA),
45 .instance_init = vhost_user_vga_inst_initfn,
47 module_obj(TYPE_VHOST_USER_VGA);
48 module_kconfig(VHOST_USER_VGA);
50 static void vhost_user_vga_register_types(void)
52 virtio_pci_types_register(&vhost_user_vga_info);
55 type_init(vhost_user_vga_register_types)