g_mutex_lock(>hread->idle_mutex);
id = tpl_gthread_add_idle(gthread, (tpl_gsource_func)_thread_idle_cb, gthread);
-
- /* 500ms timeout */
- end_time = g_get_monotonic_time() +
- (WAIT_IDLE_TIMEOUT * G_TIME_SPAN_MILLISECOND);
- do {
- ret = g_cond_wait_until(>hread->idle_cond,
- >hread->idle_mutex,
- end_time);
- if (!ret) {
- tpl_gsource_remove(gthread, id);
- TPL_ERR("wait_idle timeout!");
- res = TPL_ERROR_TIME_OUT;
- break;
- }
- } while (!gthread->is_idle);
+ if (!id) {
+ TPL_WARN("Failed to attach idle gsource.");
+ } else {
+ /* 500ms timeout */
+ end_time = g_get_monotonic_time() +
+ (WAIT_IDLE_TIMEOUT * G_TIME_SPAN_MILLISECOND);
+ do {
+ ret = g_cond_wait_until(>hread->idle_cond,
+ >hread->idle_mutex,
+ end_time);
+ if (!ret) {
+ tpl_gsource_remove(gthread, id);
+ TPL_ERR("wait_idle timeout!");
+ res = TPL_ERROR_TIME_OUT;
+ break;
+ }
+ } while (!gthread->is_idle);
+ }
gthread->is_idle = TPL_FALSE;
wl_egl_surface->buffers_finalize_done = TPL_FALSE;
id = tpl_gthread_add_idle(wl_egl_display->thread,
__idle_cb_buffers_finalize, wl_egl_surface);
- tpl_gcond_timed_wait(&wl_egl_surface->surf_cond,
- &wl_egl_surface->surf_mutex,
- BUFFER_CLEAR_WAITING_TIMEOUT_MS)
- {
- if (wl_egl_surface->buffers_finalize_done)
- break;
- } else {
- tpl_gsource_remove(wl_egl_display->thread, id);
- TPL_WARN("buffer clear timeout. wl_egl_surface(%p)", wl_egl_surface);
-
- wl_egl_surface->buffers_finalize_done = TPL_TRUE;
+ if (!id) {
+ TPL_WARN("Failed to attach idle gsource. wl_egl_surface(%p)",
+ wl_egl_surface);
wl_egl_surface->need_force_release = TPL_TRUE;
+ } else {
+ tpl_gcond_timed_wait(&wl_egl_surface->surf_cond,
+ &wl_egl_surface->surf_mutex,
+ BUFFER_CLEAR_WAITING_TIMEOUT_MS)
+ {
+ if (wl_egl_surface->buffers_finalize_done)
+ break;
+ } else {
+ tpl_gsource_remove(wl_egl_display->thread, id);
+ TPL_WARN("buffer clear timeout. wl_egl_surface(%p)", wl_egl_surface);
+ wl_egl_surface->need_force_release = TPL_TRUE;
+ }
}
+ wl_egl_surface->buffers_finalize_done = TPL_TRUE;
if (wl_egl_surface->surf_source) {
// Send destroy mesage to thread
wl_egl_surface->buffers_commit_done = TPL_FALSE;
id = tpl_gthread_add_idle(wl_egl_display->thread,
__idle_cb_check_buffers_commit, wl_egl_surface);
- tpl_gcond_timed_wait(&wl_egl_surface->surf_cond,
- &wl_egl_surface->surf_mutex,
- CHECK_COMMIT_TIMEOUT_MS)
- {
- if (wl_egl_surface->buffers_commit_done)
- break;
+ if (!id) {
+ TPL_WARN("Failed to attach idle gsource. wl_egl_surface(%p)",
+ wl_egl_surface);
} else {
- tpl_gsource_remove(wl_egl_display->thread, id);
- TPL_WARN("wl_egl_surface(%p) timeout error occured", wl_egl_surface);
- _print_buffer_lists(wl_egl_surface);
+ tpl_gcond_timed_wait(&wl_egl_surface->surf_cond,
+ &wl_egl_surface->surf_mutex,
+ CHECK_COMMIT_TIMEOUT_MS)
+ {
+ if (wl_egl_surface->buffers_commit_done)
+ break;
+ } else {
+ tpl_gsource_remove(wl_egl_display->thread, id);
+ TPL_WARN("wl_egl_surface(%p) timeout error occured",
+ wl_egl_surface);
+ _print_buffer_lists(wl_egl_surface);
+ }
}
wl_egl_surface->buffers_commit_done = TPL_TRUE;