[explicit_sync] Added zwp_linux_surface_synchroniation init/fini
authorJoonbum Ko <joonbum.ko@samsung.com>
Thu, 9 Apr 2020 06:35:29 +0000 (15:35 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 10 Aug 2020 08:14:31 +0000 (17:14 +0900)
 - wayland-extension : zwp_linux_surface_synchronization_v1
 - precondition : explicit_sync of disp_source should be bound.
 - If surface_sync is successfully obtained,
  the flag use_surface_sync of surf_source is TPL_TRUE.

Change-Id: I6a439c174412e08ac146428e041a5934be1986a1
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
src/tpl_wayland_egl_thread.c

index 7d96dcd2bd908adab3cbf5912b8042f797acce85..de98abe5bcaad938e8b7032d89b090b64f047323 100755 (executable)
@@ -148,12 +148,18 @@ struct _twe_wl_surf_source {
        /* for waiting draw done */
        tpl_bool_t use_sync_fence;
 
+       /* to use zwp_linux_surface_synchronization */
+       tpl_bool_t use_surface_sync;
+
        int post_interval;
 
        struct {
                tbm_surface_h tbm_surface;
                int sync_fd;
        } sync_info;
+
+       struct zwp_linux_surface_synchronization_v1 *surface_sync;
+
 };
 
 struct _twe_wl_buffer_info {
@@ -2832,6 +2838,14 @@ _twe_thread_wl_surf_source_destroy(void *source)
                surf_source->vblank = NULL;
        }
 
+       if (surf_source->surface_sync) {
+               TPL_LOG_T(BACKEND,
+                                 "[SURFACE_SYNC FINI] twe_wl_surf_source(%p) surface_sync(%p)",
+                                 surf_source, surf_source->surface_sync);
+               zwp_linux_surface_synchronization_v1_destroy(surf_source->surface_sync);
+               surf_source->surface_sync = NULL;
+       }
+
        surf_source->cb_data = NULL;
        surf_source->rotate_cb = NULL;
 
@@ -2941,6 +2955,7 @@ twe_surface_add(twe_thread* thread,
        source->rotate_cb = NULL;
        source->format = format;
        source->use_sync_fence = TPL_FALSE;
+       source->use_surface_sync = TPL_FALSE;
 
        /* for vulkan swapchain */
        source->vblank_waiting_buffers = NULL;
@@ -3005,6 +3020,17 @@ twe_surface_add(twe_thread* thread,
 
        _twe_surface_buffer_flusher_init(source);
 
+       if (disp_source->explicit_sync) {
+               source->surface_sync =
+                       zwp_linux_explicit_synchronization_v1_get_synchronization(
+                                       disp_source->explicit_sync, source->surf);
+               if (!source->surface_sync) {
+                       TPL_WARN("Failed to create surf_sync. | surf_source(%p)", source);
+               } else {
+                       source->use_surface_sync = TPL_TRUE;
+               }
+       }
+
        source->surf_del_source = _twe_del_source_init(ctx, source);
        if (source->surf_del_source) {
                source->surf_del_source->destroy_target_source_func