[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 15/29] hw/display: avoid creating empty loadable modules
From: |
Paolo Bonzini |
Subject: |
[PULL 15/29] hw/display: avoid creating empty loadable modules |
Date: |
Tue, 10 Jan 2023 17:02:19 +0100 |
From: Daniel P. Berrangé <berrange@redhat.com>
When using --disable-virglrenderer, QEMU still creates
hw-display-virtio-gpu-gl.so
hw-display-virtio-vga-gl.so
hw-display-virtio-gpu-pci-gl.so
but when these are loaded, they provide no functionality as the code
which registers types is not compiled in. Funtionally this is
relatively harmless, because QEMU is fine loading a module with no
types.
This is rather confusing for users and OS distro maintainers though,
as they think they have the GL functionality built, but in fact the
module they are looking at provides nothing of value.
The root cause is the use of 'when/if_true' rules when adding sources
to the module source set. If all the rules evaluate to false, then we
have declared the module, but not added anything to it. We need to
put declaration of the entire module inside a condition based on
existance of the 3rd party library deps that are mandatory.
Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1352
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20221219125830.2369169-1-berrange@redhat.com>
[Do not check for pixman. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/display/meson.build | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/hw/display/meson.build b/hw/display/meson.build
index 7a725ed80eb5..f860c2c562ac 100644
--- a/hw/display/meson.build
+++ b/hw/display/meson.build
@@ -73,10 +73,12 @@ if config_all_devices.has_key('CONFIG_VIRTIO_GPU')
virtio_gpu_ss.add(when: 'CONFIG_VHOST_USER_GPU', if_true:
files('vhost-user-gpu.c'))
hw_display_modules += {'virtio-gpu': virtio_gpu_ss}
- virtio_gpu_gl_ss = ss.source_set()
- virtio_gpu_gl_ss.add(when: ['CONFIG_VIRTIO_GPU', virgl, opengl],
- if_true: [files('virtio-gpu-gl.c',
'virtio-gpu-virgl.c'), pixman, virgl])
- hw_display_modules += {'virtio-gpu-gl': virtio_gpu_gl_ss}
+ if virgl.found() and opengl.found()
+ virtio_gpu_gl_ss = ss.source_set()
+ virtio_gpu_gl_ss.add(when: ['CONFIG_VIRTIO_GPU', virgl, opengl],
+ if_true: [files('virtio-gpu-gl.c',
'virtio-gpu-virgl.c'), pixman, virgl])
+ hw_display_modules += {'virtio-gpu-gl': virtio_gpu_gl_ss}
+ endif
endif
if config_all_devices.has_key('CONFIG_VIRTIO_PCI')
@@ -87,10 +89,12 @@ if config_all_devices.has_key('CONFIG_VIRTIO_PCI')
if_true: files('vhost-user-gpu-pci.c'))
hw_display_modules += {'virtio-gpu-pci': virtio_gpu_pci_ss}
- virtio_gpu_pci_gl_ss = ss.source_set()
- virtio_gpu_pci_gl_ss.add(when: ['CONFIG_VIRTIO_GPU', 'CONFIG_VIRTIO_PCI',
virgl, opengl],
- if_true: [files('virtio-gpu-pci-gl.c'), pixman])
- hw_display_modules += {'virtio-gpu-pci-gl': virtio_gpu_pci_gl_ss}
+ if virgl.found() and opengl.found()
+ virtio_gpu_pci_gl_ss = ss.source_set()
+ virtio_gpu_pci_gl_ss.add(when: ['CONFIG_VIRTIO_GPU', 'CONFIG_VIRTIO_PCI',
virgl, opengl],
+ if_true: [files('virtio-gpu-pci-gl.c'), pixman])
+ hw_display_modules += {'virtio-gpu-pci-gl': virtio_gpu_pci_gl_ss}
+ endif
endif
if config_all_devices.has_key('CONFIG_VIRTIO_VGA')
--
2.38.1
- [PULL 00/29] Misc patches for 2023-01-10, Paolo Bonzini, 2023/01/10
- [PULL 01/29] configure: fix GLIB_VERSION for cross-compilation, Paolo Bonzini, 2023/01/10
- [PULL 04/29] KVM: keep track of running ioctls, Paolo Bonzini, 2023/01/10
- [PULL 05/29] kvm: Atomic memslot updates, Paolo Bonzini, 2023/01/10
- [PULL 03/29] accel: introduce accelerator blocker API, Paolo Bonzini, 2023/01/10
- [PULL 02/29] i386: Emit correct error code for 64-bit IDT entry, Paolo Bonzini, 2023/01/10
- [PULL 10/29] hw/xen: use G_GNUC_PRINTF/SCANF for various functions, Paolo Bonzini, 2023/01/10
- [PULL 14/29] enforce use of G_GNUC_PRINTF attributes, Paolo Bonzini, 2023/01/10
- [PULL 07/29] chardev: clean up chardev-parallel.c, Paolo Bonzini, 2023/01/10
- [PULL 15/29] hw/display: avoid creating empty loadable modules,
Paolo Bonzini <=
- [PULL 11/29] tools/virtiofsd: add G_GNUC_PRINTF for logging functions, Paolo Bonzini, 2023/01/10
- [PULL 17/29] libvhost-user: Replace typeof with __typeof__, Paolo Bonzini, 2023/01/10
- [PULL 24/29] libvduse: Fix assignment in vring_set_avail_event, Paolo Bonzini, 2023/01/10
- [PULL 22/29] libvduse: Provide _GNU_SOURCE when compiling outside of QEMU, Paolo Bonzini, 2023/01/10
- [PULL 21/29] libvhost-user: Change dev->postcopy_ufd assignment to make it C90 compliant, Paolo Bonzini, 2023/01/10
- [PULL 06/29] target/i386: Remove compilation errors when -Werror=maybe-uninitialized, Paolo Bonzini, 2023/01/10
- [PULL 09/29] disas: add G_GNUC_PRINTF to gstring_printf, Paolo Bonzini, 2023/01/10