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>
(cherry picked from commit 70b40fd2a0)
This commit is contained in:
Mike Blumenkrantz 2024-06-25 12:39:26 -04:00 committed by Eric Engestrom
parent fe4312235f
commit fbd4b2be5b
2 changed files with 9 additions and 5 deletions

View file

@ -224,7 +224,7 @@
"description": "zink: modify some buffer mapping behavior for buffer replacement srcs",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -2393,10 +2393,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) {
@ -2437,6 +2439,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: