-
Notifications
You must be signed in to change notification settings - Fork 107
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
#411
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. |
905893f
to
8d00edc
Compare
src/backend/kms/mod.rs
Outdated
@@ -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.
Can we get this rebased on the newest master please |
182a391
to
3b5de88
Compare
Is this going to be implemented soon? |
3b5de88
to
b5b9548
Compare
I've just marked Smithay/smithay#1356 as ready for review, so hopefully if no issues come up this should be merged soon. I'm not sure if explicit sync will help with whatever issues you're seeing, but if you'd like to test this PR and report how it impacts behavior (for a certain game / graphics card / driver), that could be helpful. |
I think it will. I will report back. @ids1024 There's definitely something weird with my setup, the issue is still here, no weird tearing now, but FPS are halved if they're less than 60 (they're even more than halved).
I'm not telling anything to the game, the just uses the nvidia gpu, I do not force any GPU. Mesa is at version EDIT: for more details refer to this pop-os/cosmic-epoch#184 (comment) |
FPS being lower than expected (often around 30 on a 60 fps monitor) with vsync is something I've noticed with Intel-rendered windows on a 1650 mobile (later NVIDIA cards don't seem to have this issue). In my testing Gnome Wayland seemed similar, so I assume it's something in the driver. #211 has some previous testing I've done with that. |
In my case the inverse is true. Personally I see extreme lag, the game renders fine though because if you record a gameplay and watch it, you'll see it buttery-smooth UPDATE: Basically the chronological order is the whole thing is:
|
b5b9548
to
54fc7d5
Compare
Tried this briefly with NVIDIA 560.35.03. Other things seemed to work fine though. Using Pop!_os 22.04 with popdev:master branch. |
Can you read my comment and please tell me if you don't have the issue? |
I'm using a desktop, with my intel integrated gpu disabled in BIOS. |
Hm, are there still issues with Firefox? nvidia/egl-wayland 1.1.15 was supposed to fix some issues like that. Not sure if Firefox also needed fixes. |
Appears so. I could send the firefox crash log if you think it could help. |
Ive tested this MR on my 4070 Super with 560 Drivers. I was not able to open discord, nor cosmic settings or equal. |
Hm. Hopefully the logs provide more context. |
sorry, my env has WGPU_BACKEND=vulkan, so my test should not be considered a valid reference I'm trying this. spec : gtx 1080 quick check the following apps work list: not work list: It can be started, but the menu cannot be displayed: cosmic-settings vulkan log : log maybe I also need to test latest cosmic-comp
what I can do for you cosmic-comp keep printing in journal ... cosmic-comp[1718]: [GL] Buffer detailed info: Buffer object 3 (bound to GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB (0), usage hint is GL_STATIC_DRAW) will use VIDEO memory as the source for buffer object operations. If my gpu is not supported, please let me know |
I test this pr on my rx7900xtx driver : mesa 24.3.0_devel.194431.6f3c003433f-1 I tried to play DBD and encountered the following situation, I don't see this regression in cosmic-comp 1.0.0.alpha.2 And it only happens in full screen mode, windowed mode has no problem |
We expect COSMIC to work on any GPU supported by the current NVIDIA drivers. (Though if there's a bug in their drivers on certain cards, we may not be able to do anything about it.)
Hm, probably something involving direct scanout. We should be waiting properly for the explicit sync point before the buffer is used... |
got it :)
very much like what you surmised, this damage is not visible in the capture screenshots. |
Since the latest update, cosmic settings seems to be working on nvidia. |
Yep, Smithay/smithay#1554 should fix that issue on Nvidia, at least. Not sure about the issue on the rx7900xtx, which does look like a real synchronization issue. I assume that's using vkd3d on wine on xwayland for rendering? The only RDNA hardware I have is a Steam Deck, and I'm not seeing that issue running a couple games on it under cosmic-comp. |
yep, the game I run with dx12, and it support dx11 too. You are welcome to ping me at any time with your list of testing needs and I will be available to assist with testing after get off work today :) my work computer is equipped with gtx 1080, I will test it again when I have time |
Apparently my weird issue translates to VR too since I see "backwards" frames or something. |
I'm still having the same sync issues playing dx12 and dx11 games on the latest update on my 7900xtx, and some temporary freezes during daily use. I might have to try to collect more logs, but I'm not sure what information in the journal would be useful. |
as a 7900xtx user : I upgraded to cosmic-epoch alpha 4 and I rebase this branch on master, everything is working fine now regardless of whether vrr is enabled or not! edit : What I tested was that the strange tear line no longer appeared. |
Does this require any testing still or is there anything else an end-user can do to help? |
I need to look into this more. But there are a couple reports here of visual issues due to synchronization issues (so a bug in cosmic-comp/smithay, or the driver), which I haven't so far reproduced on hardware I have. It's hard to debug without having a way to reproduce the issue, though I could try a few more things to see if I can. More testing on different hardware and software and specific details about what does and does not work is always welcome. |
Hey, would you mind to rebase the patchset on latest master? |
So the only known issue with this, other than the Nvidia issue that was fixed a while ago, seems to be #411 (comment) on the RX7900 XTX. That was a while ago, but does look like a synchronization issue, and I can't recall that we've merged anything that would fix it since (unless it was a bug in Mesa/XWayland/DXVK or VKD3D/etc and fixed there). @skygrango How much have you tested this on the RX7900 XTX lately? It seems to be working now? |
I'm still testing the GTX1080 today and I noticed that when VRR is enabled and watch full screen video, there is a constant screen flashing white randomly. As far as I can remember from last time, everything was working fine with the 7900xtx, I will update branch to test AMD 7900XTX again. |
on GTX 1080, There is an interesting problem. the menus of kate and gnome-terminal cannot be displayed, but if I click on another window or desktop first, and then go back and click on the menu, it will be displayed successfully, and only the first clicked menu can be displayed normally. as long as the sub-menu is triggered, the main menu will disappear directly, just like I no longer focus on the window. cosmic-comp show warnning about it :
Gimp's menu can be used normally, but what's interesting is that if you click on other windows while the menu is open, the menu will not close, but the main window will be hidden under other windows normally. I'm not sure if this is specifically Nvidia's or drm-syncobj's responsibility, I'm just documenting it |
The errors about popup positioning are unrelated to the rendering code, so they won't be dependent on driver or on drm-syncobj. So that's probably unrelated. Though that's interesting, I don't think I've seen issues like that with menus, on native Wayland clients. #1122 may be relevant, and has some improvements to popup positioning. |
Merging for more widespread testing after 5.1 and before alpha 6. This seems to be good on a bunch of our test machines. Thanks everybody else as well for providing test results. |
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.