private->transform = 0;
private->window_transform = 0;
private->serial = 0;
+ private->serial_updated = false;
private->data = NULL;
private->rotate_callback = NULL;
return rotation_capability;
}
-static void
-__cb_set_window_serial_callback(struct wl_egl_window *wl_egl_window,
- void *private, unsigned int serial)
-{
- TPL_ASSERT(private);
-
- struct tizen_private tizen_private(private);
- tpl_wl_egl_surface_t wl_egl_surface(tizen_private->data);
-
- if (!wl_egl_surface) {
- TPL_ERR("Invalid wl_egl_window(%p) tizen_private->data is null.",
- wl_egl_window);
- return;
- }
-
- wl_egl_surface->serial = serial;
- wl_egl_surface->serial_updated = TPL_TRUE;
-}
-
static int
__cb_create_commit_sync_fd(struct wl_egl_window *wl_egl_window, void *private)
{
wl_egl_surface->need_to_enqueue = TPL_TRUE;
wl_egl_surface->prerotation_capability = TPL_FALSE;
wl_egl_surface->vblank_done = TPL_TRUE;
- wl_egl_surface->serial_updated = TPL_FALSE;
wl_egl_surface->gsource_finalized = TPL_FALSE;
wl_egl_surface->initialized_in_thread = TPL_FALSE;
wl_egl_surface->frontbuffer_activated = TPL_FALSE;
wl_egl_surface->reset_result = TPL_ERROR_NONE;
wl_egl_surface->latest_transform = -1;
- wl_egl_surface->serial = 0;
wl_egl_surface->vblank = NULL;
#if TIZEN_FEATURE_ENABLE
tizen_private->rotate_callback = (void *)__cb_rotate_callback;
tizen_private->get_rotation_capability = (void *)
__cb_get_rotation_capability;
- tizen_private->set_window_serial_callback = (void *)
- __cb_set_window_serial_callback;
tizen_private->create_commit_sync_fd = (void *)__cb_create_commit_sync_fd;
tizen_private->set_frontbuffer_callback = (void *)__cb_client_window_set_frontbuffer_mode;
#if TIZEN_FEATURE_ENABLE
tpl_wl_egl_surface_t wl_egl_surface(surface->backend.data);
tpl_wl_egl_buffer_t *wl_egl_buffer = NULL;
+ struct wl_egl_window *wl_egl_window = wl_egl_surface->wl_egl_window;
tbm_surface_queue_error_e tsq_err = TBM_SURFACE_QUEUE_ERROR_NONE;
int bo_name = -1;
+ struct tizen_private *tizen_private = wl_egl_tizen_get_tizen_private(wl_egl_window);
if (!tbm_surface_internal_is_valid(tbm_surface)) {
TPL_ERR("Failed to enqueue tbm_surface(%p) Invalid value.",
wl_egl_buffer->acquire_fence_fd = acquire_fence;
- if (wl_egl_surface->serial_updated) {
- wl_egl_buffer->serial = wl_egl_surface->serial;
+ if (tizen_private && tizen_private->serial_updated) {
+ wl_egl_buffer->serial = tizen_private->serial;
wl_egl_buffer->serial_updated = TPL_TRUE;
- wl_egl_surface->serial_updated = TPL_FALSE;
+ tizen_private->serial_updated = false;
}
if (wl_egl_surface->pre_commit_cb.func) {
#include "wayland-egl-tizen.h"
#include "wayland-egl-tizen-priv.h"
-#include <stdio.h>
+
#include <stdlib.h>
#include <unistd.h>
#include <sys/syscall.h>
struct tizen_private *private = wl_egl_tizen_get_tizen_private(egl_window);
if (!private) return;
+ private->serial = serial;
+ private->serial_updated = true;
+
if (private->set_window_serial_callback)
private->set_window_serial_callback(egl_window, egl_window->driver_private,
serial);
if (private && private->set_pre_commit_callback)
private->set_pre_commit_callback(egl_window->driver_private, func, data, option);
}
+
+unsigned int
+wl_egl_window_tizen_increment_window_serial(struct wl_egl_window *egl_window)
+{
+ struct tizen_private *private = wl_egl_tizen_get_tizen_private(egl_window);
+
+ if (private) {
+ private->serial_updated = true;
+ return ++private->serial;
+ }
+
+ return 0;
+}
void *data,
callback_option option);
+/**
+ * Increment the window serial and then returns it.
+ *
+ * The updated serial is copied to the buffer at the next eglSwapBuffers
+ * and delivered to the server when wl_surface_commit.
+ *
+ * Important *
+ * - This API should be called only from the thread that calls eglSwapBuffers
+ * because it is not thread safe.
+ * - It is recommended not to use it with wl_egl_window_tizen_set_window_serial
+ * because set_window_seriaal can overwrite serial with a completely different value.
+ * - If caller want to obtain the current serial without increasing it,
+ * need to call get_window_serial
+ *
+ * @param egl_window handle to wl_egl_window to increase serial.
+ *
+ * @see wl_egl_window_tizen_get_window_serial
+*/
+unsigned int
+wl_egl_window_tizen_increment_window_serial(struct wl_egl_window *egl_window);
+
#ifdef __cplusplus
}
#endif