-
Notifications
You must be signed in to change notification settings - Fork 46
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
WIP linux-drm-syncobj-v1 #411
base: master
Are you sure you want to change the base?
Conversation
For that you probably have to remove the old
Yeah, I am pretty sure smithay's code isn't correct in what it does today, but given direct-scanout mostly works, that is probably using implicit-sync in the background. What needs to happen is storing the fence generated by compositing or in case of direct scanout, we need to get the
Yeah, imo this needs a compile test similar to what we do for gbm in smithay: https://github.com/Smithay/smithay/blob/master/build.rs#L99-L125 So if the local kernel/drm headers of the system support it, we enable the feature and assume the kernel does as well. I don't know how well runtime detection would work, but we have to make sure to not advertise the global, if this function isn't supported. |
This should already be doing that. If there's an acquire point, it adds a
I'm not sure if implicit sync does does something to help with releases (blocking client writes to the buffer until the display controller is done with the buffer... but yeah, it does seem to mostly work. If implicit sync isn't involved, this won't be more problematic with explicit sync and the same limitation.
It should be possible to do something with We just have to make sure to only do that once the buffer is no longer used elsewhere in the compositor. |
It definitely does, but the nvidia-driver at least isn't doing that correctly, when you send dmabufs directly to KMS without going through egl-gbm and allocating a
👍
I am pretty sure, that is what our current release logic does, with the exception of handling direct-scanout. Which would be handled by the fence anywhere in this case, so that should be correct. We just need to adjust the |
I mean if we want to have
So I'm not sure when we could actually do that? Maybe with So at least for now I think we need to stick to signaling the release point from CPU? But should still track when |
Right, so this rather needs to be a list of fences to wait for. Meaning we probably have to wait and signal ourselves instead of relying on
But merge of the state should only happen, once all blockers are resolved. And only then we release, so I believe that issue is already handled correctly. Nothing would be able to use that buffer for rendering any more at that point. But we still need to track the buffer to be able to signal later, so we might as well unify the approach and handle the
I think we can implement both fifo and commit-queue with blockers as well.
Yeah, I am coming to the same conclusion, but that isn't too bad, as that is just another fd in the loop and a very small action. |
b73721a
to
7c700d5
Compare
Update
@@ -450,6 +451,9 @@ pub fn init_backend( | |||
// Create relative pointer global | |||
RelativePointerManagerState::new::<State>(&dh); | |||
|
|||
// TODO check if main device supports syncobj eventfd? |
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.
I guess worst case we can still fail the import_timeline
-request, right?
Is Xwayland/mesa able to handle this / fallback to implicit sync?
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.
I don't think there's any way to fallback once we expose the global. The protocol doesn't make import_timeline
failable, except as a protocol error.
It looks like Mutter uses drmSyncobjEventfd (drm_fd, 0, 0, -1, 0) != -1 || errno != ENOENT)
to check if the call is supported. So we probably want to do the same, and only create the global if it is supported.
Based on Smithay/smithay#1356.
I think the blocker logic should be correct for handling acquire points (if I properly understand the transaction system in Smithay). Though I don't see rendering issues with Mesa git when the blocker is removed... maybe it needs to be tested with something heavier than vkcube. (Or is there something still forcing implicit sync?).
The logic I added in Smithay for signaling releases may be a little less correct. Though maybe not more incorrect that how buffer releases are currently handled? (If I understand DRM correctly, with direct scanout we should make sure not to release until we've committed a new buffer and are sure the display controller won't want to read the buffer.)
We'll be able to test more when the next Nvidia driver is released. This at least gives us a way to test the explicit sync support they're adding.
Presumably we should test if
drmSyncobjEventfd
is supported... maybe just creating a syncobj and calling that to see if it works? I'm also still a little unsure how this ends up working with multiple GPUs... particularly if one is Nvidia.