return -1;
}
+
+void
+wl_egl_window_tizen_set_pre_commit_callback(struct wl_egl_window *egl_window,
+ pre_commit_cb_func_t func, void *data,
+ callback_option option)
+{
+ struct tizen_private *private = wl_egl_tizen_get_tizen_private(egl_window);
+
+ if (!private) return;
+
+ struct pre_commit_cb *pre_commit_cb = &private->pre_commit_cb;
+
+ if (pre_commit_cb->func &&
+ (pre_commit_cb->func != func || pre_commit_cb->data != data)) {
+ WL_EGL_WARN("overwrite pre_commit_cb_func(%p)->(%p) | data(%p)->(%p)",
+ pre_commit_cb->func, func,
+ pre_commit_cb->data, data);
+ }
+
+ pre_commit_cb->func = func;
+ pre_commit_cb->data = data;
+ pre_commit_cb->option = option;
+ WL_EGL_INFO("[SET_PRE_COMMIT_CB]", "wl_egl_window(%p) func(%p) data(%p)",
+ egl_window, pre_commit_cb->func, pre_commit_cb->data);
+}
WL_EGL_WINDOW_TIZEN_ROTATION_270 = 270
} wl_egl_window_tizen_rotation;
+typedef void (*pre_commit_cb_func_t)(void *data);
+
+typedef enum {
+ ONCE,
+ CONTINUOUS,
+} callback_option;
+
void
wl_egl_window_tizen_set_rotation(struct wl_egl_window *egl_window,
int rotation);
wl_egl_window_tizen_merge_sync_fds(struct wl_egl_window *egl_window,
int sync_fd1, int sync_fd2);
+/**
+ * Set pre-commit callback with data to wl_egl_window.
+ *
+ * The registered callback function will be called with the data
+ * immedately before the frame's wl_surface_commit.
+ * The callback registered before calling eglSwapBuffers will be called
+ * at the time the swap requested buffer is attached.
+ *
+ * Important *
+ * - Since the callback may be called from a separate thread that performs
+ * wl_surface_commit, protection is required if there is a critical section
+ * inside the callback function.
+ * - To avoid poor performance or complicated lifecycle issues,
+ * it is recommended that the behavior inside the callback function be concise.
+ * - This API should be called from one thread.
+ * - If it is called multiple times in a frame, the previously registered ones
+ * are overwritten.
+ *
+ * Callback Options *
+ * - ONCE : The registered callback and data are stored in the buffer requested
+ * for swap when calling eglSwapBuffers and then initialized.
+ * The callback function is called only once when the buffer requested
+ * for swap is committed, and is not called after that.
+ * - CONTINUOUS : Once the callback and data are registered, the callback function
+ * is called continuously until it is released.
+ * To release the callback, simply pass NULL to func.
+ *
+ * @param egl_window handle to wl_egl_window to which the callback is to be registered.
+ * @param option callback_option to determine the lifecycle of func.
+ * @param func callback function that will be called just before wl_surface_commit.
+ * @param data data to be passed to the callback function.
+*/
+void
+wl_egl_window_tizen_set_pre_commit_callback(struct wl_egl_window *egl_window,
+ pre_commit_cb_func_t func,
+ void *data,
+ callback_option option);
+
#ifdef __cplusplus
}
#endif