e_hwc_windows: add timer of waiting commit handler 34/239734/3 accepted/tizen_5.5_unified_wearable_hotfix tizen_5.5_wearable_hotfix accepted/tizen/5.5/unified/20200804.154149 accepted/tizen/5.5/unified/wearable/hotfix/20201027.103221 submit/tizen_5.5/20200804.045920 submit/tizen_5.5_wearable_hotfix/20201026.184306
authorChangyeon Lee <cyeon.lee@samsung.com>
Wed, 29 Jul 2020 08:52:00 +0000 (17:52 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Tue, 4 Aug 2020 03:15:41 +0000 (12:15 +0900)
add config of e_comp commit_handler_timer.use and
commit_handler_timer.interval

Change-Id: Ib90a43468dc9202ab8ca5b39219819ed47b62d7f

src/bin/e_comp.c
src/bin/e_comp.h
src/bin/e_comp_cfdata.c
src/bin/e_comp_cfdata.h
src/bin/e_hwc.h
src/bin/e_hwc_windows.c

index 90f30276dd73f210001a20a2fbee46e31aac06bb..ea4d15ba08aaf48706649c8f6902c57e78432d43 100644 (file)
@@ -466,6 +466,12 @@ e_comp_init(void)
 
    if (conf->canvas_render_delay_after_boot) e_comp->canvas_render_delayed = EINA_TRUE;
 
+   if ((conf->commit_handler_timer.use) && (conf->commit_handler_timer.interval))
+     {
+        e_comp->commit_handler_timer.use = EINA_TRUE;
+        e_comp->commit_handler_timer.interval = conf->commit_handler_timer.interval;
+     }
+
    e_comp_canvas_fake_layers_init();
 
    E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_ON,  _e_comp_screensaver_on,  NULL);
index 50dd68120d0c4b10bd625a7b3a1a787917469a30..bd164bba16099132b27e670a81b98e67e9b4727b 100644 (file)
@@ -181,6 +181,12 @@ struct _E_Comp
    int norender;
 
    void           (*func_memory_dump) (void);
+
+   struct
+   {
+      char use; // 0: none 1: use commit_handler timer
+      double interval; // time value the interval of commit_handler after tdm_commit in second (default : 0)
+   } commit_handler_timer;
 };
 
 struct _E_Comp_Connected_Client_Info
index e1ffa22f3dabdbf4401804a8b8ee6dfd787677ec..55f61fd9db523e192cc257677fc71b673e8c583d 100644 (file)
@@ -90,6 +90,8 @@ e_comp_cfdata_edd_init(E_Config_DD **conf_edd, E_Config_DD **match_edd)
    E_CONFIG_VAL(D, T, input_log_enable, UCHAR);
    E_CONFIG_VAL(D, T, avoid_afill, UCHAR);
    E_CONFIG_VAL(D, T, canvas_render_delay_after_boot, UCHAR);
+   E_CONFIG_VAL(D, T, commit_handler_timer.use, UCHAR);
+   E_CONFIG_VAL(D, T, commit_handler_timer.interval, DOUBLE);
 }
 
 E_API E_Comp_Config *
@@ -141,6 +143,8 @@ e_comp_cfdata_config_new(void)
    cfg->first_draw_delay = 0.15;
    cfg->skip_first_damage = 1;
    cfg->launch_file = NULL;
+   cfg->commit_handler_timer.use = 0;
+   cfg->commit_handler_timer.interval = 0;
 
    cfg->match.popups = NULL;
 
index d79560184c008b0bdbdd1bd4af9c8f5e9af37bf2..670d68110fafa05a57dd2c403ddcc8016c6aac2a 100644 (file)
@@ -73,6 +73,12 @@ struct _E_Comp_Config
    Eina_Bool input_log_enable;
    unsigned char avoid_afill; // used for avoiding to fill the alpha channel. 0: use gl_tbm ee engine, 1: use gl_tbm_ES ee engine
    unsigned char canvas_render_delay_after_boot; // no canvas update before client's commit request, begin rendering after 1st commit
+
+   struct
+   {
+      Eina_Bool use; // 0: none 1: use commit_handler timer
+      double    interval; // time value the interval of commit_handler after tdm_commit in second (default : 0)
+   } commit_handler_timer;
 };
 
 struct _E_Comp_Match
index c6039f2b5d944814894a29b3d830b8d83961f09c..8ad0c7f9f60af0d31c47b386c6022fb8d7ed17e5 100644 (file)
@@ -138,6 +138,8 @@ struct _E_Hwc
    double               lapse;
    int                  cframes;
    int                  flapse;
+
+   Ecore_Timer         *commit_handler_timer;
 };
 
 E_API extern int E_EVENT_HWC_ACTIVE;
index 828c5e7f69f62ada328b438616f93730c34d758a..71fcbadb19a240f19bc8bf62207e24b225ccbbf8 100644 (file)
@@ -75,6 +75,7 @@ static uint64_t ehws_rendered_buffers_key;
 static Eina_Bool _e_hwc_windows_target_window_queue_set(E_Hwc_Window_Target *target_hwc_window);
 static Eina_Bool _e_hwc_windows_pp_output_data_commit(E_Hwc *hwc, E_Hwc_Window_Commit_Data *data);
 static Eina_Bool _e_hwc_windows_pp_window_commit(E_Hwc *hwc, E_Hwc_Window *hwc_window);
+static void _e_hwc_windows_wait_commit_set(E_Hwc *hwc, Eina_Bool set);
 
 static E_Comp_Wl_Buffer *
 _e_hwc_windows_comp_wl_buffer_get(E_Hwc_Window *hwc_window)
@@ -281,7 +282,7 @@ _e_hwc_windows_commit_handler(tdm_hwc *thwc, unsigned int sequence,
 
    /* 'wait_commit' is mechanism to make 'fetch and commit' no more than one time per a frame;
     * a 'page flip' happened so it's time to allow to make 'fetch and commit' for the e_output */
-   hwc->wait_commit = EINA_FALSE;
+   _e_hwc_windows_wait_commit_set(hwc, EINA_FALSE);
 }
 
 static void
@@ -1254,7 +1255,7 @@ _e_hwc_windows_pp_pending_data_remove(E_Hwc *hwc)
 }
 
 static void
-_e_hwc_windows_pp_output_commit_handler(tdm_output *toutput, unsigned int sequence,
+_e_hwc_windows_pp_output_commit_handler(tdm_hwc *thwc, unsigned int sequence,
                                               unsigned int tv_sec, unsigned int tv_usec,
                                               void *user_data)
 {
@@ -1269,7 +1270,7 @@ _e_hwc_windows_pp_output_commit_handler(tdm_output *toutput, unsigned int sequen
    hwc->pp_output_commit = EINA_FALSE;
 
    _e_hwc_windows_commit_data_release(hwc, sequence, tv_sec, tv_usec);
-   hwc->wait_commit = EINA_FALSE;
+   _e_hwc_windows_wait_commit_set(hwc, EINA_FALSE);
 
    /* layer already resetted */
    if (hwc->pp_output_commit_data)
@@ -1284,7 +1285,7 @@ _e_hwc_windows_pp_output_commit_handler(tdm_output *toutput, unsigned int sequen
                tbm_surface_internal_unref(hwc->pp_tsurface);
 
              hwc->pp_tsurface = data->buffer.tsurface;
-             hwc->wait_commit = EINA_FALSE;
+             _e_hwc_windows_wait_commit_set(hwc, EINA_FALSE);
 
              E_FREE(data);
 
@@ -1414,7 +1415,7 @@ fail:
    E_FREE(data);
 
    _e_hwc_windows_commit_data_release(hwc, 0, 0, 0);
-   hwc->wait_commit = EINA_FALSE;
+   _e_hwc_windows_wait_commit_set(hwc, EINA_FALSE);
 
    return EINA_FALSE;
 }
@@ -1495,7 +1496,7 @@ _e_hwc_windows_pp_commit_handler(tdm_pp *pp, tbm_surface_h tsurface_src, tbm_sur
              hwc->tpp = NULL;
           }
         _e_hwc_windows_commit_data_release(hwc, 0, 0, 0);
-        hwc->wait_commit = EINA_FALSE;
+        _e_hwc_windows_wait_commit_set(hwc, EINA_FALSE);
 
         goto done;
      }
@@ -1506,7 +1507,7 @@ _e_hwc_windows_pp_commit_handler(tdm_pp *pp, tbm_surface_h tsurface_src, tbm_sur
         _e_hwc_windows_pp_pending_data_remove(hwc);
         tbm_surface_queue_release(hwc->pp_tqueue, tsurface_dst);
         _e_hwc_windows_commit_data_release(hwc, 0, 0, 0);
-        hwc->wait_commit = EINA_FALSE;
+        _e_hwc_windows_wait_commit_set(hwc, EINA_FALSE);
 
         goto done;
      }
@@ -1622,7 +1623,7 @@ _e_hwc_windows_pp_window_commit(E_Hwc *hwc, E_Hwc_Window *hwc_window)
    terror = tdm_pp_commit(hwc->tpp);
    EINA_SAFETY_ON_FALSE_GOTO(terror == TDM_ERROR_NONE, commit_fail);
 
-   hwc->wait_commit = EINA_TRUE;
+   _e_hwc_windows_wait_commit_set(hwc, EINA_TRUE);
    hwc->pp_commit = EINA_TRUE;
 
    return EINA_TRUE;
@@ -1694,15 +1695,16 @@ _e_hwc_windows_pp_commit(E_Hwc *hwc)
              return EINA_FALSE;
           }
 
+        _e_hwc_windows_wait_commit_set(hwc, EINA_TRUE);
+
         terror = tdm_hwc_commit(hwc->thwc, 0, _e_hwc_windows_commit_handler, hwc);
         if (terror != TDM_ERROR_NONE)
           {
+             _e_hwc_windows_wait_commit_set(hwc, EINA_FALSE);
              EHWSERR("fail to tdm_hwc_commit", hwc);
              return EINA_FALSE;
           }
 
-        hwc->wait_commit = EINA_TRUE;
-
         return EINA_TRUE;
      }
 
@@ -1713,7 +1715,7 @@ _e_hwc_windows_pp_commit(E_Hwc *hwc)
                   commit_data->buffer_ref.buffer ? commit_data->buffer_ref.buffer->resource : NULL, commit_data);
         hwc->pending_pp_hwc_window_list = eina_list_append(hwc->pending_pp_hwc_window_list, hwc_window);
 
-        hwc->wait_commit = EINA_TRUE;
+        _e_hwc_windows_wait_commit_set(hwc, EINA_TRUE);
 
         return EINA_TRUE;
      }
@@ -1725,7 +1727,7 @@ _e_hwc_windows_pp_commit(E_Hwc *hwc)
                   commit_data->buffer_ref.buffer ? commit_data->buffer_ref.buffer->resource : NULL, commit_data);
         hwc->pending_pp_hwc_window_list = eina_list_append(hwc->pending_pp_hwc_window_list, hwc_window);
 
-        hwc->wait_commit = EINA_TRUE;
+        _e_hwc_windows_wait_commit_set(hwc, EINA_TRUE);
 
         return EINA_TRUE;
      }
@@ -1740,6 +1742,48 @@ _e_hwc_windows_pp_commit(E_Hwc *hwc)
    return EINA_TRUE;
 }
 
+static Eina_Bool
+_e_hwc_windows_commit_handler_timeout(void *data)
+{
+   E_Hwc *hwc = (E_Hwc *)data;
+
+   if (!hwc) return ECORE_CALLBACK_CANCEL;
+
+   EHWSERR("Timeout wait commit", hwc);
+
+   if (hwc->pp_output_commit)
+     _e_hwc_windows_pp_output_commit_handler(hwc->thwc, 0, 0, 0, hwc);
+   else
+     _e_hwc_windows_commit_handler(hwc->thwc, 0, 0, 0, hwc);
+
+   hwc->wait_commit = EINA_FALSE;
+   hwc->commit_handler_timer = NULL;
+
+   return ECORE_CALLBACK_CANCEL;
+}
+
+static void
+_e_hwc_windows_wait_commit_set(E_Hwc *hwc, Eina_Bool set)
+{
+   if (hwc->wait_commit == set) return;
+
+   if (e_comp->commit_handler_timer.use)
+     {
+        if (hwc->commit_handler_timer)
+          {
+             ecore_timer_del(hwc->commit_handler_timer);
+             hwc->commit_handler_timer = NULL;
+          }
+
+        if (set)
+          hwc->commit_handler_timer = ecore_timer_add(e_comp->commit_handler_timer.interval,
+                                                      _e_hwc_windows_commit_handler_timeout,
+                                                      hwc);
+     }
+
+   hwc->wait_commit = set;
+}
+
 static Eina_Bool
 _e_hwc_windows_device_states_available_check(E_Hwc *hwc)
 {
@@ -3076,7 +3120,7 @@ _e_hwc_windows_pp_set(E_Hwc *hwc, tbm_surface_h src, tbm_surface_h dst,
    error = tdm_pp_commit(hwc->tpp);
    EINA_SAFETY_ON_FALSE_GOTO(error == TDM_ERROR_NONE, pp_fail);
 
-   hwc->wait_commit = EINA_TRUE;
+   _e_hwc_windows_wait_commit_set(hwc, EINA_TRUE);
    hwc->pp_commit = EINA_TRUE;
 
    return EINA_TRUE;
@@ -3334,7 +3378,7 @@ e_hwc_windows_commit(E_Hwc *hwc, E_Output_Display_Mode display_mode)
         EHWSTRACE("!!!!!!!! HWC Commit !!!!!!!!", NULL, hwc);
         _e_hwc_windows_update_fps(hwc);
 
-        hwc->wait_commit = EINA_TRUE;
+        _e_hwc_windows_wait_commit_set(hwc, EINA_TRUE);
 
         error = tdm_hwc_commit(hwc->thwc, 0, _e_hwc_windows_commit_handler, hwc);
         if (error != TDM_ERROR_NONE)
@@ -3348,7 +3392,7 @@ e_hwc_windows_commit(E_Hwc *hwc, E_Output_Display_Mode display_mode)
    return EINA_TRUE;
 
 fail:
-   hwc->wait_commit = EINA_FALSE;
+   _e_hwc_windows_wait_commit_set(hwc, EINA_FALSE);
 
    return EINA_FALSE;
 }
@@ -3527,7 +3571,7 @@ e_hwc_windows_zoom_unset(E_Hwc *hwc)
           }
 
         if (hwc->pp_output_commit_data)
-          hwc->wait_commit = EINA_TRUE;
+          _e_hwc_windows_wait_commit_set(hwc, EINA_TRUE);
 
         hwc->pp_src_rect_prev.x = 0;
         hwc->pp_src_rect_prev.y = 0;