tpl_bool_t rotation_capability;
tpl_list_t *committed_buffers; /* Trace tbm_surface from wl_surface_commit() to RELEASE */
tpl_list_t *in_use_buffers; /* Trace tbm_surface from DEQUEUE to ENQUEUE */
+ tpl_list_t *fence_waiting_sources; /* Trace fence_wait_source from ENQUEUE to fence signaled */
tpl_list_t *vblank_waiting_buffers; /* for FIFO/FIFO_RELAXED modes */
tbm_surface_h draw_done_buffer; /* for MAILBOX mode */
int render_done_cnt;
surf_source->vblank_waiting_buffers = NULL;
}
+ if (surf_source->use_sync_fence && surf_source->fence_waiting_sources) {
+ while (!__tpl_list_is_empty(surf_source->fence_waiting_sources)) {
+ twe_fence_wait_source *wait_source =
+ __tpl_list_pop_front(surf_source->fence_waiting_sources,
+ NULL);
+ if (!g_source_is_destroyed(&wait_source->gsource)) {
+ tbm_surface_internal_unref(wait_source->tbm_surface);
+ wait_source->tbm_surface = NULL;
+
+ close(wait_source->fence_fd);
+ wait_source->fence_fd = -1;
+
+ g_source_remove_unix_fd(&wait_source->gsource, wait_source->tag);
+ g_source_destroy(&wait_source->gsource);
+ g_source_unref(&wait_source->gsource);
+ }
+ }
+ }
+
_twe_surface_buffer_flusher_fini(surf_source);
if (surf_source->tbm_queue) {
source->is_destroying = TPL_FALSE;
source->committed_buffers = __tpl_list_alloc();
source->in_use_buffers = __tpl_list_alloc();
+ source->fence_waiting_sources = __tpl_list_alloc();
source->render_done_cnt = 0;
source->cb_data = NULL;
_twe_thread_wl_surface_acquire_and_commit(surf_source);
tbm_surface_internal_unref(tbm_surface);
+ g_mutex_lock(&surf_source->surf_mutex);
+ __tpl_list_remove_data(surf_source->fence_waiting_sources,
+ (void *)wait_source, TPL_FIRST, NULL);
+ g_mutex_unlock(&surf_source->surf_mutex);
+
/* This source is used only once and does not allow reuse.
* So finalize will be executed immediately. */
g_source_remove_unix_fd(&wait_source->gsource, wait_source->tag);
wait_source->tag = g_source_add_unix_fd(&wait_source->gsource,
wait_source->fence_fd,
G_IO_IN);
+
+ /* When waiting is over, it will be removed from the list. */
+ g_mutex_lock(&surf_source->surf_mutex);
+ __tpl_list_push_back(surf_source->fence_waiting_sources, (void *)wait_source);
+ g_mutex_unlock(&surf_source->surf_mutex);
+
g_source_attach(&wait_source->gsource, g_main_loop_get_context(_twe_ctx->twe_loop));
return TPL_ERROR_NONE;