[RFC PATCH] Re: KMS:RV635:Radeon 3650HD graphics driver broken on a laptop when connected to a docking station and external display

Pasi Kärkkäinen pasik at iki.fi
Mon Jun 21 11:17:14 PDT 2010


On Mon, Jun 21, 2010 at 11:03:08AM -0400, Alex Deucher wrote:
> On Mon, Jun 21, 2010 at 8:45 AM, Jerome Glisse <glisse at freedesktop.org> wrote:
> > On Mon, Jun 21, 2010 at 12:31:22PM +0300, Pasi Kärkkäinen wrote:
> >> On Mon, Jun 21, 2010 at 12:23:10PM +0300, Pasi Kärkkäinen wrote:
> >> > On Sat, Jun 19, 2010 at 10:24:53PM +0300, Pasi Kärkkäinen wrote:
> >> > > On Fri, Jun 18, 2010 at 09:45:22PM +0300, Pasi Kärkkäinen wrote:
> >> > > > > > > >> >
> >> > > > > > > >> > I wonder if that HDMI-0 is the key to the problem.. I don't have anything connected
> >> > > > > > > >> > to the HDMI connector on the laptop. There's no HDMI connector on the dock, it's only in the laptop.
> >> > > > > > > >>
> >> > > > > > > >> Indeed that is the problem.  On your system the HDMI and DVI ports
> >> > > > > > > >> share the same encoder and DDC line so they will both come up as
> >> > > > > > > >> connected since the line is shared.  The driver used to check the edid
> >> > > > > > > >> when the lines where shared and select HDMI or DVI based on the EDID,
> >> > > > > > > >> but perhaps that got broken at some point.
> >> > > > > > > >>
> >> > > > > > > >
> >> > > > > > > > Makes sense. Does some kernel option/parameter affect that?
> >> > > > > > >
> >> > > > > > > No.  I'll check the code and see if I can figure out what's going on.
> >> > > > > > >
> >> > > > > >
> >> > > > > > Ok, thanks!
> >> > > > > >
> >> > > > >
> >> > > > > Hello,
> >> > > > >
> >> > > > > I'll be near the dock tomorrow.. So if you have a chance of looking at this, and want me to test something,
> >> > > > > I could do it on thursday/friday.
> >> > > > >
> >> > > >
> >> > > > I just tried the latest Fedora 13 kernel (2.6.33.5-124.fc13.x86_64) and the latest
> >> > > > Fedora development (rawhide 2.6.34-43.fc14.x86_64) kernel, but the behaviour was the same.
> >> > > >
> >> > > > Connecting display to the DVI connector makes the HDMI connector also show the same display,
> >> > > > breaking things..
> >> > > >
> >> > >
> >> > > Here's a new log with drm.debug=4.. that's the biggest debug level that still allows me to grab
> >> > > the whole dmesg log before it's overwritten by huge amount of debug messages.
> >> > >
> >> > > Full dmesg log:
> >> > > http://pasik.reaktio.net/fedora/bz593429/both-internal-and-external-displays-active/dmesg-with-drmdebug4.txt
> >> > >
> >> >
> >> > Ok.. I did some debugging, and figured out how to make it work. Patch attached.
> >> > I'm not sure if this is the correct method.. someone familiar with the code should review it.
> >> >
> >> >
> >> > Some debugging information for my system (HP EliteBook 8530p):
> >> >
> >> > >
> >> > > [drm] Radeon Display Connectors
> >> > > [drm] Connector 0:
> >> > > [drm]   VGA
> >> > > [drm]   DDC: 0x7e40 0x7e40 0x7e44 0x7e44 0x7e48 0x7e48 0x7e4c 0x7e4c
> >> > > [drm]   Encoders:
> >> > > [drm]     CRT1: INTERNAL_KLDSCP_DAC1
> >> >
> >> > connector->devices for VGA is: 1
> >> >
> >> > > [drm] Connector 1:
> >> > > [drm]   LVDS
> >> > > [drm]   Encoders:
> >> > > [drm]     LCD1: INTERNAL_KLDSCP_LVTMA
> >> >
> >> > connector->devices for LVDS is: 2
> >> >
> >> > > [drm] Connector 2:
> >> > > [drm]   DVI-D
> >> > > [drm]   HPD1
> >> > > [drm]   DDC: 0x7e60 0x7e60 0x7e64 0x7e64 0x7e68 0x7e68 0x7e6c 0x7e6c
> >> > > [drm]   Encoders:
> >> > > [drm]     DFP1: INTERNAL_UNIPHY
> >> >
> >> > connector->devices for DVI-D is: 8
> >> >
> >> > > [drm] Connector 3:
> >> > > [drm]   HDMI-A
> >> > > [drm]   HPD2
> >> > > [drm]   DDC: 0x7e60 0x7e60 0x7e64 0x7e64 0x7e68 0x7e68 0x7e6c 0x7e6c
> >> > > [drm]   Encoders:
> >> > > [drm]     DFP2: INTERNAL_UNIPHY
> >> >
> >> > connector->devices for HDMI-A is: 128
> >> >
> >> >
> >> >
> >> > The code in radeon_connectors.c in radeon_dvi_detect():
> >> >
> >> >     /* multiple connectors on the same encoder with the same ddc line
> >> >      * This tends to be HDMI and DVI on the same encoder with the
> >> >      * same ddc line.  If the edid says HDMI, consider the HDMI port
> >> >      * connected and the DVI port disconnected.  If the edid doesn't
> >> >      * say HDMI, vice versa.
> >> >      */
> >> >     if (radeon_connector->shared_ddc && (ret == connector_status_connected)) {
> >> >             struct drm_device *dev = connector->dev;
> >> >             struct drm_connector *list_connector;
> >> >             struct radeon_connector *list_radeon_connector;
> >> >             list_for_each_entry(list_connector, &dev->mode_config.connector_list, head) {
> >> >                     if (connector == list_connector)
> >> >                             continue;
> >> >                     list_radeon_connector = to_radeon_connector(list_connector);
> >> >                     if (radeon_connector->devices == list_radeon_connector->devices) {
> >> >                             if (drm_detect_hdmi_monitor(radeon_connector->edid)) {
> >> >                                     if (connector->connector_type == DRM_MODE_CONNECTOR_DVID) {
> >> >                                             kfree(radeon_connector->edid);
> >> >                                             radeon_connector->edid = NULL;
> >> >                                             ret = connector_status_disconnected;
> >> >                                     }
> >> >                             } else {
> >> >                                     if ((connector->connector_type == DRM_MODE_CONNECTOR_HDMIA) ||
> >> >                                         (connector->connector_type == DRM_MODE_CONNECTOR_HDMIB)) {
> >> >                                             kfree(radeon_connector->edid);
> >> >                                             radeon_connector->edid = NULL;
> >> >                                             ret = connector_status_disconnected;
> >> >                                     }
> >> >                             }
> >> >                     }
> >> >             }
> >> >     }
> >> >
> >> >
> >> > Ok, so at least on my system the "if (connector == list_connector)" will SKIP the connector
> >> > that actually would match in "if (radeon_connector->devices == list_radeon_connector->devices)",
> >> > and thus the drm_detect_hdmi_monitor() is never called.
> >> >
> >> > My patch removes that "if (connector == list_connector)" check and fixes the problem on my system.
> >> > Is this the correct way to do it?
> >> >
> >> > radeon-fix-shared_ddc-dvi-hdmi-edid-detection.patch:
> >> >     - allow checking against all connectors to be able to properly detect shared_ddc dvi/hdmi displays
> >> >     - patch applies to 2.6.33.5, 2.6.34 and 2.6.35-rc3. Tested with Fedora 13 2.6.33.5-124.fc13.x86_64.
> >> >     - Signed-off-by: Pasi Kärkkäinen <pasik at iki.fi>
> >> >
> >>
> >> And actually attached now :)
> >>
> >> -- Pasi
> >
> > I am not sure your patch is right, my guess is that devices field of
> > radeon connector structure btw the HDMI & DVI connector are different
> > and thus that drm_detect_hdmi_monitor is not call. I expect it's normal
> > for the device field to be different (my understanding being that HDMI
> > will have one more bit set than the DVI connector). Bottom line is
> > i think we want to discard non hdmi connector just in case we face
> > shared connector.
> >
> > Alex would have to comment on the device field test, maybe your atombios
> > is broken. Does it works if instead of removing
> > if (connector == list_connector)
> >        continue;
> > You remove :
> > if (radeon_connector->devices == list_radeon_connector->devices)
> >
> > Also can you print the radeon_connector->devices of all your connector
> > so we can compare them.
> 
> The code was for systems with shared ddc lines and shared encoders,
> but it looks like your system may have a shared ddc line and (sort of)
> non-shared encoders.  I suspect the DVI port is using UNIPHY A or A+B
> (for dual link) and HDMI is using UNIPHY link B.  It's probably
> actually using router objects (gpio toggle to switch gpio routing
> between physical ports), however support for that is not implemented
> yet which is why we have the current code.  Can you send me a copy of
> your vbios so I can verify?
> 
> To access your vbios (as root):
> cd /sys/bus/pci/device/<pci bus id>
> echo 1 > rom
> cat rom > /tmp/vbios.rom
> echo 0 > rom
> 


