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

Author: Mike Blumenkrantz <[email protected]>
Date:   Mon Sep 19 15:16:39 2022 -0400

zink: track current queue for resources

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21733>

---

 src/gallium/drivers/zink/zink_resource.c | 4 ++++
 src/gallium/drivers/zink/zink_types.h    | 1 +
 2 files changed, 5 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_resource.c 
b/src/gallium/drivers/zink/zink_resource.c
index bf584053845..5faf37fe138 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -1202,6 +1202,7 @@ resource_create(struct pipe_screen *pscreen,
       return NULL;
    }
 
+   res->queue = VK_QUEUE_FAMILY_IGNORED;
    res->internal_format = templ->format;
    if (templ->target == PIPE_BUFFER) {
       util_range_init(&res->valid_buffer_range);
@@ -1267,6 +1268,7 @@ resource_create(struct pipe_screen *pscreen,
       res->linear = false;
       res->swapchain = true;
    }
+
    if (!res->obj->host_visible)
       res->base.b.flags |= PIPE_RESOURCE_FLAG_DONT_MAP_DIRECTLY;
    if (res->obj->is_buffer) {
@@ -1327,6 +1329,7 @@ add_resource_bind(struct zink_context *ctx, struct 
zink_resource *res, unsigned
    staging.all_binds = 0;
    res->layout = VK_IMAGE_LAYOUT_UNDEFINED;
    res->obj = new_obj;
+   res->queue = VK_QUEUE_FAMILY_IGNORED;
    for (unsigned i = 0; i <= res->base.b.last_level; i++) {
       struct pipe_box box = {0, 0, 0,
                              u_minify(res->base.b.width0, i),
@@ -1677,6 +1680,7 @@ invalidate_buffer(struct zink_context *ctx, struct 
zink_resource *res)
    /* this ref must be transferred before rebind or else BOOM */
    zink_batch_reference_resource_move(&ctx->batch, res);
    res->obj = new_obj;
+   res->queue = VK_QUEUE_FAMILY_IGNORED;
    zink_resource_rebind(ctx, res);
    return true;
 }
diff --git a/src/gallium/drivers/zink/zink_types.h 
b/src/gallium/drivers/zink/zink_types.h
index c99ca1dcd1e..2eee620d0ca 100644
--- a/src/gallium/drivers/zink/zink_types.h
+++ b/src/gallium/drivers/zink/zink_types.h
@@ -1182,6 +1182,7 @@ struct zink_resource {
    enum pipe_format internal_format:16;
 
    struct zink_resource_object *obj;
+   uint32_t queue;
    union {
       struct {
          struct util_range valid_buffer_range;

Reply via email to