From: joonbum.ko Date: Wed, 13 Sep 2017 05:29:25 +0000 (+0900) Subject: tpl_wayland_egl_thread: Modified twe_surface_destroy to unref the tbm_surface in... X-Git-Tag: accepted/tizen/4.0/unified/20170920.081113~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F38%2F149838%2F4;p=platform%2Fcore%2Fuifw%2Flibtpl-egl.git tpl_wayland_egl_thread: Modified twe_surface_destroy to unref the tbm_surface in in_user_buffers. - When eglSurfaceDestroy is called on the main thread, the function twe_surface_del() waits for the worker thread to finish rendering the buffer no longer Change-Id: Ieb3921eedd990b8621122cb1db9d42cb5933c2c1 Signed-off-by: joonbum.ko --- diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c index 5912b91..4fc7976 100644 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -1043,7 +1043,7 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source, if (surf_source->in_use_buffers) { TPL_OBJECT_LOCK(&surf_source->obj); __tpl_list_push_back(surf_source->in_use_buffers, - (void *)buf_info); + (void *)tbm_surface); TPL_OBJECT_UNLOCK(&surf_source->obj); } @@ -1106,7 +1106,7 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source, if (surf_source->in_use_buffers) { TPL_OBJECT_LOCK(&surf_source->obj); __tpl_list_push_back(surf_source->in_use_buffers, - (void *)buf_info); + (void *)tbm_surface); TPL_OBJECT_UNLOCK(&surf_source->obj); } @@ -1144,7 +1144,7 @@ _twe_surface_cancel_dequeued_buffer(twe_wl_surf_source *surf_source, TPL_OBJECT_LOCK(&surf_source->obj); /* Stop tracking of this canceled tbm_surface */ __tpl_list_remove_data(surf_source->in_use_buffers, - (void *)buf_info, TPL_FIRST, NULL); + (void *)tbm_surface, TPL_FIRST, NULL); TPL_OBJECT_UNLOCK(&surf_source->obj); } } @@ -1323,7 +1323,7 @@ _twe_thread_wl_surface_commit(twe_wl_surf_source *surf_source, __tpl_list_push_back(surf_source->committed_buffers, tbm_surface); /* Stop tracking of this released tbm_surface. */ __tpl_list_remove_data(surf_source->in_use_buffers, - (void *)buf_info, TPL_FIRST, NULL); + (void *)tbm_surface, TPL_FIRST, NULL); TPL_OBJECT_UNLOCK(&surf_source->obj); } } @@ -1670,12 +1670,14 @@ twe_surface_del(twe_surface_h twe_surface) return TPL_ERROR_INVALID_PARAMETER; } - /* Should be waited until all in_use_buffers has been retrieved. */ + TPL_OBJECT_LOCK(&surf_source->obj); while (!__tpl_list_is_empty(surf_source->in_use_buffers)) { - sched_yield(); + tbm_surface_h tbm_surface = (tbm_surface_h)__tpl_list_pop_front( + surf_source->in_use_buffers, + NULL); + tbm_surface_internal_unref(tbm_surface); } - TPL_OBJECT_LOCK(&surf_source->obj); __tpl_list_free(surf_source->in_use_buffers, NULL); TPL_OBJECT_UNLOCK(&surf_source->obj);