From: Seunghun Lee Date: Wed, 19 Feb 2020 01:06:34 +0000 (+0900) Subject: video:hwc_planes: wait next vblank until commit callback handler is called. X-Git-Tag: submit/tizen/20200220.070651~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=149b44af978bad2cfc053e093e8e53574aaf2286;p=platform%2Fupstream%2Fenlightenment.git video:hwc_planes: wait next vblank until commit callback handler is called. 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 --- diff --git a/src/bin/video/iface/e_video_hwc_planes.c b/src/bin/video/iface/e_video_hwc_planes.c index 613ec5ae7b..6208bf4837 100644 --- a/src/bin/video/iface/e_video_hwc_planes.c +++ b/src/bin/video/iface/e_video_hwc_planes.c @@ -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);