]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/display/virtio-gpu: Improve "opengl is not available" error message
authorPeter Maydell <peter.maydell@linaro.org>
Wed, 31 Jul 2024 15:41:34 +0000 (16:41 +0100)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Tue, 6 Aug 2024 14:22:12 +0000 (16:22 +0200)
commit0fa57cbfa7039e4a579f1a4a0956982b654335c8
tree4aa09073c8b04c0ad2cfc76470c5e9a1a1f21b3c
parentc1a6ae5145f2e72c1eaf53b7a8c96cdbb64211bd
hw/display/virtio-gpu: Improve "opengl is not available" error message

If the user tries to use the virtio-gpu-gl device but the display
backend doesn't have OpenGL support enabled, we currently print a
rather uninformative error message:

$ qemu-system-aarch64 -M virt -device virtio-gpu-gl
qemu-system-aarch64: -device virtio-gpu-gl: opengl is not available

Since OpenGL is not enabled on display frontends by default, users
are quite likely to run into this. Improve the error message to
be more specific and to suggest to the user a path forward.

Note that the case of "user tried to enable OpenGL but the display
backend doesn't handle it" is caught elsewhere first, so we can
assume that isn't the problem:

$ qemu-system-aarch64 -M virt -device virtio-gpu-gl -display curses,gl=on
qemu-system-aarch64: OpenGL is not supported by the display

(Use of error_append_hint() requires us to add an ERRP_GUARD() to
the function, as noted in include/qapi/error.h.)

With this commit we now produce the hopefully more helpful error:
$ ./build/x86/qemu-system-aarch64 -M virt -device virtio-gpu-gl
qemu-system-aarch64: -device virtio-gpu-gl: The display backend does not have OpenGL support enabled
It can be enabled with '-display BACKEND,gl=on' where BACKEND is the name of the display backend to use.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2443
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-ID: <20240731154136.3494621-2-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
hw/display/virtio-gpu-gl.c