summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Revest <revestflo@gmail.com>2015-07-22 18:48:41 +0200
committerNicolas Aguirre <aguirre.nicolas@gmail.com>2015-08-03 14:16:35 +0200
commita254725d6dedbcfec638f8151bd89e9db068df8f (patch)
treee94b2f0594632712f2f6ecd872afbdb39f9c1d7a
parent715e0a2508115829e4652ed92c6dc0e871c15ee5 (diff)
ecore_evas: Adds an eglfs module
-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.c106
4 files changed, 148 insertions, 0 deletions
diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h
index 1a035ab1fa..9e94ebdb5d 100644
--- a/src/lib/ecore_evas/Ecore_Evas.h
+++ b/src/lib/ecore_evas/Ecore_Evas.h
@@ -91,6 +91,7 @@ extern "C" {
91 */ 91 */
92#define HAVE_ECORE_EVAS_X 1 92#define HAVE_ECORE_EVAS_X 1
93#define HAVE_ECORE_EVAS_FB 1 93#define HAVE_ECORE_EVAS_FB 1
94#define HAVE_ECORE_EVAS_EGLFS 1
94#define HAVE_ECORE_EVAS_X11_GL 1 95#define HAVE_ECORE_EVAS_X11_GL 1
95//#define HAVE_ECORE_EVAS_X11_16 1 96//#define HAVE_ECORE_EVAS_X11_16 1
96//#define HAVE_ECORE_EVAS_DIRECTFB 1 97//#define HAVE_ECORE_EVAS_DIRECTFB 1
@@ -121,6 +122,7 @@ typedef enum _Ecore_Evas_Engine_Type
121 ECORE_EVAS_ENGINE_SOFTWARE_SDL, 122 ECORE_EVAS_ENGINE_SOFTWARE_SDL,
122 ECORE_EVAS_ENGINE_DIRECTFB, 123 ECORE_EVAS_ENGINE_DIRECTFB,
123 ECORE_EVAS_ENGINE_SOFTWARE_FB, 124 ECORE_EVAS_ENGINE_SOFTWARE_FB,
125 ECORE_EVAS_ENGINE_EGLFS,
124 ECORE_EVAS_ENGINE_SOFTWARE_8_X11, 126 ECORE_EVAS_ENGINE_SOFTWARE_8_X11,
125 ECORE_EVAS_ENGINE_SOFTWARE_16_X11, 127 ECORE_EVAS_ENGINE_SOFTWARE_16_X11,
126 ECORE_EVAS_ENGINE_SOFTWARE_16_DDRAW, 128 ECORE_EVAS_ENGINE_SOFTWARE_16_DDRAW,
@@ -1303,6 +1305,7 @@ EAPI void ecore_evas_software_x11_16_extra_event_window_add(Ecore_Eva
1303 * @return The new Ecore_Evas. 1305 * @return The new Ecore_Evas.
1304 */ 1306 */
1305EAPI Ecore_Evas *ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h); 1307EAPI Ecore_Evas *ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h);
1308EAPI Ecore_Evas *ecore_evas_eglfs_new(const char *disp_name, int rotation, int w, int h);
1306 1309
1307EAPI Ecore_Evas *ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h) EINA_DEPRECATED; 1310EAPI Ecore_Evas *ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h) EINA_DEPRECATED;
1308EAPI Ecore_DirectFB_Window *ecore_evas_directfb_window_get(const Ecore_Evas *ee) EINA_DEPRECATED; 1311EAPI 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 f7fa61f61b..ad15b1f5df 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -277,6 +277,12 @@ ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine)
277#else 277#else
278 return EINA_FALSE; 278 return EINA_FALSE;
279#endif 279#endif
280 case ECORE_EVAS_ENGINE_EGLFS:
281#ifdef BUILD_ECORE_EVAS_EGLFS
282 return EINA_TRUE;
283#else
284 return EINA_FALSE;
285#endif
280 286
281 case ECORE_EVAS_ENGINE_SOFTWARE_8_X11: 287 case ECORE_EVAS_ENGINE_SOFTWARE_8_X11:
282 return EINA_FALSE; 288 return EINA_FALSE;
@@ -641,6 +647,22 @@ _ecore_evas_constructor_fb(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, c
641} 647}
642 648
643static Ecore_Evas * 649static Ecore_Evas *
650_ecore_evas_constructor_eglfs(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options)
651{
652 Ecore_Evas *ee;
653 char *disp_name = NULL;
654 unsigned int rotation = 0;
655
656 _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name);
657 _ecore_evas_parse_extra_options_uint(extra_options, "rotation=", &rotation);
658
659 ee = ecore_evas_eglfs_new(disp_name, rotation, w, h);
660 free(disp_name);
661
662 return ee;
663}
664
665static Ecore_Evas *
644_ecore_evas_constructor_psl1ght(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options) 666_ecore_evas_constructor_psl1ght(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options)
645{ 667{
646 Ecore_Evas *ee; 668 Ecore_Evas *ee;
@@ -764,6 +786,7 @@ static const struct ecore_evas_engine _engines[] = {
764 {"software_x11", _ecore_evas_constructor_software_x11}, 786 {"software_x11", _ecore_evas_constructor_software_x11},
765 {"opengl_x11", _ecore_evas_constructor_opengl_x11}, 787 {"opengl_x11", _ecore_evas_constructor_opengl_x11},
766 {"fb", _ecore_evas_constructor_fb}, 788 {"fb", _ecore_evas_constructor_fb},
789 {"eglfs", _ecore_evas_constructor_eglfs},
767 {"software_gdi", _ecore_evas_constructor_software_gdi}, 790 {"software_gdi", _ecore_evas_constructor_software_gdi},
768 {"software_ddraw", _ecore_evas_constructor_software_ddraw}, 791 {"software_ddraw", _ecore_evas_constructor_software_ddraw},
769 {"direct3d", _ecore_evas_constructor_direct3d}, 792 {"direct3d", _ecore_evas_constructor_direct3d},
@@ -3481,6 +3504,19 @@ ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h)
3481} 3504}
3482 3505
3483EAPI Ecore_Evas * 3506EAPI Ecore_Evas *
3507ecore_evas_eglfs_new(const char *disp_name, int rotation, int w, int h)
3508{
3509 Ecore_Evas *(*new)(const char *, int, int, int);
3510 Eina_Module *m = _ecore_evas_engine_load("fb");
3511 EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
3512
3513 new = eina_module_symbol_get(m, "ecore_evas_eglfs_new_internal");
3514 EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
3515
3516 return new(disp_name, rotation, w, h);
3517}
3518
3519EAPI Ecore_Evas *
3484ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h) 3520ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h)
3485{ 3521{
3486 Ecore_Evas *(*new)(const char *, Ecore_X_Window, int, int, int, int); 3522 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)
189#ifdef BUILD_ECORE_EVAS_FB 189#ifdef BUILD_ECORE_EVAS_FB
190 ADDENG("fb"); 190 ADDENG("fb");
191#endif 191#endif
192#ifdef BUILD_ECORE_EVAS_EGLFS
193 ADDENG("eglfs");
194#endif
192 } 195 }
193 else if (!strcmp(name, "x")) 196 else if (!strcmp(name, "x"))
194 { 197 {
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 8042d0c082..34e410dd38 100644
--- a/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c
+++ b/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c
@@ -744,3 +744,109 @@ ecore_evas_fb_new_internal(const char *disp_name, int rotation, int w, int h)
744 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); 744 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
745 return ee; 745 return ee;
746} 746}
747
748#ifdef BUILD_ECORE_EVAS_EGLFS
749EAPI Ecore_Evas *
750ecore_evas_eglfs_new_internal(const char *disp_name, int rotation, int w, int h)
751{
752 Evas_Engine_Info_FB *einfo;
753 Ecore_Evas_Engine_FB_Data *idata;
754 Ecore_Evas *ee;
755
756 int rmethod;
757
758 if (!disp_name)
759 disp_name = ecore_evas_default_display;
760
761 rmethod = evas_render_method_lookup("eglfs");
762 if (!rmethod) return NULL;
763
764 if (!ecore_fb_init(disp_name)) return NULL;
765 ee = calloc(1, sizeof(Ecore_Evas));
766 if (!ee) return NULL;
767 idata = calloc(1, sizeof(Ecore_Evas_Engine_FB_Data));
768
769 ee->engine.data = idata;
770
771 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
772
773 _ecore_evas_fb_init(ee, w, h);
774
775 ecore_fb_callback_gain_set(_ecore_evas_fb_gain, ee);
776 ecore_fb_callback_lose_set(_ecore_evas_fb_lose, ee);
777
778 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_fb_engine_func;
779
780 ee->driver = "eglfs";
781 if (disp_name) ee->name = strdup(disp_name);
782
783 if (w < 1) w = 1;
784 if (h < 1) h = 1;
785 ee->rotation = rotation;
786 ee->visible = 1;
787 ee->w = w;
788 ee->h = h;
789 ee->req.w = ee->w;
790 ee->req.h = ee->h;
791
792 ee->prop.max.w = 0;
793 ee->prop.max.h = 0;
794 ee->prop.layer = 0;
795 ee->prop.focused = EINA_FALSE;
796 ee->prop.borderless = EINA_TRUE;
797 ee->prop.override = EINA_TRUE;
798 ee->prop.maximized = EINA_TRUE;
799 ee->prop.fullscreen = EINA_FALSE;
800 ee->prop.withdrawn = EINA_TRUE;
801 ee->prop.sticky = EINA_FALSE;
802
803 /* init evas here */
804 ee->evas = evas_new();
805 evas_data_attach_set(ee->evas, ee);
806 evas_output_method_set(ee->evas, rmethod);
807
808 if (ECORE_EVAS_PORTRAIT(ee))
809 {
810 evas_output_size_set(ee->evas, w, h);
811 evas_output_viewport_set(ee->evas, 0, 0, w, h);
812 }
813 else
814 {
815 evas_output_size_set(ee->evas, h, w);
816 evas_output_viewport_set(ee->evas, 0, 0, h, w);
817 }
818
819 einfo = (Evas_Engine_Info_FB *)evas_engine_info_get(ee->evas);
820 if (einfo && disp_name)
821 {
822 einfo->info.virtual_terminal = 0;
823 einfo->info.device_number = strtol(disp_name, NULL, 10);
824 einfo->info.refresh = 0;
825 einfo->info.rotation = ee->rotation;
826 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
827 {
828 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
829 ecore_evas_free(ee);
830 return NULL;
831 }
832 }
833 else
834 {
835 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
836 ecore_evas_free(ee);
837 return NULL;
838 }
839
840 ecore_evas_input_event_register(ee);
841
842 ee->engine.func->fn_render = _ecore_evas_fb_render;
843 _ecore_evas_register(ee);
844 ecore_event_window_register(1, ee, ee->evas,
845 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
846 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
847 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
848 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
849 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
850 return ee;
851}
852#endif