Flush vblank waiting buffers when tdm error occured. 72/266672/1
authorJoonbum Ko <joonbum.ko@samsung.com>
Wed, 17 Nov 2021 04:31:12 +0000 (13:31 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Wed, 17 Nov 2021 04:42:24 +0000 (13:42 +0900)
 - If tdm error such as TIEMOUT occured,
  flush all vblank waiting buffers of its wl_egl_surface.
   Otherwise, only one wl_egl_buffer will be commited
  per one vblank event.

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

index 11c7f16..6fcce36 100755 (executable)
@@ -2866,12 +2866,19 @@ __cb_tdm_client_vblank(tdm_client_vblank *vblank, tdm_error error,
 
        tpl_gmutex_lock(&wl_egl_surface->surf_mutex);
        if (wl_egl_surface->vblank && wl_egl_surface->vblank->waiting_buffers) {
-               wl_egl_buffer = (tpl_wl_egl_buffer_t *)__tpl_list_pop_front(
-                                                       wl_egl_surface->vblank->waiting_buffers,
-                                                       NULL);
-
-               if (wl_egl_buffer)
-                       _thread_wl_surface_commit(wl_egl_surface, wl_egl_buffer);
+               while (!__tpl_list_is_empty(wl_egl_surface->vblank->waiting_buffers)) {
+                       wl_egl_buffer = (tpl_wl_egl_buffer_t *)__tpl_list_pop_front(
+                                                               wl_egl_surface->vblank->waiting_buffers,
+                                                               NULL);
+                       if (wl_egl_buffer)
+                               _thread_wl_surface_commit(wl_egl_surface, wl_egl_buffer);
+
+                       /* If tdm error such as TIEMOUT occured,
+                        * flush all vblank waiting buffers of its wl_egl_surface.
+                        * Otherwise, only one wl_egl_buffer will be commited per one vblank event.
+                        */
+                       if (error == TDM_ERROR_NONE) break;
+               }
        }
        tpl_gmutex_unlock(&wl_egl_surface->surf_mutex);
 }