From: MinJeong Kim Date: Fri, 4 Dec 2015 04:26:36 +0000 (+0900) Subject: Added enable-quick-init option X-Git-Tag: accepted/tizen/mobile/20151206.224233~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F45%2F53345%2F3;p=platform%2Fupstream%2Fenlightenment.git Added enable-quick-init option To decrease enlightenment's initialization time, quick init option is added. Change-Id: I509a113e020cd3d6685e2e891a2c58e3f5a87aa3 --- diff --git a/configure.ac b/configure.ac index a561ed4..3003f4c 100755 --- a/configure.ac +++ b/configure.ac @@ -454,6 +454,17 @@ AC_ARG_ENABLE([wayland-only], AC_MSG_CHECKING([whether wayland-only version is enabled]) AC_MSG_RESULT([${e_cv_want_wayland_only}]) +quick_init=no +AC_ARG_ENABLE([quick-init], + AS_HELP_STRING([--enable-quick-init],[]), + [ + quick_init=yes + AC_DEFINE_UNQUOTED([ENABLE_QUICK_INIT], [1], [enable quick init]) + ], + [quick_init=no]) +AC_MSG_CHECKING([whether enlightenment quick initialization is enabled]) +AC_MSG_RESULT([${quick_init}]) + # doxygen program for documentation building EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"]) diff --git a/packaging/enlightenment.spec b/packaging/enlightenment.spec index 075bdd5..4544916 100644 --- a/packaging/enlightenment.spec +++ b/packaging/enlightenment.spec @@ -92,6 +92,7 @@ cp %{SOURCE1001} . --disable-winlist \ --disable-wizard \ --disable-wl-x11 \ + --enable-quick-init \ %endif --enable-mount-eeze diff --git a/src/bin/e_comp.c b/src/bin/e_comp.c index 74f27a4..c7cdb72 100644 --- a/src/bin/e_comp.c +++ b/src/bin/e_comp.c @@ -1115,8 +1115,10 @@ e_comp_init(void) #endif if (!e_comp) return EINA_FALSE; out: +#ifndef ENABLE_QUICK_INIT e_comp->elm = elm_win_fake_add(e_comp->ee); evas_object_show(e_comp->elm); +#endif e_util_env_set("HYBRIS_EGLPLATFORM", NULL); E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_ON, _e_comp_screensaver_on, NULL); E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_OFF, _e_comp_screensaver_off, NULL); @@ -1127,7 +1129,6 @@ out: return EINA_TRUE; } - static Eina_Bool _style_demo(void *data) { @@ -1360,6 +1361,17 @@ e_comp_shutdown(void) } EAPI void +e_comp_deferred_job(void) +{ + e_comp->elm = elm_win_fake_add(e_comp->ee); + evas_object_show(e_comp->elm); + +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) + e_comp_wl_deferred_job(); +#endif +} + +EAPI void e_comp_render_queue(E_Comp *c) { E_OBJECT_CHECK(c); diff --git a/src/bin/e_comp.h b/src/bin/e_comp.h index 72a699a..d6aff5a 100644 --- a/src/bin/e_comp.h +++ b/src/bin/e_comp.h @@ -177,6 +177,7 @@ EINTERN Eina_Bool e_comp_init(void); EAPI E_Comp *e_comp_new(void); EAPI int e_comp_internal_save(void); EINTERN int e_comp_shutdown(void); +EAPI void e_comp_deferred_job(void); EAPI void e_comp_render_queue(E_Comp *c); EAPI void e_comp_shape_queue(E_Comp *c); EAPI void e_comp_shape_queue_block(E_Comp *c, Eina_Bool block); diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index 4d14fe4..e72f246 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -3822,9 +3822,11 @@ _e_comp_wl_compositor_create(void) /* setup module idler to load shell mmodule */ ecore_idler_add(_e_comp_wl_cb_module_idle, cdata); +#ifndef ENABLE_QUICK_INIT /* check if gl init succeded */ ecore_idler_add(_e_comp_wl_gl_idle, cdata); +#endif if (comp->comp_type == E_PIXMAP_TYPE_X) { e_comp_wl_input_pointer_enabled_set(EINA_TRUE); @@ -3923,6 +3925,12 @@ e_comp_wl_init(void) return EINA_TRUE; } +EAPI void +e_comp_wl_deferred_job(void) +{ + ecore_idle_enterer_add(_e_comp_wl_gl_idle, NULL); +} + /** * Get the signal that is fired for the creation of a Wayland surface. * diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h index 3fb7d2f..64c79f0 100644 --- a/src/bin/e_comp_wl.h +++ b/src/bin/e_comp_wl.h @@ -402,6 +402,8 @@ struct _E_Comp_Wl_Output EAPI Eina_Bool e_comp_wl_init(void); EINTERN void e_comp_wl_shutdown(void); +EAPI void e_comp_wl_deferred_job(void); + EINTERN struct wl_resource *e_comp_wl_surface_create(struct wl_client *client, int version, uint32_t id); EINTERN void e_comp_wl_surface_destroy(struct wl_resource *resource); EINTERN void e_comp_wl_surface_attach(E_Client *ec, E_Comp_Wl_Buffer *buffer); diff --git a/src/bin/e_main.c b/src/bin/e_main.c index e357d5b..e4151be 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -200,12 +200,78 @@ _xdg_data_dirs_augment(void) } } +#ifndef ENABLE_QUICK_INIT static Eina_Bool _e_main_shelf_init_job(void *data EINA_UNUSED) { e_shelf_config_update(); return ECORE_CALLBACK_CANCEL; } +#else +static Eina_Bool +_e_main_subsystem_defer(void *data EINA_UNUSED) +{ + int argc; + char **argv; + + ecore_app_args_get(&argc, &argv); + + /* try to init delayed subsystems */ + TS("[DEFERRED] Elementary Init"); + if (!elm_init(argc, argv)) + { + e_error_message_show(_("Enlightenment cannot initialize Elementary!\n")); + _e_main_shutdown(-1); + } + TS("[DEFERRED] Elementary Init Done"); + + TS("[DEFERRED] Screens Init: win"); + if (!e_win_init()) + { + e_error_message_show(_("Enlightenment cannot setup elementary trap!\n")); + _e_main_shutdown(-1); + } + TS("[DEFERRED] Screens Init: win Done"); + + TS("[DEFERRED] E_Scale Init"); + if (!e_scale_init()) + { + e_error_message_show(_("Enlightenment cannot set up its scale system.\n")); + _e_main_shutdown(-1); + } + TS("[DEFERRED E_Scale Init Done"); + _e_main_shutdown_push(e_scale_shutdown); + + TS("[DEFERRED] E_Test_Helper Init"); + e_test_helper_init(); + _e_main_shutdown_push(e_test_helper_shutdown); + TS("[DEFERRED] E_Test_Helper Done"); + + TS("[DEFERRED] E_INFO_SERVER Init"); + e_info_server_init(); + _e_main_shutdown_push(e_info_server_shutdown); + TS("[DEFERRED] E_INFO_SERVER Done"); + + /* try to do deferred job of any subsystems*/ + TS("[DEFERRED] Compositor's deferred job"); + e_comp_deferred_job(); + TS("[DEFERRED] Compositor's deferred job Done"); + + TS("[DEFERRED] E_Module's deferred job"); + e_module_deferred_job(); + TS("[DEFERRED] E_Module's deferred job Done"); + + return ECORE_CALLBACK_DONE; +} + +static Eina_Bool +_e_main_deferred_job_schedule(void *d EINA_UNUSED, int type EINA_UNUSED, void *ev EINA_UNUSED) +{ + ecore_idler_add(_e_main_subsystem_defer, NULL); + return ECORE_CALLBACK_DONE; +} + +#endif /* externally accessible functions */ int @@ -404,6 +470,7 @@ main(int argc, char **argv) TS("Ecore_File Init Done"); _e_main_shutdown_push(ecore_file_shutdown); +#ifndef ENABLE_QUICK_INIT TS("Ecore_Con Init"); if (!ecore_con_init()) { @@ -1025,10 +1092,10 @@ main(int argc, char **argv) _e_main_shutdown_push(e_test_helper_shutdown); TS("E_Test_Helper Done"); - TS("E_INFO_SERVER Init"); + TS("E_Info_Server Init"); e_info_server_init(); _e_main_shutdown_push(e_info_server_shutdown); - TS("E_INFO_SERVER Done"); + TS("E_Info_Server Done"); if (e_config->show_splash) e_init_status_set(_("Setup Shelves")); @@ -1041,6 +1108,319 @@ main(int argc, char **argv) TS("E_Shelf Init Done"); ecore_idle_enterer_before_add(_e_main_shelf_init_job, NULL); +#else + _idle_before = ecore_idle_enterer_before_add(_e_main_cb_idle_before, NULL); + + _xdg_data_dirs_augment(); + + TS("Ecore_Evas Init"); + if (!ecore_evas_init()) + { + e_error_message_show(_("Enlightenment cannot initialize Ecore_Evas!\n")); + _e_main_shutdown(-1); + } + TS("Ecore_Evas Init Done"); + + /* e doesn't sync to compositor - it should be one */ + ecore_evas_app_comp_sync_set(0); + + TS("Ecore_Evas Engine Check"); +#ifdef HAVE_WAYLAND_ONLY + if (!ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_WAYLAND_SHM)) + { + e_error_message_show(_("Enlightenment found ecore_evas doesn't support the Wayland SHM\n" + "rendering in Evas. Please check your installation of Evas and\n" + "Ecore and check they support the Wayland SHM rendering engine.")); + _e_main_shutdown(-1); + } +#else + if (!ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_SOFTWARE_XCB)) + { + if (!ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_SOFTWARE_XLIB)) + { + e_error_message_show(_("Enlightenment found ecore_evas doesn't support the Software X11\n" + "rendering in Evas. Please check your installation of Evas and\n" + "Ecore and check they support the Software X11 rendering engine.")); + _e_main_shutdown(-1); + } + } +#endif + if (!ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_SOFTWARE_BUFFER)) + { + e_error_message_show(_("Enlightenment found ecore_evas doesn't support the Software Buffer\n" + "rendering in Evas. Please check your installation of Evas and\n" + "Ecore and check they support the Software Buffer rendering engine.")); + _e_main_shutdown(-1); + } + TS("Ecore_Evas Engine Check Done"); + + TS("Edje Init"); + if (!edje_init()) + { + e_error_message_show(_("Enlightenment cannot initialize Edje!\n")); + _e_main_shutdown(-1); + } + TS("Edje Init Done"); + _e_main_shutdown_push(edje_shutdown); + edje_freeze(); + + /*** Initialize E Subsystems We Need ***/ + + TS("E Directories Init"); + /* setup directories we will be using for configurations storage etc. */ + if (!_e_main_dirs_init()) + { + e_error_message_show(_("Enlightenment cannot create directories in your home directory.\n" + "Perhaps you have no home directory or the disk is full?")); + _e_main_shutdown(-1); + } + TS("E Directories Init Done"); + _e_main_shutdown_push(_e_main_dirs_shutdown); + + TS("E_Config Init"); + if (!e_config_init()) + { + e_error_message_show(_("Enlightenment cannot set up its config system.\n")); + _e_main_shutdown(-1); + } + TS("E_Config Init Done"); + _e_main_shutdown_push(e_config_shutdown); + + TS("E_Env Init"); + if (!e_env_init()) + { + e_error_message_show(_("Enlightenment cannot set up its environment.\n")); + _e_main_shutdown(-1); + } + TS("E_Env Init Done"); + _e_main_shutdown_push(e_env_shutdown); + + efreet_desktop_environment_set(e_config->desktop_environment); + e_util_env_set("E_ICON_THEME", e_config->icon_theme); + ecore_exe_run_priority_set(e_config->priority); + locked |= e_config->desklock_start_locked; + + s = getenv("E_DESKLOCK_LOCKED"); + if ((s) && (!strcmp(s, "locked"))) waslocked = EINA_TRUE; + + TS("E Paths Init"); + if (!_e_main_path_init()) + { + e_error_message_show(_("Enlightenment cannot set up paths for finding files.\n" + "Perhaps you are out of memory?")); + _e_main_shutdown(-1); + } + TS("E Paths Init Done"); + _e_main_shutdown_push(_e_main_path_shutdown); + + edje_frametime_set(1.0 / e_config->framerate); + + TS("E_Font Init"); + if (!e_font_init()) + { + e_error_message_show(_("Enlightenment cannot set up its font system.\n")); + _e_main_shutdown(-1); + } + TS("E_Font Init Done"); + _e_main_shutdown_push(e_font_shutdown); + + TS("E_Font Apply"); + e_font_apply(); + TS("E_Font Apply Done"); + + TS("E_Theme Init"); + if (!e_theme_init()) + { + e_error_message_show(_("Enlightenment cannot set up its theme system.\n")); + _e_main_shutdown(-1); + } + TS("E_Theme Init Done"); + _e_main_shutdown_push(e_theme_shutdown); + + TS("E_Moveresize Init"); + e_moveresize_init(); + TS("E_Moveresize Init Done"); + _e_main_shutdown_push(e_moveresize_shutdown); + + TS("Efreet Init"); + if (!efreet_init()) + { + e_error_message_show(_("Enlightenment cannot initialize the FDO desktop system.\n" + "Perhaps you lack permissions on ~/.cache/efreet or are\n" + "out of memory or disk space?")); + _e_main_shutdown(-1); + } + TS("Efreet Init Done"); + _e_main_shutdown_push(efreet_shutdown); + + e_screensaver_preinit(); + + if (e_config->show_splash) + e_init_status_set(_("Setup Actions")); + TS("E_Actions Init"); + if (!e_actions_init()) + { + e_error_message_show(_("Enlightenment cannot set up its actions system.\n")); + _e_main_shutdown(-1); + } + TS("E_Actions Init Done"); + _e_main_shutdown_push(e_actions_shutdown); + + /* these just add event handlers and can't fail + * timestamping them is dumb. + */ + e_zone_init(); + e_desk_init(); + e_exehist_init(); + + if (e_config->show_splash) + e_init_status_set(_("Setup Powersave Modes")); + TS("E_Powersave Init"); + if (!e_powersave_init()) + { + e_error_message_show(_("Enlightenment cannot set up its powersave modes.\n")); + _e_main_shutdown(-1); + } + TS("E_Powersave Init Done"); + _e_main_shutdown_push(e_powersave_shutdown); + + if (e_config->show_splash) + e_init_status_set(_("Setup Screensaver")); + TS("E_Screensaver Init"); + if (!e_screensaver_init()) + { + e_error_message_show(_("Enlightenment cannot configure the X screensaver.\n")); + _e_main_shutdown(-1); + } + TS("E_Screensaver Init Done"); + _e_main_shutdown_push(e_screensaver_shutdown); + + if (e_config->show_splash) + e_init_status_set(_("Setup Screens")); + TS("Screens Init"); + if (!_e_main_screens_init()) + { + e_error_message_show(_("Enlightenment set up window management for all the screens on your system\n" + "failed. Perhaps another window manager is running?\n")); + _e_main_shutdown(-1); + } + TS("Screens Init Done"); + _e_main_shutdown_push(_e_main_screens_shutdown); + e_screensaver_force_update(); + + TS("E_Pointer Init"); + if (!e_pointer_init()) + { + e_error_message_show(_("Enlightenment cannot set up its pointer system.\n")); + _e_main_shutdown(-1); + } + TS("E_Pointer Init Done"); + _e_main_shutdown_push(e_pointer_shutdown); + e_menu_init(); + + if (e_config->show_splash) + e_init_status_set(_("Setup Paths")); + TS("Efreet Paths"); + _e_main_efreet_paths_init(); + TS("Efreet Paths Done"); + + if (e_config->show_splash) + e_init_status_set(_("Setup System Controls")); + TS("E_Sys Init"); + if (!e_sys_init()) + { + e_error_message_show(_("Enlightenment cannot initialize the System Command system.\n")); + _e_main_shutdown(-1); + } + TS("E_Sys Init Done"); + _e_main_shutdown_push(e_sys_shutdown); + + TS("E_Comp Freeze"); + e_comp_all_freeze(); + TS("E_Comp Freeze Done"); + + if (e_config->show_splash) + e_init_status_set(_("Setup Grab Input Handling")); + TS("E_Grabinput Init"); + if (!e_grabinput_init()) + { + e_error_message_show(_("Enlightenment cannot set up its grab input handling system.\n")); + _e_main_shutdown(-1); + } + TS("E_Grabinput Init Done"); + _e_main_shutdown_push(e_grabinput_shutdown); + + ecore_event_handler_add(E_EVENT_MODULE_INIT_END, _e_main_deferred_job_schedule, NULL); + + if (e_config->show_splash) + e_init_status_set(_("Setup Modules")); + TS("E_Module Init"); + if (!e_module_init()) + { + e_error_message_show(_("Enlightenment cannot set up its module system.\n")); + _e_main_shutdown(-1); + } + TS("E_Module Init Done"); + _e_main_shutdown_push(e_module_shutdown); + + if (e_config->show_splash) + e_init_status_set(_("Setup Remembers")); + TS("E_Remember Init"); + if (!e_remember_init(after_restart ? E_STARTUP_RESTART : E_STARTUP_START)) + { + e_error_message_show(_("Enlightenment cannot setup remember settings.\n")); + _e_main_shutdown(-1); + } + TS("E_Remember Init Done"); + _e_main_shutdown_push(e_remember_shutdown); + + if (e_config->show_splash) + e_init_status_set(_("Setup Mouse")); + TS("E_Mouse Init"); + if (!e_mouse_update()) + { + e_error_message_show(_("Enlightenment cannot configure the mouse settings.\n")); + _e_main_shutdown(-1); + } + TS("E_Mouse Init Done"); + + if (e_config->show_splash) + e_init_status_set(_("Setup Bindings")); + TS("E_Bindings Init"); + if (!e_bindings_init()) + { + e_error_message_show(_("Enlightenment cannot set up its bindings system.\n")); + _e_main_shutdown(-1); + } + TS("E_Bindings Init Done"); + _e_main_shutdown_push(e_bindings_shutdown); + + TS("E_Icon Init"); + if (!e_icon_init()) + { + e_error_message_show(_("Enlightenment cannot initialize the Icon Cache system.\n")); + _e_main_shutdown(-1); + } + TS("E_Icon Init Done"); + _e_main_shutdown_push(e_icon_shutdown); + + TS("E_Manager Keys Grab"); + e_managers_keys_grab(); + TS("E_Manager Keys Grab Done"); + + if (e_config->show_splash) + e_init_status_set(_("Load Modules")); + TS("Load Modules"); + _e_main_modules_load(safe_mode); + TS("Load Modules Done"); + + if (e_config->show_splash && (!after_restart)) + ecore_timer_add(2.0, _e_main_cb_startup_fake_end, NULL); + + TS("E_Comp Thaw"); + e_comp_all_thaw(); + TS("E_Comp Thaw Done"); +#endif _idle_after = ecore_idle_enterer_add(_e_main_cb_idle_after, NULL); @@ -1578,8 +1958,10 @@ _e_main_screens_init(void) TS("\tscreens: client"); if (!e_client_init()) return 0; +#ifndef ENABLE_QUICK_INIT TS("\tscreens: win"); if (!e_win_init()) return 0; +#endif #ifndef HAVE_WAYLAND_ONLY TS("E_Xkb Init"); if (!e_xkb_init()) diff --git a/src/bin/e_module.c b/src/bin/e_module.c index fa0efd6..db445a0 100644 --- a/src/bin/e_module.c +++ b/src/bin/e_module.c @@ -9,6 +9,7 @@ /* local subsystem functions */ static void _e_module_free(E_Module *m); +static void _e_module_dialog_disable_defer(const char *title, const char *body, E_Module *m); static void _e_module_dialog_disable_show(const char *title, const char *body, E_Module *m); static void _e_module_cb_dialog_disable(void *data, E_Dialog *dia); static void _e_module_event_update_free(void *data, void *event); @@ -34,6 +35,14 @@ EAPI int E_EVENT_MODULE_UPDATE = 0; EAPI int E_EVENT_MODULE_INIT_END = 0; static Eina_Stringshare *mod_src_path = NULL; +static Eina_List *deferred_dialogs = NULL; + +typedef struct _Defer_Dialog +{ + const char *title; + const char *body; + E_Module *m; +} Defer_Dialog; static Eina_Bool _module_filter_cb(void *d EINA_UNUSED, Eio_File *ls EINA_UNUSED, const Eina_File_Direct_Info *info) @@ -697,6 +706,21 @@ e_module_desktop_list(void) } EAPI void +e_module_deferred_job(void) +{ + Defer_Dialog *dd; + + if (!deferred_dialogs) return; + + EINA_LIST_FREE(deferred_dialogs, dd) + { + _e_module_dialog_disable_show(dd->title, dd->body, dd->m); + eina_stringshare_del(dd->title); + eina_stringshare_del(dd->body); + } +} + +EAPI void e_module_desktop_free(E_Module_Desktop *md) { if (!md) return; @@ -763,11 +787,38 @@ _e_module_desktop_list_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EIN } static void +_e_module_dialog_disable_defer(const char *title, const char *body, E_Module *m) +{ + Defer_Dialog *dd; + + dd = E_NEW(Defer_Dialog, 1); + if (!dd) + { + ERR("Failed to allocate Defer_Dialog"); + return; + } + + dd->title = eina_stringshare_add(title); + dd->body = eina_stringshare_add(body); + dd->m = m; + + deferred_dialogs = eina_list_append(deferred_dialogs, dd); +} + +static void _e_module_dialog_disable_show(const char *title, const char *body, E_Module *m) { E_Dialog *dia; char buf[4096]; +#ifdef ENABLE_QUICK_INIT + if (!_e_modules_init_end) + { + _e_module_dialog_disable_defer(title, body, m); + return; + } +#endif + printf("MODULE ERR:\n%s\n", body); /* FIXME: Stupid hack for ELM_WIN_DIALOG_BASIC not working in wayland */ diff --git a/src/bin/e_module.h b/src/bin/e_module.h index fea6997..18cf257 100644 --- a/src/bin/e_module.h +++ b/src/bin/e_module.h @@ -62,6 +62,7 @@ struct _E_Module_Api EINTERN int e_module_init(void); EINTERN int e_module_shutdown(void); +EAPI void e_module_deferred_job(void); EAPI void e_module_all_load(void); EAPI E_Module *e_module_new(const char *name); EAPI int e_module_save(E_Module *m); diff --git a/src/bin/e_scale.c b/src/bin/e_scale.c index cc666cf..ba13a9e 100644 --- a/src/bin/e_scale.c +++ b/src/bin/e_scale.c @@ -1,17 +1,25 @@ #include "e.h" EAPI double e_scale = 1.0; +static Eina_Bool _initted = EINA_FALSE; +static int _dpi = -1; EINTERN int e_scale_init(void) { - e_scale_update(); + _initted = EINA_TRUE; + + if (_dpi == -1) e_scale_update(); + else e_scale_manual_update(_dpi); + return 1; } EINTERN int e_scale_shutdown(void) { + _initted = EINA_FALSE; + _dpi = -1; return 1; } @@ -53,6 +61,12 @@ e_scale_manual_update(int dpi) { char buf[128]; + if (!_initted) + { + _dpi = dpi; + return; + } + e_scale = (double)dpi / (double)e_config->scale.base_dpi; if (e_scale > e_config->scale.max) e_scale = e_config->scale.max;