asahi: Support importing sync objects on BO export
authorAsahi Lina <lina@asahilina.net>
Fri, 3 Mar 2023 09:55:24 +0000 (18:55 +0900)
committerMarge Bot <emma+marge@anholt.net>
Thu, 16 Mar 2023 20:42:01 +0000 (20:42 +0000)
commite6b565699fcc22a3f68377b80f03c17f5204c1da
treef5dca43117f559c807cd125ef1ea6c279ae44602
parentc4aa7828b345a5c289b301a566488d2f080e0794
asahi: Support importing sync objects on BO export

When a BO is exported, implicit sync convention requires that writers
signal a fence on the object when complete. We already do this for BOs
that are *already* exported, but it is possible for a BO to be written
to, then exported for the first time.

Add a field to agx_bo to keep track of the current writer syncobj
handle. On first export, we use this to import it into the DMA-BUF.

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