tpl_wayland_egl_thread: Modified wait_vblank handling of PRESENT_MODE_FIFO. 99/189599/1
authorJoonbum Ko <joonbum.ko@samsung.com>
Wed, 19 Sep 2018 05:45:48 +0000 (14:45 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Wed, 19 Sep 2018 06:16:36 +0000 (15:16 +0900)
 - PRESENT_MODE_FIFO has been modified to be dependent on
  the behavior of the display server which can use HW vblank.
  (Therefore, PRESENT_MODE_IMMEDIATE and PRESENT_MODE_FIFO_RELAXED
   are not meaningful because client can not control HW vblank.)

 - If the client sends a commit only once per one vblank,
  the display server will perform pageflip on the HW vsync,
  so the latency of PRESENT_MODE_FIFO can be reduced.

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

index 12b7315..62061b4 100644 (file)
@@ -1644,24 +1644,6 @@ __cb_tdm_client_wait_vblank(tdm_client_vblank *vblank, tdm_error error,
                        break;
 
                case TPL_DISPLAY_PRESENT_MODE_FIFO:
-                       if (surf_source->vblank_waiting_buffers) {
-                               tbm_surface_h tbm_surface = NULL;
-                               tbm_surface = (tbm_surface_h)__tpl_list_pop_front(
-                                                                       surf_source->vblank_waiting_buffers,
-                                                                       NULL);
-                               if (tbm_surface)
-                                       _twe_thread_wl_vk_surface_commit(surf_source, tbm_surface);
-                       }
-
-                       if (!__tpl_list_is_empty(surf_source->vblank_waiting_buffers)) {
-                               tpl_result_t res = TPL_ERROR_NONE;
-                               res = _twe_surface_wait_vblank(surf_source);
-                               if (res != TPL_ERROR_NONE)
-                                       TPL_ERR("Failed to set wait vblank. surf_source(%p)",
-                                                       surf_source);
-                       }
-                       break;
-
                case TPL_DISPLAY_PRESENT_MODE_FIFO_RELAXED:
                        if (surf_source->vblank_waiting_buffers) {
                                tbm_surface_h tbm_surface = NULL;
@@ -1780,7 +1762,9 @@ _twe_thread_wl_vk_surface_commit(twe_wl_surf_source *surf_source,
                          tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0)));
 
        if (surf_source->swapchain_properties.present_mode
-                       == TPL_DISPLAY_PRESENT_MODE_FIFO_RELAXED) {
+                       == TPL_DISPLAY_PRESENT_MODE_FIFO_RELAXED ||
+                       surf_source->swapchain_properties.present_mode
+                       == TPL_DISPLAY_PRESENT_MODE_FIFO) {
                if (_twe_surface_wait_vblank(surf_source) != TPL_ERROR_NONE)
                        TPL_ERR("Failed to set wait vblank");
        }
@@ -2002,21 +1986,6 @@ _twe_thread_wl_surface_acquire_and_commit(twe_wl_surf_source *surf_source)
                                break;
 
                        case TPL_DISPLAY_PRESENT_MODE_FIFO:
-                               if (surf_source->vblank_done) {
-                                       if (_twe_surface_wait_vblank(surf_source) != TPL_ERROR_NONE) {
-                                               TPL_WARN("Failed to set wait vblank. Falling back to IMMEDIATE_MODE.");
-                                               _twe_thread_wl_vk_surface_commit(surf_source, tbm_surface);
-                                       }
-                               }
-                               if (surf_source->vblank_waiting_buffers) {
-                                       __tpl_list_push_back(surf_source->vblank_waiting_buffers,
-                                                                                (void *)tbm_surface);
-
-                               } else {
-                                       TPL_ERR("Invalid list. vblank_waiting_buffers is NULL.");
-                               }
-                               break;
-
                        case TPL_DISPLAY_PRESENT_MODE_FIFO_RELAXED:
                                if (surf_source->vblank_done) {
                                        _twe_thread_wl_vk_surface_commit(surf_source, tbm_surface);