From: joonbum.ko Date: Tue, 9 Jan 2018 08:59:46 +0000 (+0900) Subject: tpl_wayland_egl_thread: Added a new internal API to get swapchain buffers from wl_tbm... X-Git-Tag: accepted/tizen/unified/20180208.163715~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b97db75972ce555526a391ba324b4c2d2ebf3f3d;p=platform%2Fcore%2Fuifw%2Flibtpl-egl.git tpl_wayland_egl_thread: Added a new internal API to get swapchain buffers from wl_tbm_client. - Added internal API is twe_surface_get_swapchain_buffers. - This function uses the wayland-tbm API 'wayland_tbm_client_queue_get_surfaces()' to get the handle of tbm_surfaces to be used from the tbm_surface_queue of swapchain. Change-Id: If2d5d2f2d6bbb85ba586d56a9ffac6cb54cb689e Signed-off-by: joonbum.ko --- diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c index 7704956..d800c4c 100644 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -2658,6 +2658,39 @@ twe_surface_destroy_swapchain(twe_surface_h twe_surface) return TPL_ERROR_NONE; } +tpl_result_t +twe_surface_get_swapchain_buffers(twe_surface_h twe_surface, + tbm_surface_h *surfaces, + int *buffer_count) +{ + twe_wl_surf_source *surf_source = (twe_wl_surf_source *)twe_surface; + twe_wl_disp_source *disp_source = NULL; + int ret = 1; + + if (!surf_source || g_source_is_destroyed(&surf_source->gsource)) { + TPL_ERR("twe_surface(%p) is invalid.", twe_surface); + return TPL_ERROR_INVALID_PARAMETER; + } + + if (!surfaces) { + *buffer_count = tbm_surface_queue_get_size(surf_source->tbm_queue); + return TPL_ERROR_NONE; + } + + disp_source = surf_source->disp_source; + + ret = wayland_tbm_client_queue_get_surfaces( + disp_source->wl_tbm_client, + surf_source->tbm_queue, + surfaces, buffer_count); + if (!ret) { + TPL_ERR("Failed to get buffers from wl_tbm_client(%p) tbm_queue(%p)", + disp_source->wl_tbm_client, surf_source->tbm_queue); + return TPL_ERROR_INVALID_OPERATION; + } + + return TPL_ERROR_NONE; +} tpl_result_t twe_surface_set_rotate_callback(twe_surface_h twe_surface, diff --git a/src/tpl_wayland_egl_thread.h b/src/tpl_wayland_egl_thread.h index e89d527..bd32f1d 100644 --- a/src/tpl_wayland_egl_thread.h +++ b/src/tpl_wayland_egl_thread.h @@ -55,6 +55,11 @@ twe_surface_create_swapchain(twe_surface_h twe_surface, tpl_result_t twe_surface_destroy_swapchain(twe_surface_h twe_surface); +tpl_result_t +twe_surface_get_swapchain_buffers(twe_surface_h twe_surface, + tbm_surface_h *surfaces, + int *buffer_count); + tbm_surface_queue_h twe_surface_get_tbm_queue(twe_surface_h twe_surface);