wl_egl: Set last_enq_buffer before tbm enqueue 15/284515/2
authorJoonbum Ko <joonbum.ko@samsung.com>
Fri, 18 Nov 2022 08:30:17 +0000 (17:30 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Mon, 21 Nov 2022 11:34:19 +0000 (20:34 +0900)
 - Since the operation from queue_enqueue to surface_commit
  can be done at a time slice in thread, last_enq_buffer
  must be set to enqueued tbm_surface before tbm queue enqueue
  to initialize with NULL when do surface_commit.

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

index 0c22cb6..5c4be2a 100755 (executable)
@@ -2812,6 +2812,10 @@ __tpl_wl_egl_surface_enqueue_buffer(tpl_surface_t *surface,
 
        tpl_gmutex_unlock(&wl_egl_buffer->mutex);
 
+       tpl_gmutex_lock(&wl_egl_surface->surf_mutex);
+       wl_egl_surface->last_enq_buffer = tbm_surface;
+       tpl_gmutex_unlock(&wl_egl_surface->surf_mutex);
+
        tsq_err = tbm_surface_queue_enqueue(wl_egl_surface->tbm_queue,
                                                                                tbm_surface);
        if (tsq_err != TBM_SURFACE_QUEUE_ERROR_NONE) {
@@ -2822,10 +2826,6 @@ __tpl_wl_egl_surface_enqueue_buffer(tpl_surface_t *surface,
                return TPL_ERROR_INVALID_OPERATION;
        }
 
-       tpl_gmutex_lock(&wl_egl_surface->surf_mutex);
-       wl_egl_surface->last_enq_buffer = tbm_surface;
-       tpl_gmutex_unlock(&wl_egl_surface->surf_mutex);
-
        tbm_surface_internal_unref(tbm_surface);
 
        TRACE_ASYNC_END((intptr_t)tbm_surface, "[DEQ]~[ENQ] BO_NAME:%d", bo_name);