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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30107>
This commit is contained in:
Mike Blumenkrantz
2024-06-25 12:39:26 -04:00
committed by Marge Bot
parent 76da22bfc2
commit 70b40fd2a0

View File

@@ -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: