aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2021-07-05 14:42:18 +0400
committerGerd Hoffmann <kraxel@redhat.com>2021-07-22 15:46:47 +0200
commit02f9725f3df8a0e8f0a209d7436fad04e1ac190e (patch)
treeb586b654e339ee2655d4713b52c4954a1bc585d7 /hw
parentdcc5fc2a3adb9ec4b196f82ebe4079bc88f3c91e (diff)
downloadqemu-02f9725f3df8a0e8f0a209d7436fad04e1ac190e.zip
qemu-02f9725f3df8a0e8f0a209d7436fad04e1ac190e.tar.gz
qemu-02f9725f3df8a0e8f0a209d7436fad04e1ac190e.tar.bz2
hw/display: fail early when multiple virgl devices are requested
This avoids failing to initialize virgl and crashing later on, and clear the user expectations. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Message-Id: <20210705104218.1161101-1-marcandre.lureau@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/display/virtio-gpu-gl.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c
index 7ab93bf..b1035e1 100644
--- a/hw/display/virtio-gpu-gl.c
+++ b/hw/display/virtio-gpu-gl.c
@@ -113,6 +113,11 @@ static void virtio_gpu_gl_device_realize(DeviceState *qdev, Error **errp)
return;
#endif
+ if (!object_resolve_path_type("", TYPE_VIRTIO_GPU_GL, NULL)) {
+ error_setg(errp, "at most one %s device is permitted", TYPE_VIRTIO_GPU_GL);
+ return;
+ }
+
if (!display_opengl) {
error_setg(errp, "opengl is not available");
return;