qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sdl2: Check if window exists before updating it
@ 2023-06-08 14:55 Akihiko Odaki
  2023-06-09  8:08 ` Antonio Caggiano
  2023-06-12  9:00 ` Marc-André Lureau
  0 siblings, 2 replies; 4+ messages in thread
From: Akihiko Odaki @ 2023-06-08 14:55 UTC (permalink / raw)
  Cc: qemu-devel, Antonio Caggiano, Marc-André Lureau,
	Gerd Hoffmann, Akihiko Odaki

A console does not have a window if the surface is a placeholder and
the console is not the first one. sdl2 cannot update the texture in
such a case.

Add a proper check for window existence. Such a check is only necessary
for the "gl" implementation as the "2d" implementation checks for the
texture, which is set only if a window exists.

Fixes: c821a58ee7 ("ui/console: Pass placeholder surface to displays")
Reported-by: Antonio Caggiano <quic_acaggian@quicinc.com>
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 ui/sdl2-gl.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c
index 39cab8cde7..bbfa70eac3 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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] sdl2: Check if window exists before updating it
  2023-06-08 14:55 [PATCH] sdl2: Check if window exists before updating it Akihiko Odaki
@ 2023-06-09  8:08 ` Antonio Caggiano
  2023-06-12  9:00 ` Marc-André Lureau
  1 sibling, 0 replies; 4+ messages in thread
From: Antonio Caggiano @ 2023-06-09  8:08 UTC (permalink / raw)
  To: Akihiko Odaki; +Cc: qemu-devel, Marc-André Lureau, Gerd Hoffmann

Reviewed-by: Antonio Caggiano <quic_acaggian@quicinc.com>

On 08/06/2023 16:55, Akihiko Odaki wrote:
> A console does not have a window if the surface is a placeholder and
> the console is not the first one. sdl2 cannot update the texture in
> such a case.
> 
> Add a proper check for window existence. Such a check is only necessary
> for the "gl" implementation as the "2d" implementation checks for the
> texture, which is set only if a window exists.
> 
> Fixes: c821a58ee7 ("ui/console: Pass placeholder surface to displays")
> Reported-by: Antonio Caggiano <quic_acaggian@quicinc.com>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
>   ui/sdl2-gl.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c
> index 39cab8cde7..bbfa70eac3 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++;


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] sdl2: Check if window exists before updating it
  2023-06-08 14:55 [PATCH] sdl2: Check if window exists before updating it Akihiko Odaki
  2023-06-09  8:08 ` Antonio Caggiano
@ 2023-06-12  9:00 ` Marc-André Lureau
  2023-06-13  0:28   ` Akihiko Odaki
  1 sibling, 1 reply; 4+ messages in thread
From: Marc-André Lureau @ 2023-06-12  9:00 UTC (permalink / raw)
  To: Akihiko Odaki; +Cc: qemu-devel, Antonio Caggiano, Gerd Hoffmann

[-- Attachment #1: Type: text/plain, Size: 1520 bytes --]

Hi

On Thu, Jun 8, 2023 at 4:56 PM Akihiko Odaki <akihiko.odaki@daynix.com>
wrote:

> A console does not have a window if the surface is a placeholder and
> the console is not the first one. sdl2 cannot update the texture in
> such a case.
>
> Add a proper check for window existence. Such a check is only necessary
> for the "gl" implementation as the "2d" implementation checks for the
> texture, which is set only if a window exists.
>
> Fixes: c821a58ee7 ("ui/console: Pass placeholder surface to displays")
> Reported-by: Antonio Caggiano <quic_acaggian@quicinc.com>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>


Unless I am mistaken, this is fixed in git already:
commit b3a654d82ecf276b59a67b2fd688e11a0d8a0064
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date:   Thu May 11 11:42:17 2023 +0400

    ui/sdl2: fix surface_gl_update_texture: Assertion 'gls' failed

thanks

---
>  ui/sdl2-gl.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c
> index 39cab8cde7..bbfa70eac3 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
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 2508 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] sdl2: Check if window exists before updating it
  2023-06-12  9:00 ` Marc-André Lureau
@ 2023-06-13  0:28   ` Akihiko Odaki
  0 siblings, 0 replies; 4+ messages in thread
From: Akihiko Odaki @ 2023-06-13  0:28 UTC (permalink / raw)
  To: Marc-André Lureau; +Cc: qemu-devel, Antonio Caggiano, Gerd Hoffmann

On 2023/06/12 18:00, Marc-André Lureau wrote:
> Hi
> 
> On Thu, Jun 8, 2023 at 4:56 PM Akihiko Odaki <akihiko.odaki@daynix.com 
> <mailto:akihiko.odaki@daynix.com>> wrote:
> 
>     A console does not have a window if the surface is a placeholder and
>     the console is not the first one. sdl2 cannot update the texture in
>     such a case.
> 
>     Add a proper check for window existence. Such a check is only necessary
>     for the "gl" implementation as the "2d" implementation checks for the
>     texture, which is set only if a window exists.
> 
>     Fixes: c821a58ee7 ("ui/console: Pass placeholder surface to displays")
>     Reported-by: Antonio Caggiano <quic_acaggian@quicinc.com
>     <mailto:quic_acaggian@quicinc.com>>
>     Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com
>     <mailto:akihiko.odaki@daynix.com>>
> 
> 
> 
> Unless I am mistaken, this is fixed in git already:
> commit b3a654d82ecf276b59a67b2fd688e11a0d8a0064
> Author: Marc-André Lureau <marcandre.lureau@redhat.com 
> <mailto:marcandre.lureau@redhat.com>>
> Date:   Thu May 11 11:42:17 2023 +0400
> 
>      ui/sdl2: fix surface_gl_update_texture: Assertion 'gls' failed
> 
> thanks
> 
>     ---
>       ui/sdl2-gl.c | 4 ++++
>       1 file changed, 4 insertions(+)
> 
>     diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c
>     index 39cab8cde7..bbfa70eac3 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
> 
> 
> 
> 
> -- 
> Marc-André Lureau

I overlooked it. You are right. It is identical and there is no need for 
additional patch.

Regards,
Akihiko Odaki


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-06-13  0:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-08 14:55 [PATCH] sdl2: Check if window exists before updating it Akihiko Odaki
2023-06-09  8:08 ` Antonio Caggiano
2023-06-12  9:00 ` Marc-André Lureau
2023-06-13  0:28   ` Akihiko Odaki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).