Bug 16566 - [TV] "xrandr --set TV_FORMAT" gets BadMatch error
[TV] "xrandr --set TV_FORMAT" gets BadMatch error
Status: VERIFIED FIXED
Product: xorg
Classification: Unclassified
Component: Driver/intel
git
Other Linux (All)
: high major
Assigned To: Wang Zhenyu
Xorg Project Team
:
Depends on:
Blocks: 18858 20276
  Show dependency treegraph
 
Reported: 2008-06-30 02:30 UTC by liuhaien
Modified: 2009-04-26 07:05 UTC (History)
3 users (show)

See Also:


Attachments
xorg.0.log (87.60 KB, text/plain)
2008-06-30 02:30 UTC, liuhaien
no flags Details
xorg conf file (3.26 KB, text/plain)
2008-06-30 02:30 UTC, liuhaien
no flags Details
output (1.57 KB, application/octet-stream)
2008-10-09 02:12 UTC, liuhaien
no flags Details
xrandr --verbose on master (1.57 KB, text/plain)
2008-10-09 02:14 UTC, liuhaien
no flags Details
xrandr utility patch for outputs reload after property change (1.16 KB, patch)
2009-02-05 23:06 UTC, Wang Zhenyu
no flags Details | Splinter Review
xf-v-i patch to set TV format property as non-pending (1.19 KB, patch)
2009-02-05 23:07 UTC, Wang Zhenyu
no flags Details | Splinter Review
update output and crtc modes in TV format change (3.16 KB, patch)
2009-02-18 00:22 UTC, Wang Zhenyu
no flags Details | Splinter Review
xorg.0.log.new (59.84 KB, text/plain)
2009-02-18 17:34 UTC, liuhaien
no flags Details
Updated patch (try 2) (3.28 KB, patch)
2009-02-18 18:25 UTC, Wang Zhenyu
no flags Details | Splinter Review
Updated patch (try 3) (3.29 KB, patch)
2009-02-18 19:29 UTC, Wang Zhenyu
no flags Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description liuhaien 2008-06-30 02:30:16 UTC
Created attachment 17456 [details]
xorg.0.log

System Environment:
--------------------------

--Platform:915gm

--Architecture:32-bit

--2D driver: master 37661d916e8384f537d5ed8cbec66a93795c6a05

--3D driver:master 6cb12704916822aa4d0895a6427e110afe4bfa58

--DRM: master 5d27fd94afaaf434c3a92af0075420b550055bfb

--Xserver:master 7ddfb2f1587da3ec1cd27ae270e42700adf4f560


--Kernel:2.6.25-rc3

Bug detailed description:
--------------------------
  connect TV by component,start X,when run "xrandr -q",the screen displays "TV disconnected" but in fact it connected.below is the output of "xrandr -q":
---------------------------------------------------------------------
[root@x-915gm ~]# xrandr -q
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 2048 x 2048
VGA disconnected (normal left inverted right x axis y axis)
LVDS connected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1024x768       60.0*+   85.0     75.0     70.1     60.0
   832x624        74.6
   800x600        85.1     72.2     75.0     60.3     56.2
   640x480        85.0     72.8     75.0     59.9
   720x400        85.0
   640x400        85.1
   640x350        85.1
TV disconnected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
  1024x768 (0x50)   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
-----------------------------------------------------------------------
  
 and setting TV to display at a PAl model ,and the screen print out
" X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  154 (RANDR)
  Minor opcode of failed request:  21 ()
  Serial number of failed request:  29
  Current serial number in output stream:  29"




Reproduce steps:
----------------
1. use component to connect TV(1080p) and 915gm.
2. startx 
3.xrandr -q
4. set mode : xrandr --output TV --set TV_FORMAT PAL



Current result:
----------------
xrandr -q displays "TV disconnected".and setting PAL mode failed ,and the screen print out the error :
" X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  154 (RANDR)
  Minor opcode of failed request:  21 ()
  Serial number of failed request:  29
  Current serial number in output stream:  29"




Expected result:
----------------
xrandr output correctly and TV has been set at a PAl mode.
Comment 1 liuhaien 2008-06-30 02:30:42 UTC
Created attachment 17457 [details]
xorg conf file
Comment 2 Gordon Jin 2008-06-30 19:09:16 UTC
The TV connection actually is composite, not component.
Comment 3 Wang Zhenyu 2008-07-02 23:46:55 UTC
What's output of "xrandr --verbose"?
Comment 4 Michael Fu 2008-07-03 18:59:18 UTC
dup of bug# 15663?
Comment 5 Wang Zhenyu 2008-07-14 00:08:30 UTC
Current TV property setting is broken not only in possible xrandr tool, and also within driver. Driver property setting interface doesn't take any real effect when changing property, which makes it as useless. 

