From: Joonbum Ko Date: Wed, 13 Nov 2019 02:40:23 +0000 (+0900) Subject: wayland-egl-tizen: Added new API to get presentation sync fd. X-Git-Tag: submit/tizen/20200303.024248~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F49%2F219549%2F1;p=platform%2Fcore%2Fuifw%2Flibtpl-egl.git 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 --- 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