e_comp_screen: initialize the display at e_comp_screen
authorSooChan Lim <sc1.lim@samsung.com>
Thu, 5 Dec 2024 07:46:06 +0000 (16:46 +0900)
committerJunseok Kim <juns.kim@samsung.com>
Fri, 13 Dec 2024 05:15:51 +0000 (14:15 +0900)
Change-Id: I9f02a78b836d71aef7c4001a22a446d5fe3f3277

src/bin/e_comp_screen.c

index 96223194e297434aba5cd4cf8a71f6b1915271d9..24efe8641db4b79c5ebc7366e8ccae61442407a5 100644 (file)
@@ -320,69 +320,19 @@ static E_Comp_Screen *
 _e_comp_screen_new(void)
 {
    E_Comp_Screen *e_comp_screen = NULL;
-   int screen_rotation;
 
    e_comp_screen = E_NEW(E_Comp_Screen, 1);
-   if (!e_comp_screen) return NULL;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE);
 
    e_comp_screen_set(e_comp_screen);
 
-   /* check the screen rotation */
-   screen_rotation = (e_config->screen_rotation_pre + e_config->screen_rotation_setting) % 360;
-
-   ELOGF("COMP_SCREEN","screen_rotation_pre %d and screen_rotation_setting %d",
-         NULL, e_config->screen_rotation_pre, e_config->screen_rotation_setting);
-
-   e_comp_screen->rotation_pre = e_config->screen_rotation_pre;
-   e_comp_screen->rotation_setting = e_config->screen_rotation_setting;
-   e_comp_screen->rotation = screen_rotation;
-
-   e_main_ts_begin("\te_display_init");
-
-   if (!e_display_init())
-     {
-        e_main_ts_end("\te_display_init() failed.");
-        ERR("e_display_init failed");
-        free(e_comp_screen);
-        e_comp_screen_set(NULL);
-        return NULL;
-     }
-
-   e_main_ts_end("\te_display_init Done");
-
-   e_comp_screen->num_outputs = e_display_num_outputs_get();
-   e_comp_screen->outputs = e_display_outputs_get();
-
-   if (e_comp_hwc_is_configured() && e_comp_conf_hwc_deactive_get())
-     e_comp_hwc_deactive_set(EINA_TRUE);
-
-   /* tbm bufmgr init */
-   e_main_ts_begin("\tTBM Bufmgr Server Init");
-   e_comp_screen->bufmgr = tbm_bufmgr_server_init();
-   if (!e_comp_screen->bufmgr)
-     {
-        e_main_ts_end("\tTBM Bufmgr Server Init Failed");
-        ERR("tbm_bufmgr_init failed\n");
-        goto fail;
-     }
-   e_main_ts_end("\tTBM Bufmgr Server Init Done");
-
    return e_comp_screen;
-
-fail:
-   if (e_comp_screen->bufmgr) tbm_bufmgr_deinit(e_comp_screen->bufmgr);
-
-   free(e_comp_screen);
-   e_comp_screen_set(NULL);
-   TRACE_DS_END();
-
-   return NULL;
 }
 
 static void
 _e_comp_screen_del(E_Comp_Screen *e_comp_screen)
 {
-   if (e_comp_screen->bufmgr) tbm_bufmgr_deinit(e_comp_screen->bufmgr);
+   if (!e_comp_screen) return;
 
    free(e_comp_screen);
 }
@@ -532,6 +482,7 @@ e_comp_screen_init()
    E_Comp_Wl_Data *comp_wl;
    E_Comp_Screen *e_comp_screen;
    int w, h, ptr_x = 0, ptr_y = 0;
+   int screen_rotation;
 
    E_EVENT_SCREEN_CHANGE = ecore_event_type_new();
 
@@ -549,6 +500,43 @@ e_comp_screen_init()
      }
    e_main_ts_end("\tE_Comp_Screen New Done");
 
+   /* check the screen rotation */
+   screen_rotation = (e_config->screen_rotation_pre + e_config->screen_rotation_setting) % 360;
+
+   ELOGF("COMP_SCREEN","screen_rotation_pre %d and screen_rotation_setting %d",
+         NULL, e_config->screen_rotation_pre, e_config->screen_rotation_setting);
+
+   e_comp_screen->rotation_pre = e_config->screen_rotation_pre;
+   e_comp_screen->rotation_setting = e_config->screen_rotation_setting;
+   e_comp_screen->rotation = screen_rotation;
+
+   e_main_ts_begin("\te_display_init");
+   if (!e_display_init())
+     {
+        e_main_ts_end("\te_display_init() failed.");
+        ERR("e_display_init failed");
+        goto failed_comp_screen;
+     }
+   e_main_ts_end("\te_display_init Done");
+
+   e_comp_screen->num_outputs = e_display_num_outputs_get();
+   e_comp_screen->outputs = e_display_outputs_get();
+
+   if (e_comp_hwc_is_configured() && e_comp_conf_hwc_deactive_get())
+     e_comp_hwc_deactive_set(EINA_TRUE);
+
+   /* tbm bufmgr init */
+   e_main_ts_begin("\tTBM Bufmgr Server Init");
+   e_comp_screen->bufmgr = tbm_bufmgr_server_init();
+   if (!e_comp_screen->bufmgr)
+     {
+        e_main_ts_end("\tTBM Bufmgr Server Init Failed");
+        ERR("tbm_bufmgr_init failed\n");
+        goto failed_comp_screen;
+     }
+   e_main_ts_end("\tTBM Bufmgr Server Init Done");
+
+
    ecore_event_add(E_EVENT_SCREEN_CHANGE, NULL, NULL, NULL);
 
    e_comp_screen_e_screens_setup(e_comp_screen, -1, -1);
@@ -640,8 +628,8 @@ e_comp_screen_init()
 failed_comp_screen:
 
    e_input_shutdown();
+   if (e_comp_screen->bufmgr) tbm_bufmgr_deinit(e_comp_screen->bufmgr);
    _e_comp_screen_del(e_comp_screen);
-   e_comp_screen_set(NULL);
 
    return EINA_FALSE;
 }