[repost] drm sync objects cleaned up

Jason Ekstrand jason at jlekstrand.net
Tue Apr 18 21:55:16 UTC 2017


A few thoughts (from the anv perspective) that I put on IRC but may be
better in a mail.  In no particular order:

 1. Having the fd exported from a syncobj be a valid sync_file seems like a
fairly pointless feature to me.  If we can make things more sane by
throwing that out, I'm all for it.

 2. As far as sync_file interactions go, I think the far more useful thing
would be for you to be able to export a sync_file from a syncobj which
would create a sync_file that waits on the last submitted signal operation
on the syncobj and then have a way of creating a temporary syncobj that has
the fence from a sync_file.  Not sure how this would interact with future
fences.  If we can't figure it out, let's just forget it and not have any
defined interaction.

 3. I'd like to also be able to use syncobj for implementing VkFence
sharing.  Really, all this means is a drm_syncobj_wait ioctl.  Yes, with
the current sync_file stuff, you could turn it into a sync_file and poll
but I'd rather not burn the file descriptors.

 4. It would be a neat trick if drm_syncobj_wait could take a list of
syncobjs and wait on one or all of them as requested by the user.  That
said, this would be an optimization at best and I'm fine with waiting on
them one at a time.

 5. I'd like to better define what happens when someone tries to wait
twice.  I'm a big fan of the semantics of dma-buf dependencies: Each wait
operation waits on the most recently queued signal operation.  That seems
better to me than waiting causing an implicit reset and waiting twice being
invalid.  Among other things, it means that we don't have to worry bout the
semantics of exactly how execbuf fails if you ask it to wait on the same
sync file twice.  That said, it can be anything we want, I just want it to
be well-defined.

--Jason


On Tue, Apr 18, 2017 at 1:30 PM, Chris Wilson <chris at chris-wilson.co.uk>
wrote:

> On Wed, Apr 19, 2017 at 05:34:52AM +1000, Dave Airlie wrote:
> > On 14 April 2017 at 19:45, Chris Wilson <chris at chris-wilson.co.uk>
> wrote:
> > > On Tue, Apr 11, 2017 at 01:22:12PM +1000, Dave Airlie wrote:
> > >> This set of sync object patches should address most of the issues
> > >> raised in review.
> > >>
> > >> The major changes:
> > >> Race on destroy should be gone,
> > >> Documentation fixups
> > >> amdgpu internal use p instead of adev fixups
> > >>
> > >> My plans are to write some igt tests this week, and try
> > >> to get some more review on what the API should allow (should
> > >> I lock it down to drm syncobj is just semaphores for now).
> > >
> > > Having an idr of handles is much, much nicer than fd and I want the
> same
> > > for fences :)
> >
> > Okay, but what form do you want the API to take for fences?
> >
> > because I've just ported all this to using sem_file as the backend,
> instead
> > of sync_file which seems to oppose the goal of using it for fences.
> >
> > For fences do you want upfront creation, then passing created fences
> object
> > into command submission that attach the internal fence?
>
> Yes. My understanding is that fences differ from semaphores by allowing
> use prior to execution. And that userspace (Vk) wants to be able to
> create a fence, pass it to a listener (maybe different process) and then
> attach it to an out-fence from a CS.
>
> I looked at using a shared idr for fences/semaphores and the issue I hit
> first was having to create a proxy dma-fence to initialise the syncobj
> with, so that I could attach listeners before I was able to hook the
> fence upto an execbuf.
>
> > Or do you want command submission to have out fence handles that it
> creates,
> > so we don't have any explicit syncobj create for fences?
> >
> > Do you want those fences to be shareable across processes using sync_file
> > semantics?
>
> Yes. In the same vein as the semaphore syncobjs, an idr for cheap
> creation/reuse within a process and export/import via sync_file fds.
> Where these fd differ from sema is that they do support host CPU access
> (these will work just like regular sync_files in that regard).
>
> > I kinda feel like I'm going around in circles here and I'm going to just
> merge
> > something instead.
>
> Sure. It was just from the perspective of extending the i915 execbuffer2
> that adding an array for semaphore in/out could be neatly generalised to
> cover fences as well (and that the api for syncobj is a substantial
> improvement over sync_merge and passing one fence in/out).
> -Chris
>
> --
> Chris Wilson, Intel Open Source Technology Centre
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20170418/57f9b526/attachment-0001.html>


More information about the dri-devel mailing list