swapchain_tpl: Modified tpl_object to be retained during swapchain re-creating. 83/161983/1
authorjoonbum.ko <joonbum.ko@samsung.com>
Tue, 14 Nov 2017 02:40:35 +0000 (11:40 +0900)
committerjoonbum.ko <joonbum.ko@samsung.com>
Thu, 16 Nov 2017 06:33:48 +0000 (15:33 +0900)
Change-Id: I9a7b1ae0b5550864d36a61f1e67f842866d1770c
Signed-off-by: joonbum.ko <joonbum.ko@samsung.com>
src/wsi/swapchain_tpl.c

index 909c38c..890405f 100644 (file)
@@ -59,6 +59,16 @@ swapchain_tpl_acquire_next_image(VkDevice                     device,
 
        *tbm_surface = tpl_surface_dequeue_buffer_with_sync(swapchain_tpl->tpl_surface,
                                                                                                                timeout, sync);
+
+       if (*tbm_surface == NULL && !tpl_surface_validate(swapchain_tpl->tpl_surface)) {
+               /* Returning VK_ERROR_OUT_OF_DATE_KHR calls swapchain_tpl_deinit
+                * to destroy the existing swapchain, but does not want the existing
+                * tpl_surface and tpl_display to be destroyed. */
+               tpl_object_reference((tpl_object_t *)swapchain_tpl->tpl_display);
+               tpl_object_reference((tpl_object_t *)swapchain_tpl->tpl_surface);
+               return VK_ERROR_OUT_OF_DATE_KHR;
+       }
+
        if (*tbm_surface == NULL) {
                if (timeout == 0)
                        return VK_NOT_READY;