From: joonbum.ko Date: Fri, 20 Oct 2017 06:51:24 +0000 (+0900) Subject: tpl_wayland_egl_thread: Added an internal API to create sync_fd. X-Git-Tag: accepted/tizen/unified/20171206.063114~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=43e21106e4df5f8b52968cab018a59f6413ef7f9;p=platform%2Fcore%2Fuifw%2Flibtpl-egl.git tpl_wayland_egl_thread: Added an internal API to create sync_fd. Change-Id: I96cdca8101a578b001e1bb5e85448091e6d39060 Signed-off-by: joonbum.ko --- diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c index 9acfe83..ad49932 100644 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -1656,6 +1656,8 @@ _twe_thread_wl_vk_surface_commit(twe_wl_surf_source *surf_source, surf_source->swapchain_properties.height); wl_surface_commit(wl_surface); + buf_info->sync_timestamp++; + if (surf_source->swapchain_properties.present_mode == TPL_DISPLAY_PRESENT_MODE_FIFO_RELAXED) { if (_twe_surface_wait_vblank(surf_source) != TPL_ERROR_NONE) @@ -2602,7 +2604,6 @@ twe_surface_set_sync_fd(tbm_surface_h tbm_surface, tbm_fd sync_fd) } buf_info->draw_done_fence = sync_fd; - buf_info->fence_waiting_thread = g_thread_new("fence_waiting_thread", _twe_sync_fence_waiting, buf_info); @@ -2610,6 +2611,35 @@ twe_surface_set_sync_fd(tbm_surface_h tbm_surface, tbm_fd sync_fd) return TPL_ERROR_NONE; } +tbm_fd +twe_surface_create_sync_fd(tbm_surface_h tbm_surface) +{ + twe_wl_buffer_info *buf_info = NULL; + tbm_fd sync_fd = -1; + + tbm_surface_internal_get_user_data(tbm_surface, KEY_BUFFER_INFO, + (void **)&buf_info); + + if (buf_info) { + if (buf_info->sync_timestamp) { + /* first return -1 */ + char name[32]; + snprintf(name, 32, "%d", + tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0))); + sync_fd = tbm_sync_fence_create(buf_info->sync_timeline, + name, + buf_info->sync_timestamp); + if (sync_fd == -1) { + char buf[1024]; + strerror_r(errno, buf, sizeof(buf)); + TPL_ERR("Failed to create TBM sync fence: %d(%s)", errno, buf); + } + } + } + + return sync_fd; +} + tpl_result_t twe_surface_wait_dequeueable(twe_surface_h twe_surface, uint64_t timeout_ns) { diff --git a/src/tpl_wayland_egl_thread.h b/src/tpl_wayland_egl_thread.h index e21e6bd..4c2fd4f 100644 --- a/src/tpl_wayland_egl_thread.h +++ b/src/tpl_wayland_egl_thread.h @@ -86,6 +86,9 @@ twe_surface_set_damage_region(tbm_surface_h tbm_surface, tpl_result_t twe_surface_set_sync_fd(tbm_surface_h tbm_surface, tbm_fd wait_fd); +tbm_fd +twe_surface_create_sync_fd(tbm_surface_h tbm_surface); + tpl_result_t twe_surface_wait_dequeueable(twe_surface_h twe_surface, uint64_t timeout_ns);