ui/sdl2: Fix assumption of EGL presence at runtime
PATCH 1/1 ui/sdl2: Fix assumption of EGL presence at runtime
The original commit had a section of code which worked on the assumption that if OpenGL was enabled at build, it was present on the end user machine, and calls could be made to it. This is not always the case (such as Windows on Arm devices).
This line should have also included a runtime check.
This commit moves the relevant line to inside a runtime check for OpenGL.
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3347
--- ui/sdl2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
ui/sdl2.c +4 -4
@@ -120,15 +120,15 @@ void sdl2_window_create(struct sdl2_console *scon) scon->winctx =SDL_GL_CreateContext (scon->real_window);SDL_GL_SetSwapInterval (0 ); + +#ifdef CONFIG_OPENGL + qemu_egl_display =eglGetCurrentDisplay (); +#endif }else {/* The SDL renderer is only used by sdl2-2D, when OpenGL is disabled */ scon->real_renderer =SDL_CreateRenderer (scon->real_window,-1 ,0 ); } -#ifdef CONFIG_OPENGL - qemu_egl_display =eglGetCurrentDisplay (); -#endif -sdl_update_caption (scon); }
Signature · 1 line
2.53.0
Quoted 5 lines · Anthony Roberts
The original commit had a section of code which worked on the assumption that if OpenGL was enabled at build, it was present on the end user machine, and calls could be made to it. This is not always the case (such as Windows on Arm devices).
Quoted 7 lines
This line should have also included a runtime check.
This commit moves the relevant line to inside a runtime check for OpenGL.
Fixes 52053b7e0a0e ("ui/sdl2: Implement dpy dmabuf functions")Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3347
Signed-off-by Anthony Roberts <[email protected]>
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Quoted 13 lines · Alex Bennée
Quoted 7 lines · Anthony Roberts
The original commit had a section of code which worked on the assumption that if OpenGL was enabled at build, it was present on the end user machine, and calls could be made to it. This is not always the case (such as Windows on Arm devices).
This line should have also included a runtime check.
Quoted 12 lines
Quoted 5 lines
This commit moves the relevant line to inside a runtime check for OpenGL.
Fixes 52053b7e0a0e ("ui/sdl2: Implement dpy dmabuf functions")Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3347
Signed-off-by Anthony Roberts <[email protected]>Reviewed-by Alex Bennée <[email protected]>Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Hello,
As a related note, modern QEMU is built assuming EGL which Windows does not ship as a system library - and doesn’t support a WGL-only configuration...
For those distributing QEMU binaries on Windows, they should bring an EGL implementation along such as the one in mingw-w64-angleproject or Mesa for Windows if they wish to support OpenGL functionality instead of having crashes.
Wonder what’s the best place to document that requirement…
Mohamed Mediouni <[email protected]> writes:
(Add Stefan to CC)
Quoted 26 lines
Quoted 11 lines · Alex Bennée
Quoted 7 lines · Anthony Roberts
The original commit had a section of code which worked on the assumption that if OpenGL was enabled at build, it was present on the end user machine, and calls could be made to it. This is not always the case (such as Windows on Arm devices).
This line should have also included a runtime check.
Quoted 12 lines
Quoted 5 lines
This commit moves the relevant line to inside a runtime check for OpenGL.
Fixes 52053b7e0a0e ("ui/sdl2: Implement dpy dmabuf functions")Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3347
Signed-off-by Anthony Roberts <[email protected]>Reviewed-by Alex Bennée <[email protected]>Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ LinaroHello,
Quoted 7 lines
As a related note, modern QEMU is built assuming EGL which Windows does not ship as a system library - and doesn’t support a WGL-only configuration...
For those distributing QEMU binaries on Windows, they should bring an EGL implementation along such as the one in mingw-w64-angleproject or Mesa for Windows if they wish to support OpenGL functionality instead of having crashes.
Stefan handles the semi-official windows binaries.
Generally our windows coverage is poor as most developers can only use the mingw cross compilers (if they even check) and we have one Windows x86_64 runner via Cirrus which doesn't have bare metal access to the hypervisor.
It would be nice to have better testing coverage in CI but that would require someone to fund some bare metal runners and volunteer to keep them updated.
Quoted 2 lines
Wonder what’s the best place to document that requirement…
docs/system/devices/virtio/virtio-gpu.rst
has a fairly in-depth breakdown of the various moving parts you need.
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Peter Maydell
AppliedQuoted 10 lines · Alex Bennée
Quoted 7 lines · Anthony Roberts
The original commit had a section of code which worked on the assumption that if OpenGL was enabled at build, it was present on the end user machine, and calls could be made to it. This is not always the case (such as Windows on Arm devices).
This line should have also included a runtime check.
Quoted 7 lines
Quoted 5 lines
This commit moves the relevant line to inside a runtime check for OpenGL.
Fixes 52053b7e0a0e ("ui/sdl2: Implement dpy dmabuf functions")Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3347
Signed-off-by Anthony Roberts <[email protected]>Reviewed-by Alex Bennée <[email protected]>
Applied to git directly, as requested.
thanks
-- PMM
Quoted 5 lines · Anthony Roberts
The original commit had a section of code which worked on the assumption that if OpenGL was enabled at build, it was present on the end user machine, and calls could be made to it. This is not always the case (such as Windows on Arm devices).
Quoted 7 lines
This line should have also included a runtime check.
This commit moves the relevant line to inside a runtime check for OpenGL.
Fixes 52053b7e0a0e ("ui/sdl2: Implement dpy dmabuf functions")Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3347
Signed-off-by Anthony Roberts <[email protected]>
As this got missed I've queued to virtio-gpu/next, thanks.
Quoted 27 lines
--- ui/sdl2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)ui/sdl2.c +4
-4@@ -120,15 +120,15 @@ void sdl2_window_create(struct sdl2_console *scon) scon->winctx =SDL_GL_CreateContext (scon->real_window);SDL_GL_SetSwapInterval (0 ); + +#ifdef CONFIG_OPENGL + qemu_egl_display =eglGetCurrentDisplay (); +#endif }else {/* The SDL renderer is only used by sdl2-2D, when OpenGL is disabled */ scon->real_renderer =SDL_CreateRenderer (scon->real_window,-1 ,0 ); } -#ifdef CONFIG_OPENGL - qemu_egl_display =eglGetCurrentDisplay (); -#endif -sdl_update_caption (scon); }
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro