From: Joonbum Ko Date: Tue, 21 May 2024 10:10:31 +0000 (+0900) Subject: wl_egl: implement set_pre_commit_callback X-Git-Tag: accepted/tizen/unified/20240701.055759~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F57%2F311457%2F3;p=platform%2Fcore%2Fuifw%2Flibtpl-egl.git wl_egl: implement set_pre_commit_callback Change-Id: I223fd84d00c9e951d04d4149d3851c6c57c38610 Signed-off-by: Joonbum Ko --- diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index 1a7b9d5..ebb010f 100755 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -250,6 +250,8 @@ struct _tpl_wl_egl_buffer { * presentation feedback from display server */ int32_t presentation_sync_fd; + struct pre_commit_cb pre_commit_cb; + tpl_gsource *waiting_source; tpl_gmutex mutex; @@ -2654,6 +2656,9 @@ _wl_egl_buffer_init(tpl_wl_egl_buffer_t *wl_egl_buffer, wl_egl_buffer->rects = NULL; wl_egl_buffer->num_rects = 0; } + + wl_egl_buffer->pre_commit_cb.func = NULL; + wl_egl_buffer->pre_commit_cb.data = NULL; } static tpl_wl_egl_buffer_t * @@ -3042,6 +3047,7 @@ __tpl_wl_egl_surface_enqueue_buffer(tpl_surface_t *surface, tpl_wl_egl_buffer_t *wl_egl_buffer = NULL; tbm_surface_queue_error_e tsq_err = TBM_SURFACE_QUEUE_ERROR_NONE; int bo_name = -1; + struct tizen_private *tizen_private = wl_egl_tizen_get_tizen_private(wl_egl_surface->wl_egl_window); if (!tbm_surface_internal_is_valid(tbm_surface)) { TPL_ERR("Failed to enqueue tbm_surface(%p) Invalid value.", @@ -3120,6 +3126,16 @@ __tpl_wl_egl_surface_enqueue_buffer(tpl_surface_t *surface, wl_egl_surface->serial_updated = TPL_FALSE; } + if (tizen_private && tizen_private->pre_commit_cb.func) { + wl_egl_buffer->pre_commit_cb.func = tizen_private->pre_commit_cb.func; + wl_egl_buffer->pre_commit_cb.data = tizen_private->pre_commit_cb.data; + + if (tizen_private->pre_commit_cb.option == ONCE) { + tizen_private->pre_commit_cb.func = NULL; + tizen_private->pre_commit_cb.data = NULL; + } + } + tpl_gmutex_lock(&wl_egl_surface->presentation_sync.mutex); if (wl_egl_surface->presentation_sync.fd != -1) { wl_egl_buffer->presentation_sync_fd = wl_egl_surface->presentation_sync.fd; @@ -3754,6 +3770,17 @@ _thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface, wl_egl_window->attached_height = wl_egl_buffer->height; } + if (wl_egl_buffer->pre_commit_cb.func) { + TPL_INFO("[CALL_PRE_COMMIT_CB]", "wl_egl_window(%p) func(%p) data(%p)", + wl_egl_window, wl_egl_buffer->pre_commit_cb.func, + wl_egl_buffer->pre_commit_cb.data); + + wl_egl_buffer->pre_commit_cb.func(wl_egl_buffer->pre_commit_cb.data); + + wl_egl_buffer->pre_commit_cb.func = NULL; + wl_egl_buffer->pre_commit_cb.data = NULL; + } + wl_surface_attach(wl_surface, (void *)wl_egl_buffer->wl_buffer, wl_egl_buffer->dx, wl_egl_buffer->dy); @@ -3999,6 +4026,11 @@ __cb_wl_egl_buffer_free(tpl_wl_egl_buffer_t *wl_egl_buffer) wl_egl_buffer->num_rects = 0; } + if (wl_egl_buffer->pre_commit_cb.func) { + wl_egl_buffer->pre_commit_cb.func = NULL; + wl_egl_buffer->pre_commit_cb.data = NULL; + } + wl_egl_buffer->wl_egl_surface = NULL; wl_egl_buffer->tbm_surface = NULL; wl_egl_buffer->bo_name = -1;