tdm: split the visible_window_lnk into curr_vwin_list and candidate_vwin_list at... 00/264600/4
authorSooChan Lim <sc1.lim@samsung.com>
Mon, 27 Sep 2021 06:02:13 +0000 (15:02 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 27 Sep 2021 07:07:30 +0000 (16:07 +0900)
Change-Id: If55394f4d4d123c99eafc72ae878e5ecb8d94e9c

src/lib/tdm/tdm-hwc.c
src/lib/tdm/tdm-internal.h

index f5afd7f..34990c3 100644 (file)
@@ -226,7 +226,7 @@ done:
        return PEPPER_TRUE;
 }
 
-// check the changes of the visible_window_list on hwc
+// check the changes of the curr_vwin_list on hwc
 // check chagnes below
 //  - number of visible windows
 //  - windows stack
@@ -234,9 +234,9 @@ done:
 //  - remove a window on the list
 //  - change the order of windows : window stack
 static pepper_bool_t
-__hwc_check_changes_visible_window_list(pepper_tdm_hwc_t *hwc,
-                                                                       pepper_list_t *visible_window_list,
-                                                                       unsigned int num_visible_wins)
+__hwc_check_changes_curr_vwin_list(pepper_tdm_hwc_t *hwc,
+                                                                       pepper_list_t *candidate_vwin_list,
+                                                                       unsigned int num_vwins)
 {
        pepper_list_t *prev_list;
        pepper_list_t *curr_list;
@@ -244,16 +244,16 @@ __hwc_check_changes_visible_window_list(pepper_tdm_hwc_t *hwc,
        unsigned int i, cnt;
 
        // first time
-       if (!hwc->visible_window_list)
+       if (!hwc->curr_vwin_list)
                return PEPPER_TRUE;
 
-       prev_list = hwc->visible_window_list;
-       curr_list = visible_window_list;
+       prev_list = hwc->curr_vwin_list;
+       curr_list = candidate_vwin_list;
 
-       if (hwc->num_visible_wins != num_visible_wins)
+       if (hwc->num_vwins != num_vwins)
                return PEPPER_TRUE;
 
-       for (i = 0; i < num_visible_wins; i++) {
+       for (i = 0; i < num_vwins; i++) {
                cnt = 0;
                pepper_list_for_each_safe(hwc_window1, tmp, prev_list, link)
                        if (i == cnt++) break;
@@ -268,37 +268,32 @@ __hwc_check_changes_visible_window_list(pepper_tdm_hwc_t *hwc,
 }
 
 static void
-__hwc_visible_window_list_destory(pepper_list_t *visible_window_list)
+__hwc_candidate_vwins_list_destory(pepper_list_t *candidate_vwin_list)
 {
-       pepper_tdm_hwc_window_t *hwc_window, *tmp;
-
-       if (!visible_window_list)
+       if (!candidate_vwin_list)
                return;
 
-       pepper_list_for_each_safe(hwc_window, tmp, visible_window_list, visible_window_link)
-               pepper_list_remove(&hwc_window->visible_window_link);
-
-       free(visible_window_list);
+       free(candidate_vwin_list);
 }
 
 // create a visible window list with a view list
 static pepper_list_t *
-__hwc_create_visible_window_list(pepper_tdm_hwc_t *hwc,
+__hwc_create_candidate_vwin_list(pepper_tdm_hwc_t *hwc,
                                                                const pepper_list_t *view_list,
-                                                               unsigned int *num_visible_wins)
+                                                               unsigned int *num_vwins)
 {
-       pepper_list_t              *visible_window_list, *l;
+       pepper_list_t              *candidate_vwin_list, *l;
        pepper_view_t              *view;
        pepper_surface_t           *surface;
        pepper_tdm_hwc_window_t    *hwc_window, *hwc_window2;
 
-       visible_window_list = calloc(1, sizeof(pepper_list_t));
-       if (!visible_window_list)
+       candidate_vwin_list = calloc(1, sizeof(pepper_list_t));
+       if (!candidate_vwin_list)
                return NULL;
 
-       pepper_list_init(visible_window_list);
+       pepper_list_init(candidate_vwin_list);
 
-       // make a visible_window_list
+       // make a candidate_vwin_list
        // TODO: CHECK Point..
        //       does not add hwc_window to the visible window list
        //      when a pepper_view does not have a pepper_surface because
@@ -320,45 +315,49 @@ __hwc_create_visible_window_list(pepper_tdm_hwc_t *hwc,
                PEPPER_INFO("surface:%p view:%p hwc_window:%p thwc_window:%p.\n",
                                        surface, view, hwc_window, hwc_window->thwc_window);
 
-               pepper_list_insert(visible_window_list, &hwc_window->visible_window_link);
-               ++(*num_visible_wins);
+               pepper_list_insert(candidate_vwin_list, &hwc_window->candidate_vwin_link);
+               ++(*num_vwins);
        }
 
-       PEPPER_INFO("num_visible_wins curr:%d, necxt:%d\n", hwc->num_visible_wins, num_visible_wins);
+       PEPPER_INFO("num_vwins curr:%d, necxt:%d\n", hwc->num_vwins, num_vwins);
 
-       return visible_window_list;
+       return candidate_vwin_list;
 }
 
 // change the visible window list on hwc with the given visible window list
 static void
-__hwc_change_visible_window_list(pepper_tdm_hwc_t *hwc, pepper_list_t *visible_window_list,
-                                                                       unsigned int num_visible_wins)
+__hwc_replace_curr_vwin_list(pepper_tdm_hwc_t *hwc, pepper_list_t *candidate_vwin_list,
+                                                       unsigned int num_vwins)
 {
-       __hwc_visible_window_list_destory(hwc->visible_window_list);
+       pepper_tdm_hwc_window_t *hwc_window;
+
+       // remove the current visible window list
+       free(hwc->curr_vwin_list);
 
-       hwc->num_visible_wins = num_visible_wins;
-       hwc->visible_window_list = visible_window_list;
+       // set the candidate visible window list as a current visible window list
+       hwc->num_vwins = num_vwins;
+       hwc->curr_vwin_list = candidate_vwin_list;
 }
 
 // update the visible window list on hwc with the given visible view list
 static pepper_bool_t
-__hwc_update_visible_window_list(pepper_tdm_hwc_t *hwc, const pepper_list_t *view_list)
+__hwc_update_curr_vwin_list(pepper_tdm_hwc_t *hwc, const pepper_list_t *view_list)
 {
-       pepper_list_t *visible_window_list;
-       unsigned int num_visible_wins = 0;
+       pepper_list_t *candidate_vwin_list;
+       unsigned int num_vwins = 0;
 
        // get a visible hwc window list from view list
-       visible_window_list = __hwc_create_visible_window_list(hwc, view_list, &num_visible_wins);
-       if (!visible_window_list)
+       candidate_vwin_list = __hwc_create_candidate_vwin_list(hwc, view_list, &num_vwins);
+       if (!candidate_vwin_list)
                return PEPPER_FALSE;
 
        // check the changes of the visible windows
-       if (!__hwc_check_changes_visible_window_list(hwc, visible_window_list, num_visible_wins)) {
-               __hwc_visible_window_list_destory(visible_window_list);
+       if (!__hwc_check_changes_curr_vwin_list(hwc, candidate_vwin_list, num_vwins)) {
+               __hwc_candidate_vwins_list_destory(candidate_vwin_list);
                return PEPPER_FALSE;
        }
 
-       __hwc_change_visible_window_list(hwc, visible_window_list, num_visible_wins);
+       __hwc_replace_curr_vwin_list(hwc, candidate_vwin_list, num_vwins);
 
        return PEPPER_TRUE;
 }
@@ -537,7 +536,7 @@ pepper_tdm_hwc_update_changes(pepper_tdm_hwc_t *hwc, const pepper_list_t *view_l
 
        PEPPER_INFO("\n");
 
-       changed = __hwc_update_visible_window_list(hwc, view_list);
+       changed = __hwc_update_curr_vwin_list(hwc, view_list);
 
        pepper_list_for_each(hwc_window, &hwc->window_list, link) {
                PEPPER_INFO("hwc_window:%p thwc_window:%p\n", hwc_window, hwc_window->thwc_window);
@@ -553,7 +552,7 @@ pepper_tdm_hwc_update_changes(pepper_tdm_hwc_t *hwc, const pepper_list_t *view_l
        // set the composition types of visible windows
        // TODO: all gl composite... for verifiying .
        if (changed) {
-               pepper_list_for_each(hwc_window, hwc->visible_window_list, visible_window_link)
+               pepper_list_for_each(hwc_window, hwc->curr_vwin_list, curr_vwin_link)
                        __hwc_window_update_composition_type(hwc_window, TDM_HWC_WIN_COMPOSITION_CLIENT);
        }
 
@@ -629,12 +628,12 @@ __hwc_validate(pepper_tdm_hwc_t *hwc)
        uint32_t i, n_thw, num_changes;
        pepper_bool_t ret;
 
-       n_thw = hwc->num_visible_wins;
+       n_thw = hwc->num_vwins;
        if (n_thw) {
                thwc_windows = calloc(n_thw, sizeof(tdm_hwc_window *));
                PEPPER_CHECK(thwc_windows, return PEPPER_FALSE, "thwc_window allocation failed.\n");
                i = 0;
-               pepper_list_for_each(hwc_window, hwc->visible_window_list, visible_window_link) {
+               pepper_list_for_each(hwc_window, hwc->curr_vwin_list, curr_vwin_link) {
                        PEPPER_INFO("[%d] hwc_window:%p thwc_window:%p\n", i, hwc_window, hwc_window->thwc_window);
                        thwc_windows[i++] = hwc_window->thwc_window;
                }
index f2c01d4..a296026 100644 (file)
@@ -123,8 +123,8 @@ struct pepper_tdm_hwc {
 
        pepper_bool_t           accept_validation;
 
-       unsigned int            num_visible_wins;
-       pepper_list_t           *visible_window_list;
+       unsigned int            num_vwins;
+       pepper_list_t          *curr_vwin_list;
        pepper_list_t           window_list;
 };
 
@@ -152,7 +152,8 @@ struct pepper_tdm_hwc_window {
 
        pepper_tdm_hwc_update_data_t   current; // current tdm data
 
-       pepper_list_t visible_window_link;
+       pepper_list_t curr_vwin_link;
+       pepper_list_t candidate_vwin_link;
        pepper_list_t link;
 };