From 7b0de5b7969e695d6235525654a8a28a0d82a0e0 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Mon, 14 Sep 2020 15:42:24 +0200 Subject: [PATCH] virtio-gpu: build modular Only build virtio-gpu-device modular (the code which actually depends on the external virglrenderer library). virtio-gpu-pci and virtio-vga are compiled into core qemu still. Signed-off-by: Gerd Hoffmann Message-id: 20200914134224.29769-7-kraxel@redhat.com --- hw/display/meson.build | 22 ++++++---------------- util/module.c | 2 ++ 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/hw/display/meson.build b/hw/display/meson.build index 2f07d427dd..0d5ddecd65 100644 --- a/hw/display/meson.build +++ b/hw/display/meson.build @@ -59,24 +59,14 @@ if config_all_devices.has_key('CONFIG_VIRTIO_GPU') virtio_gpu_ss.add(when: 'CONFIG_VIRTIO_GPU', if_true: [files('virtio-gpu-base.c', 'virtio-gpu.c', 'virtio-gpu-3d.c'), pixman, virgl]) virtio_gpu_ss.add(when: 'CONFIG_VHOST_USER_GPU', if_true: files('vhost-user-gpu.c')) - virtio_gpu_ss.add(when: ['CONFIG_VIRTIO_GPU', 'CONFIG_VIRTIO_PCI'], if_true: files('virtio-gpu-pci.c')) - virtio_gpu_ss.add(when: ['CONFIG_VHOST_USER_GPU', 'CONFIG_VIRTIO_PCI'], if_true: files('vhost-user-gpu-pci.c')) - virtio_gpu_ss.add(when: 'CONFIG_VIRTIO_VGA', if_true: files('virtio-vga.c')) - virtio_gpu_ss.add(when: 'CONFIG_VHOST_USER_VGA', if_true: files('vhost-user-vga.c')) - - # FIXME: this was attempted in the Makefile build system; it was then reverted - # as it would try to load all devices when the module is loaded, even if - # config_devices for this target only has some of them. Since virtio-gpu-pci - # and virtio-vga both instantiate a virtio-gpu-device, fixing it probably does - # not even require a dependency system, just splitting the module in three - # for CONFIG_VIRTIO_GPU/CONFIG_VHOST_USER_GPU, CONFIG_VIRTIO_PCI and - # CONFIG_VIRTIO_VGA/CONFIG_VHOST_USER_VGA. - # Sourcesets are a dime a dozen, so keep it and just disable module builds. - - #hw_display_modules += {'virtio-gpu': virtio_gpu_ss} - softmmu_ss.add_all(virtio_gpu_ss) + hw_display_modules += {'virtio-gpu': virtio_gpu_ss} endif +softmmu_ss.add(when: ['CONFIG_VIRTIO_GPU', 'CONFIG_VIRTIO_PCI'], if_true: files('virtio-gpu-pci.c')) +softmmu_ss.add(when: ['CONFIG_VHOST_USER_GPU', 'CONFIG_VIRTIO_PCI'], if_true: files('vhost-user-gpu-pci.c')) +softmmu_ss.add(when: 'CONFIG_VIRTIO_VGA', if_true: files('virtio-vga.c')) +softmmu_ss.add(when: 'CONFIG_VHOST_USER_VGA', if_true: files('vhost-user-vga.c')) + specific_ss.add(when: [x11, opengl, 'CONFIG_MILKYMIST_TMU2'], if_true: files('milkymist-tmu2.c')) specific_ss.add(when: 'CONFIG_OMAP', if_true: files('omap_lcdc.c')) diff --git a/util/module.c b/util/module.c index 6e63006a8f..34772e7d87 100644 --- a/util/module.c +++ b/util/module.c @@ -265,6 +265,8 @@ static struct { { "usb-redir", "hw-", "usb-redirect" }, { "qxl-vga", "hw-", "display-qxl" }, { "qxl", "hw-", "display-qxl" }, + { "virtio-gpu-device", "hw-", "display-virtio-gpu" }, + { "vhost-user-gpu", "hw-", "display-virtio-gpu" }, { "chardev-braille", "chardev-", "baum" }, };