wl_egl: check is_activated after calling can_dequeue 43/305343/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 11:05:53 +0000 (20:05 +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: I88b58a62bc42537d7bd8fe1d446a343fd40aab7b
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
src/tpl_wl_egl_thread.c

index 23574a327d4f61edb50ccca5e820a53e26c07a70..1b16009662c38cff25cdc3ae37d79bbb36bb1a7a 100755 (executable)
@@ -1540,7 +1540,6 @@ __cb_tbm_queue_reset_callback(tbm_surface_queue_h tbm_queue,
 {
        tpl_wl_egl_display_t *wl_egl_display = NULL;
        tpl_surface_t *surface = NULL;
-       tpl_bool_t is_activated = TPL_FALSE;
        int width, height;
 
        tpl_wl_egl_surface_t wl_egl_surface(data);
@@ -1563,25 +1562,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->is_activated = is_activated;
-       }
-
        wl_egl_surface->reset = TPL_TRUE;
 
        if (surface->reset_cb)
@@ -2798,6 +2778,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.