From 9ac84dba7245ed32e4657bcb2d9e79ccc86cd724 Mon Sep 17 00:00:00 2001 From: "joonbum.ko" Date: Tue, 14 Nov 2017 11:40:35 +0900 Subject: [PATCH] swapchain_tpl: Modified tpl_object to be retained during swapchain re-creating. Change-Id: I9a7b1ae0b5550864d36a61f1e67f842866d1770c Signed-off-by: joonbum.ko --- src/wsi/swapchain_tpl.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/wsi/swapchain_tpl.c b/src/wsi/swapchain_tpl.c index 909c38c..890405f 100644 --- a/src/wsi/swapchain_tpl.c +++ b/src/wsi/swapchain_tpl.c @@ -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; -- 2.7.4