The reason why xrandr reports error is that each TV format seems have exclusive list of modes, which will be refreshed in every probe. When changing TV format,
mode list will be refreshed, and in xrandr apply it seems origin mode is still
in output's modes, but they're not valid in current server side now.
Comment 6 Gordon Jin 2008-10-09 02:08:28 UTC
update:
1. TV-out on the original 915GM is broken now (without display even in BIOS). So we're testing it on GM965 with s-video.
2. The "TV disconnected" issue has gone. But setting TV_FORMAT still gets BadMatch error. We're using 2.5-branch tip (identical to master essentially).
Since Zhenyu already wrote valuable comment#6, I'm not opening new bug for this, and let's continue to track here.
Comment 7 liuhaien 2008-10-09 02:12:47 UTC
Created attachment 19521 [details]
output
Comment 8 liuhaien 2008-10-09 02:14:11 UTC
Created attachment 19522 [details]
xrandr --verbose on master

the output of xrandr --verbose on master
Comment 9 Julien Cristau 2008-10-09 05:00:28 UTC
> --- Comment #6 from Gordon Jin <gordon.jin@intel.com>  2008-10-09 02:08:28 PST ---
> 2. The "TV disconnected" issue has gone. But setting TV_FORMAT still gets
> BadMatch error. We're using 2.5-branch tip (identical to master essentially).

I think I've seen that, and turning the output off before setting the
property worked fine, if I remember correctly.

Cheers,
Julien
Comment 10 Gordon Jin 2009-01-20 01:05:37 UTC
Increasing priority. This should be fixed in Q1.
Comment 11 Wang Zhenyu 2009-02-05 23:06:11 UTC
Created attachment 22628 [details] [review]
xrandr utility patch for outputs reload after property change

This is applied to xrandr git master.
Comment 12 Wang Zhenyu 2009-02-05 23:07:10 UTC
Created attachment 22629 [details] [review]
xf-v-i patch to set TV format property as non-pending

This is applied to xf86-video-intel git master.
Comment 13 liuhaien 2009-02-09 23:38:35 UTC
(In reply to comment #12)
> Created an attachment (id=22629) [details]
> xf-v-i patch to set TV format property as non-pending
> 
> This is applied to xf86-video-intel git master.
> 

zhengyu,your patches work for me.
Comment 14 Wang Zhenyu 2009-02-18 00:22:25 UTC
Created attachment 23071 [details] [review]
update output and crtc modes in TV format change

This is new patch for this bug. Don't need xrandr patch. Only apply this to xf86-video-intel master. Please help to verify.
Comment 15 liuhaien 2009-02-18 17:30:35 UTC
(In reply to comment #14)
> Created an attachment (id=23071) [details]
> update output and crtc modes in TV format change
> 
> This is new patch for this bug. Don't need xrandr patch. Only apply this to
> xf86-video-intel master. Please help to verify.
> 

hi,zhenyu

this patch dosn't work for me, Xorg could not start with below backtrace(from gdb):
#0  DevHasCursor (pDev=0x0) at events.c:304
#1  0x080d2366 in ProcessInputEvents () at xf86Events.c:177
#2  0x080867e0 in UpdateCurrentTime () at dispatch.c:220
#3  0x081500c7 in RRTellChanged (pScreen=0x8245500) at randr.c:409
#4  0xb7d32ca1 in i830_tv_set_property (output=0x8209268, property=81,
    value=0xbfa5076c) at i830_tv.c:1653
#5  0x08156ceb in RRChangeOutputProperty (output=0x824de08, property=81,
    type=4, format=<value optimized out>, mode=0, len=1, value=0xb7d83bc0,
    sendevent=0, pending=1) at rrproperty.c:239
#6  0xb7d341b4 in i830_tv_create_resources (output=0x8209268) at i830_tv.c:1501
#7  0x080ea21c in xf86RandR12Init (pScreen=0x8245500) at xf86RandR12.c:1307
#8  0x080e42cc in xf86CrtcScreenInit (screen=0x8245500) at xf86Crtc.c:754
#9  0xb7d2116e in I830ScreenInit (scrnIndex=0, pScreen=0x8245500, argc=1,
    argv=0xbfa50a84) at i830_driver.c:3418
#10 0x0806bc75 in AddScreen (pfnInit=0xb7d1fe40 <I830ScreenInit>, argc=1,
    argv=0xbfa50a84) at main.c:702
#11 0x080a5a43 in InitOutput (pScreenInfo=0x81def40, argc=1, argv=0xbfa50a84)
    at xf86Init.c:1245
