Bug 97588

Summary: Disconnecting/Reconnecting monitor results in 'laggy' graphics and disappearing mouse cursor
Product: xorg Reporter: rik
Component: Driver/nouveauAssignee: Nouveau Project <nouveau>
Status: RESOLVED MOVED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
kernel_log
none
Xorg.0.log
none
interrupts_before
none
interrupts after
none
kernel_log with debugging
none
Xorg.0.log debug none

Description rik 2016-09-03 21:36:52 UTC
Created attachment 126188 [details]
kernel_log

Overview:
Whenever I disconnect or reconnect my monitor via HDMI or switch systems with my HDMI switcher, the screen seems to be laggy and my mouse cursor won't move. There seems to be input from the mouse as I can use the 'hidden' cursor to log out and log back in which resolves the issue.

I can only describe the effect as being extremely laggy. In chrome I can see that tabs change, however content won't show. I can type in the terminal but only see some letters appearing (really slowly and random).

Steps to Reproduce:

1) Disconnect HDMI cable
2) Reconnect

Actual Results:
Slow and unusable screen

Expected Results:
Usable screen

Hardware:
NVIDIA Corporation GM206 [GeForce GTX 960]

Software:
Fedora 24
Kernel 4.7.2-201.fc24.x86_64

X.Org X Server 1.18.4
Release Date: 2016-07-19
X Protocol Version 11, Revision 0
Build Operating System:  4.6.4-301.fc24.x86_64 
Current Operating System: Linux ElGuapo 4.7.2-201.fc24.x86_64 #1 SMP Fri Aug 26 15:58:40 UTC 2016 x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.7.2-201.fc24.x86_64 root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet log_buf_len=1M
Build Date: 25 August 2016  05:27:31PM
Build ID: xorg-x11-server 1.18.4-4.fc24 
Current version of pixman: 0.34.0

xorg-x11-drv-nouveau
Version     : 1.0.12
Release     : 4.fc24
Comment 1 rik 2016-09-03 21:37:21 UTC
Created attachment 126189 [details]
Xorg.0.log
Comment 2 Ilia Mirkin 2016-09-03 21:58:58 UTC
Can you see if your interrupt rate goes through the roof? You can see in /proc/interrupts. Is the attached kernel log from after the issue happens?
Comment 3 rik 2016-09-03 22:06:01 UTC
Created attachment 126192 [details]
interrupts_before
Comment 4 rik 2016-09-03 22:06:22 UTC
Created attachment 126193 [details]
interrupts after
Comment 5 rik 2016-09-03 22:07:08 UTC
The log is indeed after the issue occurred. I have added a cat of the interrupts before and after.
Comment 6 Ilia Mirkin 2016-09-03 22:09:09 UTC
Hm, 300 interrupts is hardly what I call a storm. Maybe with 3 or 4 more 0's on it...

Try booting with

nouveau.debug=debug drm.debug=14

and see if that reveals anything interesting.
Comment 7 rik 2016-09-03 22:15:11 UTC
Created attachment 126194 [details]
kernel_log with debugging
Comment 8 rik 2016-09-03 22:15:30 UTC
Created attachment 126195 [details]
Xorg.0.log debug
Comment 9 rik 2016-09-03 22:16:30 UTC
I am now booted with debugging on and attached the dmesg output and Xorg.0.log after I have unplugged and reconnected the monitor.
Comment 10 Ilia Mirkin 2016-09-03 22:19:56 UTC
And no messages are constantly repeating in "steady state"? If not, I got nothing. Otherwise we're not properly clearing some interrupt state. I do see

nouveau 0000:01:00.0: disp: DAC1 sense: 80100000

a whole bunch. Which reminds me - there was some userspace application that kept polling and repolling connector state and messing things up. Perhaps the unplug/plug activates it in your desktop environment?
Comment 11 rik 2016-09-03 22:28:09 UTC
I am not sure how I can check for messages that are constantly repeating in "steady state". I can provide a list of running apps if that helps at all. But it is a pretty clean installation (or at least I think so :P ).
Comment 12 Ilia Mirkin 2016-09-03 22:36:16 UTC
Once you get to a messed up state, ssh in from another machine and run

dmesg -w

And see if new messages keep appearing. If they do, I'd be curious which ones.
Comment 13 rik 2016-09-04 10:20:57 UTC
There does not seem to be any new messages popping up with dmesg -w.
Comment 14 rik 2016-09-04 10:34:58 UTC
Ok cool, I have a horrible work around! I installed Arandr, now if I disconnect the monitor and reconnect, the graphics are screwed up (laggy and does not seem to be updated).

If I then just do a ctrl-return in Arandr (apply settings) all is back to normal.

Does this maybe give a clue of what happens? I wonder if there is a way of connecting a script to the reconnect event to do this underwater. It ain't pretty but at least it is somewhat workable.
Comment 15 Karol Herbst 2016-09-04 10:50:22 UTC
uhh I remember. At work on a xfce4 machine we also have troubles with a laptop + 2 external monitors on an AMD gpu. After login all screens are black and sometimes when reconnecting screens we have really bad artefacts on one of them.

Maybe this is a xfce4 issue?
Comment 16 rik 2016-09-04 10:58:51 UTC
Hmm, it does start to look like this is a XFCE bug instead of nouveau. I'll try and see what happens with another DE. Thanks for all the responses so far, I actually learned a lot.
Comment 17 rik 2016-09-18 11:50:28 UTC
I think this can be closed as it does seem to be a XFCE bug rather than nouveau. I have confirmed that KDE/openbox do work when switching or disconnecting the monitor. 

For future reference, when people have the same issue I would recommend creating a keyboard shortcut that loads an Arandr script. (mine is at win+alt+pause). Thanks for the responses and help figuring this out.
Comment 18 poma 2016-09-18 15:51:47 UTC
(In reply to Karol Herbst from comment #15)
> uhh I remember. At work on a xfce4 machine we also have troubles with a
> laptop + 2 external monitors on an AMD gpu. After login all screens are
> black and sometimes when reconnecting screens we have really bad artefacts
> on one of them.
> 
> Maybe this is a xfce4 issue?

Have you considered the possibility to report the issue here:
https://bugzilla.xfce.org/buglist.cgi?component=Display%20Settings&product=Xfce4-settings
Comment 19 Martin Peres 2019-12-04 09:16:34 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/driver/xf86-video-nouveau/issues/284.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.