hwc: initial draft for the redesigned hwc api. 97/175897/2 accepted/tizen/unified/20180416.213825 submit/tizen/20180413.052944 submit/tizen/20180416.011552
authorSooChan Lim <sc1.lim@samsung.com>
Fri, 13 Apr 2018 07:04:12 +0000 (16:04 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Fri, 13 Apr 2018 07:31:57 +0000 (07:31 +0000)
Change-Id: I4b219a8e6bd86eb15010ed4797c7120d656cb123

src/bin/e_comp_wl_video.c
src/bin/e_hwc.c
src/bin/e_hwc.h
src/bin/e_hwc_window.c
src/bin/e_hwc_window.h
src/bin/e_hwc_windows.c

index 258188f..7fab992 100644 (file)
@@ -414,7 +414,6 @@ _e_video_get_available_formats(const tbm_format **formats, int *count)
    E_Output *output;
    tdm_output *toutput;
    tdm_layer *layer;
-   tdm_error error;
 
    *count = 0;
 
@@ -439,8 +438,10 @@ _e_video_get_available_formats(const tbm_format **formats, int *count)
              *count = NUM_SW_FORMAT;
           }
      }
+#if 0 //TODO:
    else
      {
+        tdm_error error;
         error = tdm_output_hwc_get_video_supported_formats(output, formats, count);
         if (error != TDM_ERROR_NONE)
           {
@@ -448,6 +449,7 @@ _e_video_get_available_formats(const tbm_format **formats, int *count)
              *count = NUM_SW_FORMAT;
           }
      }
+#endif
 }
 
 static int
