tpl_wl_egl_thread: Changed the wait flag to enable waiting in can_dequeue. 37/191937/1
authorJoonbum Ko <joonbum.ko@samsung.com>
Thu, 25 Oct 2018 23:53:44 +0000 (08:53 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Thu, 25 Oct 2018 23:53:48 +0000 (08:53 +0900)
 - Using the while loop with can_dequeue(wait=0) can occur high cpu usage problem.

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

index e9e463b056680c212e9a3dc168f879584871d16d..07ba6cc98beffd15bae025707939b20f5dd88bb0 100644 (file)
@@ -661,8 +661,9 @@ __tpl_wl_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeout_ns,
                *sync_fence = -1;
 
        TPL_OBJECT_UNLOCK(surface);
-       while (!tbm_surface_queue_can_dequeue(wayland_egl_surface->tbm_queue, 0)) {
-               /* waiting for dequeueable */
+       if (!tbm_surface_queue_can_dequeue(wayland_egl_surface->tbm_queue, 1)) {
+               TPL_ERR("Failed to query can_dequeue. tbm_queue(%p)", wayland_egl_surface->tbm_queue);
+               return NULL;
        }
        TPL_OBJECT_LOCK(surface);