xref: /qemu/hw/display/virtio-gpu-pci-gl.c (revision b21e2380)
1 /*
2  * Virtio video device
3  *
4  * Copyright Red Hat
5  *
6  * Authors:
7  *  Dave Airlie
8  *
9  * This work is licensed under the terms of the GNU GPL, version 2 or later.
10  * See the COPYING file in the top-level directory.
11  *
12  */
13 
14 #include "qemu/osdep.h"
15 #include "qapi/error.h"
16 #include "qemu/module.h"
17 #include "hw/pci/pci.h"
18 #include "hw/qdev-properties.h"
19 #include "hw/virtio/virtio.h"
20 #include "hw/virtio/virtio-bus.h"
21 #include "hw/virtio/virtio-gpu-pci.h"
22 #include "qom/object.h"
23 
24 #define TYPE_VIRTIO_GPU_GL_PCI "virtio-gpu-gl-pci"
25 typedef struct VirtIOGPUGLPCI VirtIOGPUGLPCI;
26 DECLARE_INSTANCE_CHECKER(VirtIOGPUGLPCI, VIRTIO_GPU_GL_PCI,
27                          TYPE_VIRTIO_GPU_GL_PCI)
28 
29 struct VirtIOGPUGLPCI {
30     VirtIOGPUPCIBase parent_obj;
31     VirtIOGPUGL vdev;
32 };
33 
34 static void virtio_gpu_gl_initfn(Object *obj)
35 {
36     VirtIOGPUGLPCI *dev = VIRTIO_GPU_GL_PCI(obj);
37 
38     virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
39                                 TYPE_VIRTIO_GPU_GL);
40     VIRTIO_GPU_PCI_BASE(obj)->vgpu = VIRTIO_GPU_BASE(&dev->vdev);
41 }
42 
43 static const VirtioPCIDeviceTypeInfo virtio_gpu_gl_pci_info = {
44     .generic_name = TYPE_VIRTIO_GPU_GL_PCI,
45     .parent = TYPE_VIRTIO_GPU_PCI_BASE,
46     .instance_size = sizeof(VirtIOGPUGLPCI),
47     .instance_init = virtio_gpu_gl_initfn,
48 };
49 module_obj(TYPE_VIRTIO_GPU_GL_PCI);
50 
51 static void virtio_gpu_gl_pci_register_types(void)
52 {
53     virtio_pci_types_register(&virtio_gpu_gl_pci_info);
54 }
55 
56 type_init(virtio_gpu_gl_pci_register_types)
57 
58 module_dep("hw-display-virtio-gpu-pci");
59