wayland-egl-tizen: Added new API to merge sync fds. 51/219551/1
authorJoonbum Ko <joonbum.ko@samsung.com>
Thu, 14 Nov 2019 11:33:32 +0000 (20:33 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Fri, 6 Dec 2019 01:55:18 +0000 (10:55 +0900)
 New API
 /**
 * Get a new fence fd with fence1 and fence2 merged
 *
 * It returns a new fence fd waiting for both fences to be signaled.
 * If user succeed in obtaining a new merged fence using this API,
 *  the two fence fds passed must be closed by the user.
 *
 * Multiple calls to this API allow to merge multiple fences.
 *
 * The two fence fds caller want to merge should be closed
 *  if caller is not going to use them after
 *  the new merged fd is created.
 *
 * @param egl_window handle to wl_egl_window
 * @param sync_fd1 first fd to merge with second fd
 * @param sync_fd2 seconde fd to merge with first fd
 * @return merged fd on success, -1 on failure.
 */
 int
 wl_egl_window_tizen_merge_sync_fds(struct wl_egl_window *egl_window,
                                    int sync_fd1, int sync_fd2);

Change-Id: I29ac248c836392b9e6acb141a30bb70dc5e9731f
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
src/wayland-egl-tizen/wayland-egl-tizen-priv.h
src/wayland-egl-tizen/wayland-egl-tizen.c
src/wayland-egl-tizen/wayland-egl-tizen.h

index 6fd31ea250ef5e35e021c10841d5993818f2866d..9a6b8123fde3af28b4d91505383bff2768758d7a 100644 (file)
@@ -24,6 +24,7 @@ struct tizen_private {
        void (*set_window_serial_callback)(struct wl_egl_window *, void *, unsigned int);
        int (*create_render_sync_fd)(struct wl_egl_window *, void *);
        int (*create_presentation_sync_fd)(struct wl_egl_window *, void *);
+       int (*merge_sync_fds)(void *, int, int);
 };
 
 static struct tizen_private* tizen_private_create()
@@ -44,6 +45,7 @@ static struct tizen_private* tizen_private_create()
                private->set_frontbuffer_callback = NULL;
                private->create_render_sync_fd = NULL;
                private->create_presentation_sync_fd = NULL;
+               private->merge_sync_fds = NULL;
        }
 
        return private;
index 831951c9d7607d772efc79c5131b87b224ab40fc..70e66a37f7fb8a99fa1850bb97bdf1228593a375 100644 (file)
@@ -295,3 +295,26 @@ wl_egl_window_tizen_create_presentation_sync_fd(struct wl_egl_window *egl_window
 
        return -1;
 }
+
+int
+wl_egl_window_tizen_merge_sync_fds(struct wl_egl_window *egl_window,
+                                                                  int sync_fd1, int sync_fd2)
+{
+       struct tizen_private *private = NULL;
+
+       if (egl_window == NULL) {
+               WL_EGL_ERR("egl_window is NULL");
+               return -1;
+       }
+
+       private = egl_window->driver_private;
+       if (private == NULL) {
+               WL_EGL_ERR("wl_egl_window(%p) dirver_private is NULL", egl_window);
+               return -1;
+       }
+
+       if (private->merge_sync_fds)
+               return private->merge_sync_fds(egl_window->driver_private, sync_fd1, sync_fd2);
+
+       return -1;
+}
\ No newline at end of file
index 00b8b75dfd442ce8ea2f73191d863b80df3b01da..041488cbf7371a18c7289889be1ef44e0a0fd71b 100644 (file)
@@ -118,6 +118,28 @@ wl_egl_window_tizen_create_render_sync_fd(struct wl_egl_window *egl_window);
 int
 wl_egl_window_tizen_create_presentation_sync_fd(struct wl_egl_window *egl_window);
 
+/**
+ * Get a new fence fd with fence1 and fence2 merged
+ *
+ * It returns a new fence fd waiting for both fences to be signaled.
+ * If user succeed in obtaining a new merged fence using this API,
+ *  the two fence fds passed must be closed by the user.
+ *
+ * Multiple calls to this API allow to merge multiple fences.
+ *
+ * The two fence fds caller want to merge should be closed
+ *  if caller is not going to use them after
+ *  the new merged fd is created.
+ *
+ * @param egl_window handle to wl_egl_window
+ * @param sync_fd1 first fd to merge with second fd
+ * @param sync_fd2 seconde fd to merge with first fd
+ * @return merged fd on success, -1 on failure.
+ */
+int
+wl_egl_window_tizen_merge_sync_fds(struct wl_egl_window *egl_window,
+                                                                  int sync_fd1, int sync_fd2);
+
 #ifdef  __cplusplus
 }
 #endif