qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 11/18] ui/sdl: get the GL context from the window


From: Daniel P . Berrangé
Subject: Re: [PATCH v2 11/18] ui/sdl: get the GL context from the window
Date: Fri, 10 Mar 2023 10:00:03 +0000
User-agent: Mutt/2.2.9 (2022-11-12)

On Tue, Mar 07, 2023 at 03:56:30PM +0400, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> There is no guarantee to have a current GL context here. The current
> code seems to rely on the renderer using a GL backend, and to set a
> current GL context. But this is not always the case, for example if the
> renderer backend is DirectX.
> 
> This change is enough to fix using virgl with sdl2 on win32, on my setup.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  ui/sdl2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/ui/sdl2.c b/ui/sdl2.c
> index 8cb77416af..f259e4c4d1 100644
> --- a/ui/sdl2.c
> +++ b/ui/sdl2.c
> @@ -101,7 +101,7 @@ void sdl2_window_create(struct sdl2_console *scon)
>                                           flags);
>      scon->real_renderer = SDL_CreateRenderer(scon->real_window, -1, 0);
>      if (scon->opengl) {
> -        scon->winctx = SDL_GL_GetCurrentContext();
> +        scon->winctx = SDL_GL_CreateContext(scon->real_window);

IIUC, previously this borrowed a pointer to an existing context
and so didn't need to free it. Now this is creating a new
dedicated context, something must free this in sdl2_window_destroy.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




reply via email to

[Prev in Thread] Current Thread [Next in Thread]