* [PATCH] ui/sdl2: Fix assumption of EGL presence at runtime
@ 2026-04-09 11:02 Anthony Roberts
2026-04-09 12:08 ` Alex Bennée
2026-04-17 16:47 ` Alex Bennée
0 siblings, 2 replies; 6+ messages in thread
From: Anthony Roberts @ 2026-04-09 11:02 UTC (permalink / raw)
To: qemu-devel; +Cc: alex.bennee, Anthony Roberts, Marc-André Lureau
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.
Fixes: 52053b7e0a0e ("ui/sdl2: Implement dpy dmabuf functions")
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3347
Signed-off-by: Anthony Roberts <anthony.roberts@linaro.org>
---
ui/sdl2.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ui/sdl2.c b/ui/sdl2.c
index aaaede56e0..987ad334bb 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -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);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] ui/sdl2: Fix assumption of EGL presence at runtime
2026-04-09 11:02 [PATCH] ui/sdl2: Fix assumption of EGL presence at runtime Anthony Roberts
@ 2026-04-09 12:08 ` Alex Bennée
2026-04-09 12:21 ` Mohamed Mediouni
2026-04-09 20:18 ` Peter Maydell
2026-04-17 16:47 ` Alex Bennée
1 sibling, 2 replies; 6+ messages in thread
From: Alex Bennée @ 2026-04-09 12:08 UTC (permalink / raw)
To: Anthony Roberts; +Cc: qemu-devel, Marc-André Lureau
Anthony Roberts <anthony.roberts@linaro.org> writes:
> 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.
>
> Fixes: 52053b7e0a0e ("ui/sdl2: Implement dpy dmabuf functions")
> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3347
> Signed-off-by: Anthony Roberts <anthony.roberts@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ui/sdl2: Fix assumption of EGL presence at runtime
2026-04-09 12:08 ` Alex Bennée
@ 2026-04-09 12:21 ` Mohamed Mediouni
2026-04-09 13:22 ` Alex Bennée
2026-04-09 20:18 ` Peter Maydell
1 sibling, 1 reply; 6+ messages in thread
From: Mohamed Mediouni @ 2026-04-09 12:21 UTC (permalink / raw)
To: Alex Bennée; +Cc: Anthony Roberts, qemu-devel, Marc-André Lureau
> On 9. Apr 2026, at 14:08, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> Anthony Roberts <anthony.roberts@linaro.org> writes:
>
>> 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.
>>
>> Fixes: 52053b7e0a0e ("ui/sdl2: Implement dpy dmabuf functions")
>> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3347
>> Signed-off-by: Anthony Roberts <anthony.roberts@linaro.org>
>
> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
>
> --
> 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…
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ui/sdl2: Fix assumption of EGL presence at runtime
2026-04-09 12:21 ` Mohamed Mediouni
@ 2026-04-09 13:22 ` Alex Bennée
0 siblings, 0 replies; 6+ messages in thread
From: Alex Bennée @ 2026-04-09 13:22 UTC (permalink / raw)
To: Mohamed Mediouni
Cc: Anthony Roberts, qemu-devel, Marc-André Lureau, Stefan Weil
Mohamed Mediouni <mohamed@unpredictable.fr> writes:
(Add Stefan to CC)
>> On 9. Apr 2026, at 14:08, Alex Bennée <alex.bennee@linaro.org> wrote:
>>
>> Anthony Roberts <anthony.roberts@linaro.org> writes:
>>
>>> 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.
>>>
>>> Fixes: 52053b7e0a0e ("ui/sdl2: Implement dpy dmabuf functions")
>>> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3347
>>> Signed-off-by: Anthony Roberts <anthony.roberts@linaro.org>
>>
>> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
>>
>> --
>> 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.
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.
>
> 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.
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ui/sdl2: Fix assumption of EGL presence at runtime
2026-04-09 12:08 ` Alex Bennée
2026-04-09 12:21 ` Mohamed Mediouni
@ 2026-04-09 20:18 ` Peter Maydell
1 sibling, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2026-04-09 20:18 UTC (permalink / raw)
To: Alex Bennée; +Cc: Anthony Roberts, qemu-devel, Marc-André Lureau
On Thu, 9 Apr 2026 at 13:09, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> Anthony Roberts <anthony.roberts@linaro.org> writes:
>
> > 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.
> >
> > Fixes: 52053b7e0a0e ("ui/sdl2: Implement dpy dmabuf functions")
> > Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3347
> > Signed-off-by: Anthony Roberts <anthony.roberts@linaro.org>
>
> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Applied to git directly, as requested.
thanks
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ui/sdl2: Fix assumption of EGL presence at runtime
2026-04-09 11:02 [PATCH] ui/sdl2: Fix assumption of EGL presence at runtime Anthony Roberts
2026-04-09 12:08 ` Alex Bennée
@ 2026-04-17 16:47 ` Alex Bennée
1 sibling, 0 replies; 6+ messages in thread
From: Alex Bennée @ 2026-04-17 16:47 UTC (permalink / raw)
To: Anthony Roberts; +Cc: qemu-devel, Marc-André Lureau
Anthony Roberts <anthony.roberts@linaro.org> writes:
> 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.
>
> Fixes: 52053b7e0a0e ("ui/sdl2: Implement dpy dmabuf functions")
> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3347
> Signed-off-by: Anthony Roberts <anthony.roberts@linaro.org>
As this got missed I've queued to virtio-gpu/next, thanks.
> ---
> ui/sdl2.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/ui/sdl2.c b/ui/sdl2.c
> index aaaede56e0..987ad334bb 100644
> --- a/ui/sdl2.c
> +++ b/ui/sdl2.c
> @@ -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);
> }
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-04-17 16:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-09 11:02 [PATCH] ui/sdl2: Fix assumption of EGL presence at runtime Anthony Roberts
2026-04-09 12:08 ` Alex Bennée
2026-04-09 12:21 ` Mohamed Mediouni
2026-04-09 13:22 ` Alex Bennée
2026-04-09 20:18 ` Peter Maydell
2026-04-17 16:47 ` Alex Bennée
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.