ui: split the GL context in a different object

This will allow to have one GL context but a variable number of
listeners.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Marc-André Lureau 2021-10-09 23:48:46 +04:00
parent 7cc712e986
commit 5e79d516e8
14 changed files with 119 additions and 76 deletions

View file

@ -132,10 +132,10 @@ void sdl2_gl_redraw(struct sdl2_console *scon)
}
}
QEMUGLContext sdl2_gl_create_context(DisplayChangeListener *dcl,
QEMUGLContext sdl2_gl_create_context(DisplayGLCtx *dgc,
QEMUGLParams *params)
{
struct sdl2_console *scon = container_of(dcl, struct sdl2_console, dcl);
struct sdl2_console *scon = container_of(dgc, struct sdl2_console, dgc);
SDL_GLContext ctx;
assert(scon->opengl);
@ -167,17 +167,17 @@ QEMUGLContext sdl2_gl_create_context(DisplayChangeListener *dcl,
return (QEMUGLContext)ctx;
}
void sdl2_gl_destroy_context(DisplayChangeListener *dcl, QEMUGLContext ctx)
void sdl2_gl_destroy_context(DisplayGLCtx *dgc, QEMUGLContext ctx)
{
SDL_GLContext sdlctx = (SDL_GLContext)ctx;
SDL_GL_DeleteContext(sdlctx);
}
int sdl2_gl_make_context_current(DisplayChangeListener *dcl,
int sdl2_gl_make_context_current(DisplayGLCtx *dgc,
QEMUGLContext ctx)
{
struct sdl2_console *scon = container_of(dcl, struct sdl2_console, dcl);
struct sdl2_console *scon = container_of(dgc, struct sdl2_console, dgc);
SDL_GLContext sdlctx = (SDL_GLContext)ctx;
assert(scon->opengl);