Bug 37669

Summary: [NVAC] problem when unplugging DP-1
Product: xorg Reporter: Antoine Reversat <a.reversat>
Component: Driver/nouveauAssignee: Nouveau Project <nouveau>
Status: RESOLVED INVALID QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: a.reversat
Version: unspecified   
Hardware: Other   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Dmesg after external monitor disabled
none
Dmesg with drm.debug=0x07 with several connect/disconnect
none
dmesg with drm.debug=15 and nouveau.reg_debug=0x200 1 unplug/replug
none
vbios none

Description Antoine Reversat 2011-05-27 09:24:37 UTC
Created attachment 47232 [details]
Dmesg after external monitor disabled

I have a macbook 5,1 with an NVAC card (02:00.0 VGA compatible controller: nVidia Corporation C79 [GeForce 9400M] (rev b1))

When I unplug my external monitor (plugged through a mini display port -> dvi adapter) my window manager tries to disable the external screen resulting in my main screen flickering and being unusable (only the cursor moves).

Attached is the output of dmesg after it has happened (I was still able to access the machine through ssh).
Comment 1 Antoine Reversat 2011-12-06 11:44:37 UTC
So I started looking deeper into this issue and it's probably somewhat low-level as if I boot my computer into a console and load the nouveau driver then unplug DP-1 the same flickering happens (but re-pluging the monitor on DP-1 stops the flickering). I'll attach a demsg output with drm.debug=0x07 there's some interresting things specialy (I think) these lines :

checking generic (c0010000 640000) vs hw (c0000000 10000000)

and then 

Dec  6 10:55:25 antoine-MacBook kernel: [   15.878616] [drm] nouveau 0000:02:00.0: Register 0x00004028 not found in PLL limits table
Dec  6 10:55:25 antoine-MacBook kernel: [   15.878622] [drm] nouveau 0000:02:00.0: Register 0x00004008 not found in PLL limits table
Dec  6 10:55:25 antoine-MacBook kernel: [   15.878630] [drm] nouveau 0000:02:00.0: Register 0x00004030 not found in PLL limits table
Comment 2 Antoine Reversat 2011-12-06 11:47:24 UTC
Created attachment 54156 [details]
Dmesg with drm.debug=0x07 with several connect/disconnect
Comment 3 Antoine Reversat 2011-12-08 08:31:34 UTC
Created attachment 54243 [details]
dmesg with drm.debug=15 and nouveau.reg_debug=0x200 1 unplug/replug
Comment 4 Antoine Reversat 2011-12-15 07:38:18 UTC
Created attachment 54465 [details]
vbios
Comment 5 Antoine Reversat 2011-12-15 07:47:52 UTC
So I've gotten a bit further.

I tracked down the code that triggers the issue : it's this part of nv50_sor.c :

        if (!nv_wait(dev, NV50_PDISPLAY_SOR_DPMS_CTRL(or),
                    NV50_PDISPLAY_SOR_DPMS_CTRL_PENDING, 0)) {
            NV_ERROR(dev, "timeout: SOR_DPMS_CTRL_PENDING(%d) == 0\n", or);
            NV_ERROR(dev, "SOR_DPMS_CTRL(%d) = 0x%08x\n", or,
                    nv_rd32(dev, NV50_PDISPLAY_SOR_DPMS_CTRL(or)));
        }

        val = nv_rd32(dev, NV50_PDISPLAY_SOR_DPMS_CTRL(or));

        if (mode == DRM_MODE_DPMS_ON)
            val |= NV50_PDISPLAY_SOR_DPMS_CTRL_ON;
        else
            val &= ~NV50_PDISPLAY_SOR_DPMS_CTRL_ON;

        nv_wr32(dev, NV50_PDISPLAY_SOR_DPMS_CTRL(or), val |
                NV50_PDISPLAY_SOR_DPMS_CTRL_PENDING);
        if (!nv_wait(dev, NV50_PDISPLAY_SOR_DPMS_STATE(or),
                    NV50_PDISPLAY_SOR_DPMS_STATE_WAIT, 0)) {
            NV_ERROR(dev, "timeout: SOR_DPMS_STATE_WAIT(%d) == 0\n", or);
            NV_ERROR(dev, "SOR_DPMS_STATE(%d) = 0x%08x\n", or,
                    nv_rd32(dev, NV50_PDISPLAY_SOR_DPMS_STATE(or)));
        }


If I add an if to skip the code if the sor is going to DPMS off and the encoder type is tmds then the bug doesn't happen anymore. I don't understand how this affects sor0 (which the LVDS output is using) as the code seems pretty sane.

I also noted something and am not sure whether it's correct or not. My flat panel is connected through a DP-DVI adapter but nv_encoder->dcb->type is OUTPUT_TMDS not OUTPUT_DP. Is this due to the fact that it's "DVI over DP" ? Or is this not normal ?
Comment 6 Ilia Mirkin 2013-08-18 18:10:06 UTC
It appears that this bug report has laid dormant for quite a while. Sorry we haven't gotten to it. Since we fix bugs all the time, chances are pretty good that your issue has been fixed with the latest software. Please give it a shot. (Linux kernel 3.10.7, xf86-video-nouveau 1.0.9, mesa 9.1.6, or their git versions.) If upgrading to the latest isn't an option for you, your distro's bugzilla is probably the right destination for your bug report.

In an effort to clean up our bug list, we're pre-emptively closing all bugs that haven't seen updates since 2011. If the original issue remains, please make sure to provide fresh info, see http://nouveau.freedesktop.org/wiki/Bugs/ for what we need to see, and re-open this one.

Thanks,

The Nouveau Team

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.