Repository navigation
Screen captures are always rendered to sRGB; implement xx-image-capture-color-management-v1 so wide-gamut content survives screenshots #16542
Replies: 2 comments
|
This discussion has been automatically closed. |
0 replies
|
|
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
On a wide-gamut output with colour management enabled, the screen is rendered in the output's colour space, but every screenshot and screen-share frame is converted to sRGB first. Colours outside sRGB display correctly and then clip in the capture. This happens for every capture client, including ones that bind
wp_color_manager_v1.Where it happens
src/managers/screenshare/ScreenshareFrame.cpp(v0.56.2 and currentmain):copyDmabuf(),copyShm()andstoreTempFB()each callsetImageDescription(NColorManagement::DEFAULT_SRGB_IMAGE_DESCRIPTION)on the capture framebuffer before rendering.renderMonitor()computesIS_CM_AWAREand passes.cmBackToSRGB = !IS_CM_AWARE, but since the target framebuffer is sRGB either way, aware clients receive the same sRGB-converted pixels.Reproduction
render:cm_enabled = true. Internal panel eDP-1 (LG), EDID primaries wider than Display P3,cm = "edid", XRGB8888.--enable-features=SurfaceColorManagement --force-color-profile=display-p3-d65 --force-raster-color-profile=display-p3-d65, showing this test page (gist). On screen, each "P3 max" swatch is visibly more saturated than the "clipped to sRGB" swatch next to it.grim -o eDP-1of that screen. Sampled pixels:The capture is the sRGB clip. A grim build that additionally binds
wp_color_manager_v1(soisClientCMAware()returns true) captures byte-identical output.Proposal
wayland-protocols has merged
xx-image-capture-color-management-v1(experimental; theext-version is !448). It gives a capture clientget_capture_source_colors→ the compositor's preferred image description for a capture source, andset_frame_image_descriptionto choose the frame's encoding.Implementing it in Hyprland would mean: advertise the output's image description (
CMonitor::m_imageDescription/workBufferImageDescription()) as the preferred description for an output capture source, and render capture frames into the description the client set instead of the hard-coded sRGB one. Clients that don't use the protocol keep getting sRGB, so current behaviour is unchanged for them. With that, screenshot tools can tag their files with the right colour space, which is what makes screenshots on macOS come out matching the screen.I can test builds on this hardware.
All reactions