From e806539702881132dcf6e449bc63f99ade2167d7 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 13 Aug 2021 11:02:40 +0900 Subject: [PATCH 01/16] Move unusing files to unused and remove from makefile. Change-Id: Ic24027a9e907cb064325a1c2690e820da17cd03a Signed-off-by: Joonbum Ko --- src/Makefile.am | 3 +-- src/{ => unused}/tpl_wayland_egl_thread.c | 0 src/{ => unused}/tpl_wayland_egl_thread.h | 0 src/{ => unused}/tpl_wl_egl_thread_legacy.c | 0 4 files changed, 1 insertion(+), 2 deletions(-) rename src/{ => unused}/tpl_wayland_egl_thread.c (100%) rename src/{ => unused}/tpl_wayland_egl_thread.h (100%) rename src/{ => unused}/tpl_wl_egl_thread_legacy.c (100%) diff --git a/src/Makefile.am b/src/Makefile.am index 62240c6..3255de3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -21,13 +21,12 @@ libtpl_egl_la_SOURCES = tpl.c \ tpl_surface.c \ tpl_utils_hlist.c \ tpl_utils_map.c \ - tpl_utils_gthread.c + tpl_utils_gthread.c # Wayland if WITH_WAYLAND libtpl_egl_la_SOURCES += tpl_wayland_egl.c \ tpl_wl_egl_thread.c \ - tpl_wayland_egl_thread.c \ tpl_wl_vk_thread.c \ wayland-vulkan/wayland-vulkan-protocol.c endif diff --git a/src/tpl_wayland_egl_thread.c b/src/unused/tpl_wayland_egl_thread.c similarity index 100% rename from src/tpl_wayland_egl_thread.c rename to src/unused/tpl_wayland_egl_thread.c diff --git a/src/tpl_wayland_egl_thread.h b/src/unused/tpl_wayland_egl_thread.h similarity index 100% rename from src/tpl_wayland_egl_thread.h rename to src/unused/tpl_wayland_egl_thread.h diff --git a/src/tpl_wl_egl_thread_legacy.c b/src/unused/tpl_wl_egl_thread_legacy.c similarity index 100% rename from src/tpl_wl_egl_thread_legacy.c rename to src/unused/tpl_wl_egl_thread_legacy.c -- 2.7.4 From de4443b12e3ee8bcf905d003cc3f65a24ea89bdb Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 13 Aug 2021 12:17:00 +0900 Subject: [PATCH 02/16] Remove dependency releated wayland-vulkan-protocol Change-Id: Id33821ae95d98e84c1af38b429804ccf3e92850e Signed-off-by: Joonbum Ko --- configure.ac | 5 +---- src/Makefile.am | 21 +-------------------- .../wayland-vulkan/wayland-vulkan-protocol.xml | 0 3 files changed, 2 insertions(+), 24 deletions(-) rename src/{ => unused}/wayland-vulkan/wayland-vulkan-protocol.xml (100%) diff --git a/configure.ac b/configure.ac index e59d587..0e38fb8 100644 --- a/configure.ac +++ b/configure.ac @@ -24,10 +24,7 @@ AC_SUBST(WL_EGL_TIZEN_VERSION_PATCH) # Checks for programs. AC_PROG_CXX AC_PROG_CC -AC_PATH_PROG([WL_SCANNER], [wayland-scanner]) -if test -z "$WL_SCANNER"; then - AC_MSG_ERROR([wayland-scanner is not found]) -fi + # Checks for libraries. AC_CHECK_LIB([dl], [dlopen]) diff --git a/src/Makefile.am b/src/Makefile.am index 3255de3..cd9ccc4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -27,8 +27,7 @@ libtpl_egl_la_SOURCES = tpl.c \ if WITH_WAYLAND libtpl_egl_la_SOURCES += tpl_wayland_egl.c \ tpl_wl_egl_thread.c \ - tpl_wl_vk_thread.c \ - wayland-vulkan/wayland-vulkan-protocol.c + tpl_wl_vk_thread.c endif # TBM @@ -36,21 +35,3 @@ if WITH_TBM libtpl_egl_la_SOURCES += tpl_tbm.c endif -nodist_libtpl_egl_la_SOURCES = wayland-vulkan/wayland-vulkan-server-protocol.h \ - wayland-vulkan/wayland-vulkan-client-protocol.h - -BUILT_SOURCES = wayland-vulkan/wayland-vulkan-server-protocol.h \ - wayland-vulkan/wayland-vulkan-client-protocol.h \ - wayland-vulkan/wayland-vulkan-protocol.c - -WAYLAND_VULKAN_PROTOCOLS = wayland-vulkan/wayland-vulkan-protocol.xml - -wayland-vulkan/wayland-vulkan-protocol.c : $(WAYLAND_VULKAN_PROTOCOLS) - wayland-scanner code < $< > $@ - -wayland-vulkan/wayland-vulkan-server-protocol.h : $(WAYLAND_VULKAN_PROTOCOLS) - wayland-scanner server-header < $< > $@ - -wayland-vulkan/wayland-vulkan-client-protocol.h : $(WAYLAND_VULKAN_PROTOCOLS) - wayland-scanner client-header < $< > $@ - diff --git a/src/wayland-vulkan/wayland-vulkan-protocol.xml b/src/unused/wayland-vulkan/wayland-vulkan-protocol.xml similarity index 100% rename from src/wayland-vulkan/wayland-vulkan-protocol.xml rename to src/unused/wayland-vulkan/wayland-vulkan-protocol.xml -- 2.7.4 From bb924dcfaed6df181b6509ea5b6adf838e9f79a2 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 13 Aug 2021 11:04:56 +0900 Subject: [PATCH 03/16] Add build flags to separate tizen specific feature. Change-Id: I4615c5a9ca6a82d116fdd0662c2ce8f271490c62 Signed-off-by: Joonbum Ko --- configure.ac | 22 +++++++++++-- packaging/libtpl-egl.spec | 14 ++++++-- src/tpl_wayland_egl.c | 29 +++++++++++++---- src/tpl_wl_egl_thread.c | 82 +++++++++++++++++++++++++++++++++++++---------- src/tpl_wl_vk_thread.c | 48 ++++++++++++++++++++++----- 5 files changed, 158 insertions(+), 37 deletions(-) diff --git a/configure.ac b/configure.ac index 0e38fb8..6d9e688 100644 --- a/configure.ac +++ b/configure.ac @@ -59,11 +59,10 @@ AC_ARG_WITH([wayland], AS_IF([test "${with_wayland}" = "yes" || test "${with_wayland}" = "1"], [PKG_CHECK_MODULES([TPL_WL], [libtdm-client wayland-tbm-client wayland-tbm-server - tizen-surface-client glib-2.0 wayland-egl presentation-time-client wayland-egl-backend - linux-explicit-synchronization-unstable-v1-client]) + glib-2.0 wayland-egl wayland-egl-backend]) TPL_CFLAGS+="$TPL_WL_CFLAGS" TPL_CFLAGS+=" -DTPL_WINSYS_WL=1 " - TPL_LIBS+="$TPL_WL_LIBS"], + TPL_LIBS+="$TPL_WL_LIBS "], []) AM_CONDITIONAL([WITH_WAYLAND], [test "${with_wayland}" = "yes" || test "${with_wayland}" = "1"]) @@ -153,6 +152,23 @@ AS_IF([test "${enable_ttrace}" = "yes" || test "${enable_ttrace}" = "1"], AM_CONDITIONAL([ENABLE_TTRACE], [test "${enable_ttrace}" = "yes" || test "${enable_ttrace}" = "1"]) +AC_ARG_ENABLE([tizen-feature], + [AS_HELP_STRING([--enable-tizen-feature=yes|no],[Enable tizen specific feature. @<:@default=enabled@:>@])], + [], + []) + +AS_IF([test "${enable_tizen_feature}" = "yes" || test "${enable_tizen_feature}" = "1"], + [PKG_CHECK_MODULES([TIZEN_FEATURE], + [tizen-surface-client presentation-time-client + linux-explicit-synchronization-unstable-v1-client]) + TPL_CFLAGS+="$TIZEN_FEATURE_CFLAGS" + TPL_CFLAGS+=" -DTIZEN_FEATURE_ENABLE=1 " + TPL_LIBS+="$TIZEN_FEATURE_LIBS"], + [TPL_CFLAGS+=" -DTIZEN_FEATURE_ENABLE=0 "]) + +AM_CONDITIONAL([ENABLE_TIZEN_FEATURE], [test "${enable_tizen_feature}" = "yes" || test "${enable_tizen_feature}" = "1"]) + + AC_ARG_WITH([utest], [AS_HELP_STRING([--with-utest=yes|no],[Build tpl unit test. @<:@default=disabled@:>@])], [], diff --git a/packaging/libtpl-egl.spec b/packaging/libtpl-egl.spec index ba8dab7..d15d8a9 100644 --- a/packaging/libtpl-egl.spec +++ b/packaging/libtpl-egl.spec @@ -18,6 +18,7 @@ %define ENABLE_OBJECT_HASH_CHECK 1 %define ENABLE_WORKER_TEST_ONLY 0 %define ENABLE_DEFAULT_WL_THREAD 0 +%define ENABLE_TIZEN_FEATURE 1 #TPL INSTALL OPTION %define ENABLE_TPL_TEST 0 @@ -53,7 +54,6 @@ Source: %{name}-%{version}.tar.gz BuildRequires: cmake BuildRequires: pkg-config BuildRequires: pkgconfig(libtbm) -BuildRequires: pkgconfig(dlog) %if "%{TPL_WINSYS}" == "DRI2" || "%{TPL_WINSYS}" == "DRI3" BuildRequires: pkgconfig(libdri2) @@ -78,16 +78,23 @@ BuildRequires: pkgconfig(wayland-egl) BuildRequires: pkgconfig(wayland-egl-backend) BuildRequires: pkgconfig(wayland-tbm-client) BuildRequires: pkgconfig(wayland-tbm-server) +BuildRequires: pkgconfig(glib-2.0) +%if "%{ENABLE_TIZEN_FEATURE}" == "1" BuildRequires: pkgconfig(tizen-surface-client) BuildRequires: pkgconfig(presentation-time-client) BuildRequires: pkgconfig(linux-explicit-synchronization-unstable-v1-client) -BuildRequires: pkgconfig(glib-2.0) +%endif + %endif %if "%{ENABLE_TTRACE}" == "1" BuildRequires: pkgconfig(ttrace) %endif +%if "%{ENABLE_DLOG}" == "1" +BuildRequires: pkgconfig(dlog) +%endif + %global TZ_SYS_RO_SHARE %{?TZ_SYS_RO_SHARE:%TZ_SYS_RO_SHARE}%{!?TZ_SYS_RO_SHARE:/usr/share} %description @@ -166,7 +173,8 @@ export WL_EGL_TIZEN_VERSION_PATCH=%{WL_EGL_TIZEN_VERSION_PATCH} --enable-dlog-default=%{ENABLE_DEFAULT_LOG} \ --enable-dump=%{ENABLE_DEFAULT_DUMP} \ --enable-object-hash-check=%{ENABLE_OBJECT_HASH_CHECK} \ - --enable-ttrace=%{ENABLE_TTRACE} + --enable-ttrace=%{ENABLE_TTRACE} \ + --enable-tizen-feature=%{ENABLE_TIZEN_FEATURE} make %{?_smp_mflags} diff --git a/src/tpl_wayland_egl.c b/src/tpl_wayland_egl.c index 1491898..3ff1817 100755 --- a/src/tpl_wayland_egl.c +++ b/src/tpl_wayland_egl.c @@ -20,7 +20,14 @@ #include #include #include + +#ifndef TIZEN_FEATURE_ENABLE +#define TIZEN_FEATURE_ENABLE 1 +#endif + +#if TIZEN_FEATURE_ENABLE #include +#endif typedef struct _tpl_wayland_egl_display tpl_wayland_egl_display_t; typedef struct _tpl_wayland_egl_surface tpl_wayland_egl_surface_t; @@ -32,7 +39,9 @@ struct _tpl_wayland_egl_display { tdm_client *tdm_client; struct wl_display *wl_dpy; struct wl_event_queue *wl_tbm_event_queue; +#if TIZEN_FEATURE_ENABLE struct tizen_surface_shm *tizen_surface_shm; /* used for surface buffer_flush */ +#endif pthread_mutex_t wl_event_mutex; pthread_mutex_t tdm_mutex; }; @@ -51,7 +60,9 @@ struct _tpl_wayland_egl_surface { int latest_transform; tpl_list_t *attached_buffers; /* list for tracking [ACQ]~[REL] buffers */ tpl_list_t *dequeued_buffers; /* list for tracking [DEQ]~[ENQ] buffers */ +#if TIZEN_FEATURE_ENABLE struct tizen_surface_shm_flusher *tizen_surface_shm_flusher; /* wl_proxy for buffer flush */ +#endif }; struct _tpl_wayland_egl_buffer { @@ -77,6 +88,7 @@ static const struct wl_buffer_listener buffer_release_listener; static int tpl_wayland_egl_buffer_key; #define KEY_tpl_wayland_egl_buffer (unsigned long)(&tpl_wayland_egl_buffer_key) +#if TIZEN_FEATURE_ENABLE static void __tpl_wayland_egl_display_buffer_flusher_init( tpl_wayland_egl_display_t *wayland_egl_display); @@ -87,6 +99,7 @@ static void __tpl_wayland_egl_surface_buffer_flusher_init(tpl_surface_t *surface); static void __tpl_wayland_egl_surface_buffer_flusher_fini(tpl_surface_t *surface); +#endif static void __tpl_wayland_egl_buffer_free(tpl_wayland_egl_buffer_t *wayland_egl_buffer); @@ -225,7 +238,9 @@ __tpl_wayland_egl_display_init(tpl_display_t *display) } wayland_egl_display->wl_dpy = wl_dpy; +#if TIZEN_FEATURE_ENABLE __tpl_wayland_egl_display_buffer_flusher_init(wayland_egl_display); +#endif } else { TPL_ERR("Invalid native handle for display."); @@ -275,9 +290,9 @@ __tpl_wayland_egl_display_fini(tpl_display_t *display) wayland_egl_display, wayland_egl_display->wl_tbm_client); lock_res = pthread_mutex_lock(&wayland_egl_display->wl_event_mutex); - +#if TIZEN_FEATURE_ENABLE __tpl_wayland_egl_display_buffer_flusher_fini(wayland_egl_display); - +#endif tdm_lock_res = pthread_mutex_lock(&wayland_egl_display->tdm_mutex); if (wayland_egl_display->tdm_client) tdm_client_destroy(wayland_egl_display->tdm_client); @@ -666,9 +681,9 @@ __tpl_wayland_egl_surface_init(tpl_surface_t *surface) } if (tdm_lock_res == 0) pthread_mutex_unlock(&wayland_egl_display->tdm_mutex); } - +#if TIZEN_FEATURE_ENABLE __tpl_wayland_egl_surface_buffer_flusher_init(surface); - +#endif TPL_LOG_B("WL_EGL", "[INIT] tpl_surface_t(%p) tpl_wayland_egl_surface_t(%p) tbm_queue(%p)", surface, wayland_egl_surface, @@ -738,9 +753,9 @@ __tpl_wayland_egl_surface_fini(tpl_surface_t *surface) wl_egl_window->driver_private = NULL; wl_egl_window->resize_callback = NULL; wl_egl_window->destroy_window_callback = NULL; - +#if TIZEN_FEATURE_ENABLE __tpl_wayland_egl_surface_buffer_flusher_fini(surface); - +#endif if (wayland_egl_surface->tdm_vblank) { int tdm_lock_res = pthread_mutex_lock(&wayland_egl_display->tdm_mutex); TPL_LOG_B("WL_EGL", @@ -1730,6 +1745,7 @@ __cb_client_window_set_window_serial_callback(struct wl_egl_window *wl_egl_windo #define IMPL_TIZEN_SURFACE_SHM_VERSION 2 +#if TIZEN_FEATURE_ENABLE void __cb_resistry_global_callback(void *data, struct wl_registry *wl_registry, uint32_t name, const char *interface, @@ -1936,3 +1952,4 @@ __tpl_wayland_egl_surface_buffer_flusher_fini(tpl_surface_t *surface) wayland_egl_surface->tizen_surface_shm_flusher = NULL; } } +#endif diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index 819fe1a..5360eb7 100755 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -21,9 +21,15 @@ #include "wayland-egl-tizen/wayland-egl-tizen.h" #include "wayland-egl-tizen/wayland-egl-tizen-priv.h" +#ifndef TIZEN_FEATURE_ENABLE +#define TIZEN_FEATURE_ENABLE 1 +#endif + +#if TIZEN_FEATURE_ENABLE #include #include #include +#endif #include "tpl_utils_gthread.h" @@ -52,6 +58,7 @@ struct _tpl_wl_egl_display { tpl_bool_t use_wait_vblank; tpl_bool_t use_explicit_sync; + tpl_bool_t use_tss; tpl_bool_t prepared; struct { @@ -62,9 +69,11 @@ struct _tpl_wl_egl_display { tpl_list_t *surface_vblanks; } tdm; +#if TIZEN_FEATURE_ENABLE struct tizen_surface_shm *tss; /* used for surface buffer_flush */ struct wp_presentation *presentation; /* for presentation feedback */ struct zwp_linux_explicit_synchronization_v1 *explicit_sync; /* for explicit fence sync */ +#endif }; typedef enum surf_message { @@ -81,8 +90,11 @@ struct _tpl_wl_egl_surface { struct wl_egl_window *wl_egl_window; struct wl_surface *wl_surface; + +#if TIZEN_FEATURE_ENABLE struct zwp_linux_surface_synchronization_v1 *surface_sync; /* for explicit fence sync */ struct tizen_surface_shm_flusher *tss_flusher; /* used for surface buffer_flush */ +#endif tpl_surface_vblank_t *vblank; @@ -189,10 +201,10 @@ struct _tpl_wl_egl_buffer { /* for checking draw done */ tpl_bool_t draw_done; - +#if TIZEN_FEATURE_ENABLE /* to get release event via zwp_linux_buffer_release_v1 */ struct zwp_linux_buffer_release_v1 *buffer_release; - +#endif /* each buffers own its release_fence_fd, until it passes ownership * to it to EGL */ int32_t release_fence_fd; @@ -219,6 +231,7 @@ struct _tpl_wl_egl_buffer { tpl_wl_egl_surface_t *wl_egl_surface; }; +#if TIZEN_FEATURE_ENABLE struct pst_feedback { /* to get presentation feedback from display server */ struct wp_presentation_feedback *presentation_feedback; @@ -229,6 +242,7 @@ struct pst_feedback { tpl_wl_egl_surface_t *wl_egl_surface; }; +#endif static int _get_tbm_surface_bo_name(tbm_surface_h tbm_surface); @@ -381,11 +395,13 @@ _thread_tdm_init(tpl_wl_egl_display_t *wl_egl_display) #define IMPL_TIZEN_SURFACE_SHM_VERSION 2 + static void __cb_wl_resistry_global_callback(void *data, struct wl_registry *wl_registry, uint32_t name, const char *interface, uint32_t version) { +#if TIZEN_FEATURE_ENABLE tpl_wl_egl_display_t *wl_egl_display = (tpl_wl_egl_display_t *)data; if (!strcmp(interface, "tizen_surface_shm")) { @@ -395,6 +411,7 @@ __cb_wl_resistry_global_callback(void *data, struct wl_registry *wl_registry, &tizen_surface_shm_interface, ((version < IMPL_TIZEN_SURFACE_SHM_VERSION) ? version : IMPL_TIZEN_SURFACE_SHM_VERSION)); + wl_egl_display->use_tss = TPL_TRUE; } else if (!strcmp(interface, wp_presentation_interface.name)) { wl_egl_display->presentation = wl_registry_bind(wl_registry, @@ -412,6 +429,7 @@ __cb_wl_resistry_global_callback(void *data, struct wl_registry *wl_registry, TPL_DEBUG("bind zwp_linux_explicit_synchronization_v1_interface"); } } +#endif } static void @@ -531,6 +549,7 @@ _thread_wl_display_init(tpl_wl_egl_display_t *wl_egl_display) goto fini; } +#if TIZEN_FEATURE_ENABLE /* set tizen_surface_shm's queue as client's private queue */ if (wl_egl_display->tss) { wl_proxy_set_queue((struct wl_proxy *)wl_egl_display->tss, @@ -551,18 +570,19 @@ _thread_wl_display_init(tpl_wl_egl_display_t *wl_egl_display) TPL_LOG_T("WL_EGL", "zwp_linux_explicit_synchronization_v1(%p) init.", wl_egl_display->explicit_sync); } - +#endif wl_egl_display->wl_initialized = TPL_TRUE; TPL_INFO("[WAYLAND_INIT]", "wl_egl_display(%p) wl_display(%p) wl_tbm_client(%p) event_queue(%p)", wl_egl_display, wl_egl_display->wl_display, wl_egl_display->wl_tbm_client, wl_egl_display->ev_queue); +#if TIZEN_FEATURE_ENABLE TPL_INFO("[WAYLAND_INIT]", "tizen_surface_shm(%p) wp_presentation(%p) explicit_sync(%p)", wl_egl_display->tss, wl_egl_display->presentation, wl_egl_display->explicit_sync); - +#endif fini: if (display_wrapper) wl_proxy_wrapper_destroy(display_wrapper); @@ -587,7 +607,7 @@ _thread_wl_display_fini(tpl_wl_egl_display_t *wl_egl_display) wl_egl_display->ev_queue) == -1) { _wl_display_print_err(wl_egl_display, "dispatch_queue_pending"); } - +#if TIZEN_FEATURE_ENABLE if (wl_egl_display->tss) { TPL_INFO("[TIZEN_SURFACE_SHM_DESTROY]", "wl_egl_display(%p) tizen_surface_shm(%p) fini.", @@ -611,7 +631,7 @@ _thread_wl_display_fini(tpl_wl_egl_display_t *wl_egl_display) zwp_linux_explicit_synchronization_v1_destroy(wl_egl_display->explicit_sync); wl_egl_display->explicit_sync = NULL; } - +#endif if (wl_egl_display->wl_tbm_client) { struct wl_proxy *wl_tbm = NULL; @@ -810,13 +830,16 @@ __tpl_wl_egl_display_init(tpl_display_t *display) wl_egl_display->ev_queue = NULL; wl_egl_display->wl_display = (struct wl_display *)display->native_handle; wl_egl_display->last_error = 0; + wl_egl_display->use_tss = TPL_FALSE; wl_egl_display->use_explicit_sync = TPL_FALSE; // default disabled wl_egl_display->prepared = TPL_FALSE; +#if TIZEN_FEATURE_ENABLE /* Wayland Interfaces */ wl_egl_display->tss = NULL; wl_egl_display->presentation = NULL; wl_egl_display->explicit_sync = NULL; +#endif wl_egl_display->wl_tbm_client = NULL; wl_egl_display->use_wait_vblank = TPL_TRUE; // default enabled @@ -873,7 +896,7 @@ __tpl_wl_egl_display_init(tpl_display_t *display) TPL_INFO("[DISPLAY_INIT]", "USE_WAIT_VBLANK(%s) TIZEN_SURFACE_SHM(%s) USE_EXPLICIT_SYNC(%s)", wl_egl_display->use_wait_vblank ? "TRUE" : "FALSE", - wl_egl_display->tss ? "TRUE" : "FALSE", + wl_egl_display->use_tss ? "TRUE" : "FALSE", wl_egl_display->use_explicit_sync ? "TRUE" : "FALSE"); return TPL_ERROR_NONE; @@ -1267,6 +1290,7 @@ __cb_create_commit_sync_fd(struct wl_egl_window *wl_egl_window, void *private) return commit_sync_fd; } +#if TIZEN_FEATURE_ENABLE static int __cb_create_presentation_sync_fd(struct wl_egl_window *wl_egl_window, void *private) { @@ -1357,7 +1381,7 @@ tss_flusher_listener = { __cb_tss_flusher_free_flush_callback }; /* -- END -- tizen_surface_shm_flusher_listener */ - +#endif /* -- BEGIN -- tbm_surface_queue callback funstions */ static void @@ -1443,7 +1467,7 @@ _thread_wl_egl_surface_fini(tpl_wl_egl_surface_t *wl_egl_surface) "wl_egl_surface(%p) wl_egl_window(%p) wl_surface(%p)", wl_egl_surface, wl_egl_surface->wl_egl_window, wl_egl_surface->wl_surface); - +#if TIZEN_FEATURE_ENABLE tpl_gmutex_lock(&wl_egl_surface->presentation_sync.mutex); if (wl_egl_display->presentation && wl_egl_surface->presentation_feedbacks) { @@ -1490,7 +1514,7 @@ _thread_wl_egl_surface_fini(tpl_wl_egl_surface_t *wl_egl_surface) tizen_surface_shm_flusher_destroy(wl_egl_surface->tss_flusher); wl_egl_surface->tss_flusher = NULL; } - +#endif if (wl_egl_surface->vblank && wl_egl_surface->vblank->waiting_buffers) { __tpl_list_free(wl_egl_surface->vblank->waiting_buffers, NULL); wl_egl_surface->vblank->waiting_buffers = NULL; @@ -1630,8 +1654,10 @@ __tpl_wl_egl_surface_init(tpl_surface_t *surface) wl_egl_surface->serial = 0; wl_egl_surface->vblank = NULL; +#if TIZEN_FEATURE_ENABLE wl_egl_surface->tss_flusher = NULL; wl_egl_surface->surface_sync = NULL; +#endif wl_egl_surface->post_interval = surface->post_interval; @@ -1665,7 +1691,11 @@ __tpl_wl_egl_surface_init(tpl_surface_t *surface) tizen_private->set_window_serial_callback = (void *) __cb_set_window_serial_callback; tizen_private->create_commit_sync_fd = (void *)__cb_create_commit_sync_fd; +#if TIZEN_FEATURE_ENABLE tizen_private->create_presentation_sync_fd = (void *)__cb_create_presentation_sync_fd; +#else + tizen_private->create_presentation_sync_fd = NULL; +#endif wl_egl_window->destroy_window_callback = (void *)__cb_destroy_callback; wl_egl_window->resize_callback = (void *)__cb_resize_callback; @@ -1888,7 +1918,7 @@ _thread_wl_egl_surface_init(tpl_wl_egl_surface_t *wl_egl_surface) } wl_egl_surface->vblank = vblank; - +#if TIZEN_FEATURE_ENABLE if (wl_egl_display->tss) { wl_egl_surface->tss_flusher = tizen_surface_shm_get_flusher(wl_egl_display->tss, @@ -1918,7 +1948,7 @@ _thread_wl_egl_surface_init(tpl_wl_egl_surface_t *wl_egl_surface) wl_egl_display->use_explicit_sync = TPL_FALSE; } } - +#endif wl_egl_surface->presentation_feedbacks = __tpl_list_alloc(); } @@ -2222,7 +2252,9 @@ _wl_egl_buffer_init(tpl_wl_egl_buffer_t *wl_egl_buffer, wl_egl_buffer->draw_done = TPL_FALSE; wl_egl_buffer->need_to_commit = TPL_TRUE; +#if TIZEN_FEATURE_ENABLE wl_egl_buffer->buffer_release = NULL; +#endif wl_egl_buffer->transform = tizen_private->transform; if (wl_egl_buffer->w_transform != tizen_private->window_transform) { @@ -2448,17 +2480,21 @@ __tpl_wl_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeout_ns, tpl_gmutex_lock(&wl_egl_buffer->mutex); wl_egl_buffer->status = DEQUEUED; + /* 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) { +#if TIZEN_FEATURE_ENABLE 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); wl_egl_buffer->release_fence_fd = -1; - } else { + } else +#endif + { *release_fence = -1; } } @@ -2753,9 +2789,12 @@ _thread_surface_queue_acquire(tpl_wl_egl_surface_t *wl_egl_surface) } if (wl_egl_buffer->acquire_fence_fd != -1) { +#if TIZEN_FEATURE_ENABLE if (wl_egl_surface->surface_sync) ready_to_commit = TPL_TRUE; - else { + else +#endif + { if (wl_egl_buffer->waiting_source) { tpl_gsource_destroy(wl_egl_buffer->waiting_source, TPL_FALSE); wl_egl_buffer->waiting_source = NULL; @@ -2826,6 +2865,7 @@ __cb_tdm_client_vblank(tdm_client_vblank *vblank, tdm_error error, } /* -- END -- tdm_client vblank callback function */ +#if TIZEN_FEATURE_ENABLE static void __cb_buffer_fenced_release(void *data, struct zwp_linux_buffer_release_v1 *release, int32_t fence) @@ -2930,6 +2970,7 @@ static const struct zwp_linux_buffer_release_v1_listener zwp_release_listner = { __cb_buffer_fenced_release, __cb_buffer_immediate_release, }; +#endif static void __cb_wl_buffer_release(void *data, struct wl_proxy *wl_buffer) @@ -2977,7 +3018,7 @@ __cb_wl_buffer_release(void *data, struct wl_proxy *wl_buffer) static const struct wl_buffer_listener wl_buffer_release_listener = { (void *)__cb_wl_buffer_release, }; - +#if TIZEN_FEATURE_ENABLE static void __cb_presentation_feedback_sync_output(void *data, struct wp_presentation_feedback *presentation_feedback, @@ -3091,6 +3132,7 @@ static const struct wp_presentation_feedback_listener feedback_listener = { __cb_presentation_feedback_presented, __cb_presentation_feedback_discarded }; +#endif static tpl_result_t _thread_surface_vblank_wait(tpl_wl_egl_surface_t *wl_egl_surface) @@ -3137,6 +3179,7 @@ _thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface, version = wl_proxy_get_version((struct wl_proxy *)wl_surface); +#if TIZEN_FEATURE_ENABLE /* create presentation feedback and add listener */ tpl_gmutex_lock(&wl_egl_surface->presentation_sync.mutex); if (wl_egl_display->presentation && wl_egl_buffer->presentation_sync_fd != -1) { @@ -3169,6 +3212,7 @@ _thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface, } } tpl_gmutex_unlock(&wl_egl_surface->presentation_sync.mutex); +#endif if (wl_egl_buffer->w_rotated == TPL_TRUE) { wayland_tbm_client_set_buffer_transform( @@ -3226,7 +3270,7 @@ _thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface, wayland_tbm_client_set_buffer_serial(wl_egl_display->wl_tbm_client, (void *)wl_egl_buffer->wl_buffer, wl_egl_buffer->serial); - +#if TIZEN_FEATURE_ENABLE if (wl_egl_display->use_explicit_sync && wl_egl_surface->surface_sync) { @@ -3246,7 +3290,9 @@ _thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface, wl_egl_buffer->buffer_release, &zwp_release_listner, wl_egl_buffer); TPL_DEBUG("add explicit_sync_release_listener."); } - } else { + } else +#endif + { wl_buffer_add_listener((void *)wl_egl_buffer->wl_buffer, &wl_buffer_release_listener, wl_egl_buffer); } @@ -3383,6 +3429,7 @@ __cb_wl_egl_buffer_free(tpl_wl_egl_buffer_t *wl_egl_buffer) wl_egl_buffer->wl_buffer = NULL; } +#if TIZEN_FEATURE_ENABLE if (wl_egl_buffer->buffer_release) { zwp_linux_buffer_release_v1_destroy(wl_egl_buffer->buffer_release); wl_egl_buffer->buffer_release = NULL; @@ -3392,6 +3439,7 @@ __cb_wl_egl_buffer_free(tpl_wl_egl_buffer_t *wl_egl_buffer) close(wl_egl_buffer->release_fence_fd); wl_egl_buffer->release_fence_fd = -1; } +#endif if (wl_egl_buffer->waiting_source) { tpl_gsource_destroy(wl_egl_buffer->waiting_source, TPL_FALSE); diff --git a/src/tpl_wl_vk_thread.c b/src/tpl_wl_vk_thread.c index f883334..c1e2017 100644 --- a/src/tpl_wl_vk_thread.c +++ b/src/tpl_wl_vk_thread.c @@ -19,8 +19,14 @@ #include +#ifndef TIZEN_FEATURE_ENABLE +#define TIZEN_FEATURE_ENABLE 1 +#endif + +#if TIZEN_FEATURE_ENABLE #include #include +#endif #include "tpl_utils_gthread.h" @@ -60,8 +66,9 @@ struct _tpl_wl_vk_display { int min_buffer; int max_buffer; int present_modes; - +#if TIZEN_FEATURE_ENABLE struct zwp_linux_explicit_synchronization_v1 *explicit_sync; /* for explicit fence sync */ +#endif }; struct _tpl_wl_vk_swapchain { @@ -96,8 +103,9 @@ struct _tpl_wl_vk_surface { tpl_wl_vk_swapchain_t *swapchain; struct wl_surface *wl_surface; +#if TIZEN_FEATURE_ENABLE struct zwp_linux_surface_synchronization_v1 *surface_sync; /* for explicit fence sync */ - +#endif tdm_client_vblank *vblank; /* surface information */ @@ -164,8 +172,10 @@ struct _tpl_wl_vk_buffer { /* for checking need_to_commit (frontbuffer mode) */ tpl_bool_t need_to_commit; +#if TIZEN_FEATURE_ENABLE /* to get release event via zwp_linux_buffer_release_v1 */ struct zwp_linux_buffer_release_v1 *buffer_release; +#endif /* each buffers own its release_fence_fd, until it passes ownership * to it to EGL */ @@ -321,13 +331,12 @@ _thread_tdm_init(tpl_wl_vk_display_t *wl_vk_display) return TPL_ERROR_NONE; } -#define IMPL_TIZEN_SURFACE_SHM_VERSION 2 - static void __cb_wl_resistry_global_callback(void *data, struct wl_registry *wl_registry, uint32_t name, const char *interface, uint32_t version) { +#if TIZEN_FEATURE_ENABLE tpl_wl_vk_display_t *wl_vk_display = (tpl_wl_vk_display_t *)data; if (strcmp(interface, "zwp_linux_explicit_synchronization_v1") == 0) { @@ -342,6 +351,7 @@ __cb_wl_resistry_global_callback(void *data, struct wl_registry *wl_registry, TPL_DEBUG("bind zwp_linux_explicit_synchronization_v1_interface"); } } +#endif } static void @@ -461,12 +471,14 @@ _thread_wl_display_init(tpl_wl_vk_display_t *wl_vk_display) goto fini; } +#if TIZEN_FEATURE_ENABLE if (wl_vk_display->explicit_sync) { wl_proxy_set_queue((struct wl_proxy *)wl_vk_display->explicit_sync, wl_vk_display->ev_queue); TPL_LOG_T("WL_VK", "zwp_linux_explicit_synchronization_v1(%p) init.", wl_vk_display->explicit_sync); } +#endif wl_vk_display->wl_initialized = TPL_TRUE; @@ -474,10 +486,11 @@ _thread_wl_display_init(tpl_wl_vk_display_t *wl_vk_display) "wl_vk_display(%p) wl_display(%p) wl_tbm_client(%p) event_queue(%p)", wl_vk_display, wl_vk_display->wl_display, wl_vk_display->wl_tbm_client, wl_vk_display->ev_queue); +#if TIZEN_FEATURE_ENABLE TPL_INFO("[WAYLAND_INIT]", "explicit_sync(%p)", wl_vk_display->explicit_sync); - +#endif fini: if (display_wrapper) wl_proxy_wrapper_destroy(display_wrapper); @@ -503,6 +516,7 @@ _thread_wl_display_fini(tpl_wl_vk_display_t *wl_vk_display) _wl_display_print_err(wl_vk_display, "dispatch_queue_pending"); } +#if TIZEN_FEATURE_ENABLE if (wl_vk_display->explicit_sync) { TPL_INFO("[EXPLICIT_SYNC_DESTROY]", "wl_vk_display(%p) zwp_linux_explicit_synchronization_v1(%p) fini.", @@ -510,6 +524,7 @@ _thread_wl_display_fini(tpl_wl_vk_display_t *wl_vk_display) zwp_linux_explicit_synchronization_v1_destroy(wl_vk_display->explicit_sync); wl_vk_display->explicit_sync = NULL; } +#endif if (wl_vk_display->wl_tbm_client) { struct wl_proxy *wl_tbm = NULL; @@ -708,7 +723,9 @@ __tpl_wl_vk_display_init(tpl_display_t *display) wl_vk_display->prepared = TPL_FALSE; /* Wayland Interfaces */ +#if TIZEN_FEATURE_ENABLE wl_vk_display->explicit_sync = NULL; +#endif wl_vk_display->wl_tbm_client = NULL; /* Vulkan specific surface capabilities */ @@ -1053,6 +1070,7 @@ _thread_wl_vk_surface_init(tpl_wl_vk_surface_t *wl_vk_surface) wl_vk_surface->vblank); } +#if TIZEN_FEATURE_ENABLE if (wl_vk_display->explicit_sync && wl_vk_display->use_explicit_sync) { wl_vk_surface->surface_sync = zwp_linux_explicit_synchronization_v1_get_synchronization( @@ -1067,7 +1085,7 @@ _thread_wl_vk_surface_init(tpl_wl_vk_surface_t *wl_vk_surface) wl_vk_display->use_explicit_sync = TPL_FALSE; } } - +#endif wl_vk_surface->vblank_waiting_buffers = __tpl_list_alloc(); } @@ -1085,6 +1103,7 @@ _thread_wl_vk_surface_fini(tpl_wl_vk_surface_t *wl_vk_surface) wl_vk_surface->vblank_waiting_buffers = NULL; } +#if TIZEN_FEATURE_ENABLE if (wl_vk_surface->surface_sync) { TPL_INFO("[SURFACE_SYNC_DESTROY]", "wl_vk_surface(%p) surface_sync(%p)", @@ -1092,6 +1111,7 @@ _thread_wl_vk_surface_fini(tpl_wl_vk_surface_t *wl_vk_surface) zwp_linux_surface_synchronization_v1_destroy(wl_vk_surface->surface_sync); wl_vk_surface->surface_sync = NULL; } +#endif if (wl_vk_surface->vblank) { TPL_INFO("[VBLANK_DESTROY]", @@ -1220,7 +1240,9 @@ __tpl_wl_vk_surface_init(tpl_surface_t *surface) wl_vk_surface->render_done_cnt = 0; wl_vk_surface->vblank = NULL; +#if TIZEN_FEATURE_ENABLE wl_vk_surface->surface_sync = NULL; +#endif wl_vk_surface->sent_message = NONE_MESSAGE; @@ -1788,10 +1810,12 @@ __cb_wl_vk_buffer_free(tpl_wl_vk_buffer_t *wl_vk_buffer) wl_vk_buffer->wl_buffer = NULL; } +#if TIZEN_FEATURE_ENABLE if (wl_vk_buffer->buffer_release) { zwp_linux_buffer_release_v1_destroy(wl_vk_buffer->buffer_release); wl_vk_buffer->buffer_release = NULL; } +#endif if (wl_vk_buffer->release_fence_fd != -1) { close(wl_vk_buffer->release_fence_fd); @@ -1855,8 +1879,9 @@ _wl_vk_buffer_create(tpl_wl_vk_surface_t *wl_vk_surface, wl_vk_buffer->num_rects = 0; wl_vk_buffer->need_to_commit = TPL_FALSE; +#if TIZEN_FEATURE_ENABLE wl_vk_buffer->buffer_release = NULL; - +#endif tpl_gmutex_init(&wl_vk_buffer->mutex); tpl_gcond_init(&wl_vk_buffer->cond); @@ -1975,12 +2000,15 @@ __tpl_wl_vk_surface_dequeue_buffer(tpl_surface_t *surface, wl_vk_buffer->status = DEQUEUED; if (release_fence) { +#if TIZEN_FEATURE_ENABLE if (wl_vk_surface->surface_sync) { *release_fence = wl_vk_buffer->release_fence_fd; TPL_DEBUG("wl_vk_surface(%p) wl_vk_buffer(%p) release_fence_fd(%d)", wl_vk_surface, wl_vk_buffer, *release_fence); wl_vk_buffer->release_fence_fd = -1; - } else { + } else +#endif + { *release_fence = -1; } } @@ -2196,6 +2224,7 @@ _thread_surface_queue_acquire(tpl_wl_vk_surface_t *wl_vk_surface) return TPL_ERROR_NONE; } +#if TIZEN_FEATURE_ENABLE static void __cb_buffer_fenced_release(void *data, struct zwp_linux_buffer_release_v1 *release, @@ -2319,6 +2348,7 @@ static const struct zwp_linux_buffer_release_v1_listener zwp_release_listner = { __cb_buffer_fenced_release, __cb_buffer_immediate_release, }; +#endif static void __cb_wl_buffer_release(void *data, struct wl_proxy *wl_buffer) @@ -2491,6 +2521,7 @@ _thread_wl_surface_commit(tpl_wl_vk_surface_t *wl_vk_surface, } } +#if TIZEN_FEATURE_ENABLE if (wl_vk_display->use_explicit_sync && wl_vk_surface->surface_sync && wl_vk_buffer->acquire_fence_fd != -1) { @@ -2512,6 +2543,7 @@ _thread_wl_surface_commit(tpl_wl_vk_surface_t *wl_vk_surface, TPL_DEBUG("add explicit_sync_release_listener."); } } +#endif wl_surface_commit(wl_surface); -- 2.7.4 From 465277182409974359f5f0271216be6350f313f2 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 27 Aug 2021 10:05:44 +0900 Subject: [PATCH 04/16] Add null checking to prevent problem. Change-Id: I4f837569048a151d43b0a689950ab7a4bbdd1355 Signed-off-by: Joonbum Ko --- src/tpl_wl_egl_thread.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index 5360eb7..433c38e 100755 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -3421,12 +3421,14 @@ __cb_wl_egl_buffer_free(tpl_wl_egl_buffer_t *wl_egl_buffer) } tpl_gmutex_unlock(&wl_egl_surface->buffers_mutex); - wl_display_flush(wl_egl_display->wl_display); + if (wl_egl_display) { + wl_display_flush(wl_egl_display->wl_display); - if (wl_egl_buffer->wl_buffer) { - wayland_tbm_client_destroy_buffer(wl_egl_display->wl_tbm_client, - (void *)wl_egl_buffer->wl_buffer); - wl_egl_buffer->wl_buffer = NULL; + if (wl_egl_buffer->wl_buffer) { + wayland_tbm_client_destroy_buffer(wl_egl_display->wl_tbm_client, + (void *)wl_egl_buffer->wl_buffer); + wl_egl_buffer->wl_buffer = NULL; + } } #if TIZEN_FEATURE_ENABLE -- 2.7.4 From 01918d910b4c9d41933f14764f75331ba5b3fc03 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 27 Aug 2021 10:09:09 +0900 Subject: [PATCH 05/16] Changed log printing for wl_buffer creation to TPL_INFO. Change-Id: I4885691b57910a991a15c19e45ab22fad14a37ad Signed-off-by: Joonbum Ko --- src/tpl_wl_egl_thread.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index 433c38e..12f6e3a 100755 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -2782,8 +2782,8 @@ _thread_surface_queue_acquire(tpl_wl_egl_surface_t *wl_egl_surface) TPL_WARN("Failed to create wl_buffer. wl_tbm_client(%p) tbm_surface(%p)", wl_egl_display->wl_tbm_client, tbm_surface); } else { - TPL_LOG_T("WL_EGL", - "[WL_BUFFER_CREATE] wl_egl_buffer(%p) wl_buffer(%p) tbm_surface(%p)", + TPL_INFO("[WL_BUFFER_CREATE]", + "wl_egl_buffer(%p) wl_buffer(%p) tbm_surface(%p)", wl_egl_buffer, wl_egl_buffer->wl_buffer, tbm_surface); } } -- 2.7.4 From 51b4549c2d09de7a216c1a6373df16620aecea46 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 27 Aug 2021 10:31:11 +0900 Subject: [PATCH 06/16] Fixed a problem than adds duplicate listener to wl_buffer. Change-Id: I0ab36d23602b9b3099b2057ea0701cf9a4540234 Signed-off-by: Joonbum Ko --- src/tpl_wl_egl_thread.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index 12f6e3a..aae8adb 100755 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -244,6 +244,8 @@ struct pst_feedback { }; #endif +static const struct wl_buffer_listener wl_buffer_release_listener; + static int _get_tbm_surface_bo_name(tbm_surface_h tbm_surface); static void @@ -2785,6 +2787,12 @@ _thread_surface_queue_acquire(tpl_wl_egl_surface_t *wl_egl_surface) TPL_INFO("[WL_BUFFER_CREATE]", "wl_egl_buffer(%p) wl_buffer(%p) tbm_surface(%p)", wl_egl_buffer, wl_egl_buffer->wl_buffer, tbm_surface); + if (!wl_egl_display->use_explicit_sync || + !wl_egl_surface->surface_sync) { + wl_buffer_add_listener((struct wl_buffer *)wl_egl_buffer->wl_buffer, + &wl_buffer_release_listener, + wl_egl_buffer); + } } } @@ -3173,6 +3181,17 @@ _thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface, (struct wl_proxy *)wayland_tbm_client_create_buffer( wl_egl_display->wl_tbm_client, wl_egl_buffer->tbm_surface); + TPL_INFO("[WL_BUFFER_CREATE]", + "wl_egl_buffer(%p) wl_buffer(%p) tbm_surface(%p)", + wl_egl_buffer, wl_egl_buffer->wl_buffer, + wl_egl_buffer->tbm_surface); + + if (!wl_egl_display->use_explicit_sync || + !wl_egl_surface->surface_sync) { + wl_buffer_add_listener((struct wl_buffer *)wl_egl_buffer->wl_buffer, + &wl_buffer_release_listener, + wl_egl_buffer); + } } TPL_CHECK_ON_FALSE_ASSERT_FAIL(wl_egl_buffer->wl_buffer != NULL, "[FATAL] Failed to create wl_buffer"); @@ -3290,12 +3309,8 @@ _thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface, wl_egl_buffer->buffer_release, &zwp_release_listner, wl_egl_buffer); TPL_DEBUG("add explicit_sync_release_listener."); } - } else -#endif - { - wl_buffer_add_listener((void *)wl_egl_buffer->wl_buffer, - &wl_buffer_release_listener, wl_egl_buffer); } +#endif wl_surface_commit(wl_surface); -- 2.7.4 From 5f8dcb1a4b4499407681c566a728f77e3ff57696 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 27 Aug 2021 10:31:58 +0900 Subject: [PATCH 07/16] Package version up to 1.8.12 Change-Id: Iebc56cec9361db0f42a5a9883493a4f63fcc350a Signed-off-by: Joonbum Ko --- packaging/libtpl-egl.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtpl-egl.spec b/packaging/libtpl-egl.spec index d15d8a9..8e011ea 100644 --- a/packaging/libtpl-egl.spec +++ b/packaging/libtpl-egl.spec @@ -4,7 +4,7 @@ #TPL VERSION MACROS %define TPL_VERSION_MAJOR 1 %define TPL_VERSION_MINOR 8 -%define TPL_VERSION_PATCH 11 +%define TPL_VERSION_PATCH 12 %define TPL_VERSION %{TPL_VERSION_MAJOR}.%{TPL_VERSION_MINOR}.%{TPL_VERSION_PATCH} #TPL WINDOW SYSTEM DEFINITION -- 2.7.4 From 6ec6b00d4c4268418b96329330d78ac0e5d95865 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Thu, 2 Sep 2021 15:29:20 +0900 Subject: [PATCH 08/16] Modified build error when TIZEN_FEATURE disabled. Change-Id: Ib0452ed93c86b1400a9daadfb2e295f95f11fd61 Signed-off-by: Joonbum Ko --- src/tpl_wl_egl_thread.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index aae8adb..cf6ba5e 100755 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -2787,8 +2787,11 @@ _thread_surface_queue_acquire(tpl_wl_egl_surface_t *wl_egl_surface) TPL_INFO("[WL_BUFFER_CREATE]", "wl_egl_buffer(%p) wl_buffer(%p) tbm_surface(%p)", wl_egl_buffer, wl_egl_buffer->wl_buffer, tbm_surface); +#if TIZEN_FEATURE_ENABLE if (!wl_egl_display->use_explicit_sync || - !wl_egl_surface->surface_sync) { + !wl_egl_surface->surface_sync) +#endif + { wl_buffer_add_listener((struct wl_buffer *)wl_egl_buffer->wl_buffer, &wl_buffer_release_listener, wl_egl_buffer); @@ -3186,8 +3189,11 @@ _thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface, wl_egl_buffer, wl_egl_buffer->wl_buffer, wl_egl_buffer->tbm_surface); +#if TIZEN_FEATURE_ENABLE if (!wl_egl_display->use_explicit_sync || - !wl_egl_surface->surface_sync) { + !wl_egl_surface->surface_sync) +#endif + { wl_buffer_add_listener((struct wl_buffer *)wl_egl_buffer->wl_buffer, &wl_buffer_release_listener, wl_egl_buffer); -- 2.7.4 From f8cad1c7643bdacfde646a26f0a16fe903b7cf52 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Mon, 6 Sep 2021 11:04:23 +0900 Subject: [PATCH 09/16] Move assert checking to before add listener of wl_buffer Change-Id: Ia1b6a7ed497b5f0f1d2201719a40a3d1291acff0 Signed-off-by: Joonbum Ko --- src/tpl_wl_egl_thread.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index cf6ba5e..926f669 100755 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -2792,9 +2792,9 @@ _thread_surface_queue_acquire(tpl_wl_egl_surface_t *wl_egl_surface) !wl_egl_surface->surface_sync) #endif { - wl_buffer_add_listener((struct wl_buffer *)wl_egl_buffer->wl_buffer, - &wl_buffer_release_listener, - wl_egl_buffer); + wl_buffer_add_listener((struct wl_buffer *)wl_egl_buffer->wl_buffer, + &wl_buffer_release_listener, + wl_egl_buffer); } } } @@ -3184,11 +3184,15 @@ _thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface, (struct wl_proxy *)wayland_tbm_client_create_buffer( 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"); + TPL_INFO("[WL_BUFFER_CREATE]", "wl_egl_buffer(%p) wl_buffer(%p) tbm_surface(%p)", wl_egl_buffer, wl_egl_buffer->wl_buffer, wl_egl_buffer->tbm_surface); - + #if TIZEN_FEATURE_ENABLE if (!wl_egl_display->use_explicit_sync || !wl_egl_surface->surface_sync) @@ -3199,8 +3203,6 @@ _thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface, wl_egl_buffer); } } - TPL_CHECK_ON_FALSE_ASSERT_FAIL(wl_egl_buffer->wl_buffer != NULL, - "[FATAL] Failed to create wl_buffer"); version = wl_proxy_get_version((struct wl_proxy *)wl_surface); -- 2.7.4 From d388f5958a9d0137749584ebc58c71fffbaebac0 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Mon, 6 Sep 2021 11:07:25 +0900 Subject: [PATCH 10/16] Package version up to 1.8.13 Change-Id: I53afc721c8b4a28b875c0c2f252feec3820e4311 Signed-off-by: Joonbum Ko --- packaging/libtpl-egl.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtpl-egl.spec b/packaging/libtpl-egl.spec index 8e011ea..5e11b4b 100644 --- a/packaging/libtpl-egl.spec +++ b/packaging/libtpl-egl.spec @@ -4,7 +4,7 @@ #TPL VERSION MACROS %define TPL_VERSION_MAJOR 1 %define TPL_VERSION_MINOR 8 -%define TPL_VERSION_PATCH 12 +%define TPL_VERSION_PATCH 13 %define TPL_VERSION %{TPL_VERSION_MAJOR}.%{TPL_VERSION_MINOR}.%{TPL_VERSION_PATCH} #TPL WINDOW SYSTEM DEFINITION -- 2.7.4 From eed0649f4cbf032cdda3c4331acea71e7b0931d9 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Tue, 28 Sep 2021 16:59:37 +0900 Subject: [PATCH 11/16] wayland-egl-tizen: Modified to do not create tizen_private. - tizen_private will be created by tpl_surface_create internally. - Calling any wl_egl_window_tizen APIs before calling tpl_surface_create will be ignored. Change-Id: I5d5c195e27a2ea1d74e779fd6abc6025456e5df6 Signed-off-by: Joonbum Ko --- src/wayland-egl-tizen/wayland-egl-tizen.c | 246 ++++++------------------------ 1 file changed, 48 insertions(+), 198 deletions(-) diff --git a/src/wayland-egl-tizen/wayland-egl-tizen.c b/src/wayland-egl-tizen/wayland-egl-tizen.c index bec3e92..737a324 100644 --- a/src/wayland-egl-tizen/wayland-egl-tizen.c +++ b/src/wayland-egl-tizen/wayland-egl-tizen.c @@ -38,6 +38,7 @@ #define WL_EGL_ERR(f, x...) wl_egl_log_e("[ERROR]", f, ##x) #define WL_EGL_WARN(f, x...) wl_egl_log_w("[WARN]", f, ##x) +static int error_set = 0; static int _wl_egl_tizen_magic_check(struct tizen_private *private) @@ -48,33 +49,45 @@ _wl_egl_tizen_magic_check(struct tizen_private *private) return 1; } -void -wl_egl_window_tizen_set_rotation(struct wl_egl_window *egl_window, - int rotation) +static struct tizen_private* +_wl_egl_tizen_get_tizen_private(struct wl_egl_window *egl_window) { struct tizen_private *private = NULL; + if (egl_window == NULL) { WL_EGL_ERR("egl_window is NULL"); - return; + return NULL; } - if (!egl_window->driver_private) { - private = tizen_private_create(); - if (!private) { - WL_EGL_ERR("Failed to create tizen_private."); - return; + private = (struct tizen_private *)egl_window->driver_private; + if (private == NULL) { + if (!error_set) { + WL_EGL_WARN("Should create tpl_surface with this wl_egl_window first."); + WL_EGL_WARN("All wl_egl_window_tizen APIs will be ignored."); + error_set = 1; } + return NULL; + } - egl_window->driver_private = (void *)private; - } else { - private = (struct tizen_private *)egl_window->driver_private; - if (!_wl_egl_tizen_magic_check(private)) { - WL_EGL_WARN("driver_private of wl_egl_window(%p) is not tizen_private", - egl_window); - return; - } + if (!_wl_egl_tizen_magic_check(private)) { + WL_EGL_WARN("driver_private of wl_egl_window(%p) is not tizen_private", + egl_window); + return NULL; } + /* If tizen_private is created, the error_set is restored to zero. */ + error_set = 0; + + return private; +} + +void +wl_egl_window_tizen_set_rotation(struct wl_egl_window *egl_window, + int rotation) +{ + struct tizen_private *private = _wl_egl_tizen_get_tizen_private(egl_window); + if (!private) return; + if (private->rotation == rotation) { WL_EGL_WARN("wl_egl_window(%p) rotation(%d) already rotated", egl_window, rotation); @@ -90,30 +103,10 @@ wl_egl_window_tizen_set_rotation(struct wl_egl_window *egl_window, int wl_egl_window_tizen_get_capabilities(struct wl_egl_window *egl_window) { - struct tizen_private *private = NULL; + struct tizen_private *private = _wl_egl_tizen_get_tizen_private(egl_window); int capabilities = WL_EGL_WINDOW_TIZEN_CAPABILITY_NONE; - if (egl_window == NULL) { - WL_EGL_ERR("egl_window is NULL"); - return -1; - } - - if (!egl_window->driver_private) { - private = tizen_private_create(); - if (!private) { - WL_EGL_ERR("Failed to create tizen_private."); - return -1; - } - - egl_window->driver_private = (void *)private; - } else { - private = (struct tizen_private *)egl_window->driver_private; - if (!_wl_egl_tizen_magic_check(private)) { - WL_EGL_WARN("driver_private of wl_egl_window(%p) is not tizen_private", - egl_window); - return -1; - } - } + if (!private) return capabilities; if (private->get_rotation_capability) capabilities = private->get_rotation_capability(egl_window, egl_window->driver_private); @@ -127,28 +120,8 @@ void wl_egl_window_tizen_set_buffer_transform(struct wl_egl_window *egl_window, int wl_output_transform) { - struct tizen_private *private = NULL; - if (egl_window == NULL) { - WL_EGL_ERR("egl_window is NULL"); - return; - } - - if (!egl_window->driver_private) { - private = tizen_private_create(); - if (!private) { - WL_EGL_ERR("Failed to create tizen_private."); - return; - } - - egl_window->driver_private = (void *)private; - } else { - private = (struct tizen_private *)egl_window->driver_private; - if (!_wl_egl_tizen_magic_check(private)) { - WL_EGL_WARN("driver_private of wl_egl_window(%p) is not tizen_private", - egl_window); - return; - } - } + struct tizen_private *private = _wl_egl_tizen_get_tizen_private(egl_window); + if (!private) return; if (private->transform == wl_output_transform) { WL_EGL_WARN("wl_egl_window(%p) wl_output_transform(%d) already rotated", @@ -163,28 +136,8 @@ void wl_egl_window_tizen_set_frontbuffer_mode(struct wl_egl_window *egl_window, int set) { - struct tizen_private *private = NULL; - if (egl_window == NULL) { - WL_EGL_ERR("egl_window is NULL"); - return; - } - - if (!egl_window->driver_private) { - private = tizen_private_create(); - if (!private) { - WL_EGL_ERR("Failed to create tizen_private."); - return; - } - - egl_window->driver_private = (void *)private; - } else { - private = (struct tizen_private *)egl_window->driver_private; - if (!_wl_egl_tizen_magic_check(private)) { - WL_EGL_WARN("driver_private of wl_egl_window(%p) is not tizen_private", - egl_window); - return; - } - } + struct tizen_private *private = _wl_egl_tizen_get_tizen_private(egl_window); + if (!private) return; private->frontbuffer_mode = set; @@ -197,28 +150,8 @@ void wl_egl_window_tizen_set_window_transform(struct wl_egl_window *egl_window, int window_transform) { - struct tizen_private *private = NULL; - if (egl_window == NULL) { - WL_EGL_ERR("egl_window is NULL"); - return; - } - - if (!egl_window->driver_private) { - private = tizen_private_create(); - if (!private) { - WL_EGL_ERR("Failed to create tizen_private."); - return; - } - - egl_window->driver_private = (void *)private; - } else { - private = (struct tizen_private *)egl_window->driver_private; - if (!_wl_egl_tizen_magic_check(private)) { - WL_EGL_WARN("driver_private of wl_egl_window(%p) is not tizen_private", - egl_window); - return; - } - } + struct tizen_private *private = _wl_egl_tizen_get_tizen_private(egl_window); + if (!private) return; if (private->window_transform == window_transform) { WL_EGL_WARN("wl_egl_window(%p) window_transform(%d) already rotated", @@ -232,28 +165,8 @@ wl_egl_window_tizen_set_window_transform(struct wl_egl_window *egl_window, unsigned int wl_egl_window_tizen_get_window_serial(struct wl_egl_window *egl_window) { - struct tizen_private *private = NULL; - if (egl_window == NULL) { - WL_EGL_ERR("egl_window is NULL"); - return 0; - } - - if (!egl_window->driver_private) { - private = tizen_private_create(); - if (!private) { - WL_EGL_ERR("Failed to create tizen_private."); - return 0; - } - - egl_window->driver_private = (void *)private; - } else { - private = (struct tizen_private *)egl_window->driver_private; - if (!_wl_egl_tizen_magic_check(private)) { - WL_EGL_WARN("driver_private of wl_egl_window(%p) is not tizen_private", - egl_window); - return 0; - } - } + struct tizen_private *private = _wl_egl_tizen_get_tizen_private(egl_window); + if (!private) return 0; return private->serial; } @@ -262,23 +175,8 @@ void wl_egl_window_tizen_set_window_serial(struct wl_egl_window *egl_window, unsigned int serial) { - struct tizen_private *private = NULL; - if (egl_window == NULL) { - WL_EGL_ERR("egl_window is NULL"); - return; - } - - private = egl_window->driver_private; - if (private == NULL) { - WL_EGL_ERR("wl_egl_window(%p) dirver_private is NULL", egl_window); - return; - } - - if (!_wl_egl_tizen_magic_check(private)) { - WL_EGL_WARN("driver_private of wl_egl_window(%p) is not tizen_private", - egl_window); - return; - } + struct tizen_private *private = _wl_egl_tizen_get_tizen_private(egl_window); + if (!private) return; if (private->set_window_serial_callback) private->set_window_serial_callback(egl_window, egl_window->driver_private, @@ -288,24 +186,8 @@ wl_egl_window_tizen_set_window_serial(struct wl_egl_window *egl_window, int wl_egl_window_tizen_create_commit_sync_fd(struct wl_egl_window *egl_window) { - struct tizen_private *private = NULL; - - if (egl_window == NULL) { - WL_EGL_ERR("egl_window is NULL"); - return -1; - } - - private = egl_window->driver_private; - if (private == NULL) { - WL_EGL_ERR("wl_egl_window(%p) dirver_private is NULL", egl_window); - return -1; - } - - if (!_wl_egl_tizen_magic_check(private)) { - WL_EGL_WARN("driver_private of wl_egl_window(%p) is not tizen_private", - egl_window); - return -1; - } + struct tizen_private *private = _wl_egl_tizen_get_tizen_private(egl_window); + if (!private) return -1; if (private->create_commit_sync_fd) return private->create_commit_sync_fd(egl_window, egl_window->driver_private); @@ -316,24 +198,8 @@ wl_egl_window_tizen_create_commit_sync_fd(struct wl_egl_window *egl_window) int wl_egl_window_tizen_create_presentation_sync_fd(struct wl_egl_window *egl_window) { - struct tizen_private *private = NULL; - - if (egl_window == NULL) { - WL_EGL_ERR("egl_window is NULL"); - return -1; - } - - private = egl_window->driver_private; - if (private == NULL) { - WL_EGL_ERR("wl_egl_window(%p) dirver_private is NULL", egl_window); - return -1; - } - - if (!_wl_egl_tizen_magic_check(private)) { - WL_EGL_WARN("driver_private of wl_egl_window(%p) is not tizen_private", - egl_window); - return -1; - } + struct tizen_private *private = _wl_egl_tizen_get_tizen_private(egl_window); + if (!private) return -1; if (private->create_presentation_sync_fd) return private->create_presentation_sync_fd(egl_window, egl_window->driver_private); @@ -345,24 +211,8 @@ int wl_egl_window_tizen_merge_sync_fds(struct wl_egl_window *egl_window, int sync_fd1, int sync_fd2) { - struct tizen_private *private = NULL; - - if (egl_window == NULL) { - WL_EGL_ERR("egl_window is NULL"); - return -1; - } - - private = egl_window->driver_private; - if (private == NULL) { - WL_EGL_ERR("wl_egl_window(%p) dirver_private is NULL", egl_window); - return -1; - } - - if (!_wl_egl_tizen_magic_check(private)) { - WL_EGL_WARN("driver_private of wl_egl_window(%p) is not tizen_private", - egl_window); - return -1; - } + struct tizen_private *private = _wl_egl_tizen_get_tizen_private(egl_window); + if (!private) return -1; if (private->merge_sync_fds) return private->merge_sync_fds(egl_window->driver_private, sync_fd1, sync_fd2); -- 2.7.4 From f8c5fd0acece4db073e3a5838875d5982abe1bea Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Tue, 28 Sep 2021 17:03:57 +0900 Subject: [PATCH 12/16] wayland_egl_tizen: Move tizen_private_create() to each backend. - Move the function implementation of tizen_private_create() to each backend. - Since wl_egl_window_tizen APIs are not used anymore, it is not necessary to provide in wayland-egl-tizen-priv.h Change-Id: I9309914f4c7a2c3267b5fd1edf844c25e866e64a Signed-off-by: Joonbum Ko --- src/tpl_wayland_egl.c | 26 ++++++++++++++++++++++++++ src/tpl_wl_egl_thread.c | 26 ++++++++++++++++++++++++++ src/wayland-egl-tizen/wayland-egl-tizen-priv.h | 26 -------------------------- 3 files changed, 52 insertions(+), 26 deletions(-) diff --git a/src/tpl_wayland_egl.c b/src/tpl_wayland_egl.c index 3ff1817..113159d 100755 --- a/src/tpl_wayland_egl.c +++ b/src/tpl_wayland_egl.c @@ -104,6 +104,32 @@ static void __tpl_wayland_egl_buffer_free(tpl_wayland_egl_buffer_t *wayland_egl_buffer); static struct tizen_private * +tizen_private_create() +{ + struct tizen_private *private = NULL; + private = (struct tizen_private *)calloc(1, sizeof(struct tizen_private)); + if (private) { + private->magic = WL_EGL_TIZEN_MAGIC; + private->rotation = 0; + private->frontbuffer_mode = 0; + private->transform = 0; + private->window_transform = 0; + private->serial = 0; + + private->data = NULL; + private->rotate_callback = NULL; + private->get_rotation_capability = NULL; + private->set_window_serial_callback = NULL; + private->set_frontbuffer_callback = NULL; + private->create_commit_sync_fd = NULL; + private->create_presentation_sync_fd = NULL; + private->merge_sync_fds = NULL; + } + + return private; +} + +static struct tizen_private * _get_tizen_private(struct wl_egl_window * wl_egl_window) { if (wl_egl_window && wl_egl_window->driver_private) diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index 926f669..ac8d2c4 100755 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -266,6 +266,32 @@ _thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface, static void __cb_surface_vblank_free(void *data); +static struct tizen_private * +tizen_private_create() +{ + struct tizen_private *private = NULL; + private = (struct tizen_private *)calloc(1, sizeof(struct tizen_private)); + if (private) { + private->magic = WL_EGL_TIZEN_MAGIC; + private->rotation = 0; + private->frontbuffer_mode = 0; + private->transform = 0; + private->window_transform = 0; + private->serial = 0; + + private->data = NULL; + private->rotate_callback = NULL; + private->get_rotation_capability = NULL; + private->set_window_serial_callback = NULL; + private->set_frontbuffer_callback = NULL; + private->create_commit_sync_fd = NULL; + private->create_presentation_sync_fd = NULL; + private->merge_sync_fds = NULL; + } + + return private; +} + static tpl_bool_t _check_native_handle_is_wl_display(tpl_handle_t display) { diff --git a/src/wayland-egl-tizen/wayland-egl-tizen-priv.h b/src/wayland-egl-tizen/wayland-egl-tizen-priv.h index af307da..1d7f834 100644 --- a/src/wayland-egl-tizen/wayland-egl-tizen-priv.h +++ b/src/wayland-egl-tizen/wayland-egl-tizen-priv.h @@ -32,32 +32,6 @@ struct tizen_private { int (*merge_sync_fds)(void *, int, int); }; -static struct tizen_private* -tizen_private_create() -{ - struct tizen_private *private = NULL; - private = (struct tizen_private *)calloc(1, sizeof(struct tizen_private)); - if (private) { - private->magic = WL_EGL_TIZEN_MAGIC; - private->rotation = 0; - private->frontbuffer_mode = 0; - private->transform = 0; - private->window_transform = 0; - private->serial = 0; - - private->data = NULL; - private->rotate_callback = NULL; - private->get_rotation_capability = NULL; - private->set_window_serial_callback = NULL; - private->set_frontbuffer_callback = NULL; - private->create_commit_sync_fd = NULL; - private->create_presentation_sync_fd = NULL; - private->merge_sync_fds = NULL; - } - - return private; -} - #ifdef __cplusplus } #endif -- 2.7.4 From 56dc5ca2c6a0a2c011749647d3b07056dc7e0ac0 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Tue, 5 Oct 2021 12:25:19 +0900 Subject: [PATCH 13/16] Package version up to 1.8.14 Change-Id: Ib22f2cefd37b778270b6a6c1b774edd79d1c8eb4 Signed-off-by: Joonbum Ko --- packaging/libtpl-egl.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtpl-egl.spec b/packaging/libtpl-egl.spec index 5e11b4b..d83d4c4 100644 --- a/packaging/libtpl-egl.spec +++ b/packaging/libtpl-egl.spec @@ -4,7 +4,7 @@ #TPL VERSION MACROS %define TPL_VERSION_MAJOR 1 %define TPL_VERSION_MINOR 8 -%define TPL_VERSION_PATCH 13 +%define TPL_VERSION_PATCH 14 %define TPL_VERSION %{TPL_VERSION_MAJOR}.%{TPL_VERSION_MINOR}.%{TPL_VERSION_PATCH} #TPL WINDOW SYSTEM DEFINITION -- 2.7.4 From bb4ddfbc86b7dcaab25de58ae743d909656d329c Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Thu, 21 Oct 2021 20:39:24 +0900 Subject: [PATCH 14/16] Modified to create wl_buffer only just before surface commit. - While surface is destroyed, it is to prevent unintentional generation of wl_proxy. Change-Id: Ic4b90c33d213453bad38ffd72cb9c2efbbfa5aa5 Signed-off-by: Joonbum Ko --- src/tpl_wl_egl_thread.c | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index ac8d2c4..0c27e50 100755 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -2800,31 +2800,6 @@ _thread_surface_queue_acquire(tpl_wl_egl_surface_t *wl_egl_surface) wl_egl_buffer, tbm_surface, _get_tbm_surface_bo_name(tbm_surface)); - if (wl_egl_buffer->wl_buffer == NULL) { - tpl_wl_egl_display_t *wl_egl_display = wl_egl_surface->wl_egl_display; - wl_egl_buffer->wl_buffer = - (struct wl_proxy *)wayland_tbm_client_create_buffer( - wl_egl_display->wl_tbm_client, tbm_surface); - - if (!wl_egl_buffer->wl_buffer) { - TPL_WARN("Failed to create wl_buffer. wl_tbm_client(%p) tbm_surface(%p)", - wl_egl_display->wl_tbm_client, tbm_surface); - } else { - TPL_INFO("[WL_BUFFER_CREATE]", - "wl_egl_buffer(%p) wl_buffer(%p) tbm_surface(%p)", - wl_egl_buffer, wl_egl_buffer->wl_buffer, tbm_surface); -#if TIZEN_FEATURE_ENABLE - if (!wl_egl_display->use_explicit_sync || - !wl_egl_surface->surface_sync) -#endif - { - wl_buffer_add_listener((struct wl_buffer *)wl_egl_buffer->wl_buffer, - &wl_buffer_release_listener, - wl_egl_buffer); - } - } - } - if (wl_egl_buffer->acquire_fence_fd != -1) { #if TIZEN_FEATURE_ENABLE if (wl_egl_surface->surface_sync) @@ -3218,7 +3193,7 @@ _thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface, "wl_egl_buffer(%p) wl_buffer(%p) tbm_surface(%p)", wl_egl_buffer, wl_egl_buffer->wl_buffer, wl_egl_buffer->tbm_surface); - + #if TIZEN_FEATURE_ENABLE if (!wl_egl_display->use_explicit_sync || !wl_egl_surface->surface_sync) @@ -3471,13 +3446,13 @@ __cb_wl_egl_buffer_free(tpl_wl_egl_buffer_t *wl_egl_buffer) tpl_gmutex_unlock(&wl_egl_surface->buffers_mutex); if (wl_egl_display) { - wl_display_flush(wl_egl_display->wl_display); - if (wl_egl_buffer->wl_buffer) { wayland_tbm_client_destroy_buffer(wl_egl_display->wl_tbm_client, (void *)wl_egl_buffer->wl_buffer); wl_egl_buffer->wl_buffer = NULL; } + + wl_display_flush(wl_egl_display->wl_display); } #if TIZEN_FEATURE_ENABLE -- 2.7.4 From 395fc2833a72f76b5c6286189599f4de752b83b1 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Thu, 21 Oct 2021 20:44:05 +0900 Subject: [PATCH 15/16] Change the timeout limit to 200ms. Change-Id: I05669288993d565f821594e19fcc404f8c02b4a5 Signed-off-by: Joonbum Ko --- src/tpl_wl_egl_thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index 0c27e50..11c7f16 100755 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -2027,7 +2027,7 @@ _tpl_wl_egl_surface_buffer_clear(tpl_wl_egl_surface_t *wl_egl_surface) tpl_gmutex_unlock(&wl_egl_display->wl_event_mutex); wait_result = tpl_cond_timed_wait(&wl_egl_buffer->cond, &wl_egl_buffer->mutex, - 50); /* 50ms */ + 200); /* 200ms */ tpl_gmutex_lock(&wl_egl_display->wl_event_mutex); if (wait_result == TPL_ERROR_TIME_OUT) -- 2.7.4 From 79c88ec669470aa34f40632d8b6a169109387e85 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Thu, 21 Oct 2021 21:16:35 +0900 Subject: [PATCH 16/16] Package version up to 1.8.15 Change-Id: Ie037ea92b73da3efb0e4ff953d6a65823036f7ad Signed-off-by: Joonbum Ko --- packaging/libtpl-egl.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtpl-egl.spec b/packaging/libtpl-egl.spec index d83d4c4..12d7ffd 100644 --- a/packaging/libtpl-egl.spec +++ b/packaging/libtpl-egl.spec @@ -4,7 +4,7 @@ #TPL VERSION MACROS %define TPL_VERSION_MAJOR 1 %define TPL_VERSION_MINOR 8 -%define TPL_VERSION_PATCH 14 +%define TPL_VERSION_PATCH 15 %define TPL_VERSION %{TPL_VERSION_MAJOR}.%{TPL_VERSION_MINOR}.%{TPL_VERSION_PATCH} #TPL WINDOW SYSTEM DEFINITION -- 2.7.4