wl_egl: check is_activated after calling can_dequeue 13/305313/1
authorJoonbum Ko <joonbum.ko@samsung.com>
Wed, 17 Jan 2024 05:04:55 +0000 (14:04 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Wed, 31 Jan 2024 07:26:11 +0000 (16:26 +0900)
 - to resolve regression issue related to support frontbuffer rendering mode.
 - The issue was caused by the commit below

    wl_egl: remove checking activated when dequeue buffer
    c362b0b2860d1ebab098956e2567aeef8313952c

     - Actual buffer will be attached when calling tbm_surface_queue_can_dequeue().
      So calling wayland_tbm_client_queue_check_activate() at dequeue_buffer
      is not appropriate.

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

index b715f03a0093b198363253301a7d313b01399031..f77d7ad97ece2f77769e297fa187cb9ee25549a6 100755 (executable)
@@ -1537,7 +1537,6 @@ __cb_tbm_queue_reset_callback(tbm_surface_queue_h tbm_queue,
        tpl_wl_egl_surface_t *wl_egl_surface = NULL;
        tpl_wl_egl_display_t *wl_egl_display = NULL;
        tpl_surface_t *surface = NULL;
-       tpl_bool_t is_activated = TPL_FALSE;
        int width, height;
 
        wl_egl_surface = (tpl_wl_egl_surface_t *)data;
@@ -1560,23 +1559,6 @@ __cb_tbm_queue_reset_callback(tbm_surface_queue_h tbm_queue,
                                 surface->width, surface->height, width, height);
        }
 
-       /* When queue_reset_callback is called, if is_activated is different from
-        * its previous state change the reset flag to TPL_TRUE to get a new buffer
-        * with the changed state(ACTIVATED/DEACTIVATED) at the next frame. */
-       is_activated = wayland_tbm_client_queue_check_activate(wl_egl_display->wl_tbm_client,
-                                                                                                                  wl_egl_surface->tbm_queue);
-       if (wl_egl_surface->is_activated != is_activated) {
-               if (is_activated) {
-                       TPL_INFO("[ACTIVATED]",
-                                         "wl_egl_surface(%p) wl_surface(%p) tbm_queue(%p)",
-                                         wl_egl_surface, wl_egl_surface->wl_surface, tbm_queue);
-               } else {
-                       TPL_INFO("[DEACTIVATED]",
-                                        " wl_egl_surface(%p) wl_surface(%p) tbm_queue(%p)",
-                                        wl_egl_surface, wl_egl_surface->wl_surface, tbm_queue);
-               }
-       }
-
        wl_egl_surface->reset = TPL_TRUE;
 
        if (surface->reset_cb)
@@ -2630,6 +2612,24 @@ __tpl_wl_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeout_ns,
        wl_egl_surface->width = surface->width;
        wl_egl_surface->height = surface->height;
 
+       if (wl_egl_surface->reset) {
+               tpl_bool_t is_activated = wayland_tbm_client_queue_check_activate(
+                                                                               wl_egl_display->wl_tbm_client,
+                                                                               wl_egl_surface->tbm_queue);
+               if (wl_egl_surface->is_activated != is_activated) {
+                       if (is_activated) {
+                               TPL_INFO("[ACTIVATED]",
+                                                 "wl_egl_surface(%p) wl_surface(%p) tbm_queue(%p)",
+                                                 wl_egl_surface, wl_egl_surface->wl_surface, wl_egl_surface->tbm_queue);
+                       } else {
+                               TPL_INFO("[DEACTIVATED]",
+                                                " wl_egl_surface(%p) wl_surface(%p) tbm_queue(%p)",
+                                                wl_egl_surface, wl_egl_surface->wl_surface, wl_egl_surface->tbm_queue);
+                       }
+               }
+
+               wl_egl_surface->is_activated  = is_activated;
+       }
 
        /* If surface->frontbuffer is not null, the frontbuffer rendering mode will be
         * maintained if the surface state meets the conditions below.