zink: try to prune resources from barrier jit on fb unbind

if a resource has no binds remaining then it should not remain in
the queue for barrier updates on the next draw

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22398>
(cherry picked from commit 75a7dcf35f)
This commit is contained in:
Mike Blumenkrantz 2023-04-07 17:06:45 -04:00 committed by Dylan Baker
parent 74ab3c8ec3
commit e8f90ac985
2 changed files with 3 additions and 1 deletions

View file

@ -5214,7 +5214,7 @@
"description": "zink: try to prune resources from barrier jit on fb unbind",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -2952,6 +2952,8 @@ unbind_fb_surface(struct zink_context *ctx, struct pipe_surface *surf, unsigned
ctx->rp_changed = true;
}
res->fb_bind_count--;
if (!res->fb_bind_count && !res->bind_count[0])
_mesa_set_remove_key(ctx->need_barriers[0], res);
unsigned feedback_loops = ctx->feedback_loops;
if (ctx->feedback_loops & BITFIELD_BIT(idx)) {
ctx->dynamic_fb.attachments[idx].imageLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;