[RFC] Add DMA_RESV_USAGE flags

Daniel Vetter daniel at ffwll.ch
Mon May 17 15:04:02 UTC 2021


On Mon, May 17, 2021 at 04:11:18PM +0200, Christian König wrote:
> We had a long outstanding problem in amdgpu that buffers exported to
> user drivers by DMA-buf serialize all command submissions using them.
> 
> In other words we can't compose the buffer with different engines and
> then send it to another driver for display further processing.
> 
> This was added to work around the fact that i915 didn't wanted to wait
> for shared fences in the dma_resv objects before displaying a buffer.
> 
> Since this problem is now causing issues with Vulkan we need to find a
> better solution for that.
> 
> The patch set here tries to do this by adding an usage flag to the
> shared fences noting when and how they should participate in implicit
> synchronization.

So the way this is fixed in every other vulkan driver is that vulkan
userspace sets flags in the CS ioctl when it wants to synchronize with
implicit sync. This gets you mostly there. Last time I checked amdgpu
isn't doing this, and yes that's broken.

I915 and iirc msm has explicit flags for this, panfrost was designed to
support this correctly from the start (also with flags I think). That's at
least what I remember from all the discussions at XDC and #dri-devel, but
didn't check the code again to give you the list of uapi flags you need
for each driver.

The other piece is making sure you're only picking up implicit fences when
you should, and not any later ones, for which Jason has a solution:

https://lore.kernel.org/dri-devel/20210317221940.2146688-1-jason@jlekstrand.net/

If amdgpu isn't using those, then you will suffer from
over-synchronization in vulkan and pay a price. The entire point of vulkan
is that you pick up sync points very explicitly, and we also need to have
very explicit uapi for userspace to pick up/set the implicit fences.

Trying to paper over this with more implicit magic is imo just wrong, and
definitely not the long term explicit sync model we want.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list