From 0d44d3c97f421eeb0c8d90d951ba2f3ca0146d39 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Wed, 17 Jan 2024 14:04:55 +0900 Subject: [PATCH] wl_egl: check is_activated after calling can_dequeue - 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 --- src/tpl_wl_egl_thread.c | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index 23574a3..1b16009 100755 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -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. -- 2.34.1