1b36eb886SGerd Hoffmann #include "qemu/osdep.h" 2b36eb886SGerd Hoffmann #include "hw/pci/pci.h" 3b36eb886SGerd Hoffmann #include "hw/qdev-properties.h" 4b36eb886SGerd Hoffmann #include "hw/virtio/virtio-gpu.h" 5b36eb886SGerd Hoffmann #include "hw/display/vga.h" 6b36eb886SGerd Hoffmann #include "qapi/error.h" 7b36eb886SGerd Hoffmann #include "qemu/module.h" 8b36eb886SGerd Hoffmann #include "virtio-vga.h" 9b36eb886SGerd Hoffmann #include "qom/object.h" 10b36eb886SGerd Hoffmann 11b36eb886SGerd Hoffmann #define TYPE_VIRTIO_VGA_GL "virtio-vga-gl" 12b36eb886SGerd Hoffmann 13b36eb886SGerd Hoffmann typedef struct VirtIOVGAGL VirtIOVGAGL; 14b36eb886SGerd Hoffmann DECLARE_INSTANCE_CHECKER(VirtIOVGAGL, VIRTIO_VGA_GL, 15b36eb886SGerd Hoffmann TYPE_VIRTIO_VGA_GL) 16b36eb886SGerd Hoffmann 17b36eb886SGerd Hoffmann struct VirtIOVGAGL { 18b36eb886SGerd Hoffmann VirtIOVGABase parent_obj; 19b36eb886SGerd Hoffmann 20b36eb886SGerd Hoffmann VirtIOGPUGL vdev; 21b36eb886SGerd Hoffmann }; 22b36eb886SGerd Hoffmann virtio_vga_gl_inst_initfn(Object * obj)23b36eb886SGerd Hoffmannstatic void virtio_vga_gl_inst_initfn(Object *obj) 24b36eb886SGerd Hoffmann { 25b36eb886SGerd Hoffmann VirtIOVGAGL *dev = VIRTIO_VGA_GL(obj); 26b36eb886SGerd Hoffmann 27b36eb886SGerd Hoffmann virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), 28b36eb886SGerd Hoffmann TYPE_VIRTIO_GPU_GL); 29b36eb886SGerd Hoffmann VIRTIO_VGA_BASE(dev)->vgpu = VIRTIO_GPU_BASE(&dev->vdev); 30b36eb886SGerd Hoffmann } 31b36eb886SGerd Hoffmann 32b36eb886SGerd Hoffmann 33b36eb886SGerd Hoffmann static VirtioPCIDeviceTypeInfo virtio_vga_gl_info = { 34b36eb886SGerd Hoffmann .generic_name = TYPE_VIRTIO_VGA_GL, 35b36eb886SGerd Hoffmann .parent = TYPE_VIRTIO_VGA_BASE, 36b36eb886SGerd Hoffmann .instance_size = sizeof(VirtIOVGAGL), 37b36eb886SGerd Hoffmann .instance_init = virtio_vga_gl_inst_initfn, 38b36eb886SGerd Hoffmann }; 39561d0f45SGerd Hoffmann module_obj(TYPE_VIRTIO_VGA_GL); 40*24ce7aa7SJose R. Ziviani module_kconfig(VIRTIO_VGA); 41b36eb886SGerd Hoffmann virtio_vga_register_types(void)42b36eb886SGerd Hoffmannstatic void virtio_vga_register_types(void) 43b36eb886SGerd Hoffmann { 44b36eb886SGerd Hoffmann if (have_vga) { 45b36eb886SGerd Hoffmann virtio_pci_types_register(&virtio_vga_gl_info); 46b36eb886SGerd Hoffmann } 47b36eb886SGerd Hoffmann } 48b36eb886SGerd Hoffmann 49b36eb886SGerd Hoffmann type_init(virtio_vga_register_types) 50561d0f45SGerd Hoffmann 51561d0f45SGerd Hoffmann module_dep("hw-display-virtio-vga"); 52