[PATCH] ui/sdl2: fix surface_gl_update_texture: Assertion 'gls' failed

marcandre.lureau@redhat.com posted 1 patch 12 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230511074217.4171842-1-marcandre.lureau@redhat.com
Maintainers: Gerd Hoffmann <kraxel@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>
ui/sdl2-gl.c | 4 ++++
1 file changed, 4 insertions(+)
[PATCH] ui/sdl2: fix surface_gl_update_texture: Assertion 'gls' failed
Posted by marcandre.lureau@redhat.com 12 months ago
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Before sdl2_gl_update() is called, sdl2_gl_switch() may decide to
destroy the console window and its associated shaders.

Fixes:
https://gitlab.com/qemu-project/qemu/-/issues/1644

Fixes: commit c84ab0a5 ("ui/console: optionally update after gfx switch")

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 ui/sdl2-gl.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c
index b36ba6415a..cc83c98349 100644
--- a/ui/sdl2-gl.c
+++ b/ui/sdl2-gl.c
@@ -67,6 +67,10 @@ void sdl2_gl_update(DisplayChangeListener *dcl,
 
     assert(scon->opengl);
 
+    if (!scon->real_window) {
+        return;
+    }
+
     SDL_GL_MakeCurrent(scon->real_window, scon->winctx);
     surface_gl_update_texture(scon->gls, scon->surface, x, y, w, h);
     scon->updates++;
-- 
2.40.1


Re: [PATCH] ui/sdl2: fix surface_gl_update_texture: Assertion 'gls' failed
Posted by Bin Meng 11 months, 2 weeks ago
On Thu, May 11, 2023 at 3:43 PM <marcandre.lureau@redhat.com> wrote:
>
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Before sdl2_gl_update() is called, sdl2_gl_switch() may decide to
> destroy the console window and its associated shaders.
>
> Fixes:
> https://gitlab.com/qemu-project/qemu/-/issues/1644

This should be:

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1644

>
> Fixes: commit c84ab0a5 ("ui/console: optionally update after gfx switch")

This should be:

Fixes: c84ab0a500a8 ("ui/console: optionally update after gfx switch")

>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  ui/sdl2-gl.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c
> index b36ba6415a..cc83c98349 100644
> --- a/ui/sdl2-gl.c
> +++ b/ui/sdl2-gl.c
> @@ -67,6 +67,10 @@ void sdl2_gl_update(DisplayChangeListener *dcl,
>
>      assert(scon->opengl);
>
> +    if (!scon->real_window) {
> +        return;
> +    }
> +
>      SDL_GL_MakeCurrent(scon->real_window, scon->winctx);
>      surface_gl_update_texture(scon->gls, scon->surface, x, y, w, h);
>      scon->updates++;
> --

Testing this patch with the "-device virtio-gpu-pci -display
sdl,gl=on" command line, the assertion mentioned in
https://gitlab.com/qemu-project/qemu/-/issues/1644 is fixed.

Tested-by: Bin Meng <bin.meng@windriver.com>

Regards,
Bin
Re: [PATCH] ui/sdl2: fix surface_gl_update_texture: Assertion 'gls' failed
Posted by Michael Tokarev 11 months, 4 weeks ago
11.05.2023 10:42, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Before sdl2_gl_update() is called, sdl2_gl_switch() may decide to
> destroy the console window and its associated shaders.
> 
> Fixes:
> https://gitlab.com/qemu-project/qemu/-/issues/1644
> 
> Fixes: commit c84ab0a5 ("ui/console: optionally update after gfx switch")

Smells like a (low-importance) -stable material.

/mjt