-
Notifications
You must be signed in to change notification settings - Fork 29
wlr-screencopy: Allow repeated capture #48
Comments
I was toying around with a similar idea myself awhile ago, but I never got around to submitting it or trying to implement it yet: https://gist.github.com/ascent12/62c3b591a8abdf3017410e6f61c10f44 |
My proposal is about eliminating that cycle of reallocation for every frame (maybe at 100fps), instead having the compositor repeatedly update the same few shared buffer(s). |
I doubt the wayland protocol itself is going to be any sort of noteworthy bottleneck. Maybe it would be if you were trying to push over 10000 FPS, but the GPU is going to get in the long before that's an issue |
-1, this changes the semantics of the protocol too much, making implementations complicated. I'd much rather see something similar to how linux-dmabuf is handling this: make it necessary for the first capture to have a roundtrip, then optimize for the case in which buffer parameters don't change (e.g. by adding
-1, the compositor needs to decide the buffer format.
Agreed. |
Also: reminder that screencopy is going to be slow anyway because it's downloading frames from the GPU. It would be nice to have benchmarks before over-optimizing. |
In the dma-buf case, I don't think it's a particularly big deal for the format to change in the copy. Maybe not for wl_shm, though. The main idea is just queuing a bunch of frames to make it easier to use the interface for capturing video and not accidentally missing frames. |
I don't understand why this is a concern for screen capture and not for frame submission? If a client really needs not to miss a frame, just do the processing in a different thread or something. |
It's just nice to remove some of the synchronization required between the client and the server. If the system is under high load, and the recording process doesn't get scheduled in time, it may end up missing a frame because it couldn't get its request in time.
It is somewhat a concern for things like video players. I'm sure they'd love a different way to schedule a frame instead of needing to precisely call wl_surface.attach at the right time, and trying to guess what the compositor's deadline is. But this is off-topic, and I think there are some VERY old discussions on wayland-devel about this. |
Same for submitting frames of e.g. a video game. I'm really not convinced that queuing would improve anything. Pretty sure it's not the bottleneck.
They don't need to do it "at the right time": the presentation-time protocol allows them to know when the next frame will be displayed. They just need to submit a frame when they receive a frame event. Also, given that almost nobody uses presentation-time, I'm not sure video players are that interested (yet?). |
wlr-protocols has migrated to gitlab.freedesktop.org. This issue has been moved to: https://gitlab.freedesktop.org/wlroots/wlr-protocols/-/issues/48 |
This is a proposed backward-compatible optimization to the wlr-screencopy-unstable-v1 protocol based on experience with similar interfaces in other systems:
The goal is to minimize the number of API round trips for repeated screen capture, such as for recording it to a video stream, or any other use.
In zwlr_screencopy_manager_v1:
In "zwlr_screencopy_frame_v1" change the following:
In the flags enum, add a bit indicating that the frame object was created as repeatable.
In the description of the "copy" request add this:
to
The text was updated successfully, but these errors were encountered: