Mesa (main): zink: improve no-op acquire detection

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 28 02:57:46 UTC 2022


Module: Mesa
Branch: main
Commit: 8606e5cff8f28e10eef8aa9a5916777eaf7891f9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8606e5cff8f28e10eef8aa9a5916777eaf7891f9

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Tue Jun 21 11:22:41 2022 -0400

zink: improve no-op acquire detection

the swapchain may have successfully completed the acquire in a previous
batch, in which case a new acquire is not needed

Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17149>

---

 src/gallium/drivers/zink/zink_kopper.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/zink/zink_kopper.c b/src/gallium/drivers/zink/zink_kopper.c
index 88ca980679c..66c7bcf7b0d 100644
--- a/src/gallium/drivers/zink/zink_kopper.c
+++ b/src/gallium/drivers/zink/zink_kopper.c
@@ -450,7 +450,16 @@ static VkResult
 kopper_acquire(struct zink_screen *screen, struct zink_resource *res, uint64_t timeout)
 {
    struct kopper_displaytarget *cdt = kopper_displaytarget(res->obj->dt);
-   if (res->obj->acquire)
+
+   /* if:
+    * - we don't need a new image
+    * - we have a swapchain image
+    * - that image is either acquired or acquiring
+    *
+    * then this is a no-op
+    */
+   if (!res->obj->new_dt && res->obj->dt_idx != UINT32_MAX &&
+       (cdt->swapchain->images[res->obj->dt_idx].acquire || cdt->swapchain->images[res->obj->dt_idx].acquired))
       return VK_SUCCESS;
    res->obj->acquire = VK_NULL_HANDLE;
    VkSemaphore acquire = VK_NULL_HANDLE;



More information about the mesa-commit mailing list