struct wl_egl_window *wl_egl_window;
int latest_transform;
int rotation;
+ void *cb_data;
+ tpl_surface_cb_func_t rotate_cb;
tpl_bool_t rotation_capability;
tpl_object_t obj; /* for mutex lock */
tpl_list_t *committed_buffers;
wl_egl_window, source->rotation, rotation);
source->rotation = rotation;
+
+ if (source->rotate_cb)
+ source->rotate_cb(source->cb_data);
}
static int
source->vblank_done = TPL_TRUE;
source->committed_buffers = __tpl_list_alloc();
source->in_use_buffers = __tpl_list_alloc();
+ source->cb_data = NULL;
+ source->rotate_cb = NULL;
__tpl_object_init(&source->obj, TPL_OBJECT_SURFACE, NULL);
_twe_surface_buffer_flusher_init(source);
/* TODO : surf_source will be removed from surfaces list in disp_source */
+ surf_source->cb_data = NULL;
+ surf_source->rotate_cb = NULL;
+
TPL_LOG_T("WL_EGL", "twe_surface(%p) wl_egl_window(%p) wl_surface(%p)",
surf_source, surf_source->wl_egl_window, surf_source->surf);
return TPL_ERROR_NONE;
}
+tpl_result_t
+twe_surface_set_rotate_callback(twe_surface_h twe_surface,
+ void *data, tpl_surface_cb_func_t rotate_cb)
+{
+ twe_wl_surf_source *source = (twe_wl_surf_source *)twe_surface;
+ if (!source) {
+ TPL_ERR("Invalid parameter. twe_surface is NULL.");
+ return TPL_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!data || !rotate_cb) {
+ TPL_ERR("Invalid parameter. data(%p) rotate_cb(%p)",
+ data, rotate_cb);
+ return TPL_ERROR_INVALID_PARAMETER;
+ }
+
+ source->cb_data = data;
+ source->rotate_cb = rotate_cb;
+
+ return TPL_ERROR_NONE;
+}
+
int
twe_surface_get_rotation(twe_surface_h twe_surface)
{
surface->reset_cb(surface->reset_data);
}
+void __cb_window_rotate_callback(void *data)
+{
+ tpl_surface_t *surface = (tpl_surface_t *)data;
+ tpl_wayland_egl_surface_t *wayland_egl_surface = NULL;
+ int rotation;
+
+ if (!surface) {
+ TPL_ERR("Inavlid parameter. surface is NULL.");
+ return;
+ }
+
+ wayland_egl_surface = (tpl_wayland_egl_surface_t *)surface->backend.data;
+ if (!wayland_egl_surface) {
+ TPL_ERR("Invalid parameter. surface->backend.data is NULL");
+ return;
+ }
+
+ rotation = twe_surface_get_rotation(wayland_egl_surface->twe_surface);
+
+ surface->rotation = rotation;
+}
+
static tpl_result_t
__tpl_wl_egl_surface_init(tpl_surface_t *surface)
{
tpl_wayland_egl_surface_t *wayland_egl_surface = NULL;
tbm_surface_queue_h tbm_queue = NULL;
twe_surface_h twe_surface = NULL;
+ tpl_result_t ret = TPL_ERROR_NONE;
TPL_ASSERT(surface);
TPL_ASSERT(surface->display);
surface->height = tbm_surface_queue_get_height(tbm_queue);
surface->rotation = twe_surface_get_rotation(twe_surface);
+ ret = twe_surface_set_rotate_callback(twe_surface, (void *)surface,
+ (tpl_surface_cb_func_t)__cb_window_rotate_callback);
+ if (ret != TPL_ERROR_NONE) {
+ TPL_WARN("Failed to register rotate callback.");
+ }
+
TPL_LOG_T("WL_EGL",
"[INIT1/2]tpl_surface(%p) tpl_wayland_egl_surface(%p) twe_surface(%p)",
surface, wayland_egl_surface, twe_surface);