aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Aguirre <aguirre.nicolas@gmail.com>2016-03-18 16:43:53 +0100
committerNicolas Aguirre <aguirre.nicolas@gmail.com>2016-03-18 16:43:53 +0100
commit9dcafb773713d237ab60041084a3f7f5688b5343 (patch)
tree643a50da57cfb58f7ea7ac62cfba88e5dcd58c90
parentecore_fb: use libinput for all inputs (diff)
downloadefl-devs/captainigloo/eglfs.tar.gz
ecore_evas: Add eglfs backenddevs/captainigloo/eglfs
-rw-r--r--configure.ac2
-rw-r--r--src/Makefile_Ecore_Evas.am5
-rw-r--r--src/lib/ecore_evas/Ecore_Evas.h3
-rw-r--r--src/lib/ecore_evas/ecore_evas.c36
-rw-r--r--src/lib/ecore_evas/ecore_evas_module.c3
-rw-r--r--src/modules/ecore_evas/engines/fb/ecore_evas_fb.c121
6 files changed, 168 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 0ac263e9e8..3782a09207 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4217,6 +4217,7 @@ want_ecore_evas_gl_cocoa="${have_evas_engine_gl_cocoa}"
want_ecore_evas_wayland_egl="${have_evas_engine_wayland_egl}"
want_ecore_evas_extn="yes"
want_ecore_evas_drm="${have_evas_engine_drm}"
+want_ecore_evas_eglfs="${have_evas_engine_eglfs}"
if test "x${have_ecore_ipc}" = "xno" || \
test "x${efl_func_shm_open}" = "xno" || \
@@ -4249,6 +4250,7 @@ ECORE_EVAS_MODULE([drm], [${want_drm}],
ECORE_EVAS_MODULE([gl-drm], [${want_gl_drm}],
[EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ECORE_EVAS], [${want_gl_drm}], [ecore-drm])])
ECORE_EVAS_MODULE([psl1ght], [${have_ps3}])
+ECORE_EVAS_MODULE([eglfs], [${want_eglfs}])
ECORE_EVAS_MODULE([opengl-cocoa], [${want_ecore_evas_gl_cocoa}])
diff --git a/src/Makefile_Ecore_Evas.am b/src/Makefile_Ecore_Evas.am
index 3ccf7c1bde..a4f9af5100 100644
--- a/src/Makefile_Ecore_Evas.am
+++ b/src/Makefile_Ecore_Evas.am
@@ -133,9 +133,12 @@ modules_ecore_evas_engines_fb_module_la_SOURCES = $(FBSOURCES)
modules_ecore_evas_engines_fb_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
@ECORE_EVAS_CFLAGS@ \
@ECORE_FB_CFLAGS@ \
--I$(top_srcdir)/src/modules/evas/engines/fb
+-I$(top_srcdir)/src/modules/evas/engines/fb \
+-I$(top_srcdir)/src/modules/evas/engines/eglfs \
+@ecore_evas_engines_eglfs_cflags@
modules_ecore_evas_engines_fb_module_la_LIBADD = \
@USE_ECORE_EVAS_LIBS@ \
+@ecore_evas_engines_eglfs_libs@ \
@USE_ECORE_FB_LIBS@
modules_ecore_evas_engines_fb_module_la_DEPENDENCIES = \
@USE_ECORE_EVAS_INTERNAL_LIBS@ \
diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h
index 30e45b1756..377e474a0e 100644
--- a/src/lib/ecore_evas/Ecore_Evas.h
+++ b/src/lib/ecore_evas/Ecore_Evas.h
@@ -91,6 +91,7 @@ extern "C" {
*/
#define HAVE_ECORE_EVAS_X 1
#define HAVE_ECORE_EVAS_FB 1
+#define HAVE_ECORE_EVAS_EGLFS 1
#define HAVE_ECORE_EVAS_X11_GL 1
//#define HAVE_ECORE_EVAS_X11_16 1
//#define HAVE_ECORE_EVAS_DIRECTFB 1
@@ -121,6 +122,7 @@ typedef enum _Ecore_Evas_Engine_Type
ECORE_EVAS_ENGINE_SOFTWARE_SDL,
ECORE_EVAS_ENGINE_DIRECTFB,
ECORE_EVAS_ENGINE_SOFTWARE_FB,
+ ECORE_EVAS_ENGINE_EGLFS,
ECORE_EVAS_ENGINE_SOFTWARE_8_X11,
ECORE_EVAS_ENGINE_SOFTWARE_16_X11,
ECORE_EVAS_ENGINE_SOFTWARE_16_DDRAW,
@@ -1303,6 +1305,7 @@ EAPI void ecore_evas_software_x11_16_extra_event_window_add(Ecore_Eva
* @return The new Ecore_Evas.
*/
EAPI Ecore_Evas *ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h);
+EAPI Ecore_Evas *ecore_evas_eglfs_new(const char *disp_name, int rotation, int w, int h);
EAPI Ecore_Evas *ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h) EINA_DEPRECATED;
EAPI Ecore_DirectFB_Window *ecore_evas_directfb_window_get(const Ecore_Evas *ee) EINA_DEPRECATED;
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c
index eb57467441..fec89438f7 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -282,6 +282,12 @@ ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine)
#else
return EINA_FALSE;
#endif
+ case ECORE_EVAS_ENGINE_EGLFS:
+#ifdef BUILD_ECORE_EVAS_EGLFS
+ return EINA_TRUE;
+#else
+ return EINA_FALSE;
+#endif
case ECORE_EVAS_ENGINE_SOFTWARE_8_X11:
return EINA_FALSE;
@@ -646,6 +652,22 @@ _ecore_evas_constructor_fb(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, c
}
static Ecore_Evas *
+_ecore_evas_constructor_eglfs(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options)
+{
+ Ecore_Evas *ee;
+ char *disp_name = NULL;
+ unsigned int rotation = 0;
+
+ _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name);
+ _ecore_evas_parse_extra_options_uint(extra_options, "rotation=", &rotation);
+
+ ee = ecore_evas_eglfs_new(disp_name, rotation, w, h);
+ free(disp_name);
+
+ return ee;
+}
+
+static Ecore_Evas *
_ecore_evas_constructor_psl1ght(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options)
{
Ecore_Evas *ee;
@@ -769,6 +791,7 @@ static const struct ecore_evas_engine _engines[] = {
{"software_x11", _ecore_evas_constructor_software_x11},
{"opengl_x11", _ecore_evas_constructor_opengl_x11},
{"fb", _ecore_evas_constructor_fb},
+ {"eglfs", _ecore_evas_constructor_eglfs},
{"software_gdi", _ecore_evas_constructor_software_gdi},
{"software_ddraw", _ecore_evas_constructor_software_ddraw},
{"direct3d", _ecore_evas_constructor_direct3d},
@@ -3647,6 +3670,19 @@ ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h)
}
EAPI Ecore_Evas *
+ecore_evas_eglfs_new(const char *disp_name, int rotation, int w, int h)
+{
+ Ecore_Evas *(*new)(const char *, int, int, int);
+ Eina_Module *m = _ecore_evas_engine_load("fb");
+ EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
+
+ new = eina_module_symbol_get(m, "ecore_evas_eglfs_new_internal");
+ EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
+
+ return new(disp_name, rotation, w, h);
+}
+
+EAPI Ecore_Evas *
ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h)
{
Ecore_Evas *(*new)(const char *, Ecore_X_Window, int, int, int, int);
diff --git a/src/lib/ecore_evas/ecore_evas_module.c b/src/lib/ecore_evas/ecore_evas_module.c
index 59fb6010cb..239829dec7 100644
--- a/src/lib/ecore_evas/ecore_evas_module.c
+++ b/src/lib/ecore_evas/ecore_evas_module.c
@@ -189,6 +189,9 @@ _ecore_evas_available_engines_get(void)
#ifdef BUILD_ECORE_EVAS_FB
ADDENG("fb");
#endif
+#ifdef BUILD_ECORE_EVAS_EGLFS
+ ADDENG("eglfs");
+#endif
}
else if (!strcmp(name, "x"))
{
diff --git a/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c b/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c
index ed970a590c..a4ba8d58da 100644
--- a/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c
+++ b/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c
@@ -41,6 +41,7 @@
#endif /* ! _WIN32 */
static int _ecore_evas_init_count = 0;
+static Ecore_Fb_Device *dev = NULL;
static char *ecore_evas_default_display = "0";
static Eina_List *ecore_evas_input_devices = NULL;
@@ -212,8 +213,18 @@ _ecore_evas_fb_init(Ecore_Evas *ee, int w, int h)
_ecore_evas_init_count++;
if (_ecore_evas_init_count > 1) return _ecore_evas_init_count;
+ if (!(dev = ecore_fb_device_find("fb0")))
+ {
+ ERR("Could not find framebuffer device with name: %s.", "/dev/fb0");
+ }
+
+ ecore_fb_device_window_set(dev, ee);
ecore_event_evas_init();
+ ecore_fb_inputs_create(dev);
+
+ return _ecore_evas_init_count;
+
/* register all input devices */
ls = eina_file_direct_ls("/dev/input/");
@@ -743,7 +754,115 @@ ecore_evas_fb_new_internal(const char *disp_name, int rotation, int w, int h)
(Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
(Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
(Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
- (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
+ (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
return ee;
}
+
+#ifdef BUILD_ECORE_EVAS_EGLFS
+EAPI Ecore_Evas *
+ecore_evas_eglfs_new_internal(const char *disp_name, int rotation, int w, int h)
+{
+ Evas_Engine_Info_FB *einfo;
+ Ecore_Evas_Engine_FB_Data *idata;
+ Ecore_Evas *ee;
+
+ int rmethod;
+
+ if (!disp_name)
+ disp_name = ecore_evas_default_display;
+
+ rmethod = evas_render_method_lookup("eglfs");
+ if (!rmethod) return NULL;
+
+ if (!ecore_fb_init(disp_name)) return NULL;
+ ee = calloc(1, sizeof(Ecore_Evas));
+ if (!ee) return NULL;
+ idata = calloc(1, sizeof(Ecore_Evas_Engine_FB_Data));
+
+ ee->engine.data = idata;
+
+ ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
+
+ _ecore_evas_fb_init(ee, w, h);
+
+ ecore_fb_callback_gain_set(_ecore_evas_fb_gain, ee);
+ ecore_fb_callback_lose_set(_ecore_evas_fb_lose, ee);
+
+ ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_fb_engine_func;
+
+ ee->driver = "eglfs";
+ if (disp_name) ee->name = strdup(disp_name);
+
+ if (w < 1) w = 1;
+ if (h < 1) h = 1;
+ ee->rotation = rotation;
+ ee->visible = 1;
+ ee->w = w;
+ ee->h = h;
+ ee->req.w = ee->w;
+ ee->req.h = ee->h;
+
+ ee->prop.max.w = 0;
+ ee->prop.max.h = 0;
+ ee->prop.layer = 0;
+ ee->prop.focused = EINA_FALSE;
+ ee->prop.borderless = EINA_TRUE;
+ ee->prop.override = EINA_TRUE;
+ ee->prop.maximized = EINA_TRUE;
+ ee->prop.fullscreen = EINA_FALSE;
+ ee->prop.withdrawn = EINA_TRUE;
+ ee->prop.sticky = EINA_FALSE;
+
+ /* init evas here */
+ ee->evas = evas_new();
+ evas_data_attach_set(ee->evas, ee);
+ evas_output_method_set(ee->evas, rmethod);
+
+ if (ECORE_EVAS_PORTRAIT(ee))
+ {
+ evas_output_size_set(ee->evas, w, h);
+ evas_output_viewport_set(ee->evas, 0, 0, w, h);
+ }
+ else
+ {
+ evas_output_size_set(ee->evas, h, w);
+ evas_output_viewport_set(ee->evas, 0, 0, h, w);
+ }
+
+ einfo = (Evas_Engine_Info_FB *)evas_engine_info_get(ee->evas);
+ if (einfo && disp_name)
+ {
+ einfo->info.virtual_terminal = 0;
+ einfo->info.device_number = strtol(disp_name, NULL, 10);
+ einfo->info.refresh = 0;
+ einfo->info.rotation = ee->rotation;
+ if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
+ {
+ ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
+ ecore_evas_free(ee);
+ return NULL;
+ }
+ }
+ else
+ {
+ ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
+ ecore_evas_free(ee);
+ return NULL;
+ }
+
+ ecore_evas_input_event_register(ee);
+
+ ee->engine.func->fn_render = _ecore_evas_fb_render;
+ _ecore_evas_register(ee);
+ ecore_evas_input_event_register(ee);
+
+ ecore_event_window_register(1, ee, ee->evas,
+ (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
+ (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
+ (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
+ (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
+ evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
+ return ee;
+}
+#endif