#12 0x0806c35b in main (argc=1, argv=0xbfa50a84, envp=0xbfa50a8c) at main.c:315
Comment 16 liuhaien 2009-02-18 17:34:36 UTC
Created attachment 23095 [details]
xorg.0.log.new
Comment 17 Wang Zhenyu 2009-02-18 17:53:59 UTC
Does X start fine without TV connected?
Comment 18 liuhaien 2009-02-18 18:09:14 UTC
(In reply to comment #17)
> Does X start fine without TV connected?
> 

No,against your patch ,we got the same issue with or without TV connected. 
Comment 19 Wang Zhenyu 2009-02-18 18:25:10 UTC
Created attachment 23097 [details] [review]
Updated patch (try 2)

Please test with this one.
Comment 20 liuhaien 2009-02-18 19:01:42 UTC
(In reply to comment #19)
> Created an attachment (id=23097) [details]
> Updated patch (try 2)
> 
> Please test with this one.
> 

still fails,and similar backtrace.

#0  0xb7ce9ba0 in i830_tv_set_property (output=0x8209268, property=81,
    value=0xbfc070dc) at i830_tv.c:1612
#1  0x08156ceb in RRChangeOutputProperty (output=0x824e9e8, property=81,
    type=4, format=<value optimized out>, mode=0, len=1, value=0xb7d3ac00,
    sendevent=0, pending=1) at rrproperty.c:239
#2  0xb7ceb1e4 in i830_tv_create_resources (output=0x8209268) at i830_tv.c:1501
#3  0x080ea21c in xf86RandR12Init (pScreen=0x8245830) at xf86RandR12.c:1307
#4  0x080e42cc in xf86CrtcScreenInit (screen=0x8245830) at xf86Crtc.c:754
#5  0xb7cd816e in I830ScreenInit (scrnIndex=0, pScreen=0x8245830, argc=1,
    argv=0xbfc073f4) at i830_driver.c:3418
#6  0x0806bc75 in AddScreen (pfnInit=0xb7cd6e40 <I830ScreenInit>, argc=1,
    argv=0xbfc073f4) at main.c:702
#7  0x080a5a43 in InitOutput (pScreenInfo=0x81def40, argc=1, argv=0xbfc073f4)
    at xf86Init.c:1245
#8  0x0806c35b in main (argc=1, argv=0xbfc073f4, envp=0xbfc073fc) at main.c:315
Comment 21 Wang Zhenyu 2009-02-18 19:29:36 UTC
Created attachment 23098 [details] [review]
Updated patch (try 3)

ok, try this one.
Comment 22 liuhaien 2009-02-18 19:42:06 UTC
(In reply to comment #21)
> Created an attachment (id=23098) [details]
> Updated patch (try 3)
> 
> ok, try this one.
> 

yes,the patch works for me.
Comment 23 Wang Zhenyu 2009-02-19 18:49:57 UTC
So you mean TV format property works fine for you right?
Comment 24 liuhaien 2009-02-19 21:29:19 UTC
(In reply to comment #23)
> So you mean TV format property works fine for you right?
> 

yes,it works against your last patch.
Comment 25 Wang Zhenyu 2009-03-02 22:08:09 UTC
Patch is pushed upstream. Close.
commit ab1ef05cc0fd5ba9768c26cc51bc2c7b52baa45f
Author: Zhenyu Wang <zhenyu.z.wang@intel.com>
Date:   Thu Feb 19 20:23:02 2009 +0800

    TV: update output and crtc modes when TV format change (try 3)
    
    This is to fix bug #16566, change TV format will cause BadMatch
    error when crtc config apply. Everytime when we change TV format,
    we may generate a new list of modelines as TV clock changed. After
    randr get info request, new modelines will be probed and randr output's
    modes will be renewed too. But crtc's mode failed to be updated,
    as it never can find a matching mode now within new modes list.
    So get info will return an invalid crtc's mode, later set crtc
    config will pass that info, and xserver catches a bad match.
    
    This patch trys to refresh output modes and setup crtc's mode
    with new modelines in TV format change. So get info would be
    sure to turn valid crtc mode that reference in current new modelines.

Comment 26 liuhaien 2009-03-02 23:37:52 UTC
verified against below commits:
Libdrm:		(master)a6dd0afa87558a670f970e61b023f45a396539eb
Mesa:	(mesa_7_4_branch)b65bfde84d2f0d83a432602cda425a63560e4034	
Xserver:	(server-1.6-branch)60c161545af80eb78eb790a05bde79409dfdf16e
Xf86_video_intel:		(master)14bb61e0c2e28725a2f6167d3263649bc845be18
Kernel:       (for-airlied)edde72a59461d766997b469f6d20afdf5fe9b5b4

Comment 27 Gordon Jin 2009-04-26 07:05:42 UTC
*** Bug 21409 has been marked as a duplicate of this bug. ***