video: 'E_Video_Hwc' handles commit done for HWC Planes/Windows. 97/204497/1
authorSeunghun Lee <shiin.lee@samsung.com>
Mon, 15 Apr 2019 06:55:00 +0000 (15:55 +0900)
committerSeunghun Lee <shiin.lee@samsung.com>
Wed, 24 Apr 2019 06:33:43 +0000 (15:33 +0900)
Change-Id: Iaa2f2537efd26e2d902979dae30045cd80bf9dd3

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

index 709009ab187be718eb267d499f6b20f5189bf5ad..f301e5df9a440afe74f763efda67dbe765912b7b 100644 (file)
@@ -1519,3 +1519,56 @@ e_video_hwc_iface_create(E_Client *ec)
 
    return &evh->iface;
 }
+
+static Eina_Bool
+_e_video_hwc_current_fb_update(E_Video_Hwc *evh)
+{
+   Eina_List *l;
+   E_Comp_Wl_Video_Buf *vbuf;
+   tbm_surface_h displaying_buffer;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(evh, EINA_FALSE);
+
+   if (!evh->committed_list)
+     return EINA_FALSE;
+
+   if (e_video_hwc_can_commit(evh))
+     {
+        if (evh->hwc_policy == E_HWC_POLICY_PLANES)
+          displaying_buffer = e_video_hwc_planes_displaying_buffer_get(evh);
+        else
+          displaying_buffer = e_video_hwc_windows_displaying_buffer_get(evh);
+
+        EINA_LIST_FOREACH(evh->committed_list, l, vbuf)
+          {
+             if (vbuf->tbm_surface == displaying_buffer) break;
+          }
+        if (!vbuf)
+          return EINA_FALSE;
+     }
+   else
+     vbuf = eina_list_nth(evh->committed_list, 0);
+
+   evh->committed_list = eina_list_remove(evh->committed_list, vbuf);
+
+   /* client can attachs the same wl_buffer twice. */
+   if (evh->current_fb && VBUF_IS_VALID(evh->current_fb) && vbuf != evh->current_fb)
+     {
+        e_comp_wl_video_buffer_set_use(evh->current_fb, EINA_FALSE);
+
+        if (evh->current_fb->comp_buffer)
+          e_comp_wl_buffer_reference(&evh->current_fb->buffer_ref, NULL);
+     }
+
+   evh->current_fb = vbuf;
+
+   VDB("current_fb(%d)", evh->ec, MSTAMP(evh->current_fb));
+
+   return EINA_TRUE;
+}
+
+EINTERN Eina_Bool
+e_video_hwc_commit_done(E_Video_Hwc *evh)
+{
+   return _e_video_hwc_current_fb_update(evh);
+}
index be2080cb41f574c46cb0238545790e76d8703eb4..18f1958240a330d5f57876055d2b87112185388e 100644 (file)
@@ -84,15 +84,18 @@ EINTERN Eina_Bool    e_video_hwc_planes_init(E_Video_Hwc *evh);
 EINTERN void         e_video_hwc_planes_buffer_show(E_Video_Hwc *evh, E_Comp_Wl_Video_Buf *vbuf, unsigned int transform);
 EINTERN Eina_Bool    e_video_hwc_planes_frame_buffer_show(E_Video_Hwc *evh, E_Comp_Wl_Video_Buf *vbuf);
 EINTERN Eina_Bool    e_video_hwc_planes_check_if_pp_needed(E_Video_Hwc *evh);
+EINTERN tbm_surface_h   e_video_hwc_planes_displaying_buffer_get(E_Video_Hwc *evh);
 
 EINTERN E_Video_Hwc *e_video_hwc_windows_create(void);
 EINTERN Eina_Bool    e_video_hwc_windows_init(E_Video_Hwc *evh);
 EINTERN void         e_video_hwc_windows_buffer_show(E_Video_Hwc *evh, E_Comp_Wl_Video_Buf *vbuf, unsigned int transform);
 EINTERN Eina_Bool    e_video_hwc_windows_frame_buffer_show(E_Video_Hwc *evh, E_Comp_Wl_Video_Buf *vbuf);
 EINTERN Eina_Bool    e_video_hwc_windows_check_if_pp_needed(E_Video_Hwc *evh);
+EINTERN tbm_surface_h   e_video_hwc_windows_displaying_buffer_get(E_Video_Hwc *evh);
 
 EINTERN void         e_video_hwc_render(E_Video_Hwc *evh, const char *func);
 EINTERN Eina_Bool    e_video_hwc_can_commit(E_Video_Hwc *evh);
+EINTERN Eina_Bool    e_video_hwc_commit_done(E_Video_Hwc *evh);
 
 EINTERN E_Client    *e_video_hwc_client_offscreen_parent_get(E_Client *ec);
 
