virtio-gpu-gl: Improve OpenGL and related display error messages
cover virtio-gpu-gl: Improve OpenGL and related display error messages
If you try to use the virtio-gpu-gl device, the error messages we produce are not very specific, which can leave users confused about what they need to do (see the issue
https://gitlab.com/qemu-project/qemu/-/issues/2443 for an example).
This patchset tries to improve those errors:
(1) Trying to use virtio-gpu-gl without enabling GL on the display backend:
$ qemu-system-aarch64 -M virt -device virtio-gpu-gl
Currently we say
qemu-system-aarch64: -device virtio-gpu-gl: opengl is not available
With these patches we will say
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.
(2) Trying to enable GL on a backend that doesn't support it:
$ qemu-system-aarch64 -M virt -device virtio-gpu-gl -display curses,gl=on
Currently we say
qemu-system-aarch64: OpenGL is not supported by the display
With these patches we will say
qemu-system-aarch64: OpenGL is not supported by display backend 'curses'
(3) Trying to enable GL when the QEMU binary wasn't built with it:
Currently we say
qemu-system-aarch64: OpenGL support is disabled
With these patches we will say
qemu-system-aarch64: OpenGL support was disabled when QEMU was compiled
(4) -display help doesn't mention that display types can have suboptions
Currently -display help just prints the list of backends. With these
patches we will also say
Some display backends support suboptions, which can be set with
-display backend,option=value,option=value...
For a short list of the suboptions for each display, see the top-level -help output; more detail is in the documentation.
(The ideal for that last would be to be like -device and let you say "-display gtk,help", but that doesn't work.)
Peter Maydell (3):
hw/display/virtio-gpu: Improve "opengl is not available" error message system/vl.c: Expand OpenGL related errors
ui/console: Note in '-display help' that some backends support
suboptions
hw/display/virtio-gpu-gl.c | 8 +++++++- system/vl.c | 5 +++-- ui/console.c | 5 +++++ 3 files changed, 15 insertions(+), 3 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/3 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
--- hw/display/virtio-gpu-gl.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
hw/display/virtio-gpu-gl.c +7 -1
@@ -107,6 +107,7 @@ static void virtio_gpu_gl_reset(VirtIODevice *vdev)static void virtio_gpu_gl_device_realize (DeviceState *qdev,Error **errp) {VirtIOGPU *g =VIRTIO_GPU (qdev); +ERRP_GUARD ();#if HOST_BIG_ENDIAN error_setg (errp,"virgl is not supported on bigendian platforms" );
@@ -119,7 +120,12 @@ static void virtio_gpu_gl_device_realize(DeviceState *qdev, Error **errp) }if (!display_opengl) { -error_setg (errp,"opengl is not available" ); +error_setg (errp, +"The display backend does not have OpenGL support enabled" ); +error_append_hint (errp, +"It can be enabled with '-display BACKEND,gl=on' " +"where BACKEND is the name of the display backend " +"to use.\n" );return ; }
Signature · 1 line
2.34.1
Re: [PATCH 1/3] hw/display/virtio-gpu: Improve "opengl is not available" error message
Quoted 26 lines · Peter Maydell
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 availableSince 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 anERRP_GUARD()to the function, as noted ininclude/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.
Quoted 5 lines
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2443
Signed-off-by Peter Maydell <[email protected]>--- hw/display/virtio-gpu-gl.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
Re: [PATCH 1/3] hw/display/virtio-gpu: Improve "opengl is not available" error message
In reply to Peter MaydellQuoted 21 lines · Peter Maydell
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 availableSince 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 anERRP_GUARD()to the function, as noted ininclude/qapi/error.h.)
Quoted 7 lines
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 <[email protected]>
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
PATCH 2/3 system/vl.c: Expand OpenGL related errors
In reply to Peter MaydellExpand the OpenGL related error messages we produce for various "OpenGL not present/not supported" cases, to hopefully guide the user towards how to fix things.
Now if the user tries to enable GL on a backend that doesn't support it the error message is a bit more precise:
$ qemu-system-aarch64 -M virt -device virtio-gpu-gl -display curses,gl=on qemu-system-aarch64: OpenGL is not supported by display backend 'curses'
--- system/vl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
system/vl.c +3 -2
@@ -1973,9 +1973,10 @@ static void qemu_create_early_backends(void)if (dpy.has_gl && dpy.gl !=DISPLAYGL_MODE_OFF && display_opengl ==0 ) {#if defined(CONFIG_OPENGL ) -error_report ("OpenGL is not supported by the display" ); +error_report ("OpenGL is not supported by display backend '%s'" , +DisplayType_str (dpy.type));#else -error_report ("OpenGL support is disabled" ); +error_report ("OpenGL support was disabled when QEMU was compiled" );#endif exit (1 ); }
Signature · 1 line
2.34.1
Re: [PATCH 2/3] system/vl.c: Expand OpenGL related errors
Quoted 7 lines · Peter Maydell
Expand the OpenGL related error messages we produce for various "OpenGL not present/not supported" cases, to hopefully guide the user towards how to fix things.
Now if the user tries to enable GL on a backend that doesn't support it the error message is a bit more precise:
Quoted 7 lines
$ qemu-system-aarch64 -M virt -device virtio-gpu-gl -display curses,gl=on qemu-system-aarch64: OpenGL is not supported by display backend 'curses'Signed-off-by Peter Maydell <[email protected]>--- system/vl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Re: [PATCH 2/3] system/vl.c: Expand OpenGL related errors
In reply to Peter MaydellQuoted 20 lines · Peter Maydell
Expand the OpenGL related error messages we produce for various "OpenGL not present/not supported" cases, to hopefully guide the user towards how to fix things.
Now if the user tries to enable GL on a backend that doesn't support it the error message is a bit more precise:
$ qemu-system-aarch64 -M virt -device virtio-gpu-gl -display curses,gl=on qemu-system-aarch64: OpenGL is not supported by display backend 'curses'Signed-off-by Peter Maydell <[email protected]>--- system/vl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)system/vl.c +0
-0
system/vl.c static void qemu_create_early_backends(void) · line 1980
Quoted 10 lines
system/vl.c +3
-2@@ -1973,9 +1973,10 @@ static void qemu_create_early_backends(void)if (dpy.has_gl && dpy.gl !=DISPLAYGL_MODE_OFF && display_opengl ==0 ) {#if defined(CONFIG_OPENGL ) -error_report ("OpenGL is not supported by the display" ); +error_report ("OpenGL is not supported by display backend '%s'" , +DisplayType_str (dpy.type));#else -error_report ("OpenGL support is disabled" ); +error_report ("OpenGL support was disabled when QEMU was compiled");
Maybe "OpenGL support was not enabled in this build of QEMU"?
Anyway:
Quoted 3 lines
system/vl.c +0
-0#endif exit (1 );}
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Antonio Caggiano
Reviewed-byRe: [PATCH 2/3] system/vl.c: Expand OpenGL related errors
Hi
Quoted 23 lines · Alex Bennée
Quoted 21 lines · Peter Maydell
Expand the OpenGL related error messages we produce for various "OpenGL not present/not supported" cases, to hopefully guide the user towards how to fix things.
Now if the user tries to enable GL on a backend that doesn't support it the error message is a bit more precise:
$ qemu-system-aarch64 -M virt -device virtio-gpu-gl -display curses,gl=on qemu-system-aarch64: OpenGL is not supported by display backend 'curses'Signed-off-by Peter Maydell <[email protected]>--- system/vl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)system/vl.c +0
-0@@ -1973,9 +1973,10 @@ static void qemu_create_early_backends(void)
Quoted 11 lines
system/vl.c static void qemu_create_early_backends(void)
Quoted 9 lines
system/vl.c +3
-2if (dpy.has_gl && dpy.gl !=DISPLAYGL_MODE_OFF && display_opengl ==0 ) {#if defined(CONFIG_OPENGL ) -error_report ("OpenGL is not supported by the display" ); +error_report ("OpenGL is not supported by display backend '%s'" , +DisplayType_str (dpy.type));#else -error_report ("OpenGL support is disabled" ); +error_report ("OpenGL support was disabled when QEMU was compiled");Maybe "OpenGL support was not enabled in this build of QEMU"?
To stay aligned with the other changes, this can provide even more details with another hint.
"OpenGL support was disabled at QEMU configuration time."
"It can be enabled by running ./configure --enable-opengl before compilation"
BTW, whole series:
Cheers,
Antonio
Quoted 11 lines
Anyway:
Reviewed-by Alex Bennée <[email protected]>Quoted 3 lines
system/vl.c +0
-0#endif exit (1 );}
Re: [PATCH 2/3] system/vl.c: Expand OpenGL related errors
Quoted 37 lines · Antonio Caggiano
Hi
Quoted 17 lines · Alex Bennée
Quoted 15 lines · Peter Maydell
Expand the OpenGL related error messages we produce for various "OpenGL not present/not supported" cases, to hopefully guide the user towards how to fix things.
Now if the user tries to enable GL on a backend that doesn't support it the error message is a bit more precise:
$ qemu-system-aarch64 -M virt -device virtio-gpu-gl -display curses,gl=on qemu-system-aarch64: OpenGL is not supported by display backend 'curses'Signed-off-by Peter Maydell <[email protected]>---
system/vl.c| 5 +++--1 file changed, 3 insertions(+), 2 deletions(-)Quoted 16 lines
Quoted 5 lines
system/vl.c +0
-0system/vl.c static void qemu_create_early_backends(void) · line 1979
Quoted 9 lines
system/vl.c +3
-2@@ -1973,9 +1973,10 @@ static void qemu_create_early_backends(void) if (dpy.has_gl && dpy.gl != DISPLAYGL_MODE_OFF && display_opengl == 0) { #if defined(CONFIG_OPENGL) - error_report("OpenGL is not supported by the display"); + error_report("OpenGL is not supported by display backend '%s'", + DisplayType_str(dpy.type)); #else - error_report("OpenGL support is disabled"); + error_report("OpenGL support was disabled when QEMU was compiled");Maybe "OpenGL support was not enabled in this build of QEMU"?
Quoted 8 lines
To stay aligned with the other changes, this can provide even more details with another hint.
"OpenGL support was disabled at QEMU configuration time."
"It can be enabled by running./configure --enable-openglbefore compilation"BTW, whole series:
Reviewed-by Antonio Caggiano <[email protected]>
Thanks Antonio. I already posted the pull request and it is being tested. I'll include your R-b tag if there is an issue and I need to repost it.
Quoted 16 lines
Cheers,
AntonioQuoted 11 lines
Anyway:
Reviewed-by Alex Bennée <[email protected]>Quoted 3 lines
system/vl.c +0
-0#endif exit(1); }
PATCH 3/3 ui/console: Note in '-display help' that some backends support suboptions
In reply to Peter MaydellCurrently '-display help' only prints the available backends. Some of those backends support suboptions (e.g. '-display gtk,gl=on'). Mention that in the help output, and point the user to where they might be able to find more information about the suboptions. The new output looks like this:
$ qemu-system-aarch64 -display help Available display backend types: none gtk sdl egl-headless curses spice-app dbus
Some display backends support suboptions, which can be set with
-display backend,option=value,option=value...
For a short list of the suboptions for each display, see the top-level -help output; more detail is in the documentation.
---
The ideal here would be to programmatically list all the suboptions, so you could say '-display gtk,help', but that seems like a lot of work and I'm not entirely sure how to do it :-)
--- ui/console.c | 5 +++++ 1 file changed, 5 insertions(+)
ui/console.c +5 -0
@@ -1632,4 +1632,9 @@ void qemu_display_help(void)printf ("%s\n" ,DisplayType_str (dpys[idx]->type)); } } +printf ("\n" +"Some display backends support suboptions, which can be set with\n" +" -display backend,option=value,option=value...\n" +"For a short list of the suboptions for each display, see the " +"top-level -help output; more detail is in the documentation.\n" ); }
Signature · 1 line
2.34.1
Re: [PATCH 3/3] ui/console: Note in '-display help' that some backends support suboptions
Quoted 21 lines · Peter Maydell
Currently '-display help' only prints the available backends. Some of those backends support suboptions (e.g. '-display gtk,gl=on'). Mention that in the help output, and point the user to where they might be able to find more information about the suboptions. The new output looks like this:
$ qemu-system-aarch64 -display help Available display backend types: none gtk sdl egl-headless curses spice-app dbusSome display backends support suboptions, which can be set with
-display backend,option=value,option=value...
For a short list of the suboptions for each display, see the top-level -help output; more detail is in the documentation.Signed-off-by Peter Maydell <[email protected]>
Quoted 8 lines
---
The ideal here would be to programmatically list all the suboptions, so you could say '-display gtk,help', but that seems like a lot of work and I'm not entirely sure how to do it :-)--- ui/console.c | 5 +++++ 1 file changed, 5 insertions(+)
Quoted 54 lines · Peter Maydell
If you try to use the virtio-gpu-gl device, the error messages we produce are not very specific, which can leave users confused about what they need to do (see the issue
https://gitlab.com/qemu-project/qemu/-/issues/2443 for an example).This patchset tries to improve those errors:
(1) Trying to use virtio-gpu-gl without enabling GL on the display backend:
$ qemu-system-aarch64 -M virt -device virtio-gpu-glCurrently we say
qemu-system-aarch64: -device virtio-gpu-gl: opengl is not available
With these patches we will say
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.(2) Trying to enable GL on a backend that doesn't support it:
$ qemu-system-aarch64 -M virt -device virtio-gpu-gl -display curses,gl=onCurrently we say
qemu-system-aarch64: OpenGL is not supported by the display
With these patches we will say
qemu-system-aarch64: OpenGL is not supported by display backend 'curses'(3) Trying to enable GL when the QEMU binary wasn't built with it:
Currently we say
qemu-system-aarch64: OpenGL support is disabled
With these patches we will say
qemu-system-aarch64: OpenGL support was disabled when QEMU was compiled(4) -display help doesn't mention that display types can have suboptions
Currently -display help just prints the list of backends. With these patches we will also say
Some display backends support suboptions, which can be set with
-display backend,option=value,option=value...
For a short list of the suboptions for each display, see the top-level
-help output; more detail is in the documentation.(The ideal for that last would be to be like -device and let you say "-display gtk,help", but that doesn't work.)
Peter Maydell (3):
hw/display/virtio-gpu: Improve "opengl is not available" error messagesystem/vl.c: Expand OpenGL related errors
ui/console: Note in '-display help' that some backends support
suboptions
Quoted 9 lines
hw/display/virtio-gpu-gl.c | 8 +++++++- system/vl.c | 5 +++-- ui/console.c | 5 +++++ 3 files changed, 15 insertions(+), 3 deletions(-)--
2.34.1
Series:
Signature · 1 line
Marc-André Lureau
Quoted 2 lines · Marc-André Lureau
Series:
Acked-by Marc-André Lureau <[email protected] <mailto:[email protected]>>
I'll queue this via my hw-misc tree, thanks.