_get_wl_egl_buffer(wl_egl_surface->last_enq_buffer);
if (enqueued_buffer) {
+ tbm_surface_internal_ref(wl_egl_surface->last_enq_buffer);
+ tpl_gmutex_unlock(&wl_egl_surface->surf_mutex);
tpl_gmutex_lock(&enqueued_buffer->mutex);
- if (enqueued_buffer->status >= ENQUEUED &&
- enqueued_buffer->status < COMMITTED) {
+ while (enqueued_buffer->status >= ENQUEUED &&
+ enqueued_buffer->status < COMMITTED) {
tpl_result_t wait_result;
TPL_INFO("[DEQ_AFTER_RESET]",
"waiting for previous wl_egl_buffer(%p) commit",
enqueued_buffer);
- tpl_gmutex_unlock(&wl_egl_surface->surf_mutex);
+
wait_result = tpl_cond_timed_wait(&enqueued_buffer->cond,
&enqueued_buffer->mutex,
200); /* 200ms */
- tpl_gmutex_lock(&wl_egl_surface->surf_mutex);
if (wait_result == TPL_ERROR_TIME_OUT) {
TPL_WARN("timeout occured waiting signaled. wl_egl_buffer(%p)",
enqueued_buffer);
+ break;
}
}
tpl_gmutex_unlock(&enqueued_buffer->mutex);
+ tpl_gmutex_lock(&wl_egl_surface->surf_mutex);
+ tbm_surface_internal_unref(wl_egl_surface->last_enq_buffer);
}
wl_egl_surface->last_enq_buffer = NULL;