virtio-gpu-pci-gl.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. #include "qemu/osdep.h"
  14. #include "qapi/error.h"
  15. #include "qemu/module.h"
  16. #include "hw/pci/pci.h"
  17. #include "hw/qdev-properties.h"
  18. #include "hw/virtio/virtio.h"
  19. #include "hw/virtio/virtio-bus.h"
  20. #include "hw/virtio/virtio-gpu-pci.h"
  21. #include "qom/object.h"
  22. #define TYPE_VIRTIO_GPU_GL_PCI "virtio-gpu-gl-pci"
  23. typedef struct VirtIOGPUGLPCI VirtIOGPUGLPCI;
  24. DECLARE_INSTANCE_CHECKER(VirtIOGPUGLPCI, VIRTIO_GPU_GL_PCI,
  25. TYPE_VIRTIO_GPU_GL_PCI)
  26. struct VirtIOGPUGLPCI {
  27. VirtIOGPUPCIBase parent_obj;
  28. VirtIOGPUGL vdev;
  29. };
  30. static void virtio_gpu_gl_initfn(Object *obj)
  31. {
  32. VirtIOGPUGLPCI *dev = VIRTIO_GPU_GL_PCI(obj);
  33. virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
  34. TYPE_VIRTIO_GPU_GL);
  35. VIRTIO_GPU_PCI_BASE(obj)->vgpu = VIRTIO_GPU_BASE(&dev->vdev);
  36. }
  37. static const VirtioPCIDeviceTypeInfo virtio_gpu_gl_pci_info = {
  38. .generic_name = TYPE_VIRTIO_GPU_GL_PCI,
  39. .parent = TYPE_VIRTIO_GPU_PCI_BASE,
  40. .instance_size = sizeof(VirtIOGPUGLPCI),
  41. .instance_init = virtio_gpu_gl_initfn,
  42. };
  43. module_obj(TYPE_VIRTIO_GPU_GL_PCI);
  44. module_kconfig(VIRTIO_PCI);
  45. static void virtio_gpu_gl_pci_register_types(void)
  46. {
  47. virtio_pci_types_register(&virtio_gpu_gl_pci_info);
  48. }
  49. type_init(virtio_gpu_gl_pci_register_types)
  50. module_dep("hw-display-virtio-gpu-pci");