Fence, timeline and android sync points

Christian König deathsimple at vodafone.de
Thu Aug 14 07:31:09 PDT 2014

Am 14.08.2014 um 14:37 schrieb Maarten Lankhorst:
> Op 14-08-14 om 13:53 schreef Christian König:
>>> But because of driver differences I can't implement it as a straight wait queue. Some drivers may not have a reliable interrupt, so they need a custom wait function. (qxl)
>>> Some may need to do extra flushing to get fences signaled (vmwgfx), others need some locking to protect against gpu lockup races (radeon, i915??).  And nouveau
>>> doesn't use wait queues, but rolls its own (nouveau).
>> But when all those drivers need a special wait function how can you still justify the common callback when a fence is signaled?
>> If I understood it right the use case for this was waiting for any fence of a list of fences from multiple drivers, but if each driver needs special handling how for it's wait how can that work reliable?
> TTM doesn't rely on the callbacks. It will call .enable_signaling when .is_signaled is NULL, to make sure that fence_is_signaled returns true sooner.
> QXL is completely awful, I've seen some patches to add dma-buf support but I'll make sure it never supports importing from/exporting to other devices. This should reduce insanity factor there.
So if I understand you right QXL doesn't really implement the whole 
fence interface? It just implements enough to make TTM happy and you 
forbid DMA-buf support because the rest isn't really working?

Sorry, but that just sounds like your fence design just isn't doing the 
right thing here.

> If I understand QXL correctly, sometimes fences may never signal at all due to virt-hw bugs.
Radeon has the same problem, with the hardware scheduler each client 
essentially has it's own fence sequence number range. If you kill a 
client the remaining fences not necessarily gets signaled by the hardware.

> nouveau (pre nv84) has no interrupt for completed work, but it has a reliable is_signaled. So .enable_signaling only checks if fence is signaled here.
> A custom waiting function makes sure things work correctly, and also signals all unsignaled fences for that context. I preserved the original wait from before the fence conversion.
> Nouveau keeps a global list of unsignaled fences, so they will all signal eventually.
> I may have to limit importing/exporting dma-buf's to other devices, or add delayed work that periodically checks all contexts for completed fences for this to work cross-device.
> nv84+ has a sane interrupt, so I use it. :-)
> Radeon with fence conversion has the delayed work for handling lockups that also checks.

Which I still don't had time to check completely, but it sounds more and 
more like those fallbacks for not fired interrupts should be in the 
common fence code and not in each individual driver.


> ~Maarten

More information about the dri-devel mailing list