]>
Commit | Line | Data |
---|---|---|
267f6646 MAL |
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" | |
db1015e9 | 14 | #include "qom/object.h" |
267f6646 MAL |
15 | |
16 | #define TYPE_VHOST_USER_VGA "vhost-user-vga" | |
17 | ||
db1015e9 | 18 | typedef struct VhostUserVGA VhostUserVGA; |
8110fa1d EH |
19 | DECLARE_INSTANCE_CHECKER(VhostUserVGA, VHOST_USER_VGA, |
20 | TYPE_VHOST_USER_VGA) | |
267f6646 | 21 | |
db1015e9 | 22 | struct VhostUserVGA { |
267f6646 MAL |
23 | VirtIOVGABase parent_obj; |
24 | ||
25 | VhostUserGPU vdev; | |
db1015e9 | 26 | }; |
267f6646 MAL |
27 | |
28 | static void vhost_user_vga_inst_initfn(Object *obj) | |
29 | { | |
30 | VhostUserVGA *dev = VHOST_USER_VGA(obj); | |
31 | ||
32 | virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), | |
33 | TYPE_VHOST_USER_GPU); | |
34 | ||
35 | VIRTIO_VGA_BASE(dev)->vgpu = VIRTIO_GPU_BASE(&dev->vdev); | |
36 | ||
37 | object_property_add_alias(obj, "chardev", | |
d2623129 | 38 | OBJECT(&dev->vdev), "chardev"); |
267f6646 MAL |
39 | } |
40 | ||
41 | static const VirtioPCIDeviceTypeInfo vhost_user_vga_info = { | |
42 | .generic_name = TYPE_VHOST_USER_VGA, | |
43 | .parent = TYPE_VIRTIO_VGA_BASE, | |
2ada901f | 44 | .instance_size = sizeof(VhostUserVGA), |
267f6646 MAL |
45 | .instance_init = vhost_user_vga_inst_initfn, |
46 | }; | |
561d0f45 | 47 | module_obj(TYPE_VHOST_USER_VGA); |
267f6646 MAL |
48 | |
49 | static void vhost_user_vga_register_types(void) | |
50 | { | |
51 | virtio_pci_types_register(&vhost_user_vga_info); | |
52 | } | |
53 | ||
54 | type_init(vhost_user_vga_register_types) |