Here you are:
http://pasik.reaktio.net/fedora/bz593429/vbios-hp-elitebook-8530p-ati-radeon-hd3650.rom


# lspci -vv

01:00.0 VGA compatible controller: ATI Technologies Inc Mobility Radeon HD 3650 (prog-if 00 [VGA controller])
        Subsystem: Hewlett-Packard Company Device 30e7
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 0, Cache Line Size: 64 bytes
        Interrupt: pin A routed to IRQ 33
        Region 0: Memory at c0000000 (32-bit, prefetchable) [size=256M]
        Region 1: I/O ports at 7000 [size=256]
        Region 2: Memory at d8300000 (32-bit, non-prefetchable) [size=64K]
        Expansion ROM at d8320000 [disabled] [size=128K]
        Capabilities: [50] Power Management version 3
                Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
                Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
        Capabilities: [58] Express (v2) Legacy Endpoint, MSI 00
                DevCap: MaxPayload 128 bytes, PhantFunc 0, Latency L0s <4us, L1 unlimited
                        ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
                DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
                        RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop+
                        MaxPayload 128 bytes, MaxReadReq 128 bytes
                DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
                LnkCap: Port #0, Speed 2.5GT/s, Width x16, ASPM L0s L1, Latency L0 <64ns, L1 <1us
                        ClockPM- Surprise- LLActRep- BwNot-
                LnkCtl: ASPM L0s L1 Enabled; RCB 64 bytes Disabled- Retrain- CommClk+
                        ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
                LnkSta: Speed 2.5GT/s, Width x16, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
                DevCap2: Completion Timeout: Not Supported, TimeoutDis-
                DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-
              LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-, Selectable De-emphasis: -6dB
                         Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
                         Compliance De-emphasis: -6dB
                LnkSta2: Current De-emphasis Level: -3.5dB
        Capabilities: [a0] MSI: Enable+ Count=1/1 Maskable- 64bit+
                Address: 00000000fee0200c  Data: 41d1
        Capabilities: [100 v1] Vendor Specific Information: ID=0001 Rev=1 Len=010 <?>
        Kernel driver in use: radeon
        Kernel modules: radeon

