This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch evas-sdl3-rewrite
in repository efl.
View the commit online.
commit 0a88debcecf3a6dbab4d180b0e9548e7f6a52ee7
Author: Swagtoy <[email protected]>
AuthorDate: Sat May 23 13:44:46 2026 -0400
gl_sdl: Fix flickering issues; try lock, swap interval vsync
Don't actually know if this lock is needed.
Swap interval will probably need to be hidden behind a flag
Signed-off-by: Swagtoy <[email protected]>
---
src/modules/evas/engines/gl_sdl/evas_engine.c | 48 ++++++++++++++++++++-------
1 file changed, 36 insertions(+), 12 deletions(-)
diff --git a/src/modules/evas/engines/gl_sdl/evas_engine.c b/src/modules/evas/engines/gl_sdl/evas_engine.c
index 0bc7321d94..25ee1a4ec3 100644
--- a/src/modules/evas/engines/gl_sdl/evas_engine.c
+++ b/src/modules/evas/engines/gl_sdl/evas_engine.c
@@ -16,6 +16,7 @@ Evas_GL_Common_Context_Call glsym_evas_gl_common_context_newframe = NULL;
Evas_GL_Common_Context_Call glsym_evas_gl_common_image_all_unload = NULL;
Evas_GL_Common_Context_Resize_Call glsym_evas_gl_common_context_resize = NULL;
Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_lock = NULL;
+Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_unlock = NULL;
Evas_Gl_Symbols glsym_evas_gl_symbols = NULL;
typedef const char * (*glGetString_fn)(GLenum);
@@ -25,10 +26,20 @@ int _evas_engine_GL_SDL_log_dom = -1;
/* function tables - filled in later (func and parent func) */
static Evas_Func func, pfunc;
+static Eina_Bool
+eng_window_make_current(void *data, void *doit EINA_UNUSED)
+{
+ Outbuf *ob = data;
+ SDL_GL_MakeCurrent(ob->window, ob->context);
+ return EINA_TRUE;
+}
+
static void
_outbuf_reconfigure(Outbuf *ob EINA_UNUSED, int w EINA_UNUSED, int h EINA_UNUSED, int rot EINA_UNUSED, Outbuf_Depth depth EINA_UNUSED)
{
- glsym_evas_gl_common_context_resize(ob->gl_context, w, h, ob->info->flags.rotation);
+ ob->w = w;
+ ob->h = h;
+ glsym_evas_gl_common_context_resize(ob->gl_context, ob->w, ob->h, ob->info->flags.rotation);
}
static Eina_Bool
@@ -36,7 +47,12 @@ _outbuf_region_first_rect(Outbuf *ob EINA_UNUSED)
{
ob->gl_context->preserve_bit = GL_COLOR_BUFFER_BIT0_QCOM;
- return EINA_FALSE;
+ glsym_evas_gl_preload_render_lock(eng_window_make_current, ob);
+
+ // Other backends do a lot more here, such as calling
+ // evas_gl_common_context_resize. Should we consider doing that here?
+
+ return EINA_TRUE;
}
static void *
@@ -83,21 +99,18 @@ static void
_outbuf_flush(Outbuf *ob, Tilebuf_Rect *surface_damage EINA_UNUSED, Tilebuf_Rect *buffer_damage EINA_UNUSED, Evas_Render_Mode render_mode EINA_UNUSED)
{
SDL_GL_SwapWindow(ob->window);
+ glsym_evas_gl_preload_render_unlock(eng_window_make_current, ob);
}
-static Eina_Bool
-eng_window_make_current(void *data, void *doit EINA_UNUSED)
+static void
+_outbuf_redraws_clear()
{
- Outbuf *ob = data;
-
- SDL_GL_MakeCurrent(ob->window, ob->context);
- return EINA_TRUE;
}
static void
_window_use(Outbuf *ob)
{
- /* With SDL 1.x, only one window, no issue here so only flush evas context */
+ // TODO: no???
glsym_evas_gl_preload_render_lock(eng_window_make_current, ob);
if (ob)
@@ -113,6 +126,8 @@ _window_gl_context_get(Outbuf *ob)
return ob->gl_context;
}
+// XXX: Drop this. We don't really poke at the direct egl display from
+// EFL, nor do we really want to.
static void *
_window_egl_display_get(Outbuf *ob)
{
@@ -178,8 +193,15 @@ evgl_eng_make_current(void *data EINA_UNUSED,
void *surface, void *context,
int flush)
{
- if (flush) _window_use(NULL);
- SDL_GL_MakeCurrent(surface, context);
+ if (flush)
+ {
+ // Will end up callign MakeCurrent in the process
+ _window_use(NULL);
+ }
+ else
+ {
+ SDL_GL_MakeCurrent(surface, context);
+ }
return EINA_TRUE;
}
@@ -305,7 +327,7 @@ eng_output_setup(void *engine, void *in, unsigned int w, unsigned int h)
NULL,
NULL,
_outbuf_flush,
- NULL,
+ NULL, // _outbuf_redraws_clear,
_outbuf_free,
_window_use,
_window_gl_context_get,
@@ -369,6 +391,7 @@ gl_symbols(void)
LINK2GENERIC(evas_gl_common_context_newframe);
LINK2GENERIC(evas_gl_common_image_all_unload);
LINK2GENERIC(evas_gl_preload_render_lock);
+ LINK2GENERIC(evas_gl_preload_render_unlock);
// Find EGL extensions
// FIXME: whgen above eglGetDisplay() is fixed... fix the below...
@@ -463,6 +486,7 @@ _sdl_output_setup(int w, int h, int fullscreen EINA_UNUSED, int noframe EINA_UNU
ob->h = h;
ob->info = info;
ob->context = SDL_GL_CreateContext(ob->window);
+ SDL_GL_SetSwapInterval(1);
if (!ob->context)
{
ERR("Cannot create a context for window %p: %s", info->window, SDL_GetError());
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.