From 70b40fd2a0cb4036f70cdc07e6d918c9876c6ea1 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 25 Jun 2024 12:39:26 -0400 Subject: [PATCH] zink: modify some buffer mapping behavior for buffer replacement srcs if the src for a replace_buffer call is mapped after replacement: * avoid clearing access flags * update valid range the pointer access here is always safe because the only case in which this scenario can occur is if tc is forced to sync immediately after creating a replaceent buffer, and the replacement buffer's lifetime will always be exceeded by the lifetime of the real buffer cc: mesa-stable Part-of: --- src/gallium/drivers/zink/zink_resource.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index 71d79fa460b..8fea8b13721 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -2395,10 +2395,12 @@ overwrite: zink_resource_usage_wait(ctx, res, ZINK_RESOURCE_ACCESS_RW); } else zink_resource_usage_wait(ctx, res, ZINK_RESOURCE_ACCESS_WRITE); - res->obj->access = 0; - res->obj->access_stage = 0; - res->obj->last_write = 0; - zink_resource_copies_reset(res); + if (!res->real_buffer_range) { + res->obj->access = 0; + res->obj->access_stage = 0; + res->obj->last_write = 0; + zink_resource_copies_reset(res); + } } if (!ptr) { @@ -2439,6 +2441,8 @@ overwrite: struct zink_resource *orig_res = zink_resource(trans->base.b.resource); util_range_add(&orig_res->base.b, &orig_res->valid_buffer_range, box->x, box->x + box->width); + if (orig_res->real_buffer_range) + util_range_add(&orig_res->base.b, orig_res->real_buffer_range, box->x, box->x + box->width); } success: