<div dir="ltr"><div><div><div><div><div>A few thoughts (from the anv perspective) that I put on IRC but may be better in a mail.  In no particular order:<br><br></div> 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.<br><br></div><div> 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.<br></div><div><br></div> 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.<br><br></div> 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.<br><br></div> 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.<br><br></div><div>--Jason<br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 18, 2017 at 1:30 PM, Chris Wilson <span dir="ltr"><<a href="mailto:chris@chris-wilson.co.uk" target="_blank">chris@chris-wilson.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wed, Apr 19, 2017 at 05:34:52AM +1000, Dave Airlie wrote:<br>
> On 14 April 2017 at 19:45, Chris Wilson <<a href="mailto:chris@chris-wilson.co.uk">chris@chris-wilson.co.uk</a>> wrote:<br>
> > On Tue, Apr 11, 2017 at 01:22:12PM +1000, Dave Airlie wrote:<br>
> >> This set of sync object patches should address most of the issues<br>
> >> raised in review.<br>
> >><br>
> >> The major changes:<br>
> >> Race on destroy should be gone,<br>
> >> Documentation fixups<br>
> >> amdgpu internal use p instead of adev fixups<br>
> >><br>
> >> My plans are to write some igt tests this week, and try<br>
> >> to get some more review on what the API should allow (should<br>
> >> I lock it down to drm syncobj is just semaphores for now).<br>
> ><br>
> > Having an idr of handles is much, much nicer than fd and I want the same<br>
> > for fences :)<br>
><br>
> Okay, but what form do you want the API to take for fences?<br>
><br>
> because I've just ported all this to using sem_file as the backend, instead<br>
> of sync_file which seems to oppose the goal of using it for fences.<br>
><br>
> For fences do you want upfront creation, then passing created fences object<br>
> into command submission that attach the internal fence?<br>
<br>
</span>Yes. My understanding is that fences differ from semaphores by allowing<br>
use prior to execution. And that userspace (Vk) wants to be able to<br>
create a fence, pass it to a listener (maybe different process) and then<br>
attach it to an out-fence from a CS.<br>
<br>
I looked at using a shared idr for fences/semaphores and the issue I hit<br>
first was having to create a proxy dma-fence to initialise the syncobj<br>
with, so that I could attach listeners before I was able to hook the<br>
fence upto an execbuf.<br>
<span class=""><br>
> Or do you want command submission to have out fence handles that it creates,<br>
> so we don't have any explicit syncobj create for fences?<br>
><br>
> Do you want those fences to be shareable across processes using sync_file<br>
> semantics?<br>
<br>
</span>Yes. In the same vein as the semaphore syncobjs, an idr for cheap<br>
creation/reuse within a process and export/import via sync_file fds.<br>
Where these fd differ from sema is that they do support host CPU access<br>
(these will work just like regular sync_files in that regard).<br>
<span class=""><br>
> I kinda feel like I'm going around in circles here and I'm going to just merge<br>
> something instead.<br>
<br>
</span>Sure. It was just from the perspective of extending the i915 execbuffer2<br>
that adding an array for semaphore in/out could be neatly generalised to<br>
cover fences as well (and that the api for syncobj is a substantial<br>
improvement over sync_merge and passing one fence in/out).<br>
<span class="im HOEnZb">-Chris<br>
<br>
--<br>
Chris Wilson, Intel Open Source Technology Centre<br>
</span><div class="HOEnZb"><div class="h5">______________________________<wbr>_________________<br>
dri-devel mailing list<br>
<a href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.<wbr>org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/dri-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/dri-devel</a><br>
</div></div></blockquote></div><br></div>