wayland-egl-tizen: Added new API to create render sync fd. 47/219547/1
authorJoonbum Ko <joonbum.ko@samsung.com>
Mon, 11 Nov 2019 04:32:48 +0000 (13:32 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Fri, 6 Dec 2019 01:55:18 +0000 (10:55 +0900)
 New API
 wl_egl_window_tizen_get_render_sync_fd(struct wl_egl_window*)

 /**
 * Create a sync fence fd that can tell render done.
 *
 * If eglSwapBuffers works async, it returns fd which tells
 * when the render job is finished.
 * This fd can wait asynchronously via poll or select.
 *
 * Important *
 * This requires the following premise:
 *  - After ddk calls libplpl-egl's tpl_surface_dequeue_buffer to get the buffer,
 *   and until it calls tpl_surface_enqueue_buffer,
 *  it is called the gpu rendering job interval.
 *  - Therefore, when using the dma_buf implicit fence,
 *   there is no guarantee that the rendering job is finished
 *   with the fence obtained through this API.
 *
 * The fence_fd obtained through this function is one-time available,
 * can not be reused, so caller must close it when finished using it.
 *
 * @param egl_window handle to wl_egl_window.
 * @return sync fd on success, -1 on failure.
 */

Change-Id: Ia19f88108cfe8d0e5e6477acbd83a2df173f5507
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 5b65a704309eb23ffc342cc50aa4f37947ddaf71..69df3bc0b744275b304af9471498dda8a8a028eb 100644 (file)
@@ -22,6 +22,7 @@ struct tizen_private {
        int (*get_rotation_capability)(struct wl_egl_window *, void *);
        void (*set_frontbuffer_callback)(struct wl_egl_window *, void *, int);
        void (*set_window_serial_callback)(struct wl_egl_window *, void *, unsigned int);
+       int (*create_render_sync_fd)(struct wl_egl_window *, void *);
 };
 
 static struct tizen_private* tizen_private_create()
@@ -40,6 +41,7 @@ static struct tizen_private* tizen_private_create()
                private->get_rotation_capability = NULL;
                private->set_window_serial_callback = NULL;
                private->set_frontbuffer_callback = NULL;
+               private->create_render_sync_fd = NULL;
        }
 
        return private;
index 4c127bcac0270c4bd4478536df95bd3010c467eb..888f8afb7f31f622c55b545e1755e50e45114b36 100644 (file)
@@ -250,4 +250,26 @@ wl_egl_window_tizen_set_window_serial(struct wl_egl_window *egl_window,
        if (private->set_window_serial_callback)
                private->set_window_serial_callback(egl_window, egl_window->driver_private,
                                                                                        serial);
-}
\ No newline at end of file
+}
+
+int
+wl_egl_window_tizen_create_render_sync_fd(struct wl_egl_window *egl_window)
+{
+       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->create_render_sync_fd)
+               return private->create_render_sync_fd(egl_window, egl_window->driver_private);
+
+       return -1;
+}
index b305e27a0173ca01c33855c5539032f27dcb3a02..96127a0c21717d01c8223cd71b3e87a7b13bc124 100644 (file)
@@ -73,6 +73,32 @@ void
 wl_egl_window_tizen_set_window_serial(struct wl_egl_window *egl_window,
                                                                          unsigned int serial);
 
+/* temporary APIs for testing sync feature */
+/**
+ * Create a sync fence fd that can tell render done.
+ *
+ * If eglSwapBuffers works async, it returns fd which tells
+ * when the render job is finished.
+ * This fd can wait asynchronously via poll or select.
+ *
+ * Important *
+ * This requires the following premise:
+ *  - After ddk calls libplpl-egl's tpl_surface_dequeue_buffer to get the buffer,
+ *   and until it calls tpl_surface_enqueue_buffer,
+ *      it is called the gpu rendering job interval.
+ *  - Therefore, when using the dma_buf implicit fence,
+ *   there is no guarantee that the rendering job is finished
+ *   with the fence obtained through this API.
+ *
+ * The fence_fd obtained through this function is one-time available,
+ * can not be reused, so caller must close it when finished using it.
+ *
+ * @param egl_window handle to wl_egl_window.
+ * @return sync fd on success, -1 on failure.
+ */
+int
+wl_egl_window_tizen_create_render_sync_fd(struct wl_egl_window *egl_window);
+
 #ifdef  __cplusplus
 }
 #endif