mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-23 11:39:53 +00:00
24ce7aa77d
module_kconfig is a new directive that should be used with module_obj whenever that module depends on the Kconfig to be enabled. When the module is enabled in Kconfig we are sure that its dependencies will be enabled as well, thus the module will be loaded without any problem. The correct way to use module_kconfig is by passing the Kconfig option to module_kconfig (or the *config-devices.mak without CONFIG_). Signed-off-by: Jose R. Ziviani <jziviani@suse.de> Signed-off-by: Dario Faggioli <dfaggioli@suse.com> Message-Id: <165369002370.5857.12150544416563557322.stgit@work> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
52 lines
1.3 KiB
C
52 lines
1.3 KiB
C
#include "qemu/osdep.h"
|
|
#include "hw/pci/pci.h"
|
|
#include "hw/qdev-properties.h"
|
|
#include "hw/virtio/virtio-gpu.h"
|
|
#include "hw/display/vga.h"
|
|
#include "qapi/error.h"
|
|
#include "qemu/module.h"
|
|
#include "virtio-vga.h"
|
|
#include "qom/object.h"
|
|
|
|
#define TYPE_VIRTIO_VGA_GL "virtio-vga-gl"
|
|
|
|
typedef struct VirtIOVGAGL VirtIOVGAGL;
|
|
DECLARE_INSTANCE_CHECKER(VirtIOVGAGL, VIRTIO_VGA_GL,
|
|
TYPE_VIRTIO_VGA_GL)
|
|
|
|
struct VirtIOVGAGL {
|
|
VirtIOVGABase parent_obj;
|
|
|
|
VirtIOGPUGL vdev;
|
|
};
|
|
|
|
static void virtio_vga_gl_inst_initfn(Object *obj)
|
|
{
|
|
VirtIOVGAGL *dev = VIRTIO_VGA_GL(obj);
|
|
|
|
virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
|
|
TYPE_VIRTIO_GPU_GL);
|
|
VIRTIO_VGA_BASE(dev)->vgpu = VIRTIO_GPU_BASE(&dev->vdev);
|
|
}
|
|
|
|
|
|
static VirtioPCIDeviceTypeInfo virtio_vga_gl_info = {
|
|
.generic_name = TYPE_VIRTIO_VGA_GL,
|
|
.parent = TYPE_VIRTIO_VGA_BASE,
|
|
.instance_size = sizeof(VirtIOVGAGL),
|
|
.instance_init = virtio_vga_gl_inst_initfn,
|
|
};
|
|
module_obj(TYPE_VIRTIO_VGA_GL);
|
|
module_kconfig(VIRTIO_VGA);
|
|
|
|
static void virtio_vga_register_types(void)
|
|
{
|
|
if (have_vga) {
|
|
virtio_pci_types_register(&virtio_vga_gl_info);
|
|
}
|
|
}
|
|
|
|
type_init(virtio_vga_register_types)
|
|
|
|
module_dep("hw-display-virtio-vga");
|