@@ -672,9 +674,11 @@ _e_video_layer_get_available_properties(E_Video_Layer * layer, const tdm_prop **
   if (_is_video_hwc_windows(layer->video))
     {
        *count = 0;
+#if 0 //TODO:
        if (layer->e_client->hwc_window->thwc_window)
          ret = tdm_hwc_window_video_get_available_properties(
                          layer->e_client->hwc_window->thwc_window, props, count);
+#endif
     }
   else
     {
@@ -698,10 +702,12 @@ _e_video_layer_get_property(E_Video_Layer * layer, unsigned id, tdm_value *value
 
   if (_is_video_hwc_windows(layer->video))
     {
+#if 0 //TODO:
        if (layer->e_client->hwc_window->thwc_window)
          ret = tdm_hwc_window_video_get_property(
                       layer->e_client->hwc_window->thwc_window, id, value);
        else
+#endif
          ret = TDM_ERROR_BAD_MODULE;
     }
   else
@@ -2421,7 +2427,6 @@ _e_video_check_if_pp_needed(E_Video *video)
    const tbm_format *formats;
    Eina_Bool found = EINA_FALSE;
    tdm_layer_capability capabilities = 0;
-   tdm_error error;
 
    if (e_hwc_policy_get(video->e_output->hwc) != E_HWC_POLICY_WINDOWS)
      {
@@ -2467,10 +2472,12 @@ _e_video_check_if_pp_needed(E_Video *video)
           if (!(capabilities & TDM_LAYER_CAPABILITY_TRANSFORM))
             goto need_pp;
      }
+#if 0 // TODO:
    else
      {
         E_Hwc_Window *hwc_window = video->ec->hwc_window;
         tdm_hwc_window_video_capability capabilities = 0;
+        tdm_error error;
 
         error = tdm_output_hwc_get_video_supported_formats(video->output, &formats, &count);
         if (error != TDM_ERROR_NONE)
@@ -2511,6 +2518,7 @@ _e_video_check_if_pp_needed(E_Video *video)
           if (!(capabilities & TDM_HWC_WINDOW_VIDEO_CAPABILITY_TRANSFORM))
             goto need_pp;
      }
+#endif
 
    return EINA_FALSE;
 
index 68e89f3..0ca2f1e 100644 (file)
@@ -13,7 +13,6 @@ _e_hwc_tbm_surface_queue_alloc(void *data, int w, int h)
    E_Hwc *hwc = (E_Hwc *)data;
    E_Output *output = hwc->output;
    E_Comp_Screen *e_comp_screen = output->e_comp_screen;
-   tdm_output *toutput = output->toutput;
    tbm_surface_queue_h tqueue = NULL;
    tdm_error error;
    int scr_w, scr_h, queue_w, queue_h;
@@ -22,10 +21,10 @@ _e_hwc_tbm_surface_queue_alloc(void *data, int w, int h)
 
    if (output->tdm_hwc)
      {
-        tqueue = tdm_output_hwc_get_target_buffer_queue(toutput, &error);
+        tqueue = tdm_hwc_get_client_target_buffer_queue(hwc->thwc, &error);
         if (error != TDM_ERROR_NONE)
          {
-            ERR("fail to tdm_output_hwc_get_target_buffer_queue");
+            ERR("fail to tdm_hwc_get_client_target_buffer_queue");
             return (void *)NULL;
          }
      }
@@ -34,7 +33,7 @@ _e_hwc_tbm_surface_queue_alloc(void *data, int w, int h)
         tqueue = tbm_surface_queue_create(3, w, h, TBM_FORMAT_ARGB8888, TBM_BO_SCANOUT);
         if (!tqueue)
           {
-             ERR("fail to tdm_output_hwc_get_target_buffer_queue");
+             ERR("fail to tbm_surface_queue_create");
              return (void *)NULL;
           }
      }
@@ -217,6 +216,7 @@ EINTERN E_Hwc *
 e_hwc_new(E_Output *output)
 {
    E_Hwc *hwc = NULL;
+   tdm_error error;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(output, NULL);
 
@@ -255,6 +255,13 @@ e_hwc_new(E_Output *output)
      {
         hwc->hwc_policy = E_HWC_POLICY_WINDOWS;
 
+        hwc->thwc = tdm_output_get_hwc(output->toutput, &error);
+        if (!hwc->thwc)
+          {
+             ERR("hwc_opt: tdm_output_get_hwc failed");
+             goto fail;
+          }
+
         if (!e_hwc_windows_init(hwc))
           {
              ERR("hwc_opt: e_hwc_windows_init failed");
index 15b3793..b4f5349 100644 (file)
@@ -26,7 +26,7 @@ struct _E_Hwc
 
    E_Hwc_Policy  hwc_policy;
    E_Hwc_Mode    hwc_mode;
-   Eina_Bool            hwc_deactive : 1; // deactive hwc policy
+   Eina_Bool     hwc_deactive : 1; // deactive hwc policy
 
    Ecore_Evas          *ee;
 
@@ -34,6 +34,7 @@ struct _E_Hwc
    Eina_Bool            hwc_use_multi_plane;
 
    /* variables for hwc_windows policy  */
+   tdm_hwc             *thwc;
    Eina_Bool            hwc_wins;
    Eina_List           *hwc_windows;
    E_Hwc_Window_Target *target_hwc_window;
index 88b331d..b5ab261 100644 (file)
@@ -984,6 +984,7 @@ e_hwc_window_init(E_Hwc *hwc)
 
    target_hwc_window = _e_hwc_window_target_new(hwc);
    EINA_SAFETY_ON_NULL_RETURN_VAL(target_hwc_window, EINA_FALSE);
+   target_hwc_window->hwc = hwc;
 
    /* set the target_window to the hwc */
    hwc->target_hwc_window = target_hwc_window;
@@ -1006,15 +1007,14 @@ EINTERN E_Hwc_Window *
 e_hwc_window_new(E_Hwc *hwc, E_Client *ec, E_Hwc_Window_State state)
 {
    E_Hwc_Window *hwc_window = NULL;
-   tdm_output *toutput;
+   tdm_hwc *thwc;;
    tdm_error error;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(hwc, NULL);
-   EINA_SAFETY_ON_NULL_RETURN_VAL(hwc->output, NULL);
    EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
 
-   toutput = hwc->output->toutput;
-   EINA_SAFETY_ON_NULL_RETURN_VAL(toutput, EINA_FALSE);
+   thwc = hwc->thwc;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(thwc, EINA_FALSE);
 
    hwc_window = E_NEW(E_Hwc_Window, 1);
    EINA_SAFETY_ON_NULL_RETURN_VAL(hwc_window, NULL);
@@ -1024,13 +1024,10 @@ e_hwc_window_new(E_Hwc *hwc, E_Client *ec, E_Hwc_Window_State state)
    hwc_window->state = state;
    hwc_window->need_change_buffer_transform = EINA_TRUE;
 
-   if (state == E_HWC_WINDOW_STATE_VIDEO)
-     hwc_window->thwc_window = tdm_output_hwc_create_video_window(toutput, &error);
-   else
-     hwc_window->thwc_window = tdm_output_hwc_create_window(toutput, &error);
+   hwc_window->thwc_window = tdm_hwc_create_window(thwc, &error);
    if (error != TDM_ERROR_NONE)
      {
-        ERR("cannot create tdm_hwc_window for toutput(%p)", toutput);
+        ERR("cannot create tdm_hwc_window for thwc(%p)", thwc);
         E_FREE(hwc_window);
         return NULL;
      }
@@ -1056,8 +1053,6 @@ EINTERN void
 e_hwc_window_free(E_Hwc_Window *hwc_window)
 {
    E_Hwc *hwc = NULL;
-   E_Output *output = NULL;
-   tdm_output *toutput = NULL;
 
    EINA_SAFETY_ON_NULL_RETURN(hwc_window);
    EINA_SAFETY_ON_NULL_RETURN(hwc_window->hwc);
@@ -1065,18 +1060,12 @@ e_hwc_window_free(E_Hwc_Window *hwc_window)
    hwc = hwc_window->hwc;
    EINA_SAFETY_ON_NULL_RETURN(hwc);
 
-   output = hwc->output;
-   EINA_SAFETY_ON_NULL_RETURN(hwc->output);
-
-   toutput = output->toutput;
-   EINA_SAFETY_ON_NULL_RETURN(toutput);
-
    /* we cannot remove the hwc_window because we need to release the commit_data */
    if (e_hwc_window_displaying_surface_get(hwc_window))
      {
-        ELOGF("HWC-WINS", "ehw:%p is destroyed on eout:%p. displaying surface.",
+        ELOGF("HWC-WINS", "ehw:%p is destroyed on ehwc:%p. displaying surface.",
               hwc_window->ec ? hwc_window->ec->pixmap : NULL, hwc_window->ec,
-              hwc_window, hwc->output);
+              hwc_window, hwc);
 
         /* mark as deleted and delete when commit_data will be released */
         hwc_window->is_deleted = EINA_TRUE;
@@ -1085,12 +1074,12 @@ e_hwc_window_free(E_Hwc_Window *hwc_window)
         return;
      }
    else
-     ELOGF("HWC-WINS", "ehw:%p is destroyed on eout:%p",
+     ELOGF("HWC-WINS", "ehw:%p is destroyed on ehwc:%p",
            hwc_window->ec ? hwc_window->ec->pixmap : NULL, hwc_window->ec,
-           hwc_window, hwc->output);
+           hwc_window, hwc);
 
    if (hwc_window->thwc_window)
-      tdm_output_hwc_destroy_window(toutput, hwc_window->thwc_window);
+      tdm_hwc_window_destroy(hwc_window->thwc_window);
 
    hwc->hwc_windows = eina_list_remove(hwc->hwc_windows, hwc_window);
 
@@ -1429,11 +1418,11 @@ e_hwc_window_target_enabled(E_Hwc_Window_Target *target_hwc_window)
 EINTERN Eina_Bool
 e_hwc_window_target_buffer_fetch(E_Hwc_Window_Target *target_hwc_window)
 {
-   E_Output *output;
    E_Hwc *hwc;
    E_Hwc_Window *hwc_window, *hw;
+   tdm_hwc *thwc;
    tbm_surface_h tsurface;
-   tdm_hwc_region fb_damage;
+   tdm_region fb_damage;
    Eina_List *ee_rendered_hw_list = NULL;
    uint32_t n_thw = 0;
    const Eina_List *l;
@@ -1465,13 +1454,13 @@ e_hwc_window_target_buffer_fetch(E_Hwc_Window_Target *target_hwc_window)
         hwc = hwc_window->hwc;
         EINA_SAFETY_ON_NULL_RETURN_VAL(hwc, EINA_FALSE);
 
-        output = hwc->output;
-        EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE);
+        thwc = hwc->thwc;
+        EINA_SAFETY_ON_NULL_RETURN_VAL(thwc, EINA_FALSE);
 
         /* the damage isn't supported by hwc extension yet */
         memset(&fb_damage, 0, sizeof(fb_damage));
 
-        tdm_output_hwc_set_client_target_buffer(output->toutput, hwc_window->tsurface, fb_damage);
+        tdm_hwc_set_client_target_buffer(thwc, hwc_window->tsurface, fb_damage);
 
         ee_rendered_hw_list = e_hwc_window_target_window_ee_rendered_hw_list_get(target_hwc_window);
         n_thw = eina_list_count(ee_rendered_hw_list);
index 85e87e5..9b1995e 100644 (file)
@@ -84,6 +84,7 @@ struct _E_Hwc_Window
 struct _E_Hwc_Window_Target
 {
    E_Hwc_Window        hwc_window; /* don't move this field */
+   E_Hwc               *hwc;
 
    Ecore_Evas         *ee;
    Evas               *evas;
index 48aad53..74734be 100644 (file)
@@ -412,7 +412,7 @@ _e_hwc_windows_pp_output_data_commit(E_Hwc *hwc, E_Hwc_Window_Commit_Data *data)
    E_Output *output = NULL;
    tdm_layer *toutput = NULL;
    tdm_error terror;
-   tdm_hwc_region fb_damage;
+   tdm_region fb_damage;
 
    /* the damage isn't supported by hwc extension yet */
    memset(&fb_damage, 0, sizeof(fb_damage));
@@ -430,10 +430,10 @@ _e_hwc_windows_pp_output_data_commit(E_Hwc *hwc, E_Hwc_Window_Commit_Data *data)
 
    /* no need to pass composited_wnds list because smooth transition isn't
     * used is this case */
-   terror = tdm_output_hwc_set_client_target_buffer(toutput, data->tsurface, fb_damage);
+   terror = tdm_hwc_set_client_target_buffer(hwc->thwc, data->tsurface, fb_damage);
    if (terror != TDM_ERROR_NONE)
      {
-        ERR("fail to tdm_output_hwc_set_client_target_buffer");
+        ERR("fail to tdm_hwc_set_client_target_buffer");
         goto fail;
      }
 
@@ -906,11 +906,9 @@ _e_hwc_windows_window_state_get(tdm_hwc_window_composition composition_type)
 static Eina_Bool
 _e_hwc_windows_accept(E_Hwc *hwc, uint32_t num_changes)
 {
-   E_Output *output = hwc->output;
    E_Hwc_Window *hwc_window;
    E_Hwc_Window_State state;
    tdm_error terror;
-   tdm_output *toutput = output->toutput;
    tdm_hwc_window **changed_hwc_window = NULL;
    tdm_hwc_window_composition *composition_types = NULL;
    Eina_Bool accept_changes = EINA_TRUE;
@@ -922,7 +920,7 @@ _e_hwc_windows_accept(E_Hwc *hwc, uint32_t num_changes)
    composition_types = E_NEW(tdm_hwc_window_composition, num_changes);
    EINA_SAFETY_ON_NULL_GOTO(composition_types, fail);
 
-   terror = tdm_output_hwc_get_changed_composition_types(toutput,
+   terror = tdm_hwc_get_changed_composition_types(hwc->thwc,
                                          &num_changes, changed_hwc_window,
                                          composition_types);
    if (terror != TDM_ERROR_NONE)
@@ -970,7 +968,7 @@ _e_hwc_windows_accept(E_Hwc *hwc, uint32_t num_changes)
    if (!accept_changes) goto fail;
 
    /* accept changes */
-   terror = tdm_output_hwc_accept_changes(toutput);
+   terror = tdm_hwc_accept_changes(hwc->thwc);
    if (terror != TDM_ERROR_NONE)
      {
         ERR("HWC-WINS: failed to accept changes required by the hwc extension");
@@ -1012,7 +1010,7 @@ _e_hwc_windows_validate(E_Hwc *hwc, Eina_List *visible_windows_list, uint32_t *n
      }
 
    /* make hwc extension choose which clients will own hw overlays */
-   terror = tdm_output_hwc_validate(toutput, thwc_windows, n_thw, num_changes);
+   terror = tdm_hwc_validate(hwc->thwc, thwc_windows, n_thw, num_changes);
    if (terror != TDM_ERROR_NONE) goto error;
 
    E_FREE(thwc_windows);