Mesa (staging/22.1): zink: move the kopper present fence to the displaytarget object
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Apr 22 16:02:23 UTC 2022
Module: Mesa
Branch: staging/22.1
Commit: c5f6ff9d3e57fd634228eee30106a9f6aa0f170f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c5f6ff9d3e57fd634228eee30106a9f6aa0f170f
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Wed Apr 20 15:32:05 2022 -0400
zink: move the kopper present fence to the displaytarget object
this is otherwise broken when front/back buffers share the same dt
Fixes: 8ade5588e39 ("zink: add kopper api")
Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16070>
(cherry picked from commit 64d5f71bbcb92b564377664371397f8d0a5b57be)
---
.pick_status.json | 2 +-
src/gallium/drivers/zink/zink_kopper.c | 6 ++++--
src/gallium/drivers/zink/zink_kopper.h | 1 +
src/gallium/drivers/zink/zink_resource.c | 2 --
src/gallium/drivers/zink/zink_resource.h | 1 -
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 7e591ebb4c4..8322d33e8f8 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -463,7 +463,7 @@
"description": "zink: move the kopper present fence to the displaytarget object",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": "8ade5588e39d736bdeab9bdd8ffa7cbfb6a5191e"
},
diff --git a/src/gallium/drivers/zink/zink_kopper.c b/src/gallium/drivers/zink/zink_kopper.c
index 3fbf6857a78..28b303ec33a 100644
--- a/src/gallium/drivers/zink/zink_kopper.c
+++ b/src/gallium/drivers/zink/zink_kopper.c
@@ -148,6 +148,7 @@ zink_kopper_deinit_displaytarget(struct zink_screen *screen, struct kopper_displ
VKSCR(DestroySurfaceKHR)(screen->instance, cdt->surface, NULL);
cdt->swapchain = cdt->old_swapchain = NULL;
cdt->surface = VK_NULL_HANDLE;
+ util_queue_fence_destroy(&cdt->present_fence);
}
static struct kopper_swapchain *
@@ -322,6 +323,7 @@ zink_kopper_displaytarget_create(struct zink_screen *screen, unsigned tex_usage,
cdt->refcount = 1;
cdt->loader_private = (void*)loader_private;
cdt->info = *info;
+ util_queue_fence_init(&cdt->present_fence);
enum pipe_format srgb = PIPE_FORMAT_NONE;
if (screen->info.have_KHR_swapchain_mutable_format) {
@@ -403,7 +405,7 @@ kopper_acquire(struct zink_screen *screen, struct zink_resource *res, uint64_t t
}
if (timeout == UINT64_MAX && util_queue_is_initialized(&screen->flush_queue) &&
p_atomic_read_relaxed(&cdt->swapchain->num_acquires) > cdt->swapchain->max_acquires) {
- util_queue_fence_wait(&res->obj->present_fence);
+ util_queue_fence_wait(&cdt->present_fence);
}
VkSemaphoreCreateInfo sci = {
VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO,
@@ -600,7 +602,7 @@ zink_kopper_present_queue(struct zink_screen *screen, struct zink_resource *res)
cpi->info.pResults = NULL;
res->obj->present = VK_NULL_HANDLE;
if (util_queue_is_initialized(&screen->flush_queue)) {
- util_queue_add_job(&screen->flush_queue, cpi, &res->obj->present_fence,
+ util_queue_add_job(&screen->flush_queue, cpi, &cdt->present_fence,
kopper_present, NULL, 0);
} else {
kopper_present(cpi, screen, 0);
diff --git a/src/gallium/drivers/zink/zink_kopper.h b/src/gallium/drivers/zink/zink_kopper.h
index 2adebcd0fee..da083dfdcb5 100644
--- a/src/gallium/drivers/zink/zink_kopper.h
+++ b/src/gallium/drivers/zink/zink_kopper.h
@@ -62,6 +62,7 @@ struct kopper_displaytarget
struct kopper_swapchain *old_swapchain;
struct kopper_loader_info info;
+ struct util_queue_fence present_fence;
VkSurfaceCapabilitiesKHR caps;
VkImageFormatListCreateInfoKHR format_list;
diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index 80c74449130..90ae9238460 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -104,7 +104,6 @@ zink_destroy_resource_object(struct zink_screen *screen, struct zink_resource_ob
zink_descriptor_set_refs_clear(&obj->desc_set_refs, obj);
if (obj->dt) {
- util_queue_fence_destroy(&obj->present_fence);
FREE(obj->bo); //this is a dummy struct
} else
zink_bo_unref(screen, obj->bo);
@@ -521,7 +520,6 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t
if (loader_private) {
obj->bo = CALLOC_STRUCT(zink_bo);
obj->transfer_dst = true;
- util_queue_fence_init(&obj->present_fence);
return obj;
} else if (templ->target == PIPE_BUFFER) {
VkBufferCreateInfo bci = create_bci(screen, templ, templ->bind);
diff --git a/src/gallium/drivers/zink/zink_resource.h b/src/gallium/drivers/zink/zink_resource.h
index 0321b4a1fb7..2b6de9a7170 100644
--- a/src/gallium/drivers/zink/zink_resource.h
+++ b/src/gallium/drivers/zink/zink_resource.h
@@ -91,7 +91,6 @@ struct zink_resource_object {
bool new_dt;
bool dt_has_data;
bool indefinite_acquire;
- struct util_queue_fence present_fence;
// }
More information about the mesa-commit
mailing list