zink: handle broken resource mapping deadlocks
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Wed, 30 Jun 2021 18:35:02 +0000 (14:35 -0400)
committerMarge Bot <emma+marge@anholt.net>
Wed, 26 Oct 2022 18:29:16 +0000 (18:29 +0000)
commit8dd314d2035876c62292f633819105939c3f6933
tree39a18333e79200a1183da4a2dd4c6004c302b086
parent5e05d98848cfc04a38cd893b77c3f7d6a6288009
zink: handle broken resource mapping deadlocks

some apps (most notably Wolfenstein: The New Order) have broken multi-context
buffer usage in which one context will attempt to write to a buffer while
another context holds unflushed usage, and the unflushed context will never
flush until the buffer write completes

it's impossible to handle this scenario correctly without deadlocking,
so add some handling to try waiting and then yolo the buffer write if
a deadlock would occur

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19141>
src/gallium/drivers/zink/zink_batch.c
src/gallium/drivers/zink/zink_batch.h
src/gallium/drivers/zink/zink_bo.h
src/gallium/drivers/zink/zink_resource.c
src/gallium/drivers/zink/zink_resource.h