From 8edb74004bb04aace3b8cc44e95e4ebfb2c5e9e3 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Thu, 8 Aug 2019 21:41:02 +0900 Subject: [PATCH] hwc: create the ecore_evas at the only primary output donot generate and initialize the ecore_evas at the external output. When e20 uses the two ecore_evas, e20 process the two egl contexts. It brings the blocking issue of the e20 because of the constrains of tbm_surface dequeue wait block. Change-Id: I9ac4cb1aa59524d230b560a9e1f9545d1e228d57 --- src/bin/e_hwc.c | 13 +++++- src/bin/e_hwc.h | 4 +- src/bin/e_hwc_windows.c | 109 +++++++++++++++++++++++++++++++++++++++++++++++- src/bin/e_output.c | 7 +++- 4 files changed, 126 insertions(+), 7 deletions(-) diff --git a/src/bin/e_hwc.c b/src/bin/e_hwc.c index 3bec0c1..843670b 100644 --- a/src/bin/e_hwc.c +++ b/src/bin/e_hwc.c @@ -189,6 +189,13 @@ _e_hwc_ee_init(E_Hwc* hwc) int screen_rotation; char buf[1024]; + /* initialize the ecore_evas only hwc of the primary output */ + if (!hwc->primary_output) + { + EHINF("No Primary Output, No Ecore_Evas.", hwc); + return EINA_TRUE; + } + EHINF("ecore evase engine init.", hwc); // TODO: fix me. change the screen_rotation into output_rotation. @@ -320,7 +327,7 @@ _e_hwc_ee_init(E_Hwc* hwc) } EINTERN E_Hwc * -e_hwc_new(E_Output *output) +e_hwc_new(E_Output *output, Eina_Bool primary_output) { E_Hwc *hwc = NULL; tdm_hwc_capability hwc_caps = 0; @@ -376,7 +383,9 @@ e_hwc_new(E_Output *output) hwc->tdm_hwc_video_scanout = EINA_TRUE; } - /* initialize the ecore_evas in each hwc */ + /* set the pirmary_output */ + hwc->primary_output = primary_output; + if (!_e_hwc_ee_init(hwc)) { EHERR("_e_hwc_ee_init failed", hwc); diff --git a/src/bin/e_hwc.h b/src/bin/e_hwc.h index 0961ced..11f95bb 100644 --- a/src/bin/e_hwc.h +++ b/src/bin/e_hwc.h @@ -78,6 +78,8 @@ struct _E_Hwc Ecore_Evas *ee; Evas *evas; + Eina_Bool primary_output; + /* variables for hwc_planes polic */ Eina_Bool hwc_use_multi_plane; @@ -134,7 +136,7 @@ struct _E_Hwc int flapse; }; -EINTERN E_Hwc *e_hwc_new(E_Output *output); +EINTERN E_Hwc *e_hwc_new(E_Output *output, Eina_Bool primary_output); EINTERN void e_hwc_del(E_Hwc *hwc); EINTERN E_Hwc_Mode e_hwc_mode_get(E_Hwc *hwc); EINTERN void e_hwc_deactive_set(E_Hwc *hwc, Eina_Bool set); diff --git a/src/bin/e_hwc_windows.c b/src/bin/e_hwc_windows.c index 567d893..1e63621 100644 --- a/src/bin/e_hwc_windows.c +++ b/src/bin/e_hwc_windows.c @@ -943,6 +943,101 @@ fail: return NULL; } +static Eina_Bool +_e_hwc_windows_tbm_surface_queue_init(E_Hwc *hwc) +{ + E_Output *output = hwc->output; + tbm_surface_queue_h tqueue = NULL; + tdm_error error; + int scr_w, scr_h, queue_w, queue_h; + + e_output_size_get(output, &scr_w, &scr_h); + + if ((output->tdm_hwc) && (!output->fake_config)) + { + tqueue = tdm_hwc_get_client_target_buffer_queue(hwc->thwc, &error); + if (error != TDM_ERROR_NONE) + { + EHWSERR("fail to tdm_hwc_get_client_target_buffer_queue", hwc); + return EINA_FALSE; + } + } + else + { + tqueue = tbm_surface_queue_create(3, scr_w, scr_h, TBM_FORMAT_ARGB8888, TBM_BO_SCANOUT); + if (!tqueue) + { + EHWSERR("fail to tbm_surface_queue_create", hwc); + return EINA_FALSE; + } + } + + queue_w = tbm_surface_queue_get_width(tqueue); + if (scr_w != queue_w) + EHWSINF("!!WARNING::: the queue width(%d) is diffrent from output width(%d)!", NULL, hwc, + queue_w, scr_w); + queue_h = tbm_surface_queue_get_height(tqueue); + if (scr_h != queue_h) + EHWSINF("!!WARNING::: the queue height(%d) is diffrent from output height(%d)!", NULL, hwc, + queue_h, scr_h); + + hwc->target_buffer_queue = tqueue; + + EHWSINF("The tqueue(%p, %dx%d) is created.", NULL, hwc, tqueue, queue_w, queue_h); + + return EINA_TRUE; +} + +static void +_e_hwc_windows_tbm_surface_queue_deinit(E_Hwc *hwc) +{ + if (hwc->target_buffer_queue) + { + tbm_surface_queue_destroy(hwc->target_buffer_queue); + hwc->target_buffer_queue = NULL; + } +} + +static E_Hwc_Window_Target * +_e_hwc_windows_target_window_new_with_no_ee(E_Hwc *hwc) +{ + E_Hwc_Window_Target *target_hwc_window = NULL; + + target_hwc_window = E_OBJECT_ALLOC(E_Hwc_Window_Target, E_HWC_WINDOW_TYPE, _e_hwc_windows_target_window_free); + EINA_SAFETY_ON_NULL_GOTO(target_hwc_window, fail); + + ((E_Hwc_Window *)target_hwc_window)->is_target = EINA_TRUE; + ((E_Hwc_Window *)target_hwc_window)->state = E_HWC_WINDOW_STATE_DEVICE; + ((E_Hwc_Window *)target_hwc_window)->accepted_state = E_HWC_WINDOW_STATE_DEVICE; + ((E_Hwc_Window *)target_hwc_window)->hwc = hwc; + + target_hwc_window->ee = NULL; + target_hwc_window->evas = NULL; + target_hwc_window->event_fd = eventfd(0, EFD_NONBLOCK);; + target_hwc_window->event_hdlr = ecore_main_fd_handler_add(target_hwc_window->event_fd, ECORE_FD_READ, + _e_hwc_windows_target_window_render_finished_cb, + (void *)target_hwc_window, NULL, NULL);; + + /* create the tqueue of the target_window */ + _e_hwc_windows_tbm_surface_queue_init(hwc); + + if (!_e_hwc_windows_target_window_queue_set(target_hwc_window)) + { + EHWSERR("fail to _e_hwc_windows_target_window_queue_set", hwc); + goto fail; + } + + return target_hwc_window; + +fail: + _e_hwc_windows_tbm_surface_queue_deinit(hwc); + + if (target_hwc_window) + e_object_del(E_OBJECT(target_hwc_window)); + + return NULL; +} + static E_Hwc_Window * _e_hwc_windows_pp_window_get(E_Hwc *hwc, tbm_surface_h tsurface) { @@ -2391,8 +2486,15 @@ e_hwc_windows_target_window_new(E_Hwc *hwc) if (e_hwc_policy_get(hwc) == E_HWC_POLICY_PLANES) return NULL; - target_hwc_window = _e_hwc_windows_target_window_new(hwc); - EINA_SAFETY_ON_NULL_RETURN_VAL(target_hwc_window, NULL); + if (hwc->primary_output) + { + target_hwc_window = _e_hwc_windows_target_window_new(hwc); + EINA_SAFETY_ON_NULL_RETURN_VAL(target_hwc_window, NULL); + } + else + { + target_hwc_window = _e_hwc_windows_target_window_new_with_no_ee(hwc); + } target_hwc_window->hwc = hwc; hwc->hwc_windows = eina_list_append(hwc->hwc_windows, target_hwc_window); @@ -2410,6 +2512,9 @@ e_hwc_windows_target_window_del(E_Hwc_Window_Target *target_hwc_window) hwc = target_hwc_window->hwc; EINA_SAFETY_ON_NULL_RETURN(hwc); + if (!hwc->primary_output) + _e_hwc_windows_tbm_surface_queue_deinit(hwc); + hwc->hwc_windows = eina_list_remove(hwc->hwc_windows, hwc->target_hwc_window); e_object_del(E_OBJECT(hwc->target_hwc_window)); } diff --git a/src/bin/e_output.c b/src/bin/e_output.c index a1054b2..edff50d 100644 --- a/src/bin/e_output.c +++ b/src/bin/e_output.c @@ -2769,6 +2769,7 @@ e_output_hwc_setup(E_Output *output) Eina_List *l, *ll; E_Plane *plane = NULL; E_Output *primary_output = NULL; + Eina_Bool is_primary_output = EINA_FALSE; EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE); @@ -2779,13 +2780,15 @@ e_output_hwc_setup(E_Output *output) return EINA_TRUE; } - hwc = e_hwc_new(output); + primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); + if (output == primary_output) is_primary_output = EINA_TRUE; + + hwc = e_hwc_new(output, is_primary_output); EINA_SAFETY_ON_NULL_RETURN_VAL(hwc, EINA_FALSE); output->hwc = hwc; if (e_hwc_policy_get(output->hwc) == E_HWC_POLICY_PLANES) { - primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); if (primary_output == output) { /* ecore evas engine setup */ -- 2.7.4