Bug 14000

Summary: [GM965 TV] "xrandr --output TV --auto" can't enable TV with xf86-video-intel-2.1.1
Product: xorg Reporter: winston <zhangwenping1980>
Component: Driver/intelAssignee: Zou Nan hai <nanhai.zou>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: critical    
Priority: medium CC: dan, ozone, pcgomes, pr, rglowery, SirRichard, zhangwenping1980, zhenyu.z.wang
Version: 7.0 (2005.12)   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
log file of Xorg when booting with S-video connector plugin
zhangwenping1980: 6.9/7.0+
this log file is got wnen restart X system with S-Video connector plugin after booting
zhangwenping1980: 6.9/7.0+
after restart X system and xrandr --output TV --auto
zhangwenping1980: 6.9/7.0+
Restart notebook with S-video connector plugin in advance
zhangwenping1980: 6.9/7.0+
intel registers information when TV output after reboot notebook with S-Video Connector plugin in advance
none
After "xrandr --output TV --off" "xrandr --output TV --auto", but TV can't come forth anymore
zhangwenping1980: 6.9/7.0+
Xorg.0.log Debug Enabled - Intel 965 GM board, error at S-Video out
none
Xrandr output when trying to enable S-Video Out none

Description winston 2008-01-09 18:29:23 UTC
1. Overview Description:
   After starting my notebook A8E(T7100, GMAX3100 Integreated, 1G RAM) and login the X system, I plug in S-Video connector and execute "xrandr --output TV --auto", But I can't get the TV output on the Screen.
   However, if I plug in the S-video before booting the notebook, I can see the TV output on the screen after I login X system. Then after executing "xrandr --output TV --off", TV output disappeared, but I can't switch to TV output anymore through "xrandr --output TV --auto".

2.Build Date & Platform: 
   My Environment: 
   a. ASUS NoteBook A8E 
   b. CPU core T7100, GMA X3100 integrated graphics, 1G RAM 
   c. Linux kernel 2.6.22.6
   d. driver version: xf86-video-intel-2.1.1 

6. Additional Information: 
   I get two /var/log/Xorg.0.log files. One is got when plug in the S-Video befor e booting the notebook. The other is got when after login X system without S-Video plugin, plugin S-Video and then restart X system.
   a.
Comment 1 winston 2008-01-09 19:07:45 UTC
Created attachment 13633 [details]
log file of Xorg when booting with S-video connector plugin

This log file is got when /etc/xorg.conf has Option "ModeDebug" "YES"
Comment 2 winston 2008-01-09 19:10:23 UTC
Created attachment 13634 [details]
this log file is got wnen restart X system with S-Video connector plugin after booting

with Option "ModeDebug" "YES" in /etc/xorg.conf file
Comment 3 Gordon Jin 2008-01-09 19:18:56 UTC
(Congrats for getting so good a bug number)

Did you get any error messages after running "xrandr --output TV --auto"?

