Bug 485403

Summary: Enabling HDR freezes system
Product: [Plasma] kwin Reporter: jroddev <kde.backboned759>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED UPSTREAM    
Severity: normal CC: nate, xaver.hugl
Priority: NOR    
Version: 6.0.3   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: kwin-drm-debug.log
dmesg-drm-debug.log
kwin-drm-debug 90 seconds wait
dmesg-drm-debug 90 second wait

Description jroddev 2024-04-11 23:26:59 UTC
SUMMARY

 I clicked ‘enable HDR’ on one of my monitors and something broke. The whole system froze up and the HDR monitor went black. If I reboot it freezes right after I login.

If I unplug that monitor or start in X11 instead of Wayland then everything is fine. Plugging the HDR monitor in while I’m logged into a Wayland session also freezes everything.

How can I disable the HDR setting? The monitor doesn’t show in System Settings whilst its unplugged so I’m hoping theirs some way to fix it on the CLI. The only place I’ve found HDR referenced is .config/kwinoutputconfig.json. I set HDR to false but after reboot it’s set to true again. I also tried deleting .config/kwinrc and .local/share/kscreen but no luck.


STEPS TO REPRODUCE
1. Enable HDR on Monitor in System Settings > Display


OBSERVED RESULT
- HDR monitor goes black
- Other monitor now unresponsive.
- System works if monitor is not plugged in on start up
- Cannot disable HDR setting in UI without the monitor plugged in. If I plug in the monitor then the system freezes.
- Monitor also does not appear in kscreen-doctor when unplugged.

EXPECTED RESULT
- System does not freeze
- Saved monitor settings can be modified or cleared even when disconnected.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Manjaro
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.3

ADDITIONAL INFORMATION
Lemmy Community Discussion https://lemmy.kde.social/post/1104524
Similar to https://bugs.kde.org/show_bug.cgi?id=483600 but if I use only the HDR monitor it still has the issue.

Fixed by
- Ctrl + Alt + F3 to go into terminal
- Set `HighDynamicRange` and `WideColorGamut` to false in ~/.config/kwinoutputconfig.json
- Execute `plasmashell --replace`
- Reboot, Login, Reattach HDR Monitor


- AMD based Desktop
- Nvidia GPU
- Dual Monitor Setup (BenQ and Gigabyte)
- HDR setting enabled on Gigabyte.
- Installation is approximately 4 years old.
Comment 1 jroddev 2024-04-12 10:25:57 UTC
hardware probe: https://linux-hardware.org/?probe=66b49c3998
Comment 2 Zamundaaa 2024-04-16 22:59:05 UTC
We're gonna need some debug information, ideally from both KWin and the driver side. The best way to get it is probably to enable HDR, disconnect the monitor, log out, switch to a tty, connect the monitor again and then run the script from https://invent.kde.org/plasma/kwin/-/wikis/Debugging-DRM-issues
Afterwards, just attach kwin-drm-debug.log and dmesg-drm-debug.log here
Comment 3 jroddev 2024-04-21 08:39:11 UTC
Created attachment 168730 [details]
kwin-drm-debug.log
Comment 4 jroddev 2024-04-21 08:39:40 UTC
Created attachment 168731 [details]
dmesg-drm-debug.log
Comment 5 Zamundaaa 2024-04-25 16:01:00 UTC
hmm, I see nothing obviously wrong in there. There's a few atomic tests that fail with "needs modeset", but that's a normal part of KWin's startup sequence, and at the very end of the log I see KWin successfully doing a modeset to turn the screens on.

Maybe the problem only happens later... Could you bump the "sleep 3" in the script to "sleep 20" or something like that, and attach the logs for that again?
Comment 6 jroddev 2024-04-29 08:35:39 UTC
I changed it to 90 seconds for good measure.
It might also be worth noting that I can't recover the system once the monitor is plugged in.
It locks up immediate (at least visually) and even after disconnecting the monitor it doesn't start working again.
Even trying to switch out to terminals once the monitor is disconnected doesn't work. Need to reboot to get back in.
Comment 7 jroddev 2024-04-29 08:36:41 UTC
Created attachment 168990 [details]
kwin-drm-debug 90 seconds wait
Comment 8 jroddev 2024-04-29 08:37:12 UTC
Created attachment 168991 [details]
dmesg-drm-debug 90 second wait
Comment 9 Bug Janitor Service 2024-05-14 03:45:25 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 10 jroddev 2024-05-14 07:04:35 UTC
Whoops. Didn't know I needed to set Status to Reported
Comment 11 Zamundaaa 2024-05-22 14:04:01 UTC
hmm, the drm log is cut off in the exact same spot as the last one. That suggests to me something is going very wrong in the kernel. Please report this to NVidia, they might be able to do more about this
Comment 12 jroddev 2024-07-13 03:56:16 UTC
The lockout no longer occurs. I'm not sure exactly what fixed it, but it could be 
- Performed a bios updated on the motherboard.
- Switched from 5 year old Manjaro to fresh AuroraOS.
- Other general updates since I reported the issue.

Now when I enable HDR the system freezes for a moment and then resumed. 
The HDR setting gets set back to disabled (after closing and reopening system settings).
I believe this is now expected behaviour since there seems to be a problem with either my monitor or graphic card/drivers.
Comment 13 Zamundaaa 2024-07-20 21:57:26 UTC
Yes, that's more in line with expectations at least - the driver rejects enabling HDR for some reason, and KWin won't save the setting when that happens