-
Notifications
You must be signed in to change notification settings - Fork 61
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
screencast: dmabuf support #9
Comments
Pipewire 0.3 is out now. Hope that will help clear up the issues. |
That certainly means we can complete dmabuf style screensharing, but it'll be mostly useless unless and until downstream apps support various modifiers. Still worth building out, although it'll likely get hidden behind an argument. |
Maybe we could use glBlitFramebuffer to copy frames on GPU before sharing. This could avoid the concern about format modifiers. I need to research and experiment with this approach further. |
swaywm/wlroots#2133 allows blitting DMA-BUFs on the compositor-side. |
I've been subscribed to this PR since any1 opened it. Looks like the example can be used almost verbatim for our use case as long as we tell pipewire to map a dmabuf that we provide. Do you think this should be implemented under a CLI flag? I would say we could fall back gracefully on our side if the compositor doesn't support the protocol version, but I think older pipewire 0.2 consumers (WebRTC especially) will fail on dmabuf (or even memfd) sources. Not sure, would have to test it. |
Ideally it should be enabled by default. We should offer support for both DMA-BUF and good old shm, and clients should pick one. |
I totally forgot that Mutter already does this (dmabuf producer for xdg-desktop-portal-gtk, consumed by WebRTC). Basically, this should work fine in all cases. We can't let clients pick one because there is no provision in the portal API for that negotiation to happen, but luckily, I don't think we have to. The only fallback that would be necessary is if the screencopy protocol version is insufficient on the compositor side. |
FWIW, https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1442 I think GNOME also blits to LINEAR because all clients ignore the modifier hint and end up with garbage. Pipewire is really missing a better API for this. Giving DMA-BUFs to a client expecting shm is not going to end well. |
I guess currently dmabuf support isn't fully implemented in pipewire at the moment. I guess if a client ca't work with a fd, pipewire will copy it to it's data pointer itself: https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/src/pipewire/stream.c#L548 |
I was wrong, it usually is the client mapping the buffer. That makes this more difficult to fix. |
|
I'll need to look into the code regarding the dataType masks. It should be trivial to use the dmabuf extension to screencopy right now if we can rely on clients to handle it correctly. As for export dmabuf, I'm guessing there could still be timing issues there if some downstream client is holding a frame fd for too long? I know that was discussed a while back. Was there ever a decision made about how wlroots handles those cases? |
|
This is a theoretical issue, yes. I'd say let's just stick to screencopy for now and leave export-dmabuf for later. |
Some update to dmabufs in pipewire: Exampleclients to test format merging: Obs branch to have a client to test on (WIP): Found the funktion in pipewire responsible for merging the formats: |
When this is merged, we can reliably distinguish between dmabufs and MemPtr/MemFd https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/683 |
Update: |
PipeWire 0.3.40 was released with full support for negotiating and dropping single modifiers! |
Support passing a dmabuf fd to pipewire instead of using the screencopy protocol. There are three things pending before this can (or should) move forward.
Waiting on Pipewire 0.3 to be released:https://gitlab.freedesktop.org/pipewire/pipewire
Waiting on xdg-desktop-portal PR to support Pipewire 0.3:PipeWire: update to 0.3 API flatpak/xdg-desktop-portal#436
Waiting on downstream ecosystem to support drm_fourcc modifiers:resolved by newer screencopy protocolDiscussion of downstream dependencies that need to support modifiers.
Here is a very early, broken demo
The text was updated successfully, but these errors were encountered: