wlr-screencopy is a wlroots protocol. Hyprland, labwc and sway offer it;
the compositors that never did - GNOME among them - had no capture path
here at all. ext-image-copy-capture is what replaced it, and this is the
backend that reads it.
Nothing that works today moves. Where a compositor offers both,
screencopy stays the default: every working deployment is on that path
and a stream is not worth trading for a newer protocol.
HERMES_WAYLAND_CAPTURE=icc or =screencopy forces one, which is how the
other gets tested on a session that offers both.
The two are asked for a frame differently. Screencopy negotiates a
buffer per frame; an image-copy-capture session negotiates once - size,
format and modifiers - and then hands out frames, so a frame arrives
only when the output is next presented. A desktop with nothing moving on
it produces none, which reaches the encoder as a timeout and re-sends
the previous frame, exactly as an idle screencopy capture does.
Two things this protocol gives that screencopy could not. The compositor
names the DRM device it renders on, which is the question init_gbm()
otherwise has to guess the answer to on a machine with two GPUs; it is
taken as the answer, after the same allocation probe every other
candidate gets, so a compositor naming a device nothing can allocate on
still falls through to the search. And it offers format modifiers, which
on AMD means the buffer can have more than one plane - every plane is
shared, because a compositor handed only the first plane of a compressed
buffer fails the frame with no reason attached.
That probe is also exposed as wl::render_node_can_allocate(), since
"this node opens" and "this node can produce a buffer" are different
questions and only the second one matters.
Verified against a headless labwc: a session negotiated, frames
produced, and repeated capture on one session. The tests talk to
whatever compositor is on WAYLAND_DISPLAY and skip when there is none.
Note what this does not deliver: KWin 6.7 does not implement the
protocol at all - it speaks only zkde_screencast_unstable_v1 - so
capturing an existing KDE desktop still has no path.
The protocol sequence follows Dregu's draft for upstream Sunshine
(LizardByte/Sunshine#4788), credited in the source beside the three
places this departs from it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
I'm putting this draft up simply because these linux prs keep popping up every day and by monday three more people will have implemented this probably, so it would be silly to keep it to myself when it's already pretty much done.
Description
Adds the ext-image-copy-capture protocol as primary backend for the wayland capture method, but keeps wlr-screencopy as a fallback, as it is still slightly better supported. Also supports actual output names in output_name, like that other pr.
Screenshot
Issues Fixed or Closed
Roadmap Issues
Type of Change
Checklist
AI Usage