Bug 24290 - SDVO-TV detected every other time I945G
Summary: SDVO-TV detected every other time I945G
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/intel (show other bugs)
Version: git
Hardware: x86 (IA32) Linux (All)
: medium major
Assignee: ykzhao
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords: NEEDINFO
: 20785 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-10-03 08:30 UTC by Yan Seiner
Modified: 2009-10-30 05:33 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Log file of failed TV detection (90.21 KB, text/plain)
2009-10-03 08:30 UTC, Yan Seiner
no flags Details
Log of successful detection (95.88 KB, text/plain)
2009-10-03 08:30 UTC, Yan Seiner
no flags Details
add the 30ms delay when detecting SDVO-TV (772 bytes, patch)
2009-10-12 22:56 UTC, ykzhao
no flags Details | Splinter Review
add the 15ms udelay to detect whether the SDVO-TV is connected (738 bytes, patch)
2009-10-25 18:08 UTC, ykzhao
no flags Details | Splinter Review

Description Yan Seiner 2009-10-03 08:30:07 UTC
Created attachment 30014 [details]
Log file of failed TV detection

The intel driver fails to reset and/or initialize my hardware correctly.

With a TV connected, the hardware detects the TV exactly 1/2 the time.  Every other time X starts, the monitor is detected correctly.  The other time it is not.

Clearly something is wrong with either my hardware or the driver, or both...

Here's a snippet of the log file:

(II) intel(0): SDVOB: W: 0B                         (SDVO_CMD_GET_ATTACHED_DISPLAYS)
(II) intel(0): SDVOB: R: 00 00                   (Pending)
(II) intel(0): SDVOB: R: 00 00                   (Pending)
(II) intel(0): SDVOB: R: 00 00                   (Pending)
(II) intel(0): SDVOB: R: 00 00                   (Pending)
(II) intel(0): SDVOB: R: 00 00                   (Pending)
(II) intel(0): SDVOB: R: 00 00                   (Success)
(II) intel(0): EDID for output TV-1
(II) intel(0): Output VGA connected
(II) intel(0): Output TV-1 disconnected

And here's the next time:

(II) intel(0): SDVOB: W: 0B                         (SDVO_CMD_GET_ATTACHED_DISPLAYS)
(II) intel(0): SDVOB: R: 08 00                   (Pending)
(II) intel(0): SDVOB: R: 08 00                   (Pending)
(II) intel(0): SDVOB: R: 08 00                   (Pending)
(II) intel(0): SDVOB: R: 08 00                   (Pending)
(II) intel(0): SDVOB: R: 08 00                   (Pending)
(II) intel(0): SDVOB: R: 08 00                   (Success)
(II) intel(0): Output TV-1 using monitor section TV
(II) intel(0): SDVOB: W: 28                         (SDVO_CMD_GET_TV_FORMAT)
(II) intel(0): SDVOB: R: 01 00 00 00 00 00       (Success)
(II) intel(0): SDVOB: W: 83 01 00 00                (SDVO_CMD_GET_SDTV_RESOLUTION_SUPPORT)
(II) intel(0): SDVOB: R: FF FF 07                (Success)

This is 100% repeatable.

00:02.0 VGA compatible controller: Intel Corporation 82945G/GZ Integrated Graphics Controller (rev 02)
   Subsystem: Intel Corporation Device 464c
   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
   Interrupt: pin A routed to IRQ 16
   Region 0: Memory at 50200000 (32-bit, non-prefetchable) [size=512K]
   Region 1: I/O ports at 20e0 [size=8]
   Region 2: Memory at 40000000 (32-bit, prefetchable) [size=256M]
   Region 3: Memory at 50280000 (32-bit, non-prefetchable) [size=256K]
   Capabilities: [90] Message Signalled Interrupts: Mask- 64bit- Queue=0/0 Enable-
       Address: 00000000  Data: 0000
   Capabilities: [d0] Power Management version 2
       Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
       Status: D0 PME-Enable- DSel=0 DScale=0 PME-
