video:hwc_planes: wait next vblank until commit callback handler is called. 34/225334/2
authorSeunghun Lee <shiin.lee@samsung.com>
Wed, 19 Feb 2020 01:06:34 +0000 (10:06 +0900)
committerSeunghun Lee <shiin.lee@samsung.com>
Wed, 19 Feb 2020 07:48:52 +0000 (16:48 +0900)
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 613ec5ae7b3043319a126ac2ca3cd0befbf9da84..6208bf4837870be6c0b99a23b7306fb87381cfaa 100644 (file)
@@ -30,7 +30,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
@@ -316,7 +320,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);
 }
@@ -505,6 +509,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);
 }
 
@@ -514,15 +523,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
@@ -556,7 +582,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);