tpl_wayland_egl_thread: Added a new internal API to get swapchain buffers from wl_tbm... 85/169085/1
authorjoonbum.ko <joonbum.ko@samsung.com>
Tue, 9 Jan 2018 08:59:46 +0000 (17:59 +0900)
committerjoonbum.ko <joonbum.ko@samsung.com>
Fri, 2 Feb 2018 06:22:40 +0000 (15:22 +0900)
 - 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 <joonbum.ko@samsung.com>
src/tpl_wayland_egl_thread.c
src/tpl_wayland_egl_thread.h

index 7704956..d800c4c 100644 (file)
@@ -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,
index e89d527..bd32f1d 100644 (file)
@@ -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);