Comment 1 Yan Seiner 2009-10-03 08:30:59 UTC
Created attachment 30015 [details]
Log of successful detection
Comment 3 Gordon Jin 2009-10-04 00:30:26 UTC
is this a regression?
Comment 4 Yan Seiner 2009-10-04 06:06:59 UTC
(In reply to comment #3)
> is this a regression?
> 

Not sure what you mean by regression.

I'm running current git (as of yesterday).  I was trying to solve the problem and saw the TV_Connector option in git and thought it would solve my problem.  Alas it appears to be effective only for i8?? chips, not i9?? chips which use the svdo code.  There's no way to bypass the load-detect in the svdo code, and I don't know enough to try to hack that in.
Comment 5 Yan Seiner 2009-10-04 07:04:32 UTC
This behavior only happens when there is a monitor connected to the VGA port as well as the S-Video port.  If there is no monitor connected to the VGA port, then the detection succeeds every time.

Also, I tested with 1.6.0 (the xorg version packaged with ubuntu jaunty) and the behavior appears to be the same.
Comment 6 ykzhao 2009-10-12 22:56:05 UTC
Created attachment 30337 [details] [review]
add the 30ms delay when detecting SDVO-TV

Will you please try the debug patch on the latest Eric's drm-intel-next tree and see whether the issue still exists?
Please add the boot option of "drm.debug=0x04" and attach the output of dmesg after doing the test.
Thanks.
Comment 7 Yan Seiner 2009-10-13 05:18:43 UTC
Sorry, I'm not a regular xorg dev... Where do I get latest Eric's drm-intel-next tree?
Comment 8 ykzhao 2009-10-13 17:50:27 UTC
(In reply to comment #7)
> Sorry, I'm not a regular xorg dev... Where do I get latest Eric's
> drm-intel-next tree?
You can use the following command to get the Eric's drm-intel-next tree:
a. git clone git://git.kernel.org/pub/scm/linux/kernel/git/anholt/drm-intel.git
b. git branch -r
c. git checkout -b origin/drm-intel-next

Of course the 2.6.32-rc4 kernel is also ok.
thanks.
> 

Comment 9 ykzhao 2009-10-19 23:45:36 UTC
*** Bug 20785 has been marked as a duplicate of this bug. ***
Comment 10 Yan Seiner 2009-10-24 16:53:53 UTC
Building 2.6.32.rc5 with the patch fails with:

ERROR: "__bad_udelay" [drivers/gpu/drm/i915/i915.ko] undefined!
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2
Comment 11 Yan Seiner 2009-10-25 15:18:46 UTC
(In reply to comment #10)
> Building 2.6.32.rc5 with the patch fails with:
> 
> ERROR: "__bad_udelay" [drivers/gpu/drm/i915/i915.ko] undefined!
> make[1]: *** [__modpost] Error 1
> make: *** [modules] Error 2
> 

I changed usleep to msleep in the above patch and rc5 compiled.

This appears to have solved the problem.
Comment 12 ykzhao 2009-10-25 18:08:19 UTC
Created attachment 30683 [details] [review]
add the 15ms udelay to detect whether the SDVO-TV is connected

Thanks for your test.
From the test it seems that the SDVO-TV can be detected correctly if we add some delay.
But when you change from udelay to msleep, it will sleep too much time.

Will you please try the debug patch and see whether the SDVO-TV can be detected correctly?

Thanks.
Comment 13 Yan Seiner 2009-10-27 14:22:20 UTC
I tried the 15ms patch.  Using either udelay(15000) or mdelay(15) results in hard lock on the machine.  It appears that X tries to start twice, then the machine hard locks the third time.  As the screen goes blank with complete signal loss, I have no way to guess what might have transpired.

I've reverted to the 30ms patch, which works fine.  I'm using mdelay(30) as udelay(30*1000) resulted in build failure.
Comment 14 ykzhao 2009-10-27 20:20:59 UTC
(In reply to comment #13)
> I tried the 15ms patch.  Using either udelay(15000) or mdelay(15) results in
> hard lock on the machine.  It appears that X tries to start twice, then the
> machine hard locks the third time.  As the screen goes blank with complete
> signal loss, I have no way to guess what might have transpired.
It is very interesting that udelay/mdelay results in the hard lock. Maybe the udelay/mdelay for 15ms is inappropriate.
> 
> I've reverted to the 30ms patch, which works fine.  I'm using mdelay(30) as
> udelay(30*1000) resulted in build failure.
Do you mean that it can work fine if we using msleep for 30ms delay?
Thanks.
> 

Comment 15 Yan Seiner 2009-10-27 20:29:20 UTC
(In reply to comment #14)
> (In reply to comment #13)
> > I tried the 15ms patch.  Using either udelay(15000) or mdelay(15) results in
> > hard lock on the machine.  It appears that X tries to start twice, then the
> > machine hard locks the third time.  As the screen goes blank with complete
> > signal loss, I have no way to guess what might have transpired.
> It is very interesting that udelay/mdelay results in the hard lock. Maybe the
> udelay/mdelay for 15ms is inappropriate.

Hardware dependent, I'd guess.  Maybe on a faster machine it may work.  I'm testing on an Atom 330 on a mini-itx board; not a speed champion.

To expand on the hardlock, gdm would try to start X twice, and hard lock on the third attempt.  That appeared to be reproducible the half-dozen or so times I tried.  The system is embedded and it's a bit of a pain to get to, so I'm not able to do a whole lot of testing that results in hard locks.

> > I've reverted to the 30ms patch, which works fine.  I'm using mdelay(30) as
> > udelay(30*1000) resulted in build failure.
> Do you mean that it can work fine if we using msleep for 30ms delay?
> Thanks.

Yes.  The system boots just fine with no perceptible delay.  mdelay(30) works fine.  I figured mdelay is sleep in msec and udelay is sleep in usec, so mdelay(30) should be the same as udelay(30000).

Comment 16 ykzhao 2009-10-27 22:10:43 UTC
> Yes.  The system boots just fine with no perceptible delay.  mdelay(30) works
> fine.  I figured mdelay is sleep in msec and udelay is sleep in usec, so
> mdelay(30) should be the same as udelay(30000).
Is it msleep or mdelay?
It seems that the msleep is used in your test.
Thanks.
> 

Comment 17 Yan Seiner 2009-10-28 05:40:30 UTC
        intel_sdvo_write_cmd(intel_output,
                             SDVO_CMD_GET_ATTACHED_DISPLAYS, NULL, 0);
        if (sdvo_priv->is_tv) {
                /* When it is SDVO-TV, add the 30ms delay */
                mdelay(30);
        }
Comment 18 ykzhao 2009-10-28 20:53:03 UTC
(In reply to comment #17)
>         intel_sdvo_write_cmd(intel_output,
>                              SDVO_CMD_GET_ATTACHED_DISPLAYS, NULL, 0);
>         if (sdvo_priv->is_tv) {
>                 /* When it is SDVO-TV, add the 30ms delay */
>                 mdelay(30);
>         }
Thanks for the confirm.
It seems that the system can work well if we add 30ms delay by using mdelay. But it can't work if the 15ms delay is added. Right?
thanks.
> 

Comment 19 Yan Seiner 2009-10-30 05:33:39 UTC
That is correct.


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.