From: joonbum.ko Date: Mon, 22 May 2017 05:24:34 +0000 (+0900) Subject: tpl_wayland_egl_thread: Added an API to check whether the buffer need to be committed. X-Git-Tag: accepted/tizen/unified/20170711.180707~25 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=92667a8a8bf2c5cb932eddf3c8bdb159132cd0d0;p=platform%2Fcore%2Fuifw%2Flibtpl-egl.git tpl_wayland_egl_thread: Added an API to check whether the buffer need to be committed. - Added API : twe_surface_check_commit_needed(twe_surface_h, tbm_surface_h) - This API helps to determine whether to commit the buffer which is render done in front-buffer mode. Change-Id: I9d06c79073f76581a4d37f585ca03fc6e0d09b2b Signed-off-by: joonbum.ko --- diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c index 8a36016..da715db 100644 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -79,6 +79,7 @@ struct _twe_wl_buffer_info { /* for damage region */ int num_rects; int *rects; + tpl_bool_t need_to_commit; twe_wl_surf_source *surf_source; }; @@ -736,6 +737,8 @@ static void __cb_tbm_queue_trace_callback(tbm_surface_queue_h tbm_queue, buf_info->num_rects = 0; } + buf_info->need_to_commit = TPL_TRUE; + if (surf_source->in_use_buffers) { TPL_OBJECT_LOCK(&surf_source->obj); __tpl_list_push_back(surf_source->in_use_buffers, @@ -777,6 +780,7 @@ static void __cb_tbm_queue_trace_callback(tbm_surface_queue_h tbm_queue, buf_info->height = wl_egl_window->height; buf_info->num_rects = 0; buf_info->rects = NULL; + buf_info->need_to_commit = TPL_TRUE; wl_buffer_add_listener((void *)buf_info->wl_buffer, &wl_buffer_release_listener, tbm_surface); @@ -859,6 +863,8 @@ _twe_thread_wl_surface_commit(twe_wl_surf_source *surf_source, wl_surface_commit(wl_surface); + buf_info->need_to_commit = TPL_FALSE; + TPL_LOG_T("WL_EGL", "[COMMIT] wl_buffer(%p) tbm_surface(%p) bo(%d)", buf_info->wl_buffer, tbm_surface, tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0))); @@ -1342,6 +1348,28 @@ twe_surface_check_activated(twe_surface_h twe_surface) surf_source->tbm_queue); } +tpl_bool_t +twe_surface_check_commit_needed(twe_surface_h twe_surface, + tbm_surface_h tbm_surface) +{ + twe_wl_surf_source *surf_source = (twe_wl_surf_source *)twe_surface; + twe_wl_buffer_info *buf_info = NULL; + + if (!surf_source) { + TPL_ERR("Invalid parameter. twe_surface(%p)", twe_surface); + return TPL_FALSE; + } + + tbm_surface_internal_get_user_data(tbm_surface, KEY_BUFFER_INFO, + (void **)&buf_info); + if (!buf_info) { + TPL_ERR("Failed to get buf_info from tbm_surface(%p).", tbm_surface); + return TPL_FALSE; + } + + return buf_info->need_to_commit; +} + void twe_surface_commit_without_enqueue(twe_surface_h twe_surface, tbm_surface_h tbm_surface) diff --git a/src/tpl_wayland_egl_thread.h b/src/tpl_wayland_egl_thread.h index 15edbaf..555b754 100644 --- a/src/tpl_wayland_egl_thread.h +++ b/src/tpl_wayland_egl_thread.h @@ -43,6 +43,10 @@ twe_surface_set_rotation_capablity(twe_surface_h twe_surface, tpl_bool_t set); tpl_bool_t twe_surface_check_activated(twe_surface_h twe_surface); +tpl_bool_t +twe_surface_check_commit_needed(twe_surface_h twe_surface, + tbm_surface_h tbm_surface); + void twe_surface_commit_without_enqueue(twe_surface_h twe_surface, tbm_surface_h tbm_surface);