tpl_wayland_egl_thread: Fixed to do acquire_and_commit until there was no tbm_surface... 65/135165/4
authorjoonbum.ko <joonbum.ko@samsung.com>
Wed, 24 May 2017 06:49:53 +0000 (15:49 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Thu, 22 Jun 2017 08:55:37 +0000 (08:55 +0000)
 - One or more tbm_surfaces that are not consumed can be in tbm_surface_queue
  because event_fd has two writes but read may be processed only once.

Change-Id: Iae3fa749f411e1ce957317a1b1d9085948a22e55
Signed-off-by: joonbum.ko <joonbum.ko@samsung.com>
src/tpl_wayland_egl_thread.c

index 3323372..e467a77 100644 (file)
@@ -900,35 +900,35 @@ _twe_thread_wl_surface_acquire_and_commit(twe_wl_surf_source *surf_source)
        tbm_surface_h tbm_surface = NULL;
        tbm_surface_queue_error_e tsq_err = TBM_SURFACE_QUEUE_ERROR_NONE;
 
-       if (!tbm_surface_queue_can_acquire(surf_source->tbm_queue, 0)) {
-               TPL_ERR("Received acquirable event, but nothing to commit.");
-               return;
-       }
+       /* One or more tbm_surfaces that are not consumed can be in tbm_surface_queue
+        * because event_fd has two writes but read may be processed only once.
+        */
+       while (tbm_surface_queue_can_acquire(surf_source->tbm_queue, 0)) {
+               tsq_err = tbm_surface_queue_acquire(surf_source->tbm_queue, &tbm_surface);
+               if (!tbm_surface || tsq_err != TBM_SURFACE_QUEUE_ERROR_NONE) {
+                       TPL_ERR("Failed to acquire from tbm_queue(%p)",
+                                       surf_source->tbm_queue);
+                       return;
+               }
 
-       tsq_err = tbm_surface_queue_acquire(surf_source->tbm_queue, &tbm_surface);
-       if (!tbm_surface || tsq_err != TBM_SURFACE_QUEUE_ERROR_NONE) {
-               TPL_ERR("Failed to acquire from tbm_queue(%p)",
-                               surf_source->tbm_queue);
-               return;
-       }
+               tbm_surface_internal_ref(tbm_surface);
 
-       tbm_surface_internal_ref(tbm_surface);
+               TPL_LOG_T("WL_EGL", "[ACQ] tbm_surface(%p) bo(%d)",
+                               tbm_surface,
+                               tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0)));
 
-       TPL_LOG_T("WL_EGL", "[ACQ] tbm_surface(%p) bo(%d)",
-                         tbm_surface,
-                         tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0)));
+               while (!surf_source->vblank_done) {
+                       tdm_error tdm_err = TDM_ERROR_NONE;
 
-       while (!surf_source->vblank_done) {
-               tdm_error tdm_err = TDM_ERROR_NONE;
-
-               tdm_err = tdm_client_handle_events(_twe_ctx->tdm_client);
-               if (tdm_err != TDM_ERROR_NONE) {
-                       TPL_ERR("Failed to tdm_client_handle_events.");
-                       break;
+                       tdm_err = tdm_client_handle_events(_twe_ctx->tdm_client);
+                       if (tdm_err != TDM_ERROR_NONE) {
+                               TPL_ERR("Failed to tdm_client_handle_events.");
+                               break;
+                       }
                }
-       }
 
-       _twe_thread_wl_surface_commit(surf_source, tbm_surface);
+               _twe_thread_wl_surface_commit(surf_source, tbm_surface);
+       }
 }
 
 static gboolean