01:00.1 Audio device: ATI Technologies Inc RV635 Audio device [Radeon HD 3600 Series]
        Subsystem: ATI Technologies Inc RV635 Audio device [Radeon HD 3600 Series]
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 0, Cache Line Size: 64 bytes
        Interrupt: pin B routed to IRQ 37
        Region 0: Memory at d8310000 (32-bit, non-prefetchable) [size=16K]
        Capabilities: [50] Power Management version 3
                Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
                Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
        Capabilities: [58] Express (v2) Legacy Endpoint, MSI 00
                DevCap: MaxPayload 128 bytes, PhantFunc 0, Latency L0s <4us, L1 unlimited
                        ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
                DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
                        RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop+
                        MaxPayload 128 bytes, MaxReadReq 128 bytes
                DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
                LnkCap: Port #0, Speed 2.5GT/s, Width x16, ASPM L0s L1, Latency L0 <64ns, L1 <1us
                        ClockPM- Surprise- LLActRep- BwNot-
                LnkCtl: ASPM L0s L1 Enabled; RCB 64 bytes Disabled- Retrain- CommClk+
                        ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
                LnkSta: Speed 2.5GT/s, Width x16, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
                DevCap2: Completion Timeout: Not Supported, TimeoutDis-
                DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-
                LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-, Selectable De-emphasis: -6dB
                         Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
                         Compliance De-emphasis: -6dB
                LnkSta2: Current De-emphasis Level: -3.5dB
        Capabilities: [a0] MSI: Enable+ Count=1/1 Maskable- 64bit+
                Address: 00000000fee0100c  Data: 4142
        Capabilities: [100 v1] Vendor Specific Information: ID=0001 Rev=1 Len=010 <?>
        Kernel driver in use: HDA Intel
        Kernel modules: snd-hda-intel



-- Pasi




More information about the dri-devel mailing list