struct wayland_tbm_client *wl_tbm_client;
struct tizen_surface_shm *tss; /* used for surface buffer_flush */
twe_thread *thread;
+ tpl_object_t obj;
/* TODO : surface list */
};
return G_SOURCE_REMOVE;
}
+ TPL_OBJECT_LOCK(&disp_source->obj);
if (disp_source->gfd.revents & G_IO_IN) {
if (wl_display_dispatch_queue_pending(disp_source->disp,
disp_source->ev_queue) == -1) {
}
wl_display_flush(disp_source->disp);
+ TPL_OBJECT_UNLOCK(&disp_source->obj);
return G_SOURCE_CONTINUE;
}
{
twe_wl_disp_source *disp_source = (twe_wl_disp_source *)source;
+ TPL_OBJECT_LOCK(&disp_source->obj);
if (wl_display_dispatch_queue_pending(disp_source->disp,
disp_source->ev_queue) == -1) {
_twe_display_print_err(disp_source, "dispatch_queue_pending");
}
wl_event_queue_destroy(disp_source->ev_queue);
+ TPL_OBJECT_UNLOCK(&disp_source->obj);
+
+ __tpl_object_fini(&disp_source->obj);
TPL_LOG_T("WL_EGL", "finalize| wl_event_queue(%p)",
disp_source->ev_queue);
source->gfd.fd = wl_display_get_fd(display);
source->gfd.events = G_IO_IN | G_IO_ERR;
source->gfd.revents = 0;
+ __tpl_object_init(&source->obj, TPL_OBJECT_DISPLAY, NULL);
_twe_display_shm_init(source);
return TPL_ERROR_NONE;
}
+tpl_result_t
+twe_display_lock(twe_display_h display)
+{
+ twe_wl_disp_source *disp_source = (twe_wl_disp_source *)display;
+ if (!disp_source || g_source_is_destroyed(&disp_source->gsource)) {
+ TPL_ERR("Invalid parameter. display(%p)", display);
+ return TPL_ERROR_INVALID_PARAMETER;
+ }
+
+ return TPL_OBJECT_LOCK(&disp_source->obj);
+}
+
+void
+twe_display_unlock(twe_display_h display)
+{
+ twe_wl_disp_source *disp_source = (twe_wl_disp_source *)display;
+ if (!disp_source || g_source_is_destroyed(&disp_source->gsource)) {
+ TPL_ERR("Invalid parameter. display(%p)", display);
+ return;
+ }
+
+ TPL_OBJECT_UNLOCK(&disp_source->obj);
+}
+
static void
__cb_resize_callback(struct wl_egl_window *wl_egl_window, void *private)
{
- dispatch buffer-release
- dispatch queue flush
*/
+ TPL_OBJECT_LOCK(&disp_source->obj);
ret = wl_display_dispatch_queue_pending(disp_source->disp,
disp_source->ev_queue);
if (ret == -1) {
_twe_display_print_err(disp_source, "dispatch_queue_pending");
return;
}
+ TPL_OBJECT_UNLOCK(&disp_source->obj);
tbm_surface_queue_flush(surf_source->tbm_queue);
return TPL_ERROR_INVALID_PARAMETER;
}
- 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);
-
/* Should be waited until all in_use_buffers has been retrieved. */
while (!__tpl_list_is_empty(surf_source->in_use_buffers)) {
sched_yield();
__tpl_list_free(surf_source->in_use_buffers, NULL);
surf_source->in_use_buffers = NULL;
+ TPL_OBJECT_LOCK(&disp_source->obj);
if (surf_source->committed_buffers) {
TPL_OBJECT_LOCK(&surf_source->obj);
while (!__tpl_list_is_empty(surf_source->committed_buffers)) {
/* TODO : surf_source will be removed from surfaces list in disp_source */
+ 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);
+
surf_source->wl_egl_window = NULL;
surf_source->surf = NULL;
+ TPL_OBJECT_UNLOCK(&disp_source->obj);
+
g_source_destroy(&surf_source->gsource);
g_source_unref(&surf_source->gsource);