e_hwc_windows: check pp restriction before making pp queue 72/226872/2
authorJunkyeong Kim <jk0430.kim@samsung.com>
Fri, 6 Mar 2020 05:12:50 +0000 (14:12 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Tue, 10 Mar 2020 11:29:19 +0000 (11:29 +0000)
Change-Id: I1fb504599a930d6a445a01a299f4288a0ce0320c
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
src/bin/e_hwc.h
src/bin/e_hwc_windows.c

index 7f326de..a7b6383 100644 (file)
@@ -117,6 +117,9 @@ struct _E_Hwc
    Eina_Rectangle        pp_rect;
    Eina_Rectangle        pp_src_rect_prev;
    E_Hwc_Window         *pp_hwc_window;
+   int                   pp_minw, pp_minh, pp_maxw, pp_maxh;
+   int                   pp_align;
+   int                   pp_align_vertical;
 
    /* external output */
    Eina_Rectangle       mirror_rect;
index 468929a..5c3060b 100644 (file)
@@ -54,6 +54,8 @@
      }                                                            \
    while (0)
 
+#define ROUNDUP(s,c)        (((s) + (c-1)) & ~(c-1))
+
 typedef struct _E_Hwc_Windows_Pp_Data E_Hwc_Windows_Pp_Data;
 typedef struct _E_Hwc_Windows_Buffer_Comp_Info E_Hwc_Windows_Buffer_Comp_Info;
 
@@ -3358,6 +3360,28 @@ e_hwc_windows_pp_commit_possible_check(E_Hwc *hwc)
    return EINA_TRUE;
 }
 
+static void
+_e_hwc_windows_zoom_pp_aligned_value_get(E_Hwc *hwc, int *aligned_width, int *aligned_height)
+{
+   if (hwc->pp_minw != -1)
+     {
+        if (hwc->pp_minw > *aligned_width)
+          *aligned_width = hwc->pp_minw;
+     }
+
+   if (hwc->pp_minh != -1)
+     {
+        if (hwc->pp_minh > *aligned_height)
+          *aligned_height = hwc->pp_minh;
+     }
+
+   if (hwc->pp_align != -1)
+     *aligned_width = ROUNDUP(*aligned_width, hwc->pp_align);
+
+   if (hwc->pp_align_vertical != -1)
+     *aligned_height = ROUNDUP(*aligned_height, hwc->pp_align_vertical);
+}
+
 EINTERN Eina_Bool
 e_hwc_windows_zoom_set(E_Hwc *hwc, Eina_Rectangle *rect)
 {
@@ -3387,10 +3411,17 @@ e_hwc_windows_zoom_set(E_Hwc *hwc, Eina_Rectangle *rect)
 
              ret = tdm_pp_set_done_handler(hwc->tpp, _e_hwc_windows_pp_commit_handler, hwc);
              EINA_SAFETY_ON_FALSE_GOTO(ret == TDM_ERROR_NONE, fail);
+
+             tdm_display_get_pp_available_size(e_comp_screen->tdisplay,
+                                               &hwc->pp_minw, &hwc->pp_minh,
+                                               &hwc->pp_maxw, &hwc->pp_maxh,
+                                               &hwc->pp_align);
+             tdm_display_get_pp_preferred_align_vertical(e_comp_screen->tdisplay, &hwc->pp_align_vertical);
           }
 
         if (!hwc->pp_tqueue)
           {
+             _e_hwc_windows_zoom_pp_aligned_value_get(hwc, &w, &h);
              //TODO: Does e20 get the buffer flags from the tdm backend?
              hwc->pp_tqueue = tbm_surface_queue_create(3, w, h, TBM_FORMAT_ARGB8888, TBM_BO_SCANOUT);
              if (!hwc->pp_tqueue)