| Summary: | External display is not detected when laptop is running on battery | ||
|---|---|---|---|
| Product: | [Plasma] kwin | Reporter: | VesperLlama <kde> |
| Component: | platform-drm | Assignee: | KWin default assignee <kwin-bugs-null> |
| Status: | RESOLVED UPSTREAM | ||
| Severity: | normal | CC: | nate, xaver.hugl |
| Priority: | NOR | ||
| Version First Reported In: | 5.24.90 | ||
| Target Milestone: | --- | ||
| Platform: | Arch Linux | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: |
Log when monitor is not detected
Log when monitor is detected drm_info output |
||
|
Description
VesperLlama
2022-05-26 12:25:41 UTC
Please add QT_LOGGING_RULES="kwin_wayland_*.debug=true" into your /etc/environment and reboot. Then attach your monitor and journalctl --boot 0 --user-unit plasma-kwin_wayland | grep kwin_wayland_drm here What could also be useful is the output of drm_info, with the monitor attached Created attachment 149253 [details]
Log when monitor is not detected
Created attachment 149254 [details]
Log when monitor is detected
Created attachment 149255 [details]
drm_info output
I have attached the required files
I am also facing this bug (https://bugs.kde.org/show_bug.cgi?id=454086) so the monitor is not working correctly but it is detected in Plasma. When the monitor is not detected, KWin is unable to access the GPU:
> kwin_wayland_drm: failed to open drm device at "/dev/dri/card0"
When the monitor is not detected, what does "ls /dev/dri" say?
> ls /dev/dri
> by-path card0 card1 renderD128 renderD129
It gives the same output when laptop is charging and the monitor is detected. Both GPUs are displayed. If I run any app on the dGPU using DRI_PRIME=1 it works fine on battery.
If you run an app on the dGPU before you connect the external monitor, does that make a difference? Yes, the monitor is detected if an app is running on the dGPU. I ran glxgears, firefox and KDE systemsettings on the dGPU then connected the monitor and it was detected in all three cases. Also, system settings, powerdevil and kded5 crashes with a segmentation fault when the monitor is connected and detected if I am on the Display Configuration page. Could this be related? The problem is that KWin completely stops bothering the GPU and driver when there's no outputs connected to it. When you're not running any apps on it while on battery, it'll be completely shut down to save power. Now we only need to find out why KWin can't wake up the GPU while other apps can do it. In the output of journalctl --boot 0 --user-unit plasma-kwin_wayland when the monitor is not detected, is there something like > kwin_wayland_core: Failed to open /dev/dri/card0 (error reason) ? If so, what is the error reason? The crash of other apps is unrelated, you're most likely experiencing https://bugs.kde.org/show_bug.cgi?id=451028 > kwin_wayland[2772]: kwin_wayland_drm: failed to open drm device at "/dev/dri/card0"
It just shows this. There's no reason given with it. I also don't see any line with "kwin_wayland_core". I used the environment variable stated earlier. Do I need to add a different one?
My laptop has a LED which lights up when the dGPU is awake and it does light up when I plug in the HDMI cable. So the dGPU wakes up when I plug it in (also checked with powertop) but still kwin can't access it.
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/2482 > I also don't see any line with "kwin_wayland_core"
Oh, sorry, it's only "kwin_core". With that, you do need to adjust the environment variable to be
QT_LOGGING_RULES="kwin_*.debug=true"
If that still doesn't show anything, can you try the linked merge request and see if that produces a message in the log?
> kwin_core: Failed to open /dev/dri/card0 device (Permission denied)
It gives this error. Should I test the merge request?
No need, I think this is a logind bug then. Can you open an issue at https://github.com/systemd/systemd/issues about TakeDevice failing with "Permission denied" despite KWin having the needed permissions, and link it here? I'll add more information to it where needed. Until the problem with logind is fixed, I'll add a workaround that allows you to make KWin not release unused GPUs. It may come with increased power draw when the GPU isn't actually used, but it should prevent the problem from appearing I have opened an issue here according to what I understood about this. https://github.com/systemd/systemd/issues/23547 > It may come with increased power draw when the GPU isn't actually used So wll the GPU never go to sleep? I will prefer less power draw instead of this. I can just workaround this myself by running any app on the dGPU before plugging it in. ok, good. Let's continue tracking this bug in the systemd repo then |