[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/33] ui/sdl2: OpenGL window context
From: |
marcandre . lureau |
Subject: |
[PULL 03/33] ui/sdl2: OpenGL window context |
Date: |
Tue, 27 Jun 2023 15:02:00 +0200 |
From: Antonio Caggiano <quic_acaggian@quicinc.com>
When OpenGL is enabled, create only the OpenGL context, ignoring the SDL
renderer as it is unused anyway.
Signed-off-by: Antonio Caggiano <quic_acaggian@quicinc.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20230612091959.2983-1-quic_acaggian@quicinc.com>
---
ui/sdl2.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/ui/sdl2.c b/ui/sdl2.c
index 9d703200bf..0d91b555e3 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -113,11 +113,11 @@ void sdl2_window_create(struct sdl2_console *scon)
SDL_SetHint(SDL_HINT_RENDER_DRIVER, driver);
SDL_SetHint(SDL_HINT_RENDER_BATCHING, "1");
- }
- scon->real_renderer = SDL_CreateRenderer(scon->real_window, -1, 0);
- if (scon->opengl) {
scon->winctx = SDL_GL_CreateContext(scon->real_window);
+ } else {
+ /* The SDL renderer is only used by sdl2-2D, when OpenGL is disabled */
+ scon->real_renderer = SDL_CreateRenderer(scon->real_window, -1, 0);
}
sdl_update_caption(scon);
}
@@ -128,10 +128,14 @@ void sdl2_window_destroy(struct sdl2_console *scon)
return;
}
- SDL_GL_DeleteContext(scon->winctx);
- scon->winctx = NULL;
- SDL_DestroyRenderer(scon->real_renderer);
- scon->real_renderer = NULL;
+ if (scon->winctx) {
+ SDL_GL_DeleteContext(scon->winctx);
+ scon->winctx = NULL;
+ }
+ if (scon->real_renderer) {
+ SDL_DestroyRenderer(scon->real_renderer);
+ scon->real_renderer = NULL;
+ }
SDL_DestroyWindow(scon->real_window);
scon->real_window = NULL;
}
--
2.41.0
- [PULL 00/33] UI patches, marcandre . lureau, 2023/06/27
- [PULL 08/33] virtio-gpu: Make non-gl display updates work again when blob=true, marcandre . lureau, 2023/06/27
- [PULL 02/33] egl: no need to lookup EGL functions manually, marcandre . lureau, 2023/06/27
- [PULL 06/33] ui/touch: Move event handling to a common helper, marcandre . lureau, 2023/06/27
- [PULL 05/33] chardev/char-win-stdio: Support VT sequences on Windows 11 host, marcandre . lureau, 2023/06/27
- [PULL 04/33] virtio-gpu: Optimize 2D resource data transfer, marcandre . lureau, 2023/06/27
- [PULL 03/33] ui/sdl2: OpenGL window context,
marcandre . lureau <=
- [PULL 07/33] ui/dbus: Expose a touch device interface, marcandre . lureau, 2023/06/27
- [PULL 01/33] ui: return NULL when getting cursor without a console, marcandre . lureau, 2023/06/27
- [PULL 15/33] ui/dbus: compile without gio/gunixfdlist.h, marcandre . lureau, 2023/06/27
- [PULL 12/33] ui/gtk: making dmabuf NULL when it's released., marcandre . lureau, 2023/06/27
- [PULL 09/33] virtio-gpu-udmabuf: create udmabuf for blob even when iov_cnt == 1, marcandre . lureau, 2023/06/27
- [PULL 18/33] qtest: add qtest_pid(), marcandre . lureau, 2023/06/27
- [PULL 16/33] scripts: add a XML preprocessor script, marcandre . lureau, 2023/06/27
- [PULL 14/33] ui/egl: fix make_context_current() callback return value, marcandre . lureau, 2023/06/27
- [PULL 13/33] ui/egl: export qemu_egl_get_error_string(), marcandre . lureau, 2023/06/27
- [PULL 19/33] tests: make dbus-display-test work on win32, marcandre . lureau, 2023/06/27