Bug 461886 - Waking screen causes application windows to disappear
Summary: Waking screen causes application windows to disappear
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.26.2
Platform: Other Linux
: NOR grave
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-15 21:11 UTC by Yosuke Matsumura
Modified: 2024-05-10 19:41 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0.5


Attachments
System log from the timeframe of screen wake (24.81 KB, text/plain)
2022-11-15 21:11 UTC, Yosuke Matsumura
Details
Screenshot of system before screen turns off (1.33 MB, image/png)
2022-11-15 21:12 UTC, Yosuke Matsumura
Details
After screen wake 1 (3.06 MB, image/png)
2022-11-15 21:14 UTC, Yosuke Matsumura
Details
After screen wake 2 (2.68 MB, image/png)
2022-11-15 21:16 UTC, Yosuke Matsumura
Details
Kwin Debug Window 1 (205.43 KB, image/png)
2022-11-22 16:21 UTC, Yosuke Matsumura
Details
Kwin Debug Window 2 (176.80 KB, image/png)
2022-11-22 16:22 UTC, Yosuke Matsumura
Details
before sleep with quick tiled windows (199.08 KB, image/png)
2024-03-31 11:06 UTC, Antoine Gatineau
Details
After resume with quick tiled windows - plasma 6 (244.33 KB, image/png)
2024-03-31 11:07 UTC, Antoine Gatineau
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yosuke Matsumura 2022-11-15 21:11:04 UTC
Created attachment 153776 [details]
System log from the timeframe of screen wake

SUMMARY
This issue occurs after waking the screen after it has turned off (due to Screen Energy Saving) - *not* from Suspend session (when manually putting computer to sleep). Some application windows (though not always all) seem to disappear. The application is still running and its icon is still in the Task Manager. However, clicking the application icon in the Task Manager does not bring the window into view. 

I end up needing to close the windows from the Task Manager (window preview pane shows blank window as well). Then I can re-launch the application.

I see in the system log (attached), that there is this message from the time when I wake the screen:
kwin_wayland[14813]: libkwinglutils: Invalid framebuffer status:  "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT"

STEPS TO REPRODUCE
1. In System Settings, Power Management, Energy Saving, enable Screen Energy Saving and set time to some value < Suspend Session time.
2. Wait for screen to turn off as per time set in step 1
3. Wake the screen by pressing key on keyboard

OBSERVED RESULT
Some windows that were open and visible before the screen turned off - such as Konsole - are no longer visible. However some other windows are unaffected - such as Firefox. I'm unable to find a pattern as to which windows will disappear and which won't, but Konsole seems to be reliably reproducible.

EXPECTED RESULT
All open and visible windows before the screen turned off should be present when the screen turns back on.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Fedora Kinoite 37
(available in About System)
KDE Plasma Version: 5.26.2
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.6

ADDITIONAL INFORMATION
GPU: AMD RX 6900XT connected to 4K monitor using DisplayPort
Comment 1 Yosuke Matsumura 2022-11-15 21:12:27 UTC
Created attachment 153777 [details]
Screenshot of system before screen turns off

I took this screenshot, then waited until the screen turned off
Comment 2 Yosuke Matsumura 2022-11-15 21:14:44 UTC
Created attachment 153778 [details]
After screen wake 1

This is what my screen looked like right after waking it. All my windows have disappeared.
Comment 3 Yosuke Matsumura 2022-11-15 21:16:26 UTC
Created attachment 153779 [details]
After screen wake 2

There was a crash report from System Settings, and you can see that other applications that were on screen prior to the screen turning off (Konsole, KWrite) are still running in the Task Manager. However, the window preview is blank, showing the window is gone.
Comment 4 Yosuke Matsumura 2022-11-17 16:04:46 UTC
Updated system to following versions; issue still remains:

