Modified to create wl_buffer only just before surface commit. 34/265534/1
authorJoonbum Ko <joonbum.ko@samsung.com>
Thu, 21 Oct 2021 11:39:24 +0000 (20:39 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Thu, 21 Oct 2021 12:15:59 +0000 (21:15 +0900)
 - While surface is destroyed, it is to prevent unintentional
  generation of wl_proxy.

Change-Id: Ic4b90c33d213453bad38ffd72cb9c2efbbfa5aa5
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
src/tpl_wl_egl_thread.c

index ac8d2c4..0c27e50 100755 (executable)
@@ -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