Could you attach the output of "xrandr --verbose"?
Comment 4 winston 2008-01-09 19:54:11 UTC
Created attachment 13635 [details]
after restart X system and xrandr --output TV --auto
Comment 5 winston 2008-01-09 20:02:26 UTC
(In reply to comment #3)
> (Congrats for getting so good a bug number)
> 
> Did you get any error messages after running "xrandr --output TV --auto"?
> 
> Could you attach the output of "xrandr --verbose"?
> 

:) Just so so
I have attach the xrandr log file
One is without TV output
The other is with TV output
Comment 6 winston 2008-01-09 20:05:04 UTC
Created attachment 13636 [details]
Restart notebook with S-video connector plugin in advance
Comment 7 winston 2008-01-09 20:09:38 UTC
Created attachment 13637 [details]
intel registers information when TV output after reboot notebook with S-Video Connector plugin in advance
Comment 8 winston 2008-01-09 20:11:27 UTC
Created attachment 13638 [details]
After "xrandr --output TV --off" "xrandr --output TV --auto", but TV can't come forth anymore
Comment 9 David Tomaschik 2008-01-15 08:04:56 UTC
I'm having this issue as well -- I'd be happy to provide any debug information that might be useful here.
Comment 10 Dan Stahlke 2008-02-01 02:22:06 UTC
I too am experiencing the same problem.  The only way to get TV-out is to boot my notebook with the cable plugged in.  "xrandr --output TV --off" turns it off and "xrandr --output TV --auto" does not turn it back on, despite the fact that it gives the exact same output when running xrandr with --prop or --verbose.  When I run xrandr --off or --auto there is a quick flicker on the TV but that is all.  This is with an HP Pavillion dx6000 computer and a 965GM video card.
Comment 11 Dan Stahlke 2008-02-01 12:29:23 UTC
I should note also that it seems that TV-out used to work fine for me.  Before my problems I knew nothing of the xrandr program and was able to get TV working by logging out and logging back in after plugging the cable in.  I checked my "yum update" logs and didn't see any package changes that caught my attention, although I don't know exactly when TV functionality was lost as I hadn't tried it in a while.  This is in 64-bit Fedora 8.
Comment 12 winston 2008-02-20 18:02:49 UTC
(In reply to comment #0)
> 1. Overview Description:
>    After starting my notebook A8E(T7100, GMAX3100 Integreated, 1G RAM) and
> login the X system, I plug in S-Video connector and execute "xrandr --output TV
> --auto", But I can't get the TV output on the Screen.
>    However, if I plug in the S-video before booting the notebook, I can see the
> TV output on the screen after I login X system. Then after executing "xrandr
> --output TV --off", TV output disappeared, but I can't switch to TV output
> anymore through "xrandr --output TV --auto".
> 
> 2.Build Date & Platform: 
>    My Environment: 
>    a. ASUS NoteBook A8E 
>    b. CPU core T7100, GMA X3100 integrated graphics, 1G RAM 
>    c. Linux kernel 2.6.22.6
>    d. driver version: xf86-video-intel-2.1.1 
> 
> 6. Additional Information: 
>    I get two /var/log/Xorg.0.log files. One is got when plug in the S-Video
> befor e booting the notebook. The other is got when after login X system
> without S-Video plugin, plugin S-Video and then restart X system.
>    a.
> 

(In reply to comment #11)
> I should note also that it seems that TV-out used to work fine for me.  Before
> my problems I knew nothing of the xrandr program and was able to get TV working
> by logging out and logging back in after plugging the cable in.  I checked my
> "yum update" logs and didn't see any package changes that caught my attention,
> although I don't know exactly when TV functionality was lost as I hadn't tried
> it in a while.  This is in 64-bit Fedora 8.
> 

(In reply to comment #0)
> 1. Overview Description:
>    After starting my notebook A8E(T7100, GMAX3100 Integreated, 1G RAM) and
> login the X system, I plug in S-Video connector and execute "xrandr --output TV
> --auto", But I can't get the TV output on the Screen.
>    However, if I plug in the S-video before booting the notebook, I can see the
> TV output on the screen after I login X system. Then after executing "xrandr
> --output TV --off", TV output disappeared, but I can't switch to TV output
> anymore through "xrandr --output TV --auto".
> 
> 2.Build Date & Platform: 
>    My Environment: 
>    a. ASUS NoteBook A8E 
>    b. CPU core T7100, GMA X3100 integrated graphics, 1G RAM 
>    c. Linux kernel 2.6.22.6
>    d. driver version: xf86-video-intel-2.1.1 
> 
> 6. Additional Information: 
>    I get two /var/log/Xorg.0.log files. One is got when plug in the S-Video
> befor e booting the notebook. The other is got when after login X system
> without S-Video plugin, plugin S-Video and then restart X system.
>    a.
> 

Comment 13 winston 2008-02-20 18:12:57 UTC
I guess the problem is in the function i830_tv_detect(xf86OutputPtr output).

If I mask the code as below and let the function return immediately, I can make the TV output correctly  by "xrandr --output TV --auto" after turn off TV.

I wonder if the key point is on this function.

static xf86OutputStatus
i830_tv_detect(xf86OutputPtr output)
{
    xf86CrtcPtr		    crtc;
    DisplayModeRec	    mode;
    I830OutputPrivatePtr    intel_output = output->driver_private;
    struct i830_tv_priv	    *dev_priv = intel_output->dev_priv;
    int			    dpms_mode;

    {
	    dev_priv->type = TV_TYPE_COMPOSITE;
	    return XF86OutputStatusConnected;
    }
    
  /*
    mode = reported_modes[0];
    xf86SetModeCrtc (&mode, INTERLACE_HALVE_V);
    crtc = i830GetLoadDetectPipe (output, &mode, &dpms_mode);
    if (crtc)
    {
        i830_tv_detect_type (crtc, output);
        i830ReleaseLoadDetectPipe (output, dpms_mode);
    }

    switch (dev_priv->type) {
    case TV_TYPE_NONE:
        return XF86OutputStatusDisconnected;
    case TV_TYPE_UNKNOWN:
        return XF86OutputStatusUnknown;
    default:
        return XF86OutputStatusConnected;
    }
    */
}
Comment 14 Gordon Jin 2008-04-10 01:27:30 UTC
Nanhai, any idea for comment#13?
Comment 15 Robert Lowery 2008-05-15 17:34:13 UTC
(In reply to comment #13)
> I guess the problem is in the function i830_tv_detect(xf86OutputPtr output).
> If I mask the code as below and let the function return immediately, I can
> make the TV output correctly  by "xrandr --output TV --auto" after turn off TV.
> I wonder if the key point is on this function.
> static xf86OutputStatus
> i830_tv_detect(xf86OutputPtr output)
> {
>     xf86CrtcPtr             crtc;
>     DisplayModeRec          mode;
>     I830OutputPrivatePtr    intel_output = output->driver_private;
>     struct i830_tv_priv     *dev_priv = intel_output->dev_priv;
>     int                     dpms_mode;
>     {
>             dev_priv->type = TV_TYPE_COMPOSITE;
>             return XF86OutputStatusConnected;
>     }
>   /*
>     mode = reported_modes[0];
>     xf86SetModeCrtc (&mode, INTERLACE_HALVE_V);
>     crtc = i830GetLoadDetectPipe (output, &mode, &dpms_mode);
>     if (crtc)
>     {
>         i830_tv_detect_type (crtc, output);
>         i830ReleaseLoadDetectPipe (output, dpms_mode);
>     }
>     switch (dev_priv->type) {
>     case TV_TYPE_NONE:
>         return XF86OutputStatusDisconnected;
>     case TV_TYPE_UNKNOWN:
>         return XF86OutputStatusUnknown;
>     default:
>         return XF86OutputStatusConnected;
>     }
>     */
> }

This patch also solves TVOut issues I have been seeing with my AOpen MP965-DR (GM965 based) HTPC.

Digging further, the problem seems to be triggered by i830_tv_detect_type().  In particular when TV_CTL is clobbered to enable detection mode.  Patch below effectively stops this clobbering, but since I use Component output, I needed the second patch to for COMPONENT output with the detection disabled.

diff --git a/src/i830_tv.c b/src/i830_tv.c
index 6adb9f2..f442a4f 100644
--- a/src/i830_tv.c
+++ b/src/i830_tv.c
@@ -1297,7 +1297,7 @@ i830_tv_detect_type (xf86CrtcPtr    crtc,
                DAC_A_0_7_V |
                DAC_B_0_7_V |
                DAC_C_0_7_V);
-       OUTREG(TV_CTL, tv_ctl);
+       //OUTREG(TV_CTL, tv_ctl);
        OUTREG(TV_DAC, tv_dac);
        i830WaitForVblank(pScrn);
        tv_dac = INREG(TV_DAC);
@@ -1316,6 +1316,7 @@ i830_tv_detect_type (xf86CrtcPtr    crtc,
                       "Detected Composite TV connection\n");
        }
        type = TV_TYPE_COMPOSITE;
+       type = TV_TYPE_COMPONENT;
     } else if ((tv_dac & (TVDAC_A_SENSE|TVDAC_B_SENSE)) == TVDAC_A_SENSE) {
        if (pI830->debug_modes) {
            xf86DrvMsg(pScrn->scrnIndex, X_INFO,

Comment 16 Pedro Gomes 2008-05-17 11:10:28 UTC
I am facing the same bug. I have a Compaq C730 with a Intel 965GM card, running openSuse 10.3 x86-64.

I've downloaded the Intel 2D driver source code and recompiled it commenting "OUTREG(TV_CTL, tv_ctl);" line, just like the patch does. Now I can switch on/off the S-Video output using xrandr --output TV --auto/off.

Anyway it's not 100% yet, because when I turn the S-Video output on, the xrandr
says that the TV output is disconnected, although the TV is showing my X session correctly. This is a big issue for me, because my TV system is PAL-M and if xrandr can't figure out the the TV is connected, it doesn't allow me to switch from NTSC to PAL-M with "xrandr --output TV --set TV_FORMAT PAL-M".

Another issue is that, the TV Out is on and if I change the LVDS display, it turns the TV off.

(In reply to comment #15)
> (In reply to comment #13)
> > I guess the problem is in the function i830_tv_detect(xf86OutputPtr output).
> > If I mask the code as below and let the function return immediately, I can
> > make the TV output correctly  by "xrandr --output TV --auto" after turn off TV.
> > I wonder if the key point is on this function.
> > static xf86OutputStatus
> > i830_tv_detect(xf86OutputPtr output)
> > {
> >     xf86CrtcPtr             crtc;
> >     DisplayModeRec          mode;
> >     I830OutputPrivatePtr    intel_output = output->driver_private;
> >     struct i830_tv_priv     *dev_priv = intel_output->dev_priv;
> >     int                     dpms_mode;
> >     {
> >             dev_priv->type = TV_TYPE_COMPOSITE;
> >             return XF86OutputStatusConnected;
> >     }
> >   /*
> >     mode = reported_modes[0];
> >     xf86SetModeCrtc (&mode, INTERLACE_HALVE_V);
> >     crtc = i830GetLoadDetectPipe (output, &mode, &dpms_mode);
> >     if (crtc)
> >     {
> >         i830_tv_detect_type (crtc, output);
> >         i830ReleaseLoadDetectPipe (output, dpms_mode);
> >     }
> >     switch (dev_priv->type) {
> >     case TV_TYPE_NONE:
> >         return XF86OutputStatusDisconnected;
> >     case TV_TYPE_UNKNOWN:
> >         return XF86OutputStatusUnknown;
> >     default:
> >         return XF86OutputStatusConnected;
> >     }
> >     */
> > }
> 
> This patch also solves TVOut issues I have been seeing with my AOpen MP965-DR
> (GM965 based) HTPC.
> 
> Digging further, the problem seems to be triggered by i830_tv_detect_type(). 
> In particular when TV_CTL is clobbered to enable detection mode.  Patch below
> effectively stops this clobbering, but since I use Component output, I needed
> the second patch to for COMPONENT output with the detection disabled.
> 
> diff --git a/src/i830_tv.c b/src/i830_tv.c
> index 6adb9f2..f442a4f 100644
> --- a/src/i830_tv.c
> +++ b/src/i830_tv.c
> @@ -1297,7 +1297,7 @@ i830_tv_detect_type (xf86CrtcPtr    crtc,
>                 DAC_A_0_7_V |
>                 DAC_B_0_7_V |
>                 DAC_C_0_7_V);
> -       OUTREG(TV_CTL, tv_ctl);
> +       //OUTREG(TV_CTL, tv_ctl);
>         OUTREG(TV_DAC, tv_dac);
>         i830WaitForVblank(pScrn);
>         tv_dac = INREG(TV_DAC);
> @@ -1316,6 +1316,7 @@ i830_tv_detect_type (xf86CrtcPtr    crtc,
>                        "Detected Composite TV connection\n");
>         }
>         type = TV_TYPE_COMPOSITE;
> +       type = TV_TYPE_COMPONENT;
>      } else if ((tv_dac & (TVDAC_A_SENSE|TVDAC_B_SENSE)) == TVDAC_A_SENSE) {
>         if (pI830->debug_modes) {
>             xf86DrvMsg(pScrn->scrnIndex, X_INFO,
> 

Comment 17 Robert Lowery 2008-05-18 04:03:44 UTC
(In reply to comment #16)
> I am facing the same bug. I have a Compaq C730 with a Intel 965GM card, running
> openSuse 10.3 x86-64.
> 
> I've downloaded the Intel 2D driver source code and recompiled it commenting
> "OUTREG(TV_CTL, tv_ctl);" line, just like the patch does. Now I can switch
> on/off the S-Video output using xrandr --output TV --auto/off.
> 
> Anyway it's not 100% yet, because when I turn the S-Video output on, the xrandr
> says that the TV output is disconnected, although the TV is showing my X
> session correctly. This is a big issue for me, because my TV system is PAL-M
> and if xrandr can't figure out the the TV is connected, it doesn't allow me to
> switch from NTSC to PAL-M with "xrandr --output TV --set TV_FORMAT PAL-M".
> 
> Another issue is that, the TV Out is on and if I change the LVDS display, it
> turns the TV off.
> 
> (In reply to comment #15)
> > (In reply to comment #13)
> > > I guess the problem is in the function i830_tv_detect(xf86OutputPtr output).
> > > If I mask the code as below and let the function return immediately, I can
> > > make the TV output correctly  by "xrandr --output TV --auto" after turn off TV.
> > > I wonder if the key point is on this function.
> > > static xf86OutputStatus
> > > i830_tv_detect(xf86OutputPtr output)
> > > {
> > >     xf86CrtcPtr             crtc;
> > >     DisplayModeRec          mode;
> > >     I830OutputPrivatePtr    intel_output = output->driver_private;
> > >     struct i830_tv_priv     *dev_priv = intel_output->dev_priv;
> > >     int                     dpms_mode;
> > >     {
> > >             dev_priv->type = TV_TYPE_COMPOSITE;
> > >             return XF86OutputStatusConnected;
> > >     }
> > >   /*
> > >     mode = reported_modes[0];
> > >     xf86SetModeCrtc (&mode, INTERLACE_HALVE_V);
> > >     crtc = i830GetLoadDetectPipe (output, &mode, &dpms_mode);
> > >     if (crtc)
> > >     {
> > >         i830_tv_detect_type (crtc, output);
> > >         i830ReleaseLoadDetectPipe (output, dpms_mode);
> > >     }
> > >     switch (dev_priv->type) {
> > >     case TV_TYPE_NONE:
> > >         return XF86OutputStatusDisconnected;
> > >     case TV_TYPE_UNKNOWN:
> > >         return XF86OutputStatusUnknown;
> > >     default:
> > >         return XF86OutputStatusConnected;
> > >     }
> > >     */
> > > }
> > 
> > This patch also solves TVOut issues I have been seeing with my AOpen MP965-DR
> > (GM965 based) HTPC.
> > 
> > Digging further, the problem seems to be triggered by i830_tv_detect_type(). 
> > In particular when TV_CTL is clobbered to enable detection mode.  Patch below
> > effectively stops this clobbering, but since I use Component output, I needed
> > the second patch to for COMPONENT output with the detection disabled.
> > 
> > diff --git a/src/i830_tv.c b/src/i830_tv.c
> > index 6adb9f2..f442a4f 100644
> > --- a/src/i830_tv.c
> > +++ b/src/i830_tv.c
> > @@ -1297,7 +1297,7 @@ i830_tv_detect_type (xf86CrtcPtr    crtc,
> >                 DAC_A_0_7_V |
> >                 DAC_B_0_7_V |
> >                 DAC_C_0_7_V);
> > -       OUTREG(TV_CTL, tv_ctl);
> > +       //OUTREG(TV_CTL, tv_ctl);
> >         OUTREG(TV_DAC, tv_dac);
> >         i830WaitForVblank(pScrn);
> >         tv_dac = INREG(TV_DAC);
> > @@ -1316,6 +1316,7 @@ i830_tv_detect_type (xf86CrtcPtr    crtc,
> >                        "Detected Composite TV connection\n");
> >         }
> >         type = TV_TYPE_COMPOSITE;
> > +       type = TV_TYPE_COMPONENT;
> >      } else if ((tv_dac & (TVDAC_A_SENSE|TVDAC_B_SENSE)) == TVDAC_A_SENSE) {
> >         if (pI830->debug_modes) {
> >             xf86DrvMsg(pScrn->scrnIndex, X_INFO,
> > 
> 

Please try this updated patch, which fixes the problem properly for me.  If you continue to have issues when LVDS is changed, try also commenting out the line "if (intel_output->load_detect_temp)", to make the detection logic unconditional.

Cheers

-Rob

diff --git a/src/i830_tv.c b/src/i830_tv.c
index 6adb9f2..a5b790b 100644
--- a/src/i830_tv.c
+++ b/src/i830_tv.c
@@ -1178,7 +1178,7 @@ i830_tv_mode_set(xf86OutputPtr output, DisplayModePtr mode,
            (i830_float_to_csc(color_conversion->bv) << 16) |
            (i830_float_to_luma(color_conversion->av)));
 
-    OUTREG(TV_CLR_KNOBS, 0x00606000);
+    OUTREG(TV_CLR_KNOBS, 0x00404000);
     OUTREG(TV_CLR_LEVEL, ((video_levels->black << TV_BLACK_LEVEL_SHIFT) |
                (video_levels->blank << TV_BLANK_LEVEL_SHIFT)));
     {
@@ -1286,6 +1286,8 @@ i830_tv_detect_type (xf86CrtcPtr    crtc,
        tv_ctl = INREG(TV_CTL);
        save_tv_ctl = tv_ctl;
        tv_ctl &= ~TV_ENC_ENABLE;
+       OUTREG(TV_CTL, tv_ctl);
+       i830WaitForVblank(pScrn);
        tv_ctl &= ~TV_TEST_MODE_MASK;
        tv_ctl |= TV_TEST_MODE_MONITOR_DETECT;
        tv_dac &= ~TVDAC_SENSE_MASK;
@@ -1298,6 +1300,7 @@ i830_tv_detect_type (xf86CrtcPtr    crtc,
                DAC_B_0_7_V |
                DAC_C_0_7_V);
        OUTREG(TV_CTL, tv_ctl);
+       i830WaitForVblank(pScrn);
        OUTREG(TV_DAC, tv_dac);
        i830WaitForVblank(pScrn);
        tv_dac = INREG(TV_DAC);


Comment 18 Pedro Gomes 2008-05-19 20:49:33 UTC
Created attachment 16638 [details]
Xorg.0.log Debug Enabled - Intel 965 GM board, error at S-Video out

This is my Xorg log, after applying the suggested patch at Comment #17
The "ModeDebug" is on at xorg.conf
Comment 19 Pedro Gomes 2008-05-19 20:54:59 UTC
Created attachment 16639 [details]
Xrandr output when trying to enable S-Video Out

My scenairo:
- Booted the laptop with S-Video cable plugged and TV on.
- Applyed the patch described at Comment #7
- The TV was blank, so I tried to enable the TVOut with "xrandr --output TV --auto"
- The TV blinked, but still no Out.
Comment 20 Pedro Gomes 2008-05-19 21:03:14 UTC
(In reply to comment #17)

Hi Rob

Thanks for the help. I have applied the patch you've told me, but then I get the same error:no Tv output, and just a brief blink when I type "xrandr --output TV --auto".

I've attached some log files, in case they would be helpful. I can generate more of those, at different scenarios, if anyone asks for it.

Any help would be great. Meanwhile I'm trying to figure out the driver's code, although it's not that easy because it's not commented.
Comment 21 Robert Lowery 2008-05-20 04:12:10 UTC
Folks,

The following much simpler patch works for me.  Could all people affected by this issue, please re-test and report back.

Thanks

-Rob

diff --git a/src/i830_tv.c b/src/i830_tv.c
index 6adb9f2..b3e03ec 100644
--- a/src/i830_tv.c
+++ b/src/i830_tv.c
@@ -1303,6 +1303,7 @@ i830_tv_detect_type (xf86CrtcPtr    crtc,
        tv_dac = INREG(TV_DAC);
        OUTREG(TV_DAC, save_tv_dac);
        OUTREG(TV_CTL, save_tv_ctl);
+       i830WaitForVblank(pScrn);
     }
     /*
      *  A B C


Comment 22 Pedro Gomes 2008-05-20 20:29:50 UTC
(In reply to comment #21)

I didn't figure out if I was supposed to add this new call to i830WaitForVblank(pScrn) at the "vanilla" code, or combine it with the previous patch, so I tested with both. Unfortunately none worked for me and the problem persists.

Also, there is one extra issue: randr displays that TV is disconnected after I send "xrandr --output TV --auto", although the cable is connected and the TV On. I've copied the xrand output and I will comment the behaviour of the TV, if this is somehow useful. I've left the VGA and LVDS information from xrandr output only for the first command, to pollute less this comment:

-------> Start X with the s-video cable unplugged
pcgomes@ospirata:~> xrandr -q
Screen 0: minimum 320 x 200, current 1280 x 800, maximum 1280 x 1280
VGA disconnected (normal left inverted right)
   1024x768_60    60.0
LVDS connected 1280x800+0+0 (normal left inverted right) 331mm x 207mm
   1280x800       59.9*+   60.0     58.9
   1152x768       54.8
   1024x768       60.0
   800x600        60.3     56.2
   640x480        59.9
TV disconnected (normal left inverted right)
-------> Plug the S-Video cable
pcgomes@ospirata:~> xrandr -q
TV connected (normal left inverted right)
   1024x768       30.0
   800x600        30.0
   848x480        30.0
   640x480        30.0
-------> The TV blinks and goes black
pcgomes@ospirata:~> xrandr --output TV --auto
-------> The TV blinks and goes black
pcgomes@ospirata:~> xrandr -q
TV disconnected 1024x768+0+0 (normal left inverted right) 0mm x 0mm
  1024x768 (0x56)   26.9MHz
        h: width  1024 start 1025 end 1088 total 1120 skew    0 clock   24.0KHz
        v: height  768 start  769 end  800 total  801           clock   30.0Hz
-------> This time the TV does not blink
pcgomes@ospirata:~> xrandr --output TV --auto
-------> This time the TV does not blink
pcgomes@ospirata:~> xrandr -q
TV connected (normal left inverted right)
   1024x768       30.0
   800x600        30.0
   848x480        30.0
   640x480        30.0
-------> The TV blinks again
Comment 23 Robert Lowery 2008-05-20 22:12:01 UTC
(In reply to comment #22)
> (In reply to comment #21)
> I didn't figure out if I was supposed to add this new call to
> i830WaitForVblank(pScrn) at the "vanilla" code, or combine it with the previous
> patch, so I tested with both. Unfortunately none worked for me and the problem
> persists.
> Also, there is one extra issue: randr displays that TV is disconnected after I
> send "xrandr --output TV --auto", although the cable is connected and the TV
> On. I've copied the xrand output and I will comment the behaviour of the TV, if
> this is somehow useful. I've left the VGA and LVDS information from xrandr
> output only for the first command, to pollute less this comment:
> -------> Start X with the s-video cable unplugged
> pcgomes@ospirata:~> xrandr -q
> Screen 0: minimum 320 x 200, current 1280 x 800, maximum 1280 x 1280
> VGA disconnected (normal left inverted right)
>    1024x768_60    60.0
> LVDS connected 1280x800+0+0 (normal left inverted right) 331mm x 207mm
>    1280x800       59.9*+   60.0     58.9
>    1152x768       54.8
>    1024x768       60.0
>    800x600        60.3     56.2
>    640x480        59.9
> TV disconnected (normal left inverted right)
> -------> Plug the S-Video cable
> pcgomes@ospirata:~> xrandr -q
> TV connected (normal left inverted right)
>    1024x768       30.0
>    800x600        30.0
>    848x480        30.0
>    640x480        30.0
> -------> The TV blinks and goes black
> pcgomes@ospirata:~> xrandr --output TV --auto
> -------> The TV blinks and goes black
> pcgomes@ospirata:~> xrandr -q
> TV disconnected 1024x768+0+0 (normal left inverted right) 0mm x 0mm
>   1024x768 (0x56)   26.9MHz
>         h: width  1024 start 1025 end 1088 total 1120 skew    0 clock   24.0KHz
>         v: height  768 start  769 end  800 total  801           clock   30.0Hz
> -------> This time the TV does not blink
> pcgomes@ospirata:~> xrandr --output TV --auto
> -------> This time the TV does not blink
> pcgomes@ospirata:~> xrandr -q
> TV connected (normal left inverted right)
>    1024x768       30.0
>    800x600        30.0
>    848x480        30.0
>    640x480        30.0
> -------> The TV blinks again

The patch in Comment #21 works for me on the "vanilla" code (ie my old patches are not required).  Sorry for the confusion.

Did you reboot after installing the patched driver?  I found that once TV output got into the bad state (ie from the unpatched driver), I could not get it to work again until I rebooted.

-Rob
Comment 24 Pedro Gomes 2008-05-22 11:09:09 UTC
(In reply to comment #23)
OK, now the this patch works partially for me (I didn't reboot last time). I can turn the TV output ON/Off using "xrandr --output TV --auto/off".

But when the TV Out is On, xrandr says that the TV is disconnected and I can't change the TV system to PAL-M with "xrandr --output TV --set TV_FORMAT PAL-M". This issue also affects some randr front-ends, such as krandrtray. Because randr does not recognize that TV is connected, it shows no options for the TV (change resolution, turn on/off, etc...).

pcgomes@ospirata:~> xrandr --output TV --auto
(TV Out is turned on)
pcgomes@ospirata:~> xrandr -q
Screen 0: minimum 320 x 200, current 1280 x 800, maximum 1280 x 1280
VGA disconnected (normal left inverted right)
   1024x768_60    60.0
LVDS connected 1280x800+0+0 (normal left inverted right) 331mm x 207mm
   1280x800       59.9*+   60.0     58.9
   1152x768       54.8
   1024x768       60.0
   800x600        60.3     56.2
   640x480        59.9
TV disconnected 1024x768+0+0 (normal left inverted right) 0mm x 0mm
  1024x768 (0x70)   26.9MHz
        h: width  1024 start 1025 end 1088 total 1120 skew    0 clock   24.0KHz
        v: height  768 start  769 end  800 total  801           clock   30.0Hz
Comment 25 Robert Lowery 2008-05-22 20:06:11 UTC
(In reply to comment #24)
> (In reply to comment #23)
> OK, now the this patch works partially for me (I didn't reboot last time). I
> can turn the TV output ON/Off using "xrandr --output TV --auto/off".
> But when the TV Out is On, xrandr says that the TV is disconnected and I can't
> change the TV system to PAL-M with "xrandr --output TV --set TV_FORMAT PAL-M".
> This issue also affects some randr front-ends, such as krandrtray. Because
> randr does not recognize that TV is connected, it shows no options for the TV
> (change resolution, turn on/off, etc...).
> pcgomes@ospirata:~> xrandr --output TV --auto
> (TV Out is turned on)
> pcgomes@ospirata:~> xrandr -q
> Screen 0: minimum 320 x 200, current 1280 x 800, maximum 1280 x 1280
> VGA disconnected (normal left inverted right)
>    1024x768_60    60.0
> LVDS connected 1280x800+0+0 (normal left inverted right) 331mm x 207mm
>    1280x800       59.9*+   60.0     58.9
>    1152x768       54.8
>    1024x768       60.0
>    800x600        60.3     56.2
>    640x480        59.9
> TV disconnected 1024x768+0+0 (normal left inverted right) 0mm x 0mm
>   1024x768 (0x70)   26.9MHz
>         h: width  1024 start 1025 end 1088 total 1120 skew    0 clock   24.0KHz
>         v: height  768 start  769 end  800 total  801           clock   30.0Hz


Pedro,

Thanks for the confirmation that my fix corrects your issue (at least partially).  I suspect the additional detection issue you are seeing is a separate problem.

As a workaround until it is fixed you might want to try selecting PAL-M in xorg.conf at startup rather than via xrandr.  Something like the following snippet should be sufficient

Section "Device"
        Identifier      "Generic Video Card"
        Driver          "intel"
        BusID           "PCI:0:2:0"
        Option          "monitor-TV"    "TV"
EndSection

Section "Monitor"
        Identifier "TV"
        Option          "TV Format" "PAL-M"
EndSection
Comment 26 Richard Goedeken 2008-06-05 07:32:56 UTC
I believe that this bug is related to an earlier bug that I filed (#13743) which is still unresolved.  That bug also affects the TV output on my AOpen MP965, the problem being that when booting into X or when switching between text and graphical VTs, the graphical display sometimes (but not always) fails to come up, and I get a blank screen.

I tested the fix posted here by applying the patch which commented out the "OUTREG(TV_CTL, tv_ctl);" call and forced the output type to Component.  I have rebooted probably 10-12 times and the X display came up properly each time, so that symptom may be fixed, but I can still get a blank screen by switching between text and graphical VTs.
Comment 27 Robert Lowery 2008-06-05 17:50:05 UTC
(In reply to comment #26)
> I believe that this bug is related to an earlier bug that I filed (#13743)
> which is still unresolved.  That bug also affects the TV output on my AOpen
> MP965, the problem being that when booting into X or when switching between
> text and graphical VTs, the graphical display sometimes (but not always) fails
> to come up, and I get a blank screen.
> I tested the fix posted here by applying the patch which commented out the
> "OUTREG(TV_CTL, tv_ctl);" call and forced the output type to Component.  I have
> rebooted probably 10-12 times and the X display came up properly each time, so
> that symptom may be fixed, but I can still get a blank screen by switching
> between text and graphical VTs.

Richard,

The correct fix that works for me very reliably for week is in comment #21 above.  The patch that commented out the "OUTREG(TV_CTL, tv_ctl);" was just a hack while I was chasing down the real bug.

I've not seen the issue #13743 you reported as I don't ever swith VTs (I'm using these boxes as mythfrontends.

Cheers

-Rob
Comment 28 Richard Goedeken 2008-06-08 07:39:53 UTC
Rob, thanks to you and everyone else for resolving this long-standing problem with the 965 TV output.  I also added a "i830WaitForVblank(pScrn);" function call at the end of the i830_tv_restore() and i830_tv_mode_set() functions, and this change fixed the issue when switching between text and X VTs.  I tested by switching between text and X virtual terminals 20 times, and the graphical display came up all 20 times.
Comment 29 Jesse Barnes 2008-06-09 08:54:26 UTC
Ok, I pushed the fix as 1142be53eb8d2ee8a9b60ace5d49f0ba27332275 and also added a "waitvblank" call in the TV DPMS routine, which also writes TV_CTL.

Thanks a lot for testing & fixing this.

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.