zink: use zink_resource_object::views to defer deferred storage view deletion
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Tue, 25 Oct 2022 17:38:34 +0000 (13:38 -0400)
committerMarge Bot <emma+marge@anholt.net>
Thu, 27 Oct 2022 14:43:50 +0000 (14:43 +0000)
this is basically the same thing, so reuse the existing mechanism

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

src/gallium/drivers/zink/zink_surface.c
src/gallium/drivers/zink/zink_types.h

index 53b94a9..076c9ca 100644 (file)
@@ -324,8 +324,6 @@ zink_destroy_surface(struct zink_screen *screen, struct pipe_surface *psurface)
       simple_mtx_unlock(&res->surface_mtx);
    }
    simple_mtx_lock(&res->obj->view_lock);
-   if (surface->simage_view)
-      util_dynarray_append(&res->obj->views, VkImageView, surface->simage_view);
    if (surface->is_swapchain) {
       for (unsigned i = 0; i < surface->swapchain_size; i++)
          util_dynarray_append(&res->obj->views, VkImageView, surface->swapchain[i]);
@@ -383,7 +381,9 @@ zink_rebind_surface(struct zink_context *ctx, struct pipe_surface **psurface)
    surface->ivci = ivci;
    entry = _mesa_hash_table_insert_pre_hashed(&res->surface_cache, surface->hash, &surface->ivci, surface);
    assert(entry);
-   surface->simage_view = surface->image_view;
+   simple_mtx_lock(&res->obj->view_lock);
+   util_dynarray_append(&res->obj->views, VkImageView, surface->image_view);
+   simple_mtx_unlock(&res->obj->view_lock);
    surface->image_view = image_view;
    surface->obj = zink_resource(surface->base.texture)->obj;
    /* update for imageless fb */
index a319fe0..9b4f33a 100644 (file)
@@ -1316,7 +1316,6 @@ struct zink_surface {
    void *dt;
    VkImageView *swapchain;
    unsigned swapchain_size;
-   VkImageView simage_view;//old iview after storage replacement/rebind
    void *obj; //backing resource object
    uint32_t hash;
 };