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 765542aa468761d17fca05c228901a0c56b5d9bb
Author: Swagtoy <[email protected]>
AuthorDate: Sun May 10 13:04:08 2026 -0400
software_sdl: introduce new SDL software renderer backend
It is buggy. It is blue (really). It has no options, but it is
slightly usably in this state.
Signed-off-by: Swagtoy <[email protected]>
---
src/modules/ecore_evas/engines/sdl/meson.build | 4 +-
src/modules/evas/engines/meson.build | 1 +
.../software_sdl/Evas_Engine_Software_SDL.h | 27 +++
.../evas/engines/software_sdl/evas_engine.c | 187 +++++++++++++++++++++
.../evas/engines/software_sdl/evas_engine.h | 49 ++++++
src/modules/evas/engines/software_sdl/meson.build | 16 ++
6 files changed, 283 insertions(+), 1 deletion(-)
diff --git a/src/modules/ecore_evas/engines/sdl/meson.build b/src/modules/ecore_evas/engines/sdl/meson.build
index 030ca6561a..b00d2ab949 100644
--- a/src/modules/ecore_evas/engines/sdl/meson.build
+++ b/src/modules/ecore_evas/engines/sdl/meson.build
@@ -1,5 +1,7 @@
engine_src = files(['ecore_evas_sdl.c'])
-engine_deps = [ecore_sdl, ecore_input, ecore, dependency('sdl2')]
+engine_deps = [ecore_sdl, ecore_input, ecore, dependency('sdl3')]
+
+engine_deps += [engine_software_sdl]
shared_module(mod_full_name, engine_src,
c_args : package_c_args,
diff --git a/src/modules/evas/engines/meson.build b/src/modules/evas/engines/meson.build
index 9bf182feb0..262a149f4f 100644
--- a/src/modules/evas/engines/meson.build
+++ b/src/modules/evas/engines/meson.build
@@ -17,6 +17,7 @@ else
engines += [
['fb', ['fb']],
['drm', ['drm']],
+ ['software_sdl', ['sdl']],
['software_x11', ['x11']],
['wayland_shm', ['wl']],
]
diff --git a/src/modules/evas/engines/software_sdl/Evas_Engine_Software_SDL.h b/src/modules/evas/engines/software_sdl/Evas_Engine_Software_SDL.h
new file mode 100644
index 0000000000..e153a85009
--- /dev/null
+++ b/src/modules/evas/engines/software_sdl/Evas_Engine_Software_SDL.h
@@ -0,0 +1,27 @@
+#ifndef _EVAS_ENGINE_SOFTWARE_SDL_H
+# define _EVAS_ENGINE_SOFTWARE_SDL_H
+
+#include <SDL3/SDL.h>
+
+typedef struct _Evas_Engine_Info_Software_SDL Evas_Engine_Info_Software_SDL;
+
+struct _Evas_Engine_Info_Software_SDL
+{
+ /* PRIVATE - don't mess with this baby or evas will poke its tongue out */
+ /* at you and make nasty noises */
+ Evas_Engine_Info magic;
+
+ /* engine specific data & parameters it needs to set up */
+ struct
+ {
+ // None. Bad?
+ } info;
+
+
+ Eina_Lock lock;
+ SDL_Surface *surface;
+ /* non-blocking or blocking mode */
+ Evas_Engine_Render_Mode render_mode;
+};
+
+#endif
diff --git a/src/modules/evas/engines/software_sdl/evas_engine.c b/src/modules/evas/engines/software_sdl/evas_engine.c
new file mode 100644
index 0000000000..3c33dd1855
--- /dev/null
+++ b/src/modules/evas/engines/software_sdl/evas_engine.c
@@ -0,0 +1,187 @@
+#include "evas_common_private.h"
+#include "evas_private.h"
+
+#include "Evas_Engine_Software_SDL.h"
+#include "evas_engine.h"
+
+#include "../software_generic/evas_native_common.h"
+
+#include <Ecore.h>
+#include <Eina.h>
+#include <SDL3/SDL.h>
+
+int _evas_engine_soft_sdl_log_dom;
+
+static Evas_Func func, pfunc;
+
+typedef Render_Output_Software_Generic Render_Engine;
+
+// Move these to their own file! //////////////////////
+///////////////////////////////////////////////////////
+
+Outbuf *
+evas_software_sdl_outbuf_setup()
+{
+
+}
+
+Render_Output_Swap_Mode
+evas_software_sdl_outbuf_swap_mode_get(Outbuf *ob)
+{
+ return MODE_FULL;
+}
+
+int
+evas_software_sdl_outbuf_rot_get(Outbuf *ob EINA_UNUSED)
+{
+ return 0;
+}
+
+void *
+evas_software_sdl_outbuf_new_region_for_update(Outbuf *ob, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch)
+{
+ RGBA_Image *im;
+
+ im = (RGBA_Image *) evas_cache_image_empty(evas_common_image_cache_get());
+ if (im)
+ {
+ *cx = 0;
+ *cy = 0;
+ *cw = w;
+ *ch = h;
+ // XXX
+ im->cache_entry.flags.alpha = 1;
+ im = (RGBA_Image *) evas_cache_image_size_set(&im->cache_entry, w, h);
+ }
+ return im;
+}
+
+void
+evas_software_sdl_outbuf_reconfigure(Outbuf *ob, int w, int h, int rot EINA_UNUSED, Outbuf_Depth depth)
+{
+ Evas_Engine_Info_Software_SDL *info = ob->info;
+ if (info->surface)
+ SDL_DestroySurface(info->surface);
+ info->surface = SDL_CreateSurface(w, h, SDL_PIXELFORMAT_ABGR8888);
+}
+
+void
+evas_software_sdl_outbuf_push_updated_region(Outbuf *ob, RGBA_Image *update, int x, int y, int w, int h)
+{
+ const int row_bytes = 4;
+ Evas_Engine_Info_Software_SDL *info = ob->info;
+ if (!info->surface)
+ {
+ return;
+ }
+
+ // map RGBA_Image data to a surface for convenience
+ SDL_Surface *tmpsurf = SDL_CreateSurfaceFrom(w, h, SDL_PIXELFORMAT_BGRA8888, update->image.data, w * row_bytes);
+
+ SDL_BlitSurface(tmpsurf, NULL, info->surface, NULL);
+ SDL_DestroySurface(tmpsurf);
+ //eina_lock_take(&info->lock);
+}
+
+void
+evas_software_sdl_outbuf_free_region_for_update(Outbuf *ob, RGBA_Image *update)
+{
+ evas_cache_image_drop(&update->cache_entry);
+}
+
+///////////////////////////////////////////////////////
+
+static void *
+eng_output_setup(void *engine, void *in, unsigned int w, unsigned int h)
+{
+ Evas_Engine_Info_Software_SDL *info = in;
+ Outbuf *ob;
+ Outbuf_Depth dep;
+ Render_Engine *re;
+
+ eina_lock_new(&info->lock);
+
+ if (!(re = calloc(1, sizeof(Render_Engine))))
+ return NULL;
+
+ ob = calloc(1, sizeof(Outbuf));
+ ob->info = info;
+ // For now...
+ dep = OUTBUF_DEPTH_ARGB_32BPP_8888_8888;
+ ob->depth = dep;
+ evas_render_engine_software_generic_init(engine, re, ob,
+ evas_software_sdl_outbuf_swap_mode_get,
+ evas_software_sdl_outbuf_rot_get, // rot
+ evas_software_sdl_outbuf_reconfigure, // reconfigure
+ NULL,
+ NULL,
+ evas_software_sdl_outbuf_new_region_for_update, // new_region_for_update
+ evas_software_sdl_outbuf_push_updated_region, // push_updated_region
+ evas_software_sdl_outbuf_free_region_for_update,
+ NULL, // idle_flush
+ NULL, // flush
+ NULL,
+ NULL, // free
+ w, h);
+ return re;
+}
+
+
+
+/* module advertising code */
+static int
+module_open(Evas_Module *em)
+{
+ if (!em) return 0;
+ /* get whatever engine module we inherit from */
+ if (!_evas_module_engine_inherit(&pfunc, "software_generic", sizeof (Evas_Engine_Info_Software_SDL))) return 0;
+
+ _evas_engine_soft_sdl_log_dom = eina_log_domain_register
+ ("evas-soft-sdl", EINA_COLOR_BLUE);
+ if (_evas_engine_soft_sdl_log_dom < 0)
+ {
+ EINA_LOG_ERR("Can not create a module log domain.");
+ return 0;
+ }
+
+ /* store it for later use */
+ func = pfunc;
+ /* now to override methods */
+#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
+ //ORD(output_info_setup);
+ ORD(output_setup);
+ //ORD(canvas_alpha_get);
+ //ORD(output_free);
+
+ /* now advertise out own api */
+ em->functions = (void *)(&func);
+ return 1;
+}
+
+static void
+module_close(Evas_Module *em EINA_UNUSED)
+{
+ if (_evas_engine_soft_sdl_log_dom >= 0)
+ {
+ eina_log_domain_unregister(_evas_engine_soft_sdl_log_dom);
+ _evas_engine_soft_sdl_log_dom = -1;
+ }
+}
+
+static Evas_Module_Api evas_modapi =
+{
+ EVAS_MODULE_API_VERSION,
+ "software_sdl",
+ "none",
+ {
+ module_open,
+ module_close
+ }
+};
+
+EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, software_sdl);
+
+#ifndef EVAS_STATIC_BUILD_BUFFER
+EVAS_EINA_MODULE_DEFINE(engine, software_sdl);
+#endif
+
diff --git a/src/modules/evas/engines/software_sdl/evas_engine.h b/src/modules/evas/engines/software_sdl/evas_engine.h
new file mode 100644
index 0000000000..6ad1522d12
--- /dev/null
+++ b/src/modules/evas/engines/software_sdl/evas_engine.h
@@ -0,0 +1,49 @@
+#ifndef EVAS_ENGINE_H
+# define EVAS_ENGINE_H
+
+#include <SDL3/SDL.h>
+#include <Ecore.h>
+
+#include "../software_generic/Evas_Engine_Software_Generic.h"
+
+extern int _evas_engine_soft_sdl_log_dom;
+
+# ifdef ERR
+# undef ERR
+# endif
+# define ERR(...) EINA_LOG_DOM_ERR(_evas_engine_soft_sdl_log_dom, __VA_ARGS__)
+
+# ifdef DBG
+# undef DBG
+# endif
+# define DBG(...) EINA_LOG_DOM_DBG(_evas_engine_soft_sdl_log_dom, __VA_ARGS__)
+
+# ifdef INF
+# undef INF
+# endif
+# define INF(...) EINA_LOG_DOM_INFO(_evas_engine_soft_sdl_log_dom, __VA_ARGS__)
+
+# ifdef WRN
+# undef WRN
+# endif
+# define WRN(...) EINA_LOG_DOM_WARN(_evas_engine_soft_sdl_log_dom, __VA_ARGS__)
+
+# ifdef CRI
+# undef CRI
+# endif
+# define CRI(...) \
+ EINA_LOG_DOM_CRIT(_evas_engine_soft_sdl_log_dom, __VA_ARGS__)
+
+struct _Outbuf
+{
+ Outbuf_Depth depth;
+ void *info;
+ int w, h;
+
+ // private
+ SDL_Surface *surface;
+
+ int ready : 1;
+};
+
+#endif
diff --git a/src/modules/evas/engines/software_sdl/meson.build b/src/modules/evas/engines/software_sdl/meson.build
new file mode 100644
index 0000000000..482a7afd83
--- /dev/null
+++ b/src/modules/evas/engines/software_sdl/meson.build
@@ -0,0 +1,16 @@
+engine_src = files([
+ 'evas_engine.c',
+ 'evas_engine.h',
+ 'Evas_Engine_Software_SDL.h',
+])
+
+engine_deps += [dependency('sdl3')]
+
+shared_module(mod_full_name, engine_src,
+ include_directories : config_dir + [engine_include_dir],
+ dependencies : engine_deps,
+ install : true,
+ install_dir : mod_install_dir,
+ name_suffix : sys_mod_extension
+)
+module_files += join_paths(mod_install_dir, 'lib'+mod_full_name + '.' + sys_mod_extension)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.