zink: add a swapchain readback case for reading differently-acquired image

if a swapchain is shared between multiple resources, a deadlock and/or invalid
data will result from readback attempts if one resource holds a swapchain
image that the other resource must read from

to avoid this, allow accessing the acquiring resource directly since this is
the only sane way to perform readback

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27553>
This commit is contained in:
Mike Blumenkrantz 2024-02-21 16:31:10 -05:00
parent ae80f9ce65
commit d5d5f54fe9

View file

@ -873,6 +873,11 @@ zink_kopper_acquire_readback(struct zink_context *ctx, struct zink_resource *res
*readback = res;
return false;
}
if (cswap->images[last_dt_idx].acquired) {
struct zink_resource *rb = cswap->images[last_dt_idx].acquired;
*readback = rb;
return false;
}
if (cswap->images[last_dt_idx].readback) {
struct zink_resource *rb = zink_resource(cswap->images[res->obj->last_dt_idx].readback);
if (rb->valid) {