e_hwc_windows: remove duplicate code 19/272919/1
authorChangyeon Lee <cyeon.lee@samsung.com>
Fri, 25 Mar 2022 03:53:51 +0000 (12:53 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Mon, 28 Mar 2022 03:22:07 +0000 (12:22 +0900)
Change-Id: I33e01f650a8d7bb5ede24001a4a8e012a9b63e16

src/bin/e_hwc_windows.c

index 4a48a03899df4b1b04a43a266a1f689066af9814..72d606e4da752df56dd9adaff581f0524b70bdb3 100644 (file)
@@ -607,27 +607,14 @@ EINTERN void
 e_hwc_windows_target_window_force_render(E_Hwc_Window_Target *target_hwc_window)
 {
    E_Hwc_Window_Target *root_target_hwc_window;
-   E_Output *primary_output;
    E_Hwc *hwc;
    int w, h;
 
    hwc = target_hwc_window->hwc;
    EINA_SAFETY_ON_NULL_RETURN(hwc);
 
-   if (hwc->primary_output)
-     {
-        root_target_hwc_window = hwc->root_target_hwc_window;
-        EINA_SAFETY_ON_NULL_RETURN(root_target_hwc_window);
-     }
-   else
-     {
-        primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen);
-        EINA_SAFETY_ON_NULL_RETURN(primary_output);
-        EINA_SAFETY_ON_NULL_RETURN(primary_output->hwc);
-
-        root_target_hwc_window = primary_output->hwc->root_target_hwc_window;
-        EINA_SAFETY_ON_NULL_RETURN(root_target_hwc_window);
-     }
+   root_target_hwc_window = _e_hwc_windows_root_target_hwc_window_get(hwc);
+   EINA_SAFETY_ON_NULL_RETURN(root_target_hwc_window);
 
    if (!root_target_hwc_window->ee) return;
    if (!root_target_hwc_window->evas) return;
@@ -811,7 +798,6 @@ _e_hwc_windows_target_buffer_fetch(E_Hwc *hwc)
    E_Hwc_Window_Target *target_hwc_window, *root_target_hwc_window;
    E_Hwc_Window *hwc_window, *root_hwc_window;
    E_Hwc_Window_Queue_Buffer *queue_buffer;
-   E_Output *primary_output;
    tdm_region fb_damage;
    tbm_surface_h tsurface;
    tdm_hwc *thwc;
@@ -821,24 +807,10 @@ _e_hwc_windows_target_buffer_fetch(E_Hwc *hwc)
 
    target_hwc_window = hwc->target_hwc_window;
    EINA_SAFETY_ON_NULL_RETURN_VAL(target_hwc_window, EINA_FALSE);
-
    hwc_window = (E_Hwc_Window *)target_hwc_window;
 
-   if (hwc->primary_output)
-     {
-        root_target_hwc_window = hwc->root_target_hwc_window;
-        EINA_SAFETY_ON_NULL_RETURN_VAL(root_target_hwc_window, EINA_FALSE);
-     }
-   else
-     {
-        primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen);
-        EINA_SAFETY_ON_NULL_RETURN_VAL(primary_output, EINA_FALSE);
-        EINA_SAFETY_ON_NULL_RETURN_VAL(primary_output->hwc, EINA_FALSE);
-
-        root_target_hwc_window = primary_output->hwc->root_target_hwc_window;
-        EINA_SAFETY_ON_NULL_RETURN_VAL(root_target_hwc_window, EINA_FALSE);
-     }
-
+   root_target_hwc_window = _e_hwc_windows_root_target_hwc_window_get(hwc);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(root_target_hwc_window, EINA_FALSE);
    root_hwc_window = (E_Hwc_Window *)root_target_hwc_window;
 
    if (hwc_window->state == E_HWC_WINDOW_STATE_DEVICE)
@@ -2102,25 +2074,12 @@ _e_hwc_windows_transition_check(E_Hwc *hwc)
    Eina_Bool target_window_changed = EINA_FALSE;
    Eina_Bool client_to_none_transition = EINA_FALSE;
    E_Hwc_Window_Queue_Type queue_type;
-   E_Output *primary_output;
 
    target_hwc_window = hwc->target_hwc_window;
    EINA_SAFETY_ON_NULL_RETURN_VAL(target_hwc_window, EINA_FALSE);
 
-   if (hwc->primary_output)
-     {
-        root_target_hwc_window = hwc->root_target_hwc_window;
-        EINA_SAFETY_ON_NULL_RETURN_VAL(root_target_hwc_window, EINA_FALSE);
-     }
-   else
-     {
-        primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen);
-        EINA_SAFETY_ON_NULL_RETURN_VAL(primary_output, EINA_FALSE);
-        EINA_SAFETY_ON_NULL_RETURN_VAL(primary_output->hwc, EINA_FALSE);
-
-        root_target_hwc_window = primary_output->hwc->root_target_hwc_window;
-        EINA_SAFETY_ON_NULL_RETURN_VAL(root_target_hwc_window, EINA_FALSE);
-     }
+   root_target_hwc_window = _e_hwc_windows_root_target_hwc_window_get(hwc);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(root_target_hwc_window, EINA_FALSE);
 
    queue_type = e_hwc_window_queue_type_get(((E_Hwc_Window *)root_target_hwc_window)->queue);
    if (queue_type == E_HWC_WINDOW_QUEUE_TYPE_GBM_SURFACE) return EINA_FALSE;
@@ -3914,7 +3873,6 @@ e_hwc_windows_rendered_window_add(E_Hwc_Window *hwc_window)
    E_Hwc *hwc;
    E_Hwc_Window_Target *root_target_hwc_window;
    E_Client *ec;
-   E_Output *primary_output;
 
    EINA_SAFETY_ON_NULL_RETURN(hwc_window);
    EINA_SAFETY_ON_NULL_RETURN(e_comp);
@@ -3925,13 +3883,10 @@ e_hwc_windows_rendered_window_add(E_Hwc_Window *hwc_window)
    ec = hwc_window->ec;
    EINA_SAFETY_ON_NULL_RETURN(ec);
 
-   primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen);
-   EINA_SAFETY_ON_NULL_RETURN(primary_output);
-
-   hwc = primary_output->hwc;
+   hwc = hwc_window->hwc;
    EINA_SAFETY_ON_NULL_RETURN(hwc);
 
-   root_target_hwc_window = hwc->root_target_hwc_window;
+   root_target_hwc_window = _e_hwc_windows_root_target_hwc_window_get(hwc);
    EINA_SAFETY_ON_NULL_RETURN(root_target_hwc_window);
 
    root_target_hwc_window->rendered_windows =