From: Joonbum Ko Date: Fri, 5 Feb 2021 06:25:49 +0000 (+0900) Subject: Expand the usage of wl_egl_buffer. X-Git-Tag: submit/tizen/20210316.021228~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a0061d1e4a6c9e8c3a92e5d3899e37364221585d;p=platform%2Fcore%2Fuifw%2Flibtpl-egl.git Expand the usage of wl_egl_buffer. Change-Id: Iedfae926e448e45660acca5b5cc76168f4bf4960 Signed-off-by: Joonbum Ko --- diff --git a/src/tpl_wl_egl.c b/src/tpl_wl_egl.c index 2abe646..aa54c77 100644 --- a/src/tpl_wl_egl.c +++ b/src/tpl_wl_egl.c @@ -133,6 +133,7 @@ typedef enum buffer_status { struct _tpl_wl_egl_buffer { tbm_surface_h tbm_surface; + int bo_name; struct wl_proxy *wl_buffer; int dx, dy; /* position to attach to wl_surface */ @@ -218,7 +219,7 @@ static tpl_result_t _thread_surface_queue_acquire(tpl_wl_egl_surface_t *wl_egl_surface); static void _thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface, - tbm_surface_h tbm_surface); + tpl_wl_egl_buffer_t *wl_egl_buffer); static tpl_bool_t _check_native_handle_is_wl_display(tpl_handle_t display) @@ -2119,6 +2120,7 @@ _wl_egl_buffer_create(tpl_wl_egl_surface_t *wl_egl_surface, wl_egl_buffer->wl_buffer = NULL; wl_egl_buffer->tbm_surface = tbm_surface; + wl_egl_buffer->bo_name = _get_tbm_surface_bo_name(tbm_surface); wl_egl_buffer->wl_egl_surface = wl_egl_surface; wl_egl_buffer->status = RELEASED; @@ -2146,7 +2148,7 @@ _wl_egl_buffer_create(tpl_wl_egl_surface_t *wl_egl_surface, TPL_INFO("[WL_EGL_BUFFER_CREATE]", "wl_egl_surface(%p) wl_egl_buffer(%p) tbm_surface(%p) bo(%d)", wl_egl_surface, wl_egl_buffer, tbm_surface, - _get_tbm_surface_bo_name(tbm_surface)); + wl_egl_buffer->bo_name); } _wl_egl_buffer_init(wl_egl_buffer, wl_egl_surface); @@ -2261,8 +2263,6 @@ __tpl_wl_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeout_ns, tbm_surface_internal_ref(tbm_surface); - bo_name = _get_tbm_surface_bo_name(tbm_surface); - wl_egl_buffer = _wl_egl_buffer_create(wl_egl_surface, tbm_surface); TPL_CHECK_ON_FALSE_ASSERT_FAIL(wl_egl_buffer, "Failed to create/get wl_egl_buffer."); @@ -2287,10 +2287,10 @@ __tpl_wl_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeout_ns, wl_egl_surface->reset = TPL_FALSE; - TRACE_MARK("[DEQ][NEW]BO_NAME:%d", bo_name); - TRACE_ASYNC_BEGIN((int)tbm_surface, "[DEQ]~[ENQ] BO_NAME:%d", bo_name); + TRACE_MARK("[DEQ][NEW]BO_NAME:%d", wl_egl_buffer->bo_name); + TRACE_ASYNC_BEGIN((int)tbm_surface, "[DEQ]~[ENQ] BO_NAME:%d", wl_egl_buffer->bo_name); TPL_LOG_T("WL_EGL", "[DEQ] wl_egl_buffer(%p) tbm_surface(%p) bo(%d) fence(%d)", - wl_egl_buffer, tbm_surface, bo_name, release_fence ? *release_fence : -1); + wl_egl_buffer, tbm_surface, wl_egl_buffer->bo_name, release_fence ? *release_fence : -1); tpl_gmutex_unlock(&wl_egl_buffer->mutex); tpl_gmutex_unlock(&wl_egl_display->wl_event_mutex); @@ -2485,10 +2485,10 @@ __thread_func_waiting_source_dispatch(tpl_gsource *gsource, uint64_t message) tpl_gmutex_lock(&wl_egl_surface->surf_mutex); if (wl_egl_surface->vblank_done) - _thread_wl_surface_commit(wl_egl_surface, tbm_surface); + _thread_wl_surface_commit(wl_egl_surface, wl_egl_buffer); else __tpl_list_push_back(wl_egl_surface->vblank_waiting_buffers, - tbm_surface); + wl_egl_buffer); tpl_gmutex_unlock(&wl_egl_surface->surf_mutex); @@ -2584,7 +2584,7 @@ _thread_surface_queue_acquire(tpl_wl_egl_surface_t *wl_egl_surface) ready_to_commit = TPL_TRUE; else { wl_egl_buffer->status = WAITING_VBLANK; - __tpl_list_push_back(wl_egl_surface->vblank_waiting_buffers, tbm_surface); + __tpl_list_push_back(wl_egl_surface->vblank_waiting_buffers, wl_egl_buffer); ready_to_commit = TPL_FALSE; } } @@ -2592,7 +2592,7 @@ _thread_surface_queue_acquire(tpl_wl_egl_surface_t *wl_egl_surface) tpl_gmutex_unlock(&wl_egl_buffer->mutex); if (ready_to_commit) - _thread_wl_surface_commit(wl_egl_surface, tbm_surface); + _thread_wl_surface_commit(wl_egl_surface, wl_egl_buffer); } return TPL_ERROR_NONE; @@ -2605,7 +2605,7 @@ __cb_tdm_client_vblank(tdm_client_vblank *vblank, tdm_error error, unsigned int tv_usec, void *user_data) { tpl_wl_egl_surface_t *wl_egl_surface = (tpl_wl_egl_surface_t *)user_data; - tbm_surface_h tbm_surface = NULL; + tpl_wl_egl_buffer_t *wl_egl_buffer = NULL; TRACE_ASYNC_END((int)wl_egl_surface, "WAIT_VBLANK"); TPL_DEBUG("[VBLANK] wl_egl_surface(%p)", wl_egl_surface); @@ -2617,11 +2617,11 @@ __cb_tdm_client_vblank(tdm_client_vblank *vblank, tdm_error error, wl_egl_surface->vblank_done = TPL_TRUE; tpl_gmutex_lock(&wl_egl_surface->surf_mutex); - tbm_surface = (tbm_surface_h)__tpl_list_pop_front( + wl_egl_buffer = (tpl_wl_egl_buffer_t *)__tpl_list_pop_front( wl_egl_surface->vblank_waiting_buffers, NULL); - if (tbm_surface) - _thread_wl_surface_commit(wl_egl_surface, tbm_surface); + if (wl_egl_buffer) + _thread_wl_surface_commit(wl_egl_surface, wl_egl_buffer); tpl_gmutex_unlock(&wl_egl_surface->surf_mutex); } /* -- END -- tdm_client vblank callback function */ @@ -2924,22 +2924,21 @@ _thread_surface_vblank_wait(tpl_wl_egl_surface_t *wl_egl_surface) static void _thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface, - tbm_surface_h tbm_surface) + tpl_wl_egl_buffer_t *wl_egl_buffer) { tpl_wl_egl_display_t *wl_egl_display = wl_egl_surface->wl_egl_display; - tpl_wl_egl_buffer_t *wl_egl_buffer = NULL; struct wl_surface *wl_surface = wl_egl_surface->wl_surface; struct wl_egl_window *wl_egl_window = wl_egl_surface->wl_egl_window; uint32_t version; - wl_egl_buffer = _get_wl_egl_buffer(tbm_surface); TPL_CHECK_ON_FALSE_ASSERT_FAIL(wl_egl_buffer != NULL, "wl_egl_buffer sould be not NULL"); if (wl_egl_buffer->wl_buffer == NULL) { wl_egl_buffer->wl_buffer = (struct wl_proxy *)wayland_tbm_client_create_buffer( - wl_egl_display->wl_tbm_client, tbm_surface); + wl_egl_display->wl_tbm_client, + wl_egl_buffer->tbm_surface); } TPL_CHECK_ON_FALSE_ASSERT_FAIL(wl_egl_buffer->wl_buffer != NULL, "[FATAL] Failed to create wl_buffer"); @@ -2961,7 +2960,7 @@ _thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface, wl_surface); pst_feedback->wl_egl_surface = wl_egl_surface; - pst_feedback->bo_name = _get_tbm_surface_bo_name(tbm_surface); + pst_feedback->bo_name = wl_egl_buffer->bo_name; pst_feedback->pst_sync_fd = wl_egl_buffer->presentation_sync_fd; wl_egl_buffer->presentation_sync_fd = -1; @@ -3045,7 +3044,7 @@ _thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface, zwp_linux_surface_synchronization_v1_set_acquire_fence(wl_egl_surface->surface_sync, wl_egl_buffer->acquire_fence_fd); TPL_DEBUG("[SET_ACQUIRE_FENCE] wl_egl_surface(%p) tbm_surface(%p) acquire_fence(%d)", - wl_egl_surface, tbm_surface, wl_egl_buffer->acquire_fence_fd); + wl_egl_surface, wl_egl_buffer->tbm_surface, wl_egl_buffer->acquire_fence_fd); close(wl_egl_buffer->acquire_fence_fd); wl_egl_buffer->acquire_fence_fd = -1; @@ -3064,15 +3063,16 @@ _thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface, wl_display_flush(wl_egl_display->wl_display); - TRACE_ASYNC_BEGIN((int)tbm_surface, "[COMMIT ~ RELEASE] BO(%d)", - _get_tbm_surface_bo_name(tbm_surface)); + TRACE_ASYNC_BEGIN((int)wl_egl_buffer->tbm_surface, "[COMMIT ~ RELEASE] BO(%d)", + wl_egl_buffer->bo_name); wl_egl_buffer->need_to_commit = TPL_FALSE; wl_egl_buffer->status = COMMITTED; - TPL_LOG_T("WL_EGL", "[COMMIT] wl_buffer(%p) tbm_surface(%p) bo(%d)", - wl_egl_buffer->wl_buffer, tbm_surface, - _get_tbm_surface_bo_name(tbm_surface)); + TPL_LOG_T("WL_EGL", + "[COMMIT] wl_egl_buffer(%p) wl_buffer(%p) tbm_surface(%p) bo(%d)", + wl_egl_buffer, wl_egl_buffer->wl_buffer, wl_egl_buffer->tbm_surface, + wl_egl_buffer->bo_name); if (wl_egl_display->tdm_initialized && _thread_surface_vblank_wait(wl_egl_surface) != TPL_ERROR_NONE) @@ -3087,7 +3087,7 @@ _thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface, } TRACE_ASYNC_END(wl_egl_buffer->commit_sync_fd, "[COMMIT_SYNC] bo(%d)", - _get_tbm_surface_bo_name(tbm_surface)); + wl_egl_buffer->bo_name); TPL_DEBUG("[COMMIT_SYNC][SEND] wl_egl_surface(%p) commit_sync_fd(%d)", wl_egl_surface, wl_egl_buffer->commit_sync_fd); @@ -3208,6 +3208,7 @@ __cb_wl_egl_buffer_free(tpl_wl_egl_buffer_t *wl_egl_buffer) } wl_egl_buffer->tbm_surface = NULL; + wl_egl_buffer->bo_name = -1; free(wl_egl_buffer); } @@ -3232,7 +3233,7 @@ _print_buffer_lists(tpl_wl_egl_surface_t *wl_egl_surface) TPL_INFO("[INFO]", "INDEX[%d] | wl_egl_buffer(%p) tbm_surface(%p) bo(%d) | status(%d)", idx, wl_egl_buffer, wl_egl_buffer->tbm_surface, - _get_tbm_surface_bo_name(wl_egl_buffer->tbm_surface), + wl_egl_buffer->bo_name, wl_egl_buffer->status); } }