Fix issue when reset 39/273639/2
authorXuelian Bai <xuelian.bai@samsung.com>
Mon, 11 Apr 2022 07:02:57 +0000 (15:02 +0800)
committerXuelian Bai <xuelian.bai@samsung.com>
Fri, 15 Apr 2022 07:17:42 +0000 (15:17 +0800)
Set ref_cnt as 1 before CREATE_QUEUE, or when queue is reused and
ref_cnt is increased, the ref_cnt will be set back to 1.
Set format as default when reset

Change-Id: I0bd90a361d26329cb86393b1eaddf1013af09244
Signed-off-by: Xuelian Bai <xuelian.bai@samsung.com>
src/tpl_wl_vk_thread.c

index 40f7e81..f9d6952 100644 (file)
@@ -1489,7 +1489,7 @@ _thread_swapchain_create_tbm_queue(tpl_wl_vk_surface_t *wl_vk_surface)
                        tbm_surface_queue_reset(swapchain->tbm_queue,
                                                                        swapchain->properties.width,
                                                                        swapchain->properties.height,
-                                                                       swapchain->properties.format);
+                                                                       TBM_FORMAT_ARGB8888);
                        TPL_INFO("[RESIZE]",
                                         "wl_vk_surface(%p) swapchain(%p) tbm_queue(%p) (%dx%d)->(%dx%d)",
                                         wl_vk_surface, swapchain, swapchain->tbm_queue,
@@ -1612,9 +1612,12 @@ __tpl_wl_vk_surface_create_swapchain(tpl_surface_t *surface,
        swapchain->properties.height       = height;
        swapchain->properties.present_mode = present_mode;
        swapchain->wl_vk_surface           = wl_vk_surface;
+       swapchain->properties.format       = format;
 
        wl_vk_surface->swapchain           = swapchain;
 
+       __tpl_util_atomic_set(&swapchain->ref_cnt, 1);
+
        tpl_gmutex_lock(&wl_vk_surface->surf_mutex);
        /* send swapchain create tbm_queue message */
        wl_vk_surface->sent_message = CREATE_QUEUE;
@@ -1627,9 +1630,9 @@ __tpl_wl_vk_surface_create_swapchain(tpl_surface_t *surface,
                swapchain->tbm_queue != NULL,
                "[CRITICAL FAIL] Failed to create tbm_surface_queue");
 
+
        wl_vk_surface->reset = TPL_FALSE;
 
-       __tpl_util_atomic_set(&swapchain->ref_cnt, 1);
 
        return TPL_ERROR_NONE;
 }