Bug 465209 - Kwin error to focus after monitor restart
Summary: Kwin error to focus after monitor restart
Status: RESOLVED NOT A BUG
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 5.26.5
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-03 04:33 UTC by dms.jonathan
Modified: 2023-02-09 03:09 UTC (History)
1 user (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 dms.jonathan 2023-02-03 04:33:06 UTC
SUMMARY

Black screen flickering when starting a game on Steam after screen/mine has turn off one time 

Only a single screen is in use (no multi monitors issue)

Tried to disable gsync with nvidia-setting, force pipeline, reconfigure xorg.conf file

Tested with compositor disabled

STEPS TO REPRODUCE
1. Switch screen with power button
2. Switch it back on
3. Start a game in Steam (tested with Deathloop but does the same on Rocket League)

No issue after a reboot for example. Only after a screen turn off (manually or through suspend)

OBSERVED RESULT

Flickering Black screen on start up. Cannot interact with the game window (I have a video if you want to see). We can still hear game sound and rendering once in a while but not interactable.

I think it is a Kwin issue because of a log in journalctl I find only when I have the issue:

Feb 02 23:10:18 arch-jimbo kwin_x11[935]: kwin_core: Failed to focus 0x340008d (error 8)
Feb 02 23:10:18 arch-jimbo kwin_x11[935]: kwin_core: Failed to restore focus. Activating 0x3400021

EXPECTED RESULT

Game starting properly

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux (Linux 6.1.9)
(available in About System)
KDE Plasma Version: 5.26.5
KDE Frameworks Version: 5.102.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION

❯ nvidia-smi
Thu Feb  2 23:16:14 2023       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.85.05    Driver Version: 525.85.05    CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:0B:00.0  On |                  N/A |
|  0%   41C    P8    14W / 300W |    861MiB / 11264MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
\|    0   N/A  N/A       770      G   /usr/lib/Xorg                     239MiB |
|    0   N/A  N/A       895      G   /usr/bin/kwalletd5                  3MiB |
|    0   N/A  N/A       932      G   /usr/bin/ksmserver                  3MiB |
|    0   N/A  N/A       934      G   /usr/bin/kded5                      3MiB |
|    0   N/A  N/A       935      G   /usr/bin/kwin_x11                  26MiB |
|    0   N/A  N/A       968      G   /usr/bin/plasmashell               34MiB |
|    0   N/A  N/A      1010      G   ...de-authentication-agent-1        3MiB |
|    0   N/A  N/A      1073      G   /usr/lib/kdeconnectd                3MiB |
|    0   N/A  N/A      1085      G   /usr/bin/kaccess                    3MiB |
|    0   N/A  N/A      1091      G   /usr/lib/DiscoverNotifier           3MiB |
|    0   N/A  N/A      1125      G   /usr/lib/firefox/firefox          199MiB |
|    0   N/A  N/A      1267      G   /usr/bin/konsole                    3MiB |
|    0   N/A  N/A      1322      G   /usr/bin/systemsettings            29MiB |
|    0   N/A  N/A      1748      G   ...-browser-integration-host        3MiB |
|    0   N/A  N/A      3433      G   ...e/Steam/ubuntu12_32/steam       42MiB |
|    0   N/A  N/A      3488      G   ...ef_log.txt --shared-files      247MiB |
+-----------------------------------------------------------------------------+
Comment 1 dms.jonathan 2023-02-03 04:41:05 UTC
Added a public video to show the issue on my google drive: https://drive.google.com/file/d/1AqO-PjKe4G-TyajE6Kae_xfXnjfVq3Ll/view
Comment 2 Vlad Zahorodnii 2023-02-03 08:20:34 UTC
Feb 02 23:10:18 arch-jimbo kwin_x11[935]: kwin_core: Failed to focus 0x340008d (error 8)
Feb 02 23:10:18 arch-jimbo kwin_x11[935]: kwin_core: Failed to restore focus. Activating 0x3400021

it can be printed if kwin tries to focus a window but it's been closed in meanwhile (communication between kwin and xorg is asynchronous). Not sure how kwin could cause it or whether it's a driver bug. Can you check whether the issue is reproducible when running another window manager, e.g. openbox

   systemctl stop --user plasma-kwin_x11
   openbox --replace

after you're done

  systemctl restart --user plasma-kwin_x11
Comment 3 dms.jonathan 2023-02-03 12:51:48 UTC
(In reply to Vlad Zahorodnii from comment #2)
> Feb 02 23:10:18 arch-jimbo kwin_x11[935]: kwin_core: Failed to focus
> 0x340008d (error 8)
> Feb 02 23:10:18 arch-jimbo kwin_x11[935]: kwin_core: Failed to restore
> focus. Activating 0x3400021
> 
> it can be printed if kwin tries to focus a window but it's been closed in
> meanwhile (communication between kwin and xorg is asynchronous). Not sure
> how kwin could cause it or whether it's a driver bug. Can you check whether
> the issue is reproducible when running another window manager, e.g. openbox
> 
>    systemctl stop --user plasma-kwin_x11
>    openbox --replace
> 
> after you're done
> 
>   systemctl restart --user plasma-kwin_x11

You are indeed right. Trying with openbox still reproduce it. 

Thanks for your time. Closing this
Comment 4 dms.jonathan 2023-02-09 03:09:10 UTC
For posterity: https://github.com/ValveSoftware/steam-for-linux/issues/7866#issuecomment-1422916056

It was indeed an error with Nvidia driver. Disabling gsync at the monitor (not in nvidia-settings) did the trick