hw/display: Restrict virtio-gpu-udmabuf stubs to !Linux
authorPhilippe Mathieu-Daudé <philmd@redhat.com>
Mon, 23 Aug 2021 10:04:53 +0000 (12:04 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 31 Aug 2021 12:31:43 +0000 (14:31 +0200)
When using qemu configured with --enabled-modules, the
generic stubs are used instead of the module symbols:

  qemu-system-x86_64: -device virtio-vga,blob=on: cannot enable blob resources without udmabuf

Restrict the stubs to Linux and only link them when
CONFIG_VIRTIO_GPU is disabled (only the modularized
version is available when it is enabled).

Reported-by: Maxim R. <mrom06@ya.ru>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/553
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210823100454.615816-2-philmd@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/display/meson.build
hw/display/virtio-gpu-udmabuf-stubs.c [new file with mode: 0644]
stubs/meson.build
stubs/virtio-gpu-udmabuf.c [deleted file]

index 1e6b707d3c0a04a0a87b21eeef104206cec0bcb4..861c43ff98471d39c2fed8af7f198f88ebfa2bc7 100644 (file)
@@ -56,7 +56,8 @@ if config_all_devices.has_key('CONFIG_VIRTIO_GPU')
   virtio_gpu_ss = ss.source_set()
   virtio_gpu_ss.add(when: 'CONFIG_VIRTIO_GPU',
                     if_true: [files('virtio-gpu-base.c', 'virtio-gpu.c'), pixman])
-  virtio_gpu_ss.add(when: 'CONFIG_LINUX', if_true: files('virtio-gpu-udmabuf.c'))
+  virtio_gpu_ss.add(when: 'CONFIG_LINUX', if_true: files('virtio-gpu-udmabuf.c'),
+                                          if_false: files('virtio-gpu-udmabuf-stubs.c'))
   virtio_gpu_ss.add(when: 'CONFIG_VHOST_USER_GPU', if_true: files('vhost-user-gpu.c'))
   hw_display_modules += {'virtio-gpu': virtio_gpu_ss}
 
diff --git a/hw/display/virtio-gpu-udmabuf-stubs.c b/hw/display/virtio-gpu-udmabuf-stubs.c
new file mode 100644 (file)
index 0000000..81f6614
--- /dev/null
@@ -0,0 +1,27 @@
+#include "qemu/osdep.h"
+#include "hw/virtio/virtio-gpu.h"
+
+bool virtio_gpu_have_udmabuf(void)
+{
+    /* nothing (stub) */
+    return false;
+}
+
+void virtio_gpu_init_udmabuf(struct virtio_gpu_simple_resource *res)
+{
+    /* nothing (stub) */
+}
+
+void virtio_gpu_fini_udmabuf(struct virtio_gpu_simple_resource *res)
+{
+    /* nothing (stub) */
+}
+
+int virtio_gpu_update_dmabuf(VirtIOGPU *g,
+                             uint32_t scanout_id,
+                             struct virtio_gpu_simple_resource *res,
+                             struct virtio_gpu_framebuffer *fb)
+{
+    /* nothing (stub) */
+    return 0;
+}
index 717bfa9a9997ad6796f7f8f87d327ffc25228973..275ac89c16005fb60701ef1147da918d78af3399 100644 (file)
@@ -52,7 +52,6 @@ if have_system
   stub_ss.add(files('semihost.c'))
   stub_ss.add(files('usb-dev-stub.c'))
   stub_ss.add(files('xen-hw-stub.c'))
-  stub_ss.add(files('virtio-gpu-udmabuf.c'))
 else
   stub_ss.add(files('qdev.c'))
 endif
diff --git a/stubs/virtio-gpu-udmabuf.c b/stubs/virtio-gpu-udmabuf.c
deleted file mode 100644 (file)
index 81f6614..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#include "qemu/osdep.h"
-#include "hw/virtio/virtio-gpu.h"
-
-bool virtio_gpu_have_udmabuf(void)
-{
-    /* nothing (stub) */
-    return false;
-}
-
-void virtio_gpu_init_udmabuf(struct virtio_gpu_simple_resource *res)
-{
-    /* nothing (stub) */
-}
-
-void virtio_gpu_fini_udmabuf(struct virtio_gpu_simple_resource *res)
-{
-    /* nothing (stub) */
-}
-
-int virtio_gpu_update_dmabuf(VirtIOGPU *g,
-                             uint32_t scanout_id,
-                             struct virtio_gpu_simple_resource *res,
-                             struct virtio_gpu_framebuffer *fb)
-{
-    /* nothing (stub) */
-    return 0;
-}