asahi: Make bo->writer_syncobj atomic
authorAsahi Lina <lina@asahilina.net>
Wed, 10 May 2023 07:02:27 +0000 (16:02 +0900)
committerMarge Bot <emma+marge@anholt.net>
Thu, 11 May 2023 23:24:48 +0000 (23:24 +0000)
commit94c9115aa0a44ae18d90a60129a0b44517896e3d
treeaea5e3ec9efa24df0b9995124b1de82787a3fc36
parentdc1a18b0ed54e53b969c4143f3fb694463c956d8
asahi: Make bo->writer_syncobj atomic

BOs can be written from several contexts, so writing to this member is
racy. We only care about this for the purposes of exporting BOs after a
submission (and if the app is racing writers/submissions at that point
all bets are off), so just keeping track of the last written value is
sufficient.

Switch to atomic operations to eliminate the race, and drop the assert
in the batch cleanup path that no longer holds when the BO might have
been written to from another context.

Fixes: asahi/mesa#20

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22971>
src/asahi/lib/agx_bo.c
src/asahi/lib/agx_bo.h
src/asahi/lib/agx_device.c
src/gallium/drivers/asahi/agx_batch.c