wayland-egl-tizen: Added new API to get presentation sync fd. 49/219549/1
authorJoonbum Ko <joonbum.ko@samsung.com>
Wed, 13 Nov 2019 02:40:23 +0000 (11:40 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Fri, 6 Dec 2019 01:55:18 +0000 (10:55 +0900)
/**
 * Create a sync fence fd that can tell presentation done.
 *
 * It returns fd which tells when the presentation is finished.
 * This fd can wait asynchronously via poll or select.
 *
 * Important *
 * This fence lets caller knows when wl_surface received PRESENT or DISCARD
 *  events from the server.
 * In case of receiving DISCARD, it is not actually displayed on the display,
 *  but it releases the fence like PRESENT.
 * In most cases that are not complicated, attached buffer will not be discarded.
 *
 * @param egl_window handle to wl_egl_window.
 * @return sync fd on success, -1 on failure.
 */
int
wl_egl_window_tizen_create_presentation_sync_fd(struct wl_egl_window *egl_window)

Change-Id: I9c69dea4b78aba34db284b25dd47dd0544672bb4
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 69df3bc..6fd31ea 100644 (file)
@@ -23,6 +23,7 @@ struct tizen_private {
        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 *);
+       int (*create_presentation_sync_fd)(struct wl_egl_window *, void *);
 };
 
 static struct tizen_private* tizen_private_create()
@@ -42,6 +43,7 @@ static struct tizen_private* tizen_private_create()
                private->set_window_serial_callback = NULL;
                private->set_frontbuffer_callback = NULL;
                private->create_render_sync_fd = NULL;
+               private->create_presentation_sync_fd = NULL;
        }
 
        return private;
index 888f8af..831951c 100644 (file)
@@ -273,3 +273,25 @@ wl_egl_window_tizen_create_render_sync_fd(struct wl_egl_window *egl_window)
 
        return -1;
 }
+
+int
+wl_egl_window_tizen_create_presentation_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_presentation_sync_fd)
+               return private->create_presentation_sync_fd(egl_window, egl_window->driver_private);
+
+       return -1;
+}
index 96127a0..00b8b75 100644 (file)
@@ -99,6 +99,25 @@ wl_egl_window_tizen_set_window_serial(struct wl_egl_window *egl_window,
 int
 wl_egl_window_tizen_create_render_sync_fd(struct wl_egl_window *egl_window);
 
+/**
+ * Create a sync fence fd that can tell presentation done.
+ *
+ * It returns fd which tells when the presentation is finished.
+ * This fd can wait asynchronously via poll or select.
+ *
+ * Important *
+ * This fence lets caller knows when wl_surface received PRESENT or DISCARD
+ *  events from the server.
+ * In case of receiving DISCARD, it is not actually displayed on the display,
+ *  but it releases the fence like PRESENT.
+ * In most cases that are not complicated, attached buffer will not be discarded.
+ *
+ * @param egl_window handle to wl_egl_window.
+ * @return sync fd on success, -1 on failure.
+ */
+int
+wl_egl_window_tizen_create_presentation_sync_fd(struct wl_egl_window *egl_window);
+
 #ifdef  __cplusplus
 }
 #endif