} swapchain_properties;
tpl_surface_cb_func_t rotate_cb;
tpl_bool_t rotation_capability;
- tpl_object_t obj; /* for mutex lock */
tpl_list_t *committed_buffers;
tpl_list_t *in_use_buffers;
tpl_list_t *vblank_waiting_buffers; /* for FIFO/FIFO_RELAXED modes */
twe_wl_disp_source *disp_source;
twe_del_source *surf_del_source;
+ GMutex surf_mutex;
+
GMutex free_queue_mutex;
GCond free_queue_cond;
if (surf_source) {
TPL_LOG_T(BACKEND, "[DESTROY_CB] wl_egl_window(%p) surf_source(%p)",
surf_source->wl_egl_window, surf_source);
- TPL_OBJECT_LOCK(&surf_source->obj);
+ g_mutex_lock(&surf_source->surf_mutex);
surf_source->wl_egl_window->private = NULL;
surf_source->wl_egl_window = NULL;
surf_source->surf = NULL;
surf_source->is_destroying = TPL_TRUE;
- TPL_OBJECT_UNLOCK(&surf_source->obj);
+ g_mutex_unlock(&surf_source->surf_mutex);
}
}
TPL_ERR("tbm_surface(%p) tsq_err(%d)", tbm_surface, tsq_err);
if (surf_source->committed_buffers) {
- TPL_OBJECT_LOCK(&surf_source->obj);
+ g_mutex_lock(&surf_source->surf_mutex);
__tpl_list_remove_data(surf_source->committed_buffers,
(void *)tbm_surface,
TPL_FIRST, NULL);
- TPL_OBJECT_UNLOCK(&surf_source->obj);
+ g_mutex_unlock(&surf_source->surf_mutex);
}
buf_info->need_to_release = TPL_FALSE;
g_mutex_lock(&surf_source->free_queue_mutex);
if (surf_source->committed_buffers) {
- TPL_OBJECT_LOCK(&surf_source->obj);
+ g_mutex_lock(&surf_source->surf_mutex);
__tpl_list_remove_data(surf_source->committed_buffers,
(void *)tbm_surface,
TPL_FIRST, NULL);
- TPL_OBJECT_UNLOCK(&surf_source->obj);
+ g_mutex_unlock(&surf_source->surf_mutex);
}
TRACE_MARK("[RELEASE] BO(%d)",
buf_info->sync_fd = -1;
if (surf_source->in_use_buffers) {
- TPL_OBJECT_LOCK(&surf_source->obj);
+ g_mutex_lock(&surf_source->surf_mutex);
__tpl_list_push_back(surf_source->in_use_buffers,
(void *)tbm_surface);
- TPL_OBJECT_UNLOCK(&surf_source->obj);
+ g_mutex_unlock(&surf_source->surf_mutex);
}
TRACE_MARK("[SET_BUFFER_INFO] BO(%d)",
buf_info);
if (surf_source->in_use_buffers) {
- TPL_OBJECT_LOCK(&surf_source->obj);
+ g_mutex_lock(&surf_source->surf_mutex);
__tpl_list_push_back(surf_source->in_use_buffers,
(void *)tbm_surface);
- TPL_OBJECT_UNLOCK(&surf_source->obj);
+ g_mutex_unlock(&surf_source->surf_mutex);
}
TRACE_MARK("[SET_BUFFER_INFO] BO(%d)",
tbm_surface);
if (surf_source->in_use_buffers) {
- TPL_OBJECT_LOCK(&surf_source->obj);
+ g_mutex_lock(&surf_source->surf_mutex);
/* Stop tracking of this canceled tbm_surface */
__tpl_list_remove_data(surf_source->in_use_buffers,
(void *)tbm_surface, TPL_FIRST, NULL);
- TPL_OBJECT_UNLOCK(&surf_source->obj);
+ g_mutex_unlock(&surf_source->surf_mutex);
}
}
if (!disp_source->is_vulkan_dpy)
_twe_thread_wl_surface_acquire_and_commit(surf_source);
else {
- TPL_OBJECT_LOCK(&surf_source->obj);
+ g_mutex_lock(&surf_source->surf_mutex);
switch (surf_source->swapchain_properties.present_mode) {
case TPL_DISPLAY_PRESENT_MODE_MAILBOX:
if (surf_source->draw_done_buffer) {
break;
}
- TPL_OBJECT_UNLOCK(&surf_source->obj);
+ g_mutex_unlock(&surf_source->surf_mutex);
}
}
tbm_surface_internal_get_user_data(tbm_surface, KEY_BUFFER_INFO,
(void **)&buf_info);
- TPL_OBJECT_LOCK(&surf_source->obj);
+ g_mutex_lock(&surf_source->surf_mutex);
if (!disp_source->is_vulkan_dpy) { /* wayland_egl */
TPL_LOG_T(BACKEND, "[ACQ] tbm_surface(%p) bo(%d)",
tbm_surface,
break;
}
}
- TPL_OBJECT_UNLOCK(&surf_source->obj);
+ g_mutex_unlock(&surf_source->surf_mutex);
}
}
close(surf_source->event_fd);
surf_source->event_fd = -1;
- __tpl_object_fini(&surf_source->obj);
-
return;
}
g_mutex_lock(&disp_source->wl_event_mutex);
+ g_mutex_lock(&surf_source->surf_mutex);
+
if (surf_source->in_use_buffers) {
__tpl_list_free(surf_source->in_use_buffers,
(tpl_free_func_t)__cb_buffer_remove_from_list);
surf_source->surf = NULL;
}
+ g_mutex_unlock(&surf_source->surf_mutex);
+ g_mutex_clear(&surf_source->surf_mutex);
+
g_mutex_unlock(&disp_source->wl_event_mutex);
g_cond_clear(&surf_source->free_queue_cond);
source->vk_sub_thread = NULL;
source->draw_done_count = 0;
- __tpl_object_init(&source->obj, TPL_OBJECT_SURFACE, NULL);
-
if (!disp_source->is_vulkan_dpy) {
struct wl_egl_window *wl_egl_window =
(struct wl_egl_window *)native_handle;
g_source_attach(&source->gsource, g_main_loop_get_context(ctx->twe_loop));
+ g_mutex_init(&source->surf_mutex);
+
g_mutex_init(&source->free_queue_mutex);
g_cond_init(&source->free_queue_cond);
}
if (surf_source->committed_buffers) {
- TPL_OBJECT_LOCK(&surf_source->obj);
+ g_mutex_lock(&surf_source->surf_mutex);
while (!__tpl_list_is_empty(surf_source->committed_buffers)) {
tbm_surface_queue_error_e tsq_err = TBM_SURFACE_QUEUE_ERROR_NONE;
tbm_surface_h tbm_surface =
TPL_ERR("Failed to release. tbm_surface(%p) tsq_err(%d)",
tbm_surface, tsq_err);
}
- TPL_OBJECT_UNLOCK(&surf_source->obj);
+ g_mutex_unlock(&surf_source->surf_mutex);
}
if (surf_source->tbm_queue) {
return;
}
- TPL_OBJECT_LOCK(&surf_source->obj);
+ g_mutex_lock(&surf_source->surf_mutex);
if (!surf_source->is_destroying)
_twe_thread_wl_surface_commit(surf_source, tbm_surface);
else
TPL_WARN("surf_source(%p) native window is already destroyed.",
surf_source);
- TPL_OBJECT_UNLOCK(&surf_source->obj);
+ g_mutex_unlock(&surf_source->surf_mutex);
}
static gboolean