Bug 22035

Summary: Possibility to set and force TV-options with KMS
Product: DRI Reporter: Peter Hjalmarsson <xake>
Component: DRM/IntelAssignee: MaLing <ling.ma>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: XOrg git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Could you please try the debug pach in kms mode, thanks.
none
dmesg after applying attached patch
none
Xorg after booting into KMS with patch.
none
UMS version of attachment# 26578
none
Xorg.log with UMS-version of patch, ModeDebug and without forcing TV-out
none
please try the patch in KMS mode, thanks none

Description Peter Hjalmarsson 2009-06-02 10:35:23 UTC
This is about the same as bug #20610 but this time for KMS.

Trying out linux-2.6.40-rc7 and KMS on a computer running TV-out  over s-video only works up until X starts.

This means: when the drm-module is loaded the default mode for my TV is set and outputs. When X starts the screen either freezes and gets garbled (fedora 11) or just has a blinking marekr upp i the left corner (gentoo with a unpatched kernel).

After looking into things like dmesg and Xorg.0.log the problem seems to be exact the same as the above referenced bug:
My adaptor/cable/TV is found to be working the first probing and I got output, but later is determined as "disconnected" and after that X and modetest both reports the TV as disconnected, and if I try to start X I do not have output again until during shutdown.

As I see it this could either be fixed in kernel (i.e. have some way of forcing TV-out-options, possibly with the help of video=) or have the intel driver use the forcing-settings in xorg.conf even when KMS is used.
Comment 1 Gordon Jin 2009-06-02 15:02:32 UTC
sounds like back-porting zhenyu's patch to KMS?
Comment 2 Wang Zhenyu 2009-06-03 23:57:11 UTC
Ma ling seems has new finding on TV detection.
Comment 3 MaLing 2009-06-08 23:25:34 UTC
Created attachment 26578 [details]
Could you please try the debug pach in kms mode, thanks.
Comment 4 Peter Hjalmarsson 2009-06-09 22:14:07 UTC
Created attachment 26612 [details]
dmesg after applying attached patch

I applied your patch to my 2.6.30-rc8-tree, configured intel to be compiled in, and enabled modset as default. This is the dmesg after rebooting, the computer stries to start X and I have done a VT-switch back to console to obtain the dmesg.

Will also attach the Xorg.0.log from this try.
In this you will see that Xorg has "TV disconnected". And I think that is why I never got a picture on the TV. however console works fine if I do a VT-switch.
Comment 5 Peter Hjalmarsson 2009-06-09 22:14:45 UTC
Created attachment 26613 [details]
Xorg after booting into KMS with patch.
Comment 6 Michael Fu 2009-06-10 18:53:02 UTC
Created attachment 26650 [details] [review]
UMS version of attachment# 26578 [details]

Peter, before we falls back to add the force option, let's give it another try to see if we could figure out the real cause.. please try the patch in UMS driver. You need to 1) turns off KMS via i915.modeset=0 2) remove the force option in your xorg.conf for TV monitor. 3) add Option "ModeDebug" "True" to driver section in xorg.conf.

then, please attach the xorg.log. thanks.
Comment 7 Peter Hjalmarsson 2009-06-11 10:09:45 UTC
Created attachment 26690 [details]
Xorg.log with UMS-version of patch, ModeDebug and without forcing TV-out

The setup is gdm which autostarts XBMC. X works fine until XBMC in some way probes with the help of xrandr. Just starting X and running 'xrandr' crashes in the same way.

