diff --git a/configure.ac b/configure.ac index 47a60fbdad..46423f58fb 100644 --- a/configure.ac +++ b/configure.ac @@ -4381,6 +4381,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" || \ @@ -4413,6 +4414,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-drm2])]) 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 747a426b8a..a6f2794cb3 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 db13c1e91d..c877892239 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c @@ -286,6 +286,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; @@ -652,6 +658,22 @@ _ecore_evas_constructor_fb(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, c return ee; } +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) { @@ -776,6 +798,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}, @@ -3667,6 +3690,19 @@ ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h) return new(disp_name, rotation, w, 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) { 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 @@ -188,6 +188,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 6f0f8b3715..fb7572bae6 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/"); @@ -748,3 +759,111 @@ ecore_evas_fb_new_internal(const char *disp_name, int rotation, int w, int h) 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