[SNIP]If you're using gpuvm, just call drm_gpuvm_resv_add_fence. I assume AMD has a similarly simple call.Nope, we try to avoid locking all BOs in the VM as hard as we can.Why? Calling in to perform fence conversion shouldn't be all that frequent and simplifies things. Also, it's likely that only a few locks are involved, as not too many external BOs are mapped within a VM (i.e., most BOs share the VM's dma-resv lock).
Now the ordering works inherently in dma-resv and the scheduler. e.g. No need to track the last completion fences explictly in preempt fences.I really don't think that this is a good approach. Explicitly keeping the last completion fence in the pre-emption fence is basically a must have as far as I can see. The approach you take here looks like a really ugly hack to me.Well, I have to disagree; it seems like a pretty solid, common design.
Anyway, I think I have this more or less working. I want to run this by the Mesa team a bit to ensure I haven't missed anything, and will likely post something shortly after. We can discuss this more after I post and perhaps solicit other opinions, weighing the pros and cons of the approaches here. I do think they function roughly the same, so something commonly agreed upon would be good. Sharing a bit of code, if possible, is always a plus too.
MattRegards, Christian.