From da1ac780bfaf8a52a0081b3746c045e949745249 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 19 Jan 2023 13:33:04 -0500 Subject: [PATCH] zink: preserve present resources during async presentation ensure that these have a lifetime great enough to be presented fixes #7781 cc: mesa-stable Part-of: (cherry picked from commit 020db79340a1932c5229574a9e5d1ccec4e5c9da) --- .pick_status.json | 2 +- src/gallium/drivers/zink/zink_kopper.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index c4a39ab..c3971cc 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2605,7 +2605,7 @@ "description": "zink: preserve present resources during async presentation", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/zink/zink_kopper.c b/src/gallium/drivers/zink/zink_kopper.c index 1df8c84..6070abb 100644 --- a/src/gallium/drivers/zink/zink_kopper.c +++ b/src/gallium/drivers/zink/zink_kopper.c @@ -715,8 +715,11 @@ kopper_present(void *data, void *gdata, int thread_idx) } util_dynarray_append(arr, VkSemaphore, cpi->sem); out: - if (thread_idx != -1) + if (thread_idx != -1) { p_atomic_dec(&swapchain->async_presents); + struct pipe_resource *pres = &cpi->res->base.b; + pipe_resource_reference(&pres, NULL); + } free(cpi); } @@ -760,6 +763,8 @@ zink_kopper_present_queue(struct zink_screen *screen, struct zink_resource *res) } if (util_queue_is_initialized(&screen->flush_queue)) { p_atomic_inc(&cpi->swapchain->async_presents); + struct pipe_resource *pres = NULL; + pipe_resource_reference(&pres, &res->base.b); util_queue_add_job(&screen->flush_queue, cpi, &cdt->present_fence, kopper_present, NULL, 0); } else { -- 2.7.4