From: Joonbum Ko Date: Thu, 4 Feb 2021 06:19:29 +0000 (+0900) Subject: Fix some wrong implementations. X-Git-Tag: submit/tizen/20210316.021228~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8ea8a5d26bac140447d09a6c0b46a2a1bcfe1f83;p=platform%2Fcore%2Fuifw%2Flibtpl-egl.git Fix some wrong implementations. - wl_egl_surface->need_to_enqueue should be initialized to TPL_TRUE at first time. - If release_fence, which is from tpl_surface_dequeue, is not null and surface_sync is not used, it should be initialized to -1. - _thread_wl_surface_commit should be called only if there is a buffer in vblank_waiting_buffers when vblank event occurs. - Some debug logs were added. Change-Id: I8dc72c5b0ddbb0d38e149d809191620691caf698 Signed-off-by: Joonbum Ko --- diff --git a/src/tpl_wl_egl.c b/src/tpl_wl_egl.c index 55eb6cd..cea25e9 100644 --- a/src/tpl_wl_egl.c +++ b/src/tpl_wl_egl.c @@ -1609,7 +1609,7 @@ __tpl_wl_egl_surface_init(tpl_surface_t *surface) wl_egl_surface->reset = TPL_FALSE; wl_egl_surface->is_activated = TPL_FALSE; - wl_egl_surface->need_to_enqueue = TPL_FALSE; + wl_egl_surface->need_to_enqueue = TPL_TRUE; wl_egl_surface->prerotation_capability = TPL_FALSE; wl_egl_surface->vblank_done = TPL_TRUE; wl_egl_surface->use_render_done_fence = TPL_FALSE; @@ -2277,10 +2277,14 @@ __tpl_wl_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeout_ns, /* If wl_egl_buffer->release_fence_fd is -1, * the tbm_surface can be used immediately. * If not, user(EGL) have to wait until signaled. */ - if (release_fence && wl_egl_surface->surface_sync) { - *release_fence = wl_egl_buffer->release_fence_fd; - TPL_DEBUG("wl_egl_surface(%p) wl_egl_buffer(%p) release_fence_fd(%d)", - wl_egl_surface, wl_egl_buffer, *release_fence); + if (release_fence) { + if (wl_egl_surface->surface_sync) { + *release_fence = wl_egl_buffer->release_fence_fd; + TPL_DEBUG("wl_egl_surface(%p) wl_egl_buffer(%p) release_fence_fd(%d)", + wl_egl_surface, wl_egl_buffer, *release_fence); + } else { + *release_fence = -1; + } } if (surface->is_frontbuffer_mode && is_activated) @@ -2459,6 +2463,9 @@ __thread_func_waiting_source_dispatch(tpl_gsource *gsource, uint64_t message) TRACE_ASYNC_END(wl_egl_buffer->acquire_fence_fd, "FENCE WAIT fd(%d)", wl_egl_buffer->acquire_fence_fd); + TPL_DEBUG("[RENDER DONE] wl_egl_buffer(%p) tbm_surface(%p)", + wl_egl_buffer, tbm_surface); + tpl_gmutex_lock(&wl_egl_buffer->mutex); tpl_gcond_signal(&wl_egl_buffer->cond); wl_egl_buffer->status = WAITING_VBLANK; @@ -2590,6 +2597,7 @@ __cb_tdm_client_vblank(tdm_client_vblank *vblank, tdm_error error, tbm_surface_h tbm_surface = NULL; TRACE_ASYNC_END((int)wl_egl_surface, "WAIT_VBLANK"); + TPL_DEBUG("[VBLANK] wl_egl_surface(%p)", wl_egl_surface); if (error == TDM_ERROR_TIMEOUT) TPL_WARN("[TDM_ERROR_TIMEOUT] It will keep going. wl_egl_surface(%p)", @@ -2601,7 +2609,8 @@ __cb_tdm_client_vblank(tdm_client_vblank *vblank, tdm_error error, tbm_surface = (tbm_surface_h)__tpl_list_pop_front( wl_egl_surface->vblank_waiting_buffers, NULL); - _thread_wl_surface_commit(wl_egl_surface, tbm_surface); + if (tbm_surface) + _thread_wl_surface_commit(wl_egl_surface, tbm_surface); tpl_gmutex_unlock(&wl_egl_surface->surf_mutex); } /* -- END -- tdm_client vblank callback function */ @@ -3128,7 +3137,7 @@ __cb_wl_egl_buffer_free(tpl_wl_egl_buffer_t *wl_egl_buffer) wl_egl_buffer, wl_egl_buffer->wl_buffer, wl_egl_buffer->tbm_surface); tpl_gmutex_lock(&wl_egl_surface->buffers_mutex); - if (wl_egl_buffer->idx > 0 && wl_egl_surface->buffers[wl_egl_buffer->idx]) { + if (wl_egl_buffer->idx >= 0 && wl_egl_surface->buffers[wl_egl_buffer->idx]) { wl_egl_surface->buffers[wl_egl_buffer->idx] = NULL; wl_egl_surface->buffer_cnt--;