Bug 434829 - kwin resets custom luts (colord-kde) at resolution change
Summary: kwin resets custom luts (colord-kde) at resolution change
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 5.18.1
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-23 11:10 UTC by Antonio Orefice
Modified: 2024-05-29 13:56 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Antonio Orefice 2021-03-23 11:10:25 UTC
SUMMARY
I use dispwin to load custom color correction lut to X11.
when kwin_x11 starts, everything is reset to default.

STEPS TO REPRODUCE
1. load a custom lut into xserver via dispwin
2. issue kwin_x11 --replace

OBSERVED RESULT
custom lut is lost

EXPECTED RESULT
to have kwin obey the current monitor color profile.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: archlinux packages
KDE Plasma Version: 5.21.3
KDE Frameworks Version: 5.80
Comment 1 Nate Graham 2021-03-23 13:10:41 UTC
See also Bug 428854.
Comment 2 Antonio Orefice 2021-03-23 14:18:32 UTC
Thanks, but i don't use nightcolor at all, i just calibrated my monitor and i'd like kwin to not reset the color profile i load via dispwin.
Comment 3 Antonio Orefice 2021-03-23 16:13:21 UTC
I also noticed that the very same issue happens when changing screen resolution.
Luts is resetted to the tefault values.
Comment 4 Antonio Orefice 2021-03-29 07:26:41 UTC
Today i decided to go the kde way to see if could improve the situation, but failed.

I installed colord-kde, loaded custom icc profiles, applied it, then i tried to:

* Change resolution via kde screen kcm module -> icc profile resetted, lut cleared.
* Restart kwin -> icc profile resetted, lut cleared.

:(
Comment 5 Antonio Orefice 2021-03-29 08:53:20 UTC
If anybody needs it, this seems like a good workaround till things will be sorted out:

#!/bin/bash

dbus-monitor --profile "type='signal',sender='org.kde.KWin',path=/ColorCorrect" | \
	while read -r line ; do
		dispwin -d 1 /koko/BENQ_7_DESTRA7.cal
		dispwin -d 2 /koko/BENQ_7_SINISTRA13.cal
	done
Comment 6 Vlad Zahorodnii 2021-03-29 13:57:19 UTC
I believe the color manager in kwin unintentionally resets gamma ramps set by colord-kde.
Comment 7 Antonio Orefice 2022-01-19 14:25:12 UTC
I spent some time to convert my .cal files to compliant icc profiles to try to better integrate into the colord subsystem.
Unfortunately Vlad was right, even colord-kde isn't able to keep the icc profile loaded.
Comment 8 Antonio Orefice 2022-03-29 11:09:24 UTC
The situation is improved.
Now kwin does not reset the lut anymore when changing resolution, but just when it starts.
Comment 9 Antonio Orefice 2023-04-06 09:32:05 UTC
And again, it resets luts on resolution changes.
Also, the previous hack does not work anymore.
Could you please suggest another workaround if fixing this issue is not an option, please?
Comment 10 Zamundaaa 2024-05-28 17:50:31 UTC
There's lots of different processes setting gamma ramps to different values on different times on Xorg. If you set the ICC profile on Wayland, nothing will be able to override that, but fixing this on Xorg isn't really feasible
Comment 11 Antonio Orefice 2024-05-28 17:57:12 UTC
(In reply to Zamundaaa from comment #10)
> There's lots of different processes setting gamma ramps to different values
> on different times on Xorg. If you set the ICC profile on Wayland, nothing
> will be able to override that, but fixing this on Xorg isn't really feasible

I'm not sure I get it.
Kde used to Not doing that, why can't it stop doing it now?

Also, what does a resolution change has to do with a color profile is out of my understanding.
Comment 12 Zamundaaa 2024-05-28 18:03:21 UTC
It doesn't have anything to do with color profiles, but Xorg has only one LUT that any and every application can set, and that we need to use for night color. With night color, we need to ensure that the lut is set appropriately when a new display is connected, otherwise the wrong lut may be set and the colors differently than expected.
KWin does not have any information about what other applications are doing or not doing with the lut, so it can't keep your use case working.
Comment 13 Antonio Orefice 2024-05-28 18:51:53 UTC
(In reply to Zamundaaa from comment #10)
> There's lots of different processes setting gamma ramps to different values
> on different times on Xorg. If you set the ICC profile on Wayland, nothing
> will be able to override that, but fixing this on Xorg isn't really feasible

I'm not sure I get it.
Kde used to Not doing that, why can't it stop doing it now?

Also, what does a resolution change has to do with a color profile is out of my understanding.(In reply to Zamundaaa from comment #12)
> It doesn't have anything to do with color profiles, but Xorg has only one
> LUT that any and every application can set, and that we need to use for
> night color. With night color, we need to ensure that the lut is set
> appropriately when a new display is connected, otherwise the wrong lut may
> be set and the colors differently than expected.
> KWin does not have any information about what other applications are doing
> or not doing with the lut, so it can't keep your use case working.
Comment 14 Antonio Orefice 2024-05-28 18:54:04 UTC
Ok, can plasma just stop resetting the lut when resolution changes?

I've edited the bug title to reflect that.

If even that is not possible, feel free to close.
Have a good day.
Comment 15 Antonio Orefice 2024-05-29 11:28:35 UTC
(In reply to Zamundaaa from comment #12)
> KWin does not have any information about what other applications are doing
> or not doing with the lut, so it can't keep your use case working.

In case you don't know, Lut can be downloaded from Xorg as well.
Comment 16 Zamundaaa 2024-05-29 13:13:09 UTC
Making KWin not set the luts on resolution changes would be possible, but I checked and there's no code that actually does that... so that's gonna be some other process doing things.
Downloading luts doesn't help either, we don't know if the lut that is set makes sense (or if it's a lut that SDL games set to implement in-game gamma settings in the most annoying way possible), if it's a combination of our previous lut and another, if it's just a different lut, and so on.
It's really not a problem that can be solved without backwards-incompatible changes in Xorg, which won't happen.
Comment 17 Antonio Orefice 2024-05-29 13:56:45 UTC
Ok, I'm just going to use xrandr and trigger a lut reload.

If anyone needs:

koko@Gozer# cat /koko/scripts/benq.keep.lut.sh 
#!/bin/bash
dispwin -d 1 -s /koko/tmp/1.lut
dispwin -d 2 -s /koko/tmp/2.lut

state_old=$(xrandr |md5sum)

while true ; do 
        sleep 5
        state_new=$(xrandr |md5sum)
        if [ "$state_new" != "$state_old" ] ; then
                echo "Trig"
                sleep 1
                dispwin -d 1 /koko/tmp/1.lut
                dispwin -d 2 /koko/tmp/2.lut
                state_old=$state_new
        fi
done