On Tue, Apr 20, 2021 at 3:04 PM Daniel Stone <daniel@xxxxxxxxxxxxx> wrote: > > Hi, > > On Tue, 20 Apr 2021 at 13:01, Daniel Vetter <daniel@xxxxxxxx> wrote: >> >> - We live in a post xf86-video-$vendor world, and all these other >> compositors rely on implicit sync. You're not going to be able to get >> rid of them anytime soon. What's worse, all the various EGL/vk buffer >> sharing things also rely on implicit sync, so you get to fix up tons of >> applications on top. Any plan that's realistic needs to cope with >> implicit/explicit at the same time together won't work. >> >> - Absolute infuriating, but you can't use page-faulting together with any >> dma_fence synchronization primitives, whether implicit or explicit. This >> means until the entire ecosystem moved forward (good luck with that) we >> have to support dma_fence. The only sync model that works together with >> page faults is userspace fence based sync. >> >> This should get rid of the oversync issues, and since implicit sync is >> backed in everywhere right now, you'll have to deal with implicit sync for >> a very long time. > > > Depends what you mean by 'implicit sync'. ;) > > Getting userspace (Vulkan WSI, EGL, Wayland compositors, browsers, media clients) over to explicit sync is easy, _provided_ that the explicit sync gives us the same guarantees as implicit sync, i.e. completes in bounded time, GPU/display work can be flushed to the kernel predicated on fence completion with the kernel handling synchronisation and scheduling. It's just a matter of typing, and until now we haven't had a great reason to do that typing. Now we do have that reason, so we are implementing it. Whether it's dma_fence or drm_syncobj is mostly immaterial; we can encode in protocol requirements that you can't try to use wait-before-signal with drm_syncobj and you'll get killed if you try. > > Getting that userspace over to fully userspace-based sync (wait-before-signal or wait-never-signal, no kernel assistance but you just have to roll your own polling or signal handling on either CPU or GPU side) is not easy. It might never happen, because it's an extraordinary amount of work, introduces a huge amount of fragility into a super-critical path, and and so far it's not clear that it's a global performance improvement for the whole system, just shifting performance problems from kernel to userspace, and probably (AFAICT) making them worse in addition to the other problems it brings. > > What am I missing? Nothing I think. Which is why I'm arguing that kernel based sync with all the current dma_fence guarantees is probably going to stick around for something close to forever, and we need to assume so. Only in specific cases does full userspace sync make sense imo: - anything compute, excluding using compute/shaders to create displayable buffers, but compute as in your final target is writing some stuff to files and never interacting with any winsys. Those really care because "run a compute kernel for a few hours" isn't supported without userspace sync, and I don't think ever will. - maybe vulkan direct display, once/if we have the extensions for atomic kms wired up - maybe someone wants to write a vulkan based compositor and deal with all this themselves. That model I think would also imply that they deal with all the timeouts and fallbacks, irrespective of whether underneath we actually run on dma_fence timeline syncobjs or userspace fence timeline syncobjs. >From about 2 years of screaming at this stuff it feels like this will be a pretty exhaustive list for the next 10 years. Definitely doesn't include your random linux desktop wayland compositor stack. But there's definitely some are specific areas where people care enough for all the pain. For everyone else it's all the other pieces I laid out. This also means that I don't think we now have that impedus to start typing all the explicit sync protocol/compositor bits, since: - the main driver is compute stuff, that needs mesa work (well vk/ocl plus all the various repainted copies of cuda) - with the tricks to make implicit sync work more like explicit sync the oversyncing can be largely solved without protocol work -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel