Bug 17533

Summary: [G43] startx crash when using DVI port
Product: xorg Reporter: Steve Bergman <sbergman27>
Component: Driver/intelAssignee: Wang Zhenyu <zhenyu.z.wang>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: critical    
Priority: high CC: ajax, jbarnes, jcristau, md, michael.fu
Version: unspecifiedKeywords: NEEDINFO
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
lspci -vv
none
Standard out and standard err
none
Strace output
none
Log with ModeDebug on
none
Log with lines 143-150 of i830_hdmi.c commented
none
Corrected log file upload
none
X log from git repo. 09-25-08 09:30 CDT
none
xserver mode choose segfault fix
none
Check nextEnabledOutput return before using
none
clear hotplug stat before detect
none
try HDMI hotplug detect more times none

Description Steve Bergman 2008-09-11 11:39:14 UTC
Created attachment 18825 [details]
lspci -vv

I have a Gigabyte EG43M-S2H which uses a G43 chipset and X4500 video.  The board has VGA, DVI, hdm, and HDMI.  If I use the VGA port everything is fine.  But if I try to use the DVI port, the X server crashes while staring up with a segfault and a backtrace.

I'm running a fully updated 64 bit Ubuntu 8.10 alpha 5 with the 2.4.1 driver. (Xorg 7.4 prerelease) I have also tried with 2.4.2 compiled from upstream with the same results.
Comment 1 Steve Bergman 2008-09-11 11:39:53 UTC
Created attachment 18826 [details]
Standard out and standard err
Comment 2 Steve Bergman 2008-09-11 11:40:29 UTC
Created attachment 18827 [details]
Strace output
Comment 3 Steve Bergman 2008-09-11 11:44:30 UTC
"""
VGA, DVI, hdm, and HDMI
"""

That should say:  "VGA, DVI, and HDMI"
Comment 4 Gordon Jin 2008-09-11 20:20:32 UTC
Below is the interesting log. all outputs are reported as disconnected.

(II) intel(0): I2C bus "SDVOCTRL_E for SDVOB" initialized.
(II) intel(0): I2C device "SDVOCTRL_E for SDVOB:SDVO Controller B" registered at address 0x70.
(II) intel(0): No SDVO device found on SDVOB
(II) intel(0): I2C device "SDVOCTRL_E for SDVOB:SDVO Controller B" removed.
(II) intel(0): I2C bus "SDVOCTRL_E for SDVOB" removed.
(II) intel(0): Output HDMI-1 has no monitor section
(II) intel(0): I2C bus "HDMIDDC_B" initialized.
(II) intel(0): HDMI output 1 detected
(II) intel(0): I2C bus "SDVOCTRL_E for SDVOC" initialized.
(II) intel(0): I2C device "SDVOCTRL_E for SDVOC:SDVO Controller C" registered at address 0x72.
(II) intel(0): No SDVO device found on SDVOC
(II) intel(0): I2C device "SDVOCTRL_E for SDVOC:SDVO Controller C" removed.
(II) intel(0): I2C bus "SDVOCTRL_E for SDVOC" removed.
(II) intel(0): Output HDMI-2 has no monitor section
(II) intel(0): I2C bus "HDMIDDC_C" initialized.
(II) intel(0): HDMI output 2 detected
(II) intel(0): Output VGA disconnected
(II) intel(0): Output HDMI-1 disconnected
(II) intel(0): Output HDMI-2 disconnected
(WW) intel(0): No outputs definitely connected, trying again...
(II) intel(0): Output VGA disconnected
(II) intel(0): Output HDMI-1 disconnected
(II) intel(0): Output HDMI-2 disconnected
Comment 5 Wang Zhenyu 2008-09-15 18:39:05 UTC
We need X log with ModeDebug option on.
Comment 6 Steve Bergman 2008-09-15 19:03:33 UTC
Created attachment 18895 [details]
Log with ModeDebug on
Comment 7 Wang Zhenyu 2008-09-15 19:46:18 UTC
Could you try 2.4.2? and also try to comment out following lines in src/i830_hdmi.c

/* For G4X, PEG_BAND_GAP_DATA 3:0 must first be written 0xd.
     * Failure to do so will result in spurious interrupts being
     * generated on the port when a cable is not attached.
     */
    if (IS_G4X(pI830)) {
        temp = INREG(PEG_BAND_GAP_DATA);
        OUTREG(PEG_BAND_GAP_DATA, (temp & ~0xf) | 0xd);
    }
Comment 8 Steve Bergman 2008-09-15 20:24:44 UTC
Created attachment 18897 [details]
Log with lines 143-150 of i830_hdmi.c commented

I had already tried 2.4.2 with the same results as the 2.4.1 in Ubuntu 8.10 alpha 5.  Here is the log, using 2.4.2, after I commented the requested lines.  Same symptoms.
Comment 9 Steve Bergman 2008-09-15 21:34:48 UTC
Created attachment 18906 [details]
Corrected log file upload

Looking at the output of the file I uploaded earlier, I suspected that is was not the right file.  I've rerun the test and this file looks more like what I would expect.  For the first one, I had to do some typing into a blank screen and I think I may have inadvertently replaced the file contents with a run that had the VGA cable plugged in.  Sorry for the confusion.
Comment 10 Wang Zhenyu 2008-09-18 00:18:31 UTC
Steve, is the DVI output DVI-I or DVI-D? Can bios light it up when booting? And can you help to get video bios version? Try to get vbios by src/bios_dumper or do like below:

cd /sys/devices/pci0000\:00/0000\:00\:02.0/
echo 1 > rom
cat rom > /tmp/vbios

then run

strings /tmp/vbios | grep -i "build number"
Comment 11 Wang Zhenyu 2008-09-18 00:19:13 UTC
oh, should be src/bios_reader/bios_dumper
Comment 12 Steve Bergman 2008-09-18 06:55:32 UTC
Keeping in mind that I did not even realize that there *were* different DVI connectors... it looks like a DVI-D Single link according to this diagram from Wikipedia:

http://tinyurl.com/2ujc2y

The BIOS lights it up just fine.  Ubuntu usplash works fine, as well.  The Xorg vesa driver has no problem.  Only Xorg with the intel driver has a problem with it.

Build Number: 1666 PC 14.34  07/07/2008  02:09:41

Sorry I keep forgetting to set the proper mime type for my attachments. ;-)
Comment 13 Steve Bergman 2008-09-21 16:44:46 UTC
One other thing.  I have no reason to think this is related, but I should probably mention that the intel driver periodically freezes the machine and I have to reboot. I can ping it.  But it does not respond to ssh connection requests.  The keyboard is dead. (Hitting capslock does not toggle the LED.  Alt-SysReq is useless.) This happens about once every hour or two.  No clues in the log or anything.  Just a silent freeze.  This doesn't happen with the vesa driver.
Comment 14 Wang Zhenyu 2008-09-24 19:29:14 UTC
We have a gigabyte g43 now, and I have tried it on two DVI monitor here, which all works ok (X can light up). Could you try current git master and with my patch on #16515?
Comment 15 Steve Bergman 2008-09-25 08:02:55 UTC
Created attachment 19197 [details]
X log from git repo. 09-25-08 09:30 CDT
Comment 16 Steve Bergman 2008-09-25 08:06:23 UTC
I've pulled the latest drm and intel driver from git. I assume you mean that your patch is in that.  I'm still seeing the same behavior, and have included the log with ModeDebug on.
Comment 17 Michael Fu 2008-09-25 21:45:48 UTC
(In reply to comment #14)
> We have a gigabyte g43 now, and I have tried it on two DVI monitor here, which
> all works ok (X can light up). Could you try current git master and with my
> patch on #16515?
> 

zhenyu, I would rather repeat the commit id here to let Steve verify that he has got the patch...
Comment 18 Steve Bergman 2008-09-26 08:34:58 UTC
Well, I just realized that 16515 was a bugzilla bug number and not a git commit id. (I'm not very familiar with git.) It looks like the patch has been pushed, so I did a "git pull" today and got:

"""
    Render register clock gating disable fix on 4 series chipset

    Do force CRT detect sequence twice on 4 series chipset

    Bug #16515: Fix VT switch with DVI on G45
    
    On DVI, centered VGA mode is used instead of native mode VGA, and
    PLL on pipe is used instead of VGA PLL setting. So make sure PLL
    settled down in restore time.
"""

However, the behavior is still the same.
Comment 19 Wang Zhenyu 2008-09-26 19:23:49 UTC
Steve, I have a gigabyte EG43M-S2H here, working fine with two (Dell/Philips) monitors with DVI. No idea what might cause your failure. What's your monitor model?
Comment 20 Steve Bergman 2008-09-27 07:31:00 UTC
Viewsonic VX2235W M-3.  It's the only monitor I have, so I can't swap it out for another.

I'm running current Ubuntu 8.10 alpha (x86_64) with the X server that comes with that.  DVI-D single link, as we've already covered.  When I have the DVI plugged in, I do not have anything plugged into the vga port, as there is not room for both.  Perhaps I can load Fedora Rawhide on a usb stick and see if it makes a difference.  Does your MB work with vanilla 2.4.x? What is the bios revision on the board?
Comment 21 Michael Fu 2008-09-27 19:49:41 UTC
(In reply to comment #19)
> Steve, I have a gigabyte EG43M-S2H here, working fine with two (Dell/Philips)
> monitors with DVI. No idea what might cause your failure. What's your monitor
> model?
> 

zhenyu, are you using Ubuntu 8.10 to test? I'm afraid you and Steve are speaking on your own system and _assume_ the other is using the same environment. 
Comment 22 Wang Zhenyu 2008-09-30 05:18:16 UTC
Well, I'm on debian sid and install xorg devel related packages, and built git tip of xserver/mesa/drm/xf86-video-intel/kernel, that's what my environment is.
Comment 23 Jesse Barnes 2008-10-06 18:41:14 UTC
It looks like an issue in the "try again" path on the server side.  Which would imply that if we fail detection at init time in the driver we do something that causes a subsequent call to crash (maybe we free something we shouldn't?).  Zhenyu, in your tests did you see a detection failure in the first pass like Steve's logs showed:
(II) intel(0): EDID for output VGA
(II) intel(0): EDID for output HDMI-1
(II) intel(0): EDID for output HDMI-2
(II) intel(0): Output VGA disconnected
(II) intel(0): Output HDMI-1 disconnected
(II) intel(0): Output HDMI-2 disconnected
(WW) intel(0): No outputs definitely connected, trying again...
(II) intel(0): Output VGA disconnected
(II) intel(0): Output HDMI-1 disconnected
(II) intel(0): Output HDMI-2 disconnected

if not, maybe you could simulate it to see if you can reproduce the crash?
Comment 24 Wang Zhenyu 2008-10-06 20:47:06 UTC
Jesse, yeah, some "trying again" path seems cause fault in the case no outputs are detected. But I don't know why in the first place DVI is not detected with Steve's monitor.

Steve, could you try to force enable output in xorg.conf?

Section "Monitor"
Identifier "DVI-D"
Option "Enable" "true"
EndSection

Section "Device"
...
Option "monitor-HDMI-2" "DVI-D"
...
EndSection
Comment 25 Wang Zhenyu 2008-10-06 23:12:13 UTC
Created attachment 19422 [details] [review]
xserver mode choose segfault fix

Per Jesse's suggest, I chased to this patch for xserver, but this is _not_ the fix for this bug, just don't segfault xserver when no output detected in that case.
Comment 26 Julien Cristau 2008-10-07 07:49:59 UTC
> --- Comment #24 from Wang Zhenyu <zhenyu.z.wang@intel.com>  2008-10-06 20:47:06 PST ---
> Jesse, yeah, some "trying again" path seems cause fault in the case no outputs
> are detected.

This is probably the crash I reported as bug#17715?

Cheers,
Julien
Comment 27 Jesse Barnes 2008-10-07 10:26:38 UTC
*** Bug 17715 has been marked as a duplicate of this bug. ***
Comment 28 Jesse Barnes 2008-10-07 10:29:21 UTC
Created attachment 19449 [details] [review]
Check nextEnabledOutput return before using

Not sure if this is the right fix, but I think Julien is right that we're probably looking at an initial configuration bug of some kind.

Adam?
Comment 29 Jesse Barnes 2008-10-07 10:35:55 UTC
Ok, Adam checked out the patch and he's ok with it.  So once someone is able to test & confirm I'll go ahead and push it.
Comment 30 Jesse Barnes 2008-10-07 10:37:11 UTC
Oops, reassign back to Zhenyu in case he wants to fix the broken detection.
Comment 31 Wang Zhenyu 2008-10-07 19:57:57 UTC
Created attachment 19470 [details] [review]
clear hotplug stat before detect

Steve, could you try with this patch applied to git master?
Comment 32 Wang Zhenyu 2008-10-07 20:00:17 UTC
Jesse, xserver patch can be pushed right now, although this bug might be other monitor relate issue. I think we should pull it from 2.5 blocker list, as works on my DVI-D monitors here.
Comment 33 Michael Fu 2008-10-08 20:29:09 UTC
ping steve..
Comment 34 Wang Zhenyu 2008-10-09 20:28:51 UTC
Steve, how about comment out following lines in src/i830_hdmi.c i830_hdmi_detect() function?

/*
 edid_mon = xf86OutputGetEDID (output, intel_output->pDDCBus);
    if (!edid_mon || !DIGITAL(edid_mon->features.input_type))
        status = XF86OutputStatusDisconnected;
    xfree(edid_mon);
*/

Comment 35 Wang Zhenyu 2008-10-23 23:13:14 UTC
Created attachment 19844 [details] [review]
try HDMI hotplug detect more times

I have accidentally produced this issue on gigabyte G43 here, what I did is changing some bios setting for a SATA disk, as it seems only work in AHCI mode. And when I booted my origin disk, and X start gave me exactly behavior like this one. I don't know what going wrong as X always worked fine with DVI output on this board.

So I tried like this patch to do hotplug detect more times on HDMI (I'm not sure if I commented out PEG_BAND_GAP_DATA fix), which bring X back on.
Comment 36 Michael Fu 2008-11-19 19:57:27 UTC
We can't reproduce this any more after zhenyu met this issue just once. I don't see others follows this bug or report similar ones.

Steve, I'll close this bug for now. If you have any response with the patch in comment# 35.

thanks.

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.