zink: add surface ref during rebind if unflushed usage
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Tue, 11 May 2021 13:22:25 +0000 (09:22 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 7 Jul 2021 00:22:10 +0000 (00:22 +0000)
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11692>

src/gallium/drivers/zink/zink_surface.c

index 1ec8876..7cfc211 100644 (file)
@@ -256,6 +256,8 @@ zink_rebind_surface(struct zink_context *ctx, struct pipe_surface **psurface)
 
    simple_mtx_lock(&screen->surface_mtx);
    struct hash_entry *new_entry = _mesa_hash_table_search_pre_hashed(&screen->surface_cache, hash, &ivci);
+   if (zink_batch_usage_exists(surface->batch_uses))
+      zink_batch_reference_surface(&ctx->batch, surface);
    surface_clear_fb_refs(screen, *psurface);
    zink_descriptor_set_refs_clear(&surface->desc_set_refs, surface);
    if (new_entry) {