Forcing TV-out makes the crashes go away.
Comment 8 MaLing 2009-06-13 09:35:17 UTC
(In reply to comment #7)
> Created an attachment (id=26690) [details]
> Xorg.log with UMS-version of patch, ModeDebug and without forcing TV-out
> The setup is gdm which autostarts XBMC. X works fine until XBMC in some way
> probes with the help of xrandr. Just starting X and running 'xrandr' crashes in
> the same way.
> Forcing TV-out makes the crashes go away.

OK, I see.
When you start X, it works fine with TV, but when you use xrandr to probe output, X crash.
The root cause is that at first driver correctly detected TV, but when you use xrandr to probe current outputs again, it shows TV is disconnected. Becuase no outputs are available, driver will cause X crash which is duplicate with bug #22124, it is another issue. I will send patch to resolve them ASAP.

Thanks for your help
Ma Ling 
Comment 9 MaLing 2009-06-15 22:39:10 UTC
Created attachment 26824 [details]
please try the patch in KMS mode, thanks
Comment 10 Peter Hjalmarsson 2009-06-16 08:46:15 UTC
(In reply to comment #9)
> Created an attachment (id=26824) [details]
> please try the patch in KMS mode, thanks
> 

I assume that DAC_A_MASK is the same as DAC_A_0_7_V_MASK from you previous patch (and so on for B and C)?
Comment 11 Peter Hjalmarsson 2009-06-16 09:33:17 UTC
(In reply to comment #10)
> (In reply to comment #9)
> > Created an attachment (id=26824) [details] [details]
> > please try the patch in KMS mode, thanks
> > 
> 
> I assume that DAC_A_MASK is the same as DAC_A_0_7_V_MASK from you previous
> patch (and so on for B and C)?
> 

Using this it seems to work fine (except from some rather hard flashing every time xrandr or alike probes).

Now all I need is some way to set it to use PAL during boot (KMS does not care about xorg.conf, and I really cannot find any documentation about changeing stuff in KMS)...
Comment 12 MaLing 2009-06-16 18:22:26 UTC
> Using this it seems to work fine (except from some rather hard flashing every
> time xrandr or alike probes).
Yes it is difficult to avoid blingking because we have to probe.

> Now all I need is some way to set it to use PAL during boot (KMS does not care
> about xorg.conf, and I really cannot find any documentation about changeing
> stuff in KMS)...
Sorry, we only provide property in this way you can set TV format as you expect.

Thanks
Ma Ling

Comment 13 Michael Fu 2009-06-16 18:45:42 UTC
(In reply to comment #12)
> > Using this it seems to work fine (except from some rather hard flashing every
> > time xrandr or alike probes).
> Yes it is difficult to avoid blingking because we have to probe.
> 
> > Now all I need is some way to set it to use PAL during boot (KMS does not care
> > about xorg.conf, and I really cannot find any documentation about changeing
> > stuff in KMS)...
> Sorry, we only provide property in this way you can set TV format as you
> expect.

actually, we probably should add this capability to xorg.conf, just like PreferredMode option...

> 
> Thanks
> Ma Ling
> 

Comment 14 Peter Hjalmarsson 2009-06-16 23:12:20 UTC
I cannot really see why you cannot hijack the "video" kernel cmd, I mean having the possibility to set some simple, or needed properties (currently console is unreadable for me becouse of the flickering from it running NTSC on a PAL TV). I mean something like "video=i915:mode=1024x768,tv_format=pal,modeset=1" could be somewhat clean.

Or at least having it read xorg.conf, since forcing people to set the tv format with the help of scripts every boot is just evil.
Comment 15 Peter Hjalmarsson 2009-06-22 12:34:52 UTC
FYI it seems like this patch also kills VT-switching. It does not even resume a VT when Xorg crashes/exits....
Comment 16 Eric Anholt 2009-06-23 09:42:42 UTC
queued:

commit 8ed9a5bc9c9425ef93a1b03b418300a5e18b2361
Author: ling.ma@intel.com <ling.ma@intel.com>
Date:   Mon Jun 22 22:08:35 2009 +0800

    drm/i915: set TV detection mode when tv is already connected
    
    We used load_detect_temp flag to determine whether to set tv to the test
    mode. However if the TV already has a mode set, we still need to set the
    test mode to determine connection.  This results in blinking, but there is
    no other reliable way to determine TV connection.
    
    freedesktop.org bug #22035
    
    Signed-off-by: Ma Ling <ling.ma@intel.com>
    Signed-off-by: Eric Anholt <eric@anholt.net>

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.