video:hwc_planes: wait next vblank until commit callback handler is called. 72/225472/2
authorSeunghun Lee <shiin.lee@samsung.com>
Wed, 19 Feb 2020 01:06:34 +0000 (10:06 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Fri, 21 Feb 2020 06:32:00 +0000 (06:32 +0000)
e_video_hwc_wait_buffer_commit() which is called by vblank would be
failed without updating current fb which is done by commit handler.

Change-Id: I9941188572ed801df356495ec0a9a20d52bf9199

src/bin/video/iface/e_video_hwc_planes.c

index 4409e920900b19f524dcd09c18e975e9b32ab3d0..797d2e2dd6d5a1e328c5a72daaede997d448dbce 100644 (file)
@@ -31,7 +31,11 @@ struct _E_Video_Hwc_Planes
         E_Client_Video_Info info;
      } pending;
 
-   Eina_Bool waiting_vblank;
+   struct
+     {
+        Eina_Bool commit;
+        Eina_Bool vblank;
+     } wait_flag;
 };
 
 typedef struct _Tdm_Prop_Value
@@ -271,7 +275,7 @@ _e_video_hwc_planes_cb_eplane_video_set_hook(void *data, E_Plane *plane)
 
    E_FREE_FUNC(evhp->video_plane_ready_handler, e_plane_hook_del);
 
-   if (evhp->waiting_vblank) return;
+   if (evhp->wait_flag.vblank) return;
 
    _e_video_hwc_planes_pending_buffer_commit(evhp);
 }
@@ -460,6 +464,11 @@ _e_video_hwc_planes_cb_commit_handler(tdm_layer *layer, unsigned int sequence,
    evhp = user_data;
    if (!evhp) return;
 
+   if (!evhp->wait_flag.commit)
+     NEVER_GET_HERE();
+
+   evhp->wait_flag.commit = EINA_FALSE;
+
    e_video_hwc_current_fb_update((E_Video_Hwc *)evhp);
 }
 
@@ -469,15 +478,32 @@ _e_video_hwc_planes_cb_vblank_handler(tdm_output *output, unsigned int sequence,
                                       void *user_data)
 {
    E_Video_Hwc_Planes *evhp;
+   tdm_error err;
 
    evhp = user_data;
    if (!evhp) return;
 
-   evhp->waiting_vblank = EINA_FALSE;
+   evhp->wait_flag.vblank = EINA_FALSE;
 
    if (evhp->video_plane_ready_handler) return;
 
-   _e_video_hwc_planes_pending_buffer_commit(evhp);
+   if (evhp->wait_flag.commit)
+     {
+        /* wait next vblank in case commit handler is not called yet. Because
+         * that means committed buffer is not on display yet. */
+        err = tdm_output_wait_vblank(evhp->tdm.output, 1, 0,
+                                     _e_video_hwc_planes_cb_vblank_handler,
+                                     evhp);
+        if (err != TDM_ERROR_NONE)
+          {
+             VER("failed to set handler for wait vblank", evhp->base.ec);
+             return;
+          }
+
+        evhp->wait_flag.vblank = EINA_TRUE;
+     }
+   else
+     _e_video_hwc_planes_pending_buffer_commit(evhp);
 }
 
 static Eina_Bool
@@ -511,7 +537,8 @@ _e_video_hwc_planes_buffer_commit(E_Video_Hwc_Planes *evhp, E_Comp_Wl_Video_Buf
    ret = tdm_output_wait_vblank(evhp->tdm.output, 1, 0, _e_video_hwc_planes_cb_vblank_handler, evhp);
    EINA_SAFETY_ON_FALSE_RETURN_VAL(ret == TDM_ERROR_NONE, EINA_FALSE);
 
-   evhp->waiting_vblank = EINA_TRUE;
+   evhp->wait_flag.commit = EINA_TRUE;
+   evhp->wait_flag.vblank = EINA_TRUE;
 
    _tdm_layer_property_list_set(evhp->tdm.layer, &evhp->tdm.late_prop_list);