From 76696ef8252c097185b333aa0472fa3e89f72f5e Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Wed, 13 Nov 2019 11:40:23 +0900 Subject: [PATCH] wayland-egl-tizen: Added new API to get presentation sync fd. /** * 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 --- src/wayland-egl-tizen/wayland-egl-tizen-priv.h | 2 ++ src/wayland-egl-tizen/wayland-egl-tizen.c | 22 ++++++++++++++++++++++ src/wayland-egl-tizen/wayland-egl-tizen.h | 19 +++++++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/src/wayland-egl-tizen/wayland-egl-tizen-priv.h b/src/wayland-egl-tizen/wayland-egl-tizen-priv.h index 69df3bc..6fd31ea 100644 --- a/src/wayland-egl-tizen/wayland-egl-tizen-priv.h +++ b/src/wayland-egl-tizen/wayland-egl-tizen-priv.h @@ -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; diff --git a/src/wayland-egl-tizen/wayland-egl-tizen.c b/src/wayland-egl-tizen/wayland-egl-tizen.c index 888f8af..831951c 100644 --- a/src/wayland-egl-tizen/wayland-egl-tizen.c +++ b/src/wayland-egl-tizen/wayland-egl-tizen.c @@ -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; +} diff --git a/src/wayland-egl-tizen/wayland-egl-tizen.h b/src/wayland-egl-tizen/wayland-egl-tizen.h index 96127a0..00b8b75 100644 --- a/src/wayland-egl-tizen/wayland-egl-tizen.h +++ b/src/wayland-egl-tizen/wayland-egl-tizen.h @@ -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 -- 2.7.4