From: SooChan Lim Date: Thu, 18 Jul 2019 02:28:52 +0000 (+0900) Subject: e_comp_screen: call the init/deinit functions once during the lifetime X-Git-Tag: submit/tizen/20190718.064631~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F28%2F210328%2F3;p=platform%2Fupstream%2Fenlightenment.git e_comp_screen: call the init/deinit functions once during the lifetime modify the code that the e20 call the init/deinit functions below only onetime. When these functions call multiple times, it brings the serious bugs. - e_hwc_planes_init/deinit - e_hwc_windows_init/deinit - e_hwc_window_init/deinit - e_hwc_window_queue_init/deinit Change-Id: I7b204b85dc395a8ec9d2b432f03f331ed50e8b01 --- diff --git a/src/bin/e_comp_screen.c b/src/bin/e_comp_screen.c index ce9d91f9e0..f87236e661 100644 --- a/src/bin/e_comp_screen.c +++ b/src/bin/e_comp_screen.c @@ -651,6 +651,8 @@ _e_comp_screen_deinit_outputs(E_Comp_Screen *e_comp_screen) e_output_del(output); } + e_hwc_windows_deinit(); + e_hwc_planes_deinit(); e_output_shutdown(); } @@ -703,6 +705,18 @@ _e_comp_screen_init_outputs(E_Comp_Screen *e_comp_screen) ELOGF("COMP_SCREEN","num_outputs = %i", NULL, e_comp_screen->num_outputs); + if (!e_hwc_planes_init()) + { + ERR("e_hwc_planes_init failed"); + goto fail; + } + + if (!e_hwc_windows_init()) + { + ERR("e_hwc_windows_init failed"); + goto fail; + } + for (i = 0; i < num_outputs; i++) { TRACE_DS_BEGIN(OUTPUT:NEW); diff --git a/src/bin/e_hwc.c b/src/bin/e_hwc.c index 0ea48edcc4..0a86b72b62 100644 --- a/src/bin/e_hwc.c +++ b/src/bin/e_hwc.c @@ -322,22 +322,33 @@ EINTERN E_Hwc * e_hwc_new(E_Output *output) { E_Hwc *hwc = NULL; + tdm_hwc_capability hwc_caps = 0; tdm_error error; EINA_SAFETY_ON_NULL_RETURN_VAL(output, NULL); hwc = E_NEW(E_Hwc, 1); EINA_SAFETY_ON_NULL_RETURN_VAL(hwc, NULL); - hwc->output = output; + /* + * E20 has two hwc policy options. + * 1. One is the E_HWC_POLICY_PLANES. + * - E20 decides the hwc policy with the E_Planes associated with the tdm_layers. + * - E20 manages how to set the surface(buffer) of the ec to the E_Plane. + * 2. Another is the E_HWC_POLICY_WIDNOWS. + * - The tdm-backend decides the hwc policy with the E_Hwc_Windows associated with the tdm_hwc_window. + * - E20 asks to verify the composition types of the E_Hwc_Window of the ec. + */ if (!output->tdm_hwc) { hwc->hwc_policy = E_HWC_POLICY_PLANES; + EHINF("Use the HWC PLANES Policy.", hwc); } else { hwc->hwc_policy = E_HWC_POLICY_WINDOWS; + EHINF("Use the HWC WINDOWS Policy.", hwc); hwc->thwc = tdm_output_get_hwc(output->toutput, &error); if (!hwc->thwc) @@ -345,57 +356,41 @@ e_hwc_new(E_Output *output) EHERR("tdm_output_get_hwc failed", hwc); goto fail; } + + error = tdm_hwc_get_capabilities(hwc->thwc, &hwc_caps); + if (error != TDM_ERROR_NONE) + { + EHERR("fail to tdm_hwc_get_capabilities", hwc); + return EINA_FALSE; + } + + /* hwc video capabilities */ + if (hwc_caps & TDM_HWC_CAPABILITY_VIDEO_STREAM) + hwc->tdm_hwc_video_stream = EINA_TRUE; + if (hwc_caps & TDM_HWC_CAPABILITY_VIDEO_SCALE) + hwc->tdm_hwc_video_scale = EINA_TRUE; + if (hwc_caps & TDM_HWC_CAPABILITY_VIDEO_TRANSFORM) + hwc->tdm_hwc_video_transform = EINA_TRUE; + if (hwc_caps & TDM_HWC_CAPABILITY_VIDEO_SCANOUT) + hwc->tdm_hwc_video_scanout = EINA_TRUE; } + /* initialize the ecore_evas in each hwc */ if (!_e_hwc_ee_init(hwc)) { EHERR("_e_hwc_ee_init failed", hwc); goto fail; } - /* - * E20 has two hwc policy options. - * 1. One is the E_HWC_POLICY_PLANES. - * - E20 decides the hwc policy with the E_Planes associated with the tdm_layers. - * - E20 manages how to set the surface(buffer) of the ec to the E_Plane. - * 2. Another is the E_HWC_POLICY_WIDNOWS. - * - The tdm-backend decides the hwc policy with the E_Hwc_Windows associated with the tdm_hwc_window. - * - E20 asks to verify the composition types of the E_Hwc_Window of the ec. - */ - if (hwc->hwc_policy == E_HWC_POLICY_PLANES) + if (e_hwc_policy_get(hwc) == E_HWC_POLICY_WINDOWS) { - if (!e_hwc_planes_init()) + /* create the target_window to the hwc */ + hwc->target_hwc_window = e_hwc_windows_target_window_new(hwc); + if (!hwc->target_hwc_window) { - EHERR("e_hwc_windows_init failed", hwc); + EHERR("e_hwc_windows_target_window_new failed", hwc); goto fail; } - - EHINF("Use the HWC PLANES Policy.", hwc); - } - else - { - if (!e_hwc_window_queue_init()) - { - EHERR("E_Hwc_Window_Queue init failed", hwc); - goto fail; - } - - if (!e_hwc_window_init()) - { - EHERR("E_Hwc_Window init failed", hwc); - goto fail; - } - - if (!e_hwc_windows_init(hwc)) - { - EHERR("e_hwc_windows_init failed", hwc); - goto fail; - } - - /* turn on sw compositor at the start */ - ecore_event_add(E_EVENT_COMPOSITOR_ENABLE, NULL, NULL, NULL); - - EHINF("Use the HWC WINDOWS Policy.", hwc); } return hwc; @@ -411,17 +406,14 @@ e_hwc_del(E_Hwc *hwc) { if (!hwc) return; - _e_hwc_ee_deinit(hwc); - - if (hwc->hwc_policy == E_HWC_POLICY_PLANES) - e_hwc_planes_deinit(); - else + if (e_hwc_policy_get(hwc) == E_HWC_POLICY_WINDOWS) { - e_hwc_windows_deinit(hwc); - e_hwc_window_deinit(); - e_hwc_window_queue_deinit(); + e_hwc_windows_target_window_del(hwc->target_hwc_window); + hwc->target_hwc_window = NULL; } + _e_hwc_ee_deinit(hwc); + E_FREE(hwc); } diff --git a/src/bin/e_hwc_windows.c b/src/bin/e_hwc_windows.c index 5dc452e6e8..d44625bcda 100644 --- a/src/bin/e_hwc_windows.c +++ b/src/bin/e_hwc_windows.c @@ -2174,58 +2174,29 @@ _e_hwc_windos_pp_pending_window_check(E_Hwc *hwc) } EINTERN Eina_Bool -e_hwc_windows_init(E_Hwc *hwc) +e_hwc_windows_init(void) { - tdm_error error; - tdm_hwc_capability hwc_caps = 0; - E_Hwc_Window_Target *target_hwc_window; - - EINA_SAFETY_ON_NULL_RETURN_VAL(hwc, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(hwc->thwc, EINA_FALSE); - - if (e_hwc_policy_get(hwc) == E_HWC_POLICY_PLANES) - return EINA_FALSE; - - target_hwc_window = _e_hwc_windows_target_window_new(hwc); - EINA_SAFETY_ON_NULL_RETURN_VAL(target_hwc_window, EINA_FALSE); - target_hwc_window->hwc = hwc; - - error = tdm_hwc_get_capabilities(hwc->thwc, &hwc_caps); - if (error != TDM_ERROR_NONE) + if (!e_hwc_window_init()) { - EHWSERR("fail to tdm_hwc_get_capabilities", hwc); + ERR("E_Hwc_Window init failed"); return EINA_FALSE; } - /* hwc video capabilities */ - if (hwc_caps & TDM_HWC_CAPABILITY_VIDEO_STREAM) - hwc->tdm_hwc_video_stream = EINA_TRUE; - if (hwc_caps & TDM_HWC_CAPABILITY_VIDEO_SCALE) - hwc->tdm_hwc_video_scale = EINA_TRUE; - if (hwc_caps & TDM_HWC_CAPABILITY_VIDEO_TRANSFORM) - hwc->tdm_hwc_video_transform = EINA_TRUE; - if (hwc_caps & TDM_HWC_CAPABILITY_VIDEO_SCANOUT) - hwc->tdm_hwc_video_scanout = EINA_TRUE; - - /* set the target_window to the hwc */ - hwc->target_hwc_window = target_hwc_window; - - hwc->hwc_windows = eina_list_append(hwc->hwc_windows, target_hwc_window); + if (!e_hwc_window_queue_init()) + { + ERR("E_Hwc_Window_Queue init failed"); + e_hwc_window_deinit(); + return EINA_FALSE; + } return EINA_TRUE; } EINTERN void -e_hwc_windows_deinit(E_Hwc *hwc) +e_hwc_windows_deinit(void) { - EINA_SAFETY_ON_NULL_RETURN(hwc); - - if (e_hwc_policy_get(hwc) == E_HWC_POLICY_PLANES) - return; - - hwc->hwc_windows = eina_list_remove(hwc->hwc_windows, hwc->target_hwc_window); - e_object_del(E_OBJECT(hwc->target_hwc_window)); - hwc->target_hwc_window = NULL; + e_hwc_window_queue_deinit(); + e_hwc_window_deinit(); } EINTERN Eina_Bool diff --git a/src/bin/e_hwc_windows.h b/src/bin/e_hwc_windows.h index a692816e9e..85be4710f3 100644 --- a/src/bin/e_hwc_windows.h +++ b/src/bin/e_hwc_windows.h @@ -16,8 +16,8 @@ typedef enum E_HWC_WINS_DEBUG_CMD_QUEUE, } E_Hwc_Wins_Debug_Cmd; -EINTERN Eina_Bool e_hwc_windows_init(E_Hwc *hwc); -EINTERN void e_hwc_windows_deinit(E_Hwc *hwc); +EINTERN Eina_Bool e_hwc_windows_init(void); +EINTERN void e_hwc_windows_deinit(void); EINTERN Eina_Bool e_hwc_windows_render(E_Hwc *hwc); EINTERN Eina_Bool e_hwc_windows_commit(E_Hwc *hwc); EINTERN E_Hwc_Window_Target *e_hwc_windows_target_window_new(E_Hwc *hwc);