tpl_wayland_egl_thread: Implemented merge sync fence. 52/219552/1 submit/tizen/20200303.024248
authorJoonbum Ko <joonbum.ko@samsung.com>
Fri, 15 Nov 2019 06:14:47 +0000 (15:14 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Fri, 6 Dec 2019 01:55:18 +0000 (10:55 +0900)
Change-Id: Ic5697fd0dbade852d9340b2c490d6247a12f46f1
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
src/tpl_wayland_egl_thread.c

index f7fb447f65496b13713a34e42703afcd78aa5f34..6368d912259db1d9b8f4b34125274de302556717 100755 (executable)
@@ -1320,6 +1320,35 @@ __cb_create_presentation_sync_fd(struct wl_egl_window *wl_egl_window, void *priv
        return -1;
 }
 
+static int
+__cb_merge_sync_fds(void *private, int sync_fd1, int sync_fd2)
+{
+       TPL_ASSERT(private);
+
+       struct tizen_private *tizen_private = (struct tizen_private *)private;
+       twe_wl_surf_source *surf_source = NULL;
+       tbm_fd merged_fd;
+
+       surf_source = (twe_wl_surf_source *)tizen_private->data;
+       if (!surf_source) {
+               TPL_ERR("Invalid parameter. twe_surface(%p)", surf_source);
+               return -1;
+       }
+
+       if (surf_source->render_sync_timeline == -1 &&
+               surf_source->presentation_sync_timeline == -1) {
+               TPL_ERR("There is no timeline for any sync fd in surf_source(%p)", surf_source);
+               return -1;
+       }
+
+       merged_fd = tbm_sync_fence_merge(NULL, sync_fd1, sync_fd2);
+
+       TPL_DEBUG("[FENCE_MERGE] surf_source(%p) fence1(%d) + fence2(%d) = merged(%d)",
+                         surf_source, sync_fd1, sync_fd2, merged_fd);
+
+       return merged_fd;
+}
+
 
 static void __cb_tss_flusher_flush_callback(void *data,
                struct tizen_surface_shm_flusher *tss_flusher)
@@ -2752,6 +2781,7 @@ twe_surface_add(twe_thread* thread,
                                __cb_set_window_serial_callback;
                        private->create_render_sync_fd = (void *)__cb_create_render_sync_fd;
                        private->create_presentation_sync_fd = (void *)__cb_create_presentation_sync_fd;
+                       private->merge_sync_fds = (void *)__cb_merge_sync_fds;
 
                        source->latest_transform = private->transform;