KDE Plasma: 5.26.3
KDE Frameworks: 5.100.0
QT Version: 5.15.7
Comment 5 Zamundaaa 2022-11-22 14:24:10 UTC
When it happens, can you open the kwin debug console (search for kwin in krunner) and check the geometry field for the disappeared windows, if they're offscreen or resized impossibly small, something like that?
Comment 6 Yosuke Matsumura 2022-11-22 16:21:51 UTC
Created attachment 153945 [details]
Kwin Debug Window 1
Comment 7 Yosuke Matsumura 2022-11-22 16:22:06 UTC
Created attachment 153946 [details]
Kwin Debug Window 2
Comment 8 Yosuke Matsumura 2022-11-22 16:22:58 UTC
(In reply to Zamundaaa from comment #5)
> When it happens, can you open the kwin debug console (search for kwin in
> krunner) and check the geometry field for the disappeared windows, if
> they're offscreen or resized impossibly small, something like that?

Hi, I've uploaded screenshots of the Kwin Debug console, opened to the Konsole windows that has disappeared.
Comment 9 Zamundaaa 2022-11-22 16:58:20 UTC
> geometry: 8267.5,8267.5, 8268x8268
Couldn't be weirder but that explains why you don't see the window anymore
Comment 10 Antoine Gatineau 2023-03-12 08:40:21 UTC
Hello,
I am also having this issue. It is still present in 5.27.2
Operating System: Fedora Linux 37
KDE Plasma Version: 5.27.2
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.1.15-200.fc37.x86_64 (64-bit)
Graphics Platform: Wayland

However sinc e5.27 the window can now be recovered by focusing, defocusing, refocuing the window (click on the app in the task manager)
Won't work if multiple windows are grouped in task manager.

If any debug output or testing is needed, please feel free to ask
Comment 11 Antoine Gatineau 2023-03-12 13:13:27 UTC
Something that might help.
On my laptop, in don't have the issue. It's configuration:
Operating System: Fedora Linux 37
KDE Plasma Version: 5.27.2
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.1.15-200.fc37.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i7-8565U CPU @ 1.80GHz
Memory: 15.4 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 620
Manufacturer: ASUSTeK COMPUTER INC.
Product Name: ZenBook UX433FA_UX433FA
System Version: 1.0

On my desktop, it is pretty systematic when waking up the screen (single screen). It's configuration:
Operating System: Fedora Linux 37
KDE Plasma Version: 5.27.2
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.1.15-200.fc37.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 1600 Six-Core Processor
Memory: 15.6 GiB of RAM
Graphics Processor: AMD Radeon RX 5700 XT
Manufacturer: Micro-Star International Co., Ltd.
Product Name: MS-7A39
System Version: 1.0

The desktop has a 4k resolution but event in 1920x1080 the issue is present.
So it looks like an issue with AMD GPU.
Comment 12 Antoine Gatineau 2024-03-31 11:06:27 UTC
Created attachment 167981 [details]
before sleep with quick tiled windows

After upgrading to plasma 6 on Fedora 40 Beta, the situation is much better.
Operating System: Fedora Linux 40
KDE Plasma Version: 6.0.2
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.8.2-300.fc40.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 5600X 6-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: AMD Radeon RX 5700 XT
Manufacturer: Micro-Star International Co., Ltd.
Product Name: MS-7C91
System Version: 2.0

The issue appears to be fixed for floating windows. I just ran a few sleep/wait/resume and the windows come back with the original geometry.
However the geometry changes when windows are quick tiled. (which is my regular way of organizing my windows :/ )
The title bar comes back to a original (default) size and the body of the window either keep the pre-sleep size or reverts to an original size matching the title bar.

I hope this helps to pinpoint the source of the issue.
Comment 13 Antoine Gatineau 2024-03-31 11:07:06 UTC
Created attachment 167982 [details]
After resume with quick tiled windows - plasma 6
Comment 14 Zamundaaa 2024-05-03 16:39:41 UTC
Git commit 14c08422ca32e6b5d6cca9b1ae1a472f68de9da6 by Xaver Hugl.
Committed on 03/05/2024 at 13:58.
Pushed by zamundaaa into branch 'master'.

placementtracker: fix quick tiled windows not being restored correctly

There were two problems:
1. Workspace interacted with the tile mode of windows before inhibiting
the placement tracker, so the wrong window state was stored in the placement
tracker
2. Window::setQuickTileMode is unintuitive and has some undesired side effects,
meant to handle quick tiling with keyboard shortcuts and by dragging the
window with a mouse specifically. This commit just works around that by
un-setting the tile mode first

M  +64   -0    autotests/integration/outputchanges_test.cpp
M  +4    -0    src/placementtracker.cpp
M  +5    -4    src/workspace.cpp

https://invent.kde.org/plasma/kwin/-/commit/14c08422ca32e6b5d6cca9b1ae1a472f68de9da6
Comment 15 Zamundaaa 2024-05-03 17:21:33 UTC
Git commit b3880f6bce9844f641e12020e4ec7e290e38a014 by Xaver Hugl.
Committed on 03/05/2024 at 16:59.
Pushed by zamundaaa into branch 'Plasma/6.0'.

placementtracker: fix quick tiled windows not being restored correctly

There were two problems:
1. Workspace interacted with the tile mode of windows before inhibiting
the placement tracker, so the wrong window state was stored in the placement
tracker
2. Window::setQuickTileMode is unintuitive and has some undesired side effects,
meant to handle quick tiling with keyboard shortcuts and by dragging the
window with a mouse specifically. This commit just works around that by
un-setting the tile mode first

M  +62   -0    autotests/integration/outputchanges_test.cpp
M  +4    -0    src/placementtracker.cpp
M  +5    -4    src/workspace.cpp

https://invent.kde.org/plasma/kwin/-/commit/b3880f6bce9844f641e12020e4ec7e290e38a014