index 5056b3d76eca13fe22fa48d7dadee6818a2b0666..83bd9ef2473dec6d0e8612075d5ae1c35fd9e7a6 100644 (file)
@@ -201,6 +201,15 @@ _e_video_layer_get_displaying_buffer(E_Video_Layer *layer, int *tdm_error)
    return tdm_layer_get_displaying_buffer(layer->tdm_layer, tdm_error);
 }
 
+EINTERN tbm_surface_h
+e_video_hwc_planes_displaying_buffer_get(E_Video_Hwc *evh)
+{
+   E_Video_Hwc_Planes *evhp;
+
+   evhp = (E_Video_Hwc_Planes *)evh;
+   return _e_video_layer_get_displaying_buffer(evhp->layer, NULL);
+}
+
 static tdm_error
 _e_video_layer_set_property(E_Video_Layer * layer, Tdm_Prop_Value *prop)
 {
@@ -308,40 +317,11 @@ _e_video_commit_handler(tdm_layer *layer, unsigned int sequence,
                         void *user_data)
 {
    E_Video_Hwc_Planes *evhp;
-   Eina_List *l;
-   E_Comp_Wl_Video_Buf *vbuf;
 
    evhp = user_data;
    if (!evhp) return;
-   if (!evhp->base.committed_list) return;
-
-   if (e_video_hwc_can_commit((E_Video_Hwc *)evhp))
-     {
-        tbm_surface_h displaying_buffer = _e_video_layer_get_displaying_buffer(evhp->layer, NULL);
-
-        EINA_LIST_FOREACH(evhp->base.committed_list, l, vbuf)
-          {
-             if (vbuf->tbm_surface == displaying_buffer) break;
-          }
-        if (!vbuf) return;
-     }
-   else
-     vbuf = eina_list_nth(evhp->base.committed_list, 0);
-
-   evhp->base.committed_list = eina_list_remove(evhp->base.committed_list, vbuf);
-
-   /* client can attachs the same wl_buffer twice. */
-   if (evhp->base.current_fb && VBUF_IS_VALID(evhp->base.current_fb) && vbuf != evhp->base.current_fb)
-     {
-        e_comp_wl_video_buffer_set_use(evhp->base.current_fb, EINA_FALSE);
-
-        if (evhp->base.current_fb->comp_buffer)
-          e_comp_wl_buffer_reference(&evhp->base.current_fb->buffer_ref, NULL);
-     }
-
-   evhp->base.current_fb = vbuf;
 
-   VDB("current_fb(%d)", evhp->base.ec, MSTAMP(evhp->base.current_fb));
+   e_video_hwc_commit_done((E_Video_Hwc *)evhp);
 }
 
 static void
index 569c0e60fd7da3470591d81de169fad0de55a3ca..f8f1c3b2caa0d5388766b633962aa66dfc21bd6f 100644 (file)
@@ -34,40 +34,12 @@ _e_video_commit_handler(tdm_layer *layer, unsigned int sequence,
                         void *user_data)
 {
    E_Video_Hwc_Windows *evhw;
-   Eina_List *l;
-   E_Comp_Wl_Video_Buf *vbuf;
 
    evhw = user_data;
    if (!evhw) return;
-   if (!evhw->base.committed_list) return;
-
-   if (e_video_hwc_can_commit((E_Video_Hwc *)evhw))
-     {
-        tbm_surface_h displaying_buffer = evhw->cur_tsurface;
-
-        EINA_LIST_FOREACH(evhw->base.committed_list, l, vbuf)
-          {
-             if (vbuf->tbm_surface == displaying_buffer) break;
-          }
-        if (!vbuf) return;
-     }
-   else
-     vbuf = eina_list_nth(evhw->base.committed_list, 0);
-
-   evhw->base.committed_list = eina_list_remove(evhw->base.committed_list, vbuf);
-
-   /* client can attachs the same wl_buffer twice. */
-   if (evhw->base.current_fb && VBUF_IS_VALID(evhw->base.current_fb) && vbuf != evhw->base.current_fb)
-     {
-        e_comp_wl_video_buffer_set_use(evhw->base.current_fb, EINA_FALSE);
 
-        if (evhw->base.current_fb->comp_buffer)
-          e_comp_wl_buffer_reference(&evhw->base.current_fb->buffer_ref, NULL);
-     }
-
-   evhw->base.current_fb = vbuf;
-
-   VDB("current_fb(%d)", evhw->base.ec, MSTAMP(evhw->base.current_fb));
+   if (!e_video_hwc_commit_done((E_Video_Hwc *)evhw))
+     return;
 
    _e_video_vblank_handler(NULL, sequence, tv_sec, tv_usec, evhw);
 }
@@ -673,3 +645,12 @@ e_video_hwc_windows_init(E_Video_Hwc *evh)
 
    return EINA_TRUE;
 }
+
+EINTERN tbm_surface_h
+e_video_hwc_windows_displaying_buffer_get(E_Video_Hwc *evh)
+{
+   E_Video_Hwc_Windows *evhw;
+
+   evhw = (E_Video_Hwc_Windows *)evh;
+   return evhw->cur_tsurface;
+}