sway
sway copied to clipboard
Draft: sway/commands/output: Add command to set color profile
This PR matches the very WIP wlroots MR 4280.
This requires the Vulkan renderer to be useful. (Use WLR_RENDERER=vulkan ; setting VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation to enable validation layers may be useful for testing.)
Example usage:
swaymsg output '*' color_profile icc /usr/share/color/icc/colord/ProPhotoRGB.icc
Known issues:
- ~some race condition in which only some frames render correctly; causes flickering~ (fixed)
- ~Only applies with bit depth 10, at the moment~ (fixed)
- ~Having to copy the
struct wlr_color_transforma number of times is awkward~ (now using reference counting)
I think we need to add #ifs (that's a bit cumbersome) and missing deps in CI manifests?
I've added missing dependencies for lcms2, so that the wlroots build (and by extension the sway build) uses color management features.
I have not yet made it possible to build this without lcms2 support, and will update this PR eventually to do that.
Tested it on my Framework 13 AMD. Seems to work as expected :+1:
Just an idea, would it be reasonable to be able to unset a profile as well? By unset, I mean returning to the same state as if I'd never called the color_profile command.
Maybe something like: swaymsg output '*' color_profile unset
Just an idea, would it be reasonable to be able to unset a profile as well? By unset, I mean returning to the same state as if I'd never called the color_profile command.
The default profile is srgb, and one can go back to it with:
swaymsg output '*' color_profile srgb
Hi, I correctly set my icc profile but when swaylock is triggered from swayidle (via killall -USR1 swayidle or when the swayidle timetout's reached). I see a little square:
this not happening if I directly start swaylock from terminal (or if i'm not setting the icc profile).
Thanks AMA if I can help with this issue
I have not yet made it possible to build this without lcms2 support, and will update this PR eventually to do that.
I've been wondering whether we should always make wlr_color_transform available regardless of LCMS availability. I think it depends if we want to base all of our color pipeline on LCMS (Weston-style), or if we want to implement this ourselves.
when I launch swaylock through swayidle I have a smal square around the circle
Weird, the ICC profile should only affect the final post-blending image. Maybe there is a small difference not noticable without the ICC profile applied, which becomes visible once the ICC profile is applied?
I've been wondering whether we should always make wlr_color_transform available regardless of LCMS availability. I think it depends if we want to base all of our color pipeline on LCMS (Weston-style), or if we want to implement this ourselves.
I've also been considering this: 1) one might want to use CICP tags to pick output color profiles (e.g. to work with HDR10) in which case one can do color management without LCMS 2) the use of LCMS in wlroots is already confined to converting ICC file data to wlr_color_transform, and may be a more natural boundary.
Right. AFAIU, Weston plans to translate the CICP stuff into LCMS pipelines (with the float point number transforms that nobody uses in ICC). Other compositors seem to do math in shaders.
Hi, I correctly set my icc profile but when swaylock is triggered from swayidle (via
killall -USR1 swayidleor when the swayidle timetout's reached). I see a little square:this not happening if I directly start
swaylockfrom terminal (or if i'm not setting the icc profile). Thanks AMA if I can help with this issue
I have the same issue :
and also, it's as if every time I write on the keyboard (i.e. when the circle is modified) the ICC profile is deactivated/activated. Or something like that
@GreyXor, @Riptils, do you see the issue if you run sway with WLR_SCENE_DISABLE_DIRECT_SCANOUT=1? The color transformation does not apply to direct scanout.
@GreyXor, @Riptils, do you see the issue if you run sway with
WLR_SCENE_DISABLE_DIRECT_SCANOUT=1? The color transformation does not apply to direct scanout.
Thanks, yes I still have the same issue
I still have the issue, even with the env var
Ref https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4692
Now that the wlroots patch has been merged, just need to guard wlr_color_transform_init_linear_to_icc().
just need to guard wlr_color_transform_init_linear_to_icc().
This is already done: wlroots compiles it to a NULL-returning stub, and the code checks for an returns an error on a NULL return value.
Oh right, didn't even remember about the patch I wrote.
Is there a reason this is still marked as a draft?
No; as this is no longer waiting on wlroots changes I have marked it as ready.
Thanks!
