video: Added 'Ecore_Job' for rendering job of hwc compositing mode. 33/209033/2
authorSeunghun Lee <shiin.lee@samsung.com>
Thu, 16 May 2019 04:59:01 +0000 (13:59 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Wed, 3 Jul 2019 08:33:39 +0000 (08:33 +0000)
Change-Id: I013c22422944e6e37f1dc58f07c04df9776bdbf2

src/bin/video/iface/e_video_hwc.c
src/bin/video/iface/e_video_hwc.h

index d51e80c598d63a2e18d6e0370cb70fedd6522dbd..268a2a78aaa5ac9b3dd5bcec4b59d2aafd8f46e9 100644 (file)
@@ -486,13 +486,54 @@ _e_video_hwc_geometry_map_apply(E_Client *ec, E_Video_Hwc_Geometry *out)
    return EINA_TRUE;
 }
 
+static void
+_e_video_hwc_render_job(void *data)
+{
+   E_Video_Hwc *evh;
+   E_Client *topmost;
+   Eina_Bool render = EINA_FALSE;
+
+   evh = data;
+   if (evh->render.map)
+     {
+        evh->render.map = EINA_FALSE;
+        render = _e_video_hwc_geometry_map_apply(evh->ec, &evh->geo);
+     }
+
+   if (evh->render.topmost_viewport)
+     {
+        evh->render.topmost_viewport = EINA_FALSE;
+        topmost = e_comp_wl_topmost_parent_get(evh->ec);
+        if (topmost)
+          e_comp_wl_viewport_apply(topmost);
+        render = EINA_TRUE;
+     }
+
+   if ((render) || (evh->render.buffer_change))
+     {
+        evh->render.buffer_change = EINA_FALSE;
+        _e_video_hwc_render(evh, __FUNCTION__);
+     }
+
+   evh->render.job = NULL;
+}
+
+static void
+_e_video_hwc_render_queue(E_Video_Hwc *evh)
+{
+   if (evh->render.job)
+     ecore_job_del(evh->render.job);
+
+   evh->render.job = ecore_job_add(_e_video_hwc_render_job, evh);
+}
+
 static void
 _e_video_hwc_cb_evas_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
 {
    E_Video_Hwc *evh = data;
 
-   if (_e_video_hwc_geometry_map_apply(evh->ec, &evh->geo))
-     _e_video_hwc_render(evh, __FUNCTION__);
+   evh->render.map = EINA_TRUE;
+   _e_video_hwc_render_queue(evh);
 }
 
 static void
@@ -500,8 +541,8 @@ _e_video_hwc_cb_evas_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA
 {
    E_Video_Hwc *evh = data;
 
-   if (_e_video_hwc_geometry_map_apply(evh->ec, &evh->geo))
-     _e_video_hwc_render(evh, __FUNCTION__);
+   evh->render.map = EINA_TRUE;
+   _e_video_hwc_render_queue(evh);
 }
 
 static E_Comp_Wl_Video_Buf *
@@ -1349,8 +1390,8 @@ _e_video_hwc_cb_client_show(void *data, int type, void *event)
    if (ec == e_comp_wl_topmost_parent_get(evh->ec))
      {
         VIN("video need rendering..", evh->ec);
-        e_comp_wl_viewport_apply(ec);
-        _e_video_hwc_render(evh, __FUNCTION__);
+        evh->render.topmost_viewport = EINA_TRUE;
+        _e_video_hwc_render_queue(evh);
      }
 
    return ECORE_CALLBACK_PASS_ON;
@@ -1375,7 +1416,8 @@ _e_video_hwc_cb_client_buffer_change(void *data, int type, void *event)
    if (e_object_is_del(E_OBJECT(ec)))
      return ECORE_CALLBACK_PASS_ON;
 
-   _e_video_hwc_render(evh, __FUNCTION__);
+   evh->render.buffer_change = EINA_TRUE;
+   _e_video_hwc_render_queue(evh);
 
    return ECORE_CALLBACK_PASS_ON;
 }
@@ -1422,6 +1464,8 @@ _e_video_hwc_iface_destroy(E_Video_Comp_Iface *iface)
    if (e_comp_object_mask_has(evh->ec->frame))
      e_comp_object_mask_set(evh->ec->frame, EINA_FALSE);
 
+   E_FREE_FUNC(evh->render.job, ecore_job_del);
+
    evh->backend.destroy(evh);
 }
 
index 65ecad83954841fcef55cbe34ef057a9e608e72f..227198b4cbe2b4bc32a90a963541f2de46cff64f 100644 (file)
@@ -84,6 +84,14 @@ struct _E_Video_Hwc
    Eina_List    *committed_list; /* buffers which are committed, but not shown on screen yet */
    E_Comp_Wl_Video_Buf *current_fb;     /* buffer which is showing on screen currently */
 
+   struct
+     {
+        Ecore_Job *job;
+        Eina_Bool map;
+        Eina_Bool buffer_change;
+        Eina_Bool topmost_viewport;
+     } render;
+
    Eina_Bool  cb_registered;
    Eina_Bool  need_force_render;
 };