qemu/hw/display/virtio-gpu-pci-gl.c
<<
>>
Prefs
   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"
  25typedef struct VirtIOGPUGLPCI VirtIOGPUGLPCI;
  26DECLARE_INSTANCE_CHECKER(VirtIOGPUGLPCI, VIRTIO_GPU_GL_PCI,
  27                         TYPE_VIRTIO_GPU_GL_PCI)
  28
  29struct VirtIOGPUGLPCI {
  30    VirtIOGPUPCIBase parent_obj;
  31    VirtIOGPUGL vdev;
  32};
  33
  34static 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
  43static 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};
  49module_obj(TYPE_VIRTIO_GPU_GL_PCI);
  50
  51static void virtio_gpu_gl_pci_register_types(void)
  52{
  53    virtio_pci_types_register(&virtio_gpu_gl_pci_info);
  54}
  55
  56type_init(virtio_gpu_gl_pci_register_types)
  57
  58module_dep("hw-display-virtio-gpu-pci");
  59