-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add linux-drm-syncobj-v1 protocol #1356
Conversation
b732491
to
f6cd415
Compare
d026857
to
e933521
Compare
Reading a bit more about https://github.com/ValveSoftware/gamescope/blob/master/src/drm.cpp uses an Then we can poll the fence produced by |
I am not sure, if you can use
Yes, if we do CPU latching (that is polling the fence), then this seems to be the right approach for direct-scanout. Though I would still just send the fence for composited frames, although we obviously could apply the principle there as well, as I tried here: pop-os/cosmic-comp#291 However I don't see a benefit outside of cases, where the driver supports polling fences, but not Perhaps there are some advantages for VRR use cases, but I don't think that is worth the trouble for a first iteration.
👍 |
2fb6a6d
to
fbb5ca6
Compare
a4246d7
to
37c2c7e
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1356 +/- ##
==========================================
+ Coverage 20.27% 20.29% +0.01%
==========================================
Files 161 162 +1
Lines 26041 26351 +310
==========================================
+ Hits 5281 5348 +67
- Misses 20760 21003 +243
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
e5b0a4b
to
e1a602f
Compare
Apparently fences have timeouts? Since the kernel wants to prevent an indefinite lock like this: https://docs.kernel.org/driver-api/dma-buf.html#indefinite-dma-fences Presumably the timeout behavior would be similar to implict sync without a So that does sound like something that could be a viable optimization for things like fullscreen applications, even if a general purpose compositor probably want to use blockers under most circumstances (for implicit or explicit sync). But it's an optimization that can be handled later, with more testing.
Ah right, we already have support for that in the renderer. So if we want to use the
I'm not sure if we can automagically fallback to implicit sync. We could just not pass an I think we need to either:
|
Right. For fullscreen surfaces, we probably want to just pass through the fence, not for normal desktop usage though. I agree this is a later optimization.
Yes, but we kinda don't want that (except for the fullscreen case again), because then we would block compositing for an undefined amount of time. The goal is to render as late as possible and use the latest ready buffer.
Yes we can absolutely do that, that is what we are doing right now. We would only block drivers not supporting implicit sync (nvidia). Anyone serious about nvidia support, just needs to implement the protocol and I don't want to mandate that. So strong preference for 1. |
My understanding is that DRM syncobjs are, at least in the future, not guaranteed to ever signal. This is because future drivers may support Userspace Memory Fences (UMFs) and userspace can deadlock themselves with them. Therefore, I think Smithay needs to do a (maybe asynchronous) explicit wait (possibly with a timeout) so that the display cannot be locked up forever. |
3c50274
to
4f13b5f
Compare
bad4088
to
ad6fb25
Compare
fc89bef
to
ae2eec6
Compare
ae2eec6
to
d6cd7ca
Compare
I've rebased this (and the cosmic-comp PR) and made a few small improvements to the doc comments. I believe this reflects how we agreed the implementation/API should work, and as far as I can tell works correctly. Though it's hard to test thoroughly. The latest version of nvidia/egl-wayland should fix the issues that NVIDIA drivers were having on certain clients with compositors that supported explicit sync. If no one else sees issues with this, it should be good to merge. |
Thanks for working on this! I will try to review and also test it on a few different devices during the next few days. |
Tested a few clients that make use of syncobj on my AMD systems, everything works as expected. 👌 |
1a1f764
to
078a420
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, so while I would like to see a more generic solution allowing control over passing fences directly to IN_FENCE_FD
I agree that we can do that later. For overlay planes, especially when having multiple, no one will probably want to just pass the fences. So the only real use-case would be fullscreen direct scan-out. As most compositors outside of kiosk use-cases will have to handle blockers anyway there is no real point for special casing fullscreen anyway.
So far just exposes the protocol but doesn't do anything. #1327 does indeed make that part mostly painless instead of having impl bounds to deal with and a delegate macro.