Bug 10772

Summary: xf86-video-ati-6.6.192 segfaults when a client makes it enter RADEONDisplayPowerManagementSet() on a r200 card
Product: xorg Reporter: Thierry Vignaud <thierry.vignaud>
Component: Driver/RadeonAssignee: xf86-video-ati maintainers <xorg-driver-ati>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: major    
Priority: medium CC: airlied, burnus, lukaswu, mat, sndirsch, yoshi314
Version: 7.2 (2007.02)   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 11749    
Attachments:
Description Flags
Workaround?
none
6.6.192's log none

Description Thierry Vignaud 2007-04-26 09:06:00 UTC
xf86-video-ati-6.6.191 segfaults as soon a client makes it enter RADEONDisplayPowerManagementSet() (mplayer, screesaver, any 3D game, ...).
With xorg-7.2, with both xserver 1.2 and 1.3

Here's the relevant info from the log diff, aka the backtrace:

--- /var/log/Xorg.0.log 2007-04-25 21:39:36.000000000 +0200
+++ /var/log/Xorg.0.log.old     2007-04-25 21:39:24.000000000 +0200
@@ -1177,6 +1179,30 @@
 (II) XINPUT: Adding extended input device "Keyboard1" (type: KEYBOARD)
 (II) Mouse1: ps2EnableDataReporting: succeeded
 (**) RADEON(0): RADEONSaveScreen(2)
+(**) RADEON(0): RADEONSaveScreen(2)
+SetClientVersion: 0 9
+SetGrabKeysState - disabled
+SetGrabKeysState - enabled
+(**) RADEON(0): RADEONSaveScreen(2)
+(II) 3rd Button detected: disabling emulate3Button
+(**) RADEON(0): RADEONDisplayPowerManagementSet(0,0x0)
+
+Backtrace:
+0: /etc/X11/X(xf86SigHandler+0x85) [0x80c3b35]
+1: [0xffffe420]
+2: /usr/lib/xorg/modules/drivers//radeon_drv.so [0xb7c05943]
+3: /usr/lib/xorg/modules/drivers//radeon_drv.so(RADEONDisplayPowerManagementSet+0x133) [0xb7c05cd3]
+4: /etc/X11/X(DPMSSet+0xc9) [0x80c2fe9]
+5: /usr/lib/xorg/modules/extensions//libextmod.so [0xb7cd80de]
+6: /etc/X11/X [0x8151517]
+7: /etc/X11/X(Dispatch+0x19f) [0x808986f]
+8: /etc/X11/X(main+0x495) [0x8071045]
+9: /lib/i686/libc.so.6(__libc_start_main+0xdc) [0xb7d52d8c]
+10: /etc/X11/X(FontFileCompleteXLFD+0x1e5) [0x8070371]
+
+Fatal server error:
+Caught signal 11.  Server aborting
+
 (II) AIGLX: Suspending AIGLX clients for VT switch
 (**) RADEON(0): RADEONLeaveVT
 (**) RADEON(0): EngineRestore (16/16)
Comment 1 Thierry Vignaud 2007-04-26 09:11:20 UTC
My card is an ATI Radeon 8500 QL (r200 driven).
Comment 2 Michel Dänzer 2007-04-27 02:40:44 UTC
Would be great if you could get a full backtrace with gdb, preferably with a radeon_drv.so with debugging symbols.
Comment 3 Thierry Vignaud 2007-04-30 11:40:15 UTC
I'll try
Comment 4 Tobias Burnus 2007-05-09 05:23:01 UTC
> Would be great if you could get a full backtrace with gdb, preferably with a
> radeon_drv.so with debugging symbols.

At https://bugzilla.novell.com/show_bug.cgi?id=264720#c28 on can find the following backtrace:

RADEONDPMSSetOff (pScrn=0x7ffb30, pPort=0x0) at radeon_display.c:2237
2237      MonType = pPort->MonType;
(gdb) bt
#0  RADEONDPMSSetOff (pScrn=0x7ffb30, pPort=0x0) at radeon_display.c:2237
#1  0x00002ac2af42aeb0 in RADEONDisplayPowerManagementSet (pScrn=0x7ffb30,
PowerManagementMode=1, flags=0) at radeon_display.c:2373
#2  0x00000000004944fe in DPMSSet (level=1) at xf86DPMS.c:168
#3  0x00002ac2aedb3069 in ProcDPMSForceLevel (client=0xcbb790) at dpms.c:256
#4  0x0000000000450d6b in Dispatch () at dispatch.c:457
#5  0x0000000000439a8d in main (argc=10, argv=0x7ffffdca6cd8, envp=<value
optimized out>) at main.c:445

(gdb) p pPort
$1 = (RADEONConnector *) 0x0
Comment 5 Michel Dänzer 2007-06-06 03:58:35 UTC
Created attachment 10203 [details] [review]
Workaround?

Does this patch help?

Not that I understand how RADEONGetCrtcConnector() could ever return NULL, or why that doesn't cause a crash earlier on... I suspect there could be some memory corruption going on.
Comment 6 Thierry Vignaud 2007-06-07 07:40:39 UTC
I've tried this patch.

At least "mplayer -vo xv" doesn't crash anymore (though, its display is black) (which was a new side effect of drivers 6.6.19x).

I've left openarena to run during the night.
When I woke up, the X server was freezed and I had to use the magic keys in order to sync, remount ro and reboot my machine :-(
There was nothing usefull in trace

I'll try to get you a debug trace through gdb -x...
Comment 7 Thierry Vignaud 2007-06-08 07:19:47 UTC
I'ven't been able to get a backtrace with gdb. It didn't even appeared in Xorg.0.log like in the old days
Comment 8 Michel Dänzer 2007-06-09 03:49:03 UTC
(In reply to comment #6)
> At least "mplayer -vo xv" doesn't crash anymore (though, its display is
> black) (which was a new side effect of drivers 6.6.19x).

The log files I could find following the links from here show the driver detecting two connected monitors. Is that the case for you as well (if you're not sure, please attach (as opposed to paste) the full Xorg.0.log file)? If so,  do you actually have two monitors connected?

> I've left openarena to run during the night.
> When I woke up, the X server was freezed and I had to use the magic keys in
> order to sync, remount ro and reboot my machine :-(
> There was nothing usefull in trace

Sounds like a GPU lockup, i.e. a different problem. Please follow up to another report about this or file a new one if there's none.
Comment 9 Thierry Vignaud 2007-06-09 04:47:47 UTC
Created attachment 10238 [details]
6.6.192's log

No, I've only one CRT monitor.
Comment 10 Thierry Vignaud 2007-06-09 04:51:50 UTC
Though this change of behaviour between 6.6.3 and 6.6.192 *may* tell us the new driver does detect a ghost monitor:

@@ -571,22 +581,24 @@ 
 (II) RADEON(0):        363639310a20202020202020000000fd
 (II) RADEON(0):        0032781e480b000a2020202020200031
 (II) RADEON(0):        
-(II) RADEON(0): Primary:
+(II) RADEON(0): Port1:
+ Monitor   -- CRT
+ Connector -- VGA
+ DAC Type  -- Primary
+ TMDS Type -- External
+ DDC Type  -- VGA_DDC
+(II) RADEON(0): Port2:
  Monitor   -- CRT
  Connector -- VGA
  DAC Type  -- Primary
- TMDS Type -- NONE
+ TMDS Type -- External
  DDC Type  -- VGA_DDC
-(II) RADEON(0): Secondary:
- Monitor   -- NONE
- Connector -- None
- DAC Type  -- Unknown
- TMDS Type -- NONE
- DDC Type  -- NONE
+(II) RADEON(0): ---- Primary Head:   Port1 ---- 
+(II) RADEON(0): ---- Secondary Head: Port2 ----                                                           
 (II) RADEON(0): PLL parameters: rf=2700 rd=12 min=20000 max=35000; xclk=25000
-(WW) RADEON(0): Failed to detect secondary monitor, MergedFB/Clone mode disabled
 (==) RADEON(0): Using gamma correction (1.0, 1.0, 1.0)
 (II) RADEON(0): Validating modes on Primary head ---------
+(II) RADEON(0): Total number of valid DDC mode(s) found: 0
 (II) RADEON(0): monitor1: Using hsync range of 30.00-72.00 kHz
 (II) RADEON(0): monitor1: Using vrefresh range of 50.00-120.00 Hz
 (II) RADEON(0): Clock range:  20.00 to 350.00 MHz
Comment 11 Thierry Vignaud 2007-06-26 10:34:43 UTC
(In reply to comment #8)
> Sounds like a GPU lockup, i.e. a different problem. Please follow up
> to another report about this or file a new one if there's none.

This lockup is already reported in bug #10224
Comment 12 Tobias Burnus 2007-07-17 07:46:00 UTC
The sister bug at SUSE,
https://bugzilla.novell.com/show_bug.cgi?id=264720#c39
contains as attachment the 0001-Clean-up-PortInfo-to-CRTC-mapping.txt patch by Luc, which is presumably also in the current git version at X.org.
Comment 13 Michel Dänzer 2007-07-17 07:56:41 UTC
(In reply to comment #12)
> The sister bug at SUSE,
> https://bugzilla.novell.com/show_bug.cgi?id=264720#c39
> contains as attachment the 0001-Clean-up-PortInfo-to-CRTC-mapping.txt patch by
> Luc, which is presumably also in the current git version at X.org.

It isn't, because nobody's pushed it upstream... *sigh* Does it fix the problem?
Comment 14 Tobias Burnus 2007-07-17 10:18:07 UTC
> It isn't, because nobody's pushed it upstream...
At least the attachment to the SUSE bugzilla was not even one hour old when I pointed to the patch ;-)

> *sigh* Does it fix the problem?
A quick test indicates that is solves the problem on my PC.
Comment 15 Alex Deucher 2007-07-21 07:30:08 UTC
*** Bug 9892 has been marked as a duplicate of this bug. ***
Comment 16 kowalski marcin 2007-07-21 12:38:58 UTC
the patch doesn't segfault the driver anymore on my pc as well.

but my display still goes into powersaving mode, and the video mode is not restored when going back to console (i could shut down the system cleanly by typing "poweroff" command). there are no errors in the Xorg log (as described in duplicate 9892 bug).
Comment 17 Tobias Burnus 2007-07-21 13:12:23 UTC
> the patch doesn't segfault the driver anymore on my pc as well.
> but my display still goes into powersaving mode,
You mean it does not recover? Otherwise going to the powersave mode is ok.

> and the video mode is not restored when going back to console.
This was later fixed, see additional one-liner patch at
https://bugzilla.novell.com/show_bug.cgi?id=264720#c52

Do you have still problems after applying *both* patches? Because here everything seems to work.
Comment 18 kowalski marcin 2007-07-22 01:17:38 UTC
> You mean it does not recover? Otherwise going to the powersave mode is ok.

definitely not if it's all you get after launching X. and the display does not restore, even when killing the X server.

i tried the patch. my display still goes off. this time i managed to return to the console. i'll try the dpms forcing trick mentioned in the link, maybe this'll help (or maybe i have to disable dpms?)
Comment 19 Thierry Vignaud 2007-07-31 07:14:12 UTC
It definitively looks better now (though still mplayer -vo xv still doesn't display anything). maplyer & 3D apps do not crash anymore (I've tested screensaver yet). Will someone commit those patches ?

However krandrtray make it segfaults when changing the resolution but I'll enter a new bug report for that:

(**) RADEON(0): RADEONSaveScreen(2)
(**) RADEON(0): RADEONSaveScreen(2)
(**) RADEON(0): RADEONSaveScreen(2)

Backtrace:
0: /etc/X11/X(xf86SigHandler+0x85) [0x80c46e5]
1: [0xffffe420]
2: /etc/X11/X(RRCrtcSet+0x2a) [0x816a91a]
3: /etc/X11/X(ProcRRSetScreenConfig+0x600) [0x816f8d0]
4: /etc/X11/X [0x81692a3]
5: /etc/X11/X [0x81527f7]
6: /etc/X11/X(Dispatch+0x1af) [0x8089d6f]
7: /etc/X11/X(main+0x465) [0x8071025]
8: /lib/i686/libc.so.6(__libc_start_main+0xe0) [0xb7cbff90]
9: /etc/X11/X(FontFileCompleteXLFD+0x1e5) [0x80703a1]

Fatal server error:
Caught signal 11.  Server aborting

(II) AIGLX: Suspending AIGLX clients for VT switch
(**) RADEON(0): RADEONLeaveVT
(**) RADEON(0): EngineRestore (32/32)
(**) RADEON(0): RADEONRestore
(**) RADEON(0): RADEONRestoreMode(0x8238bc8)
(**) RADEON(0): RADEONRestoreMemMapRegisters() : 
(**) RADEON(0):   MC_FB_LOCATION   : 0x1fff0000
(**) RADEON(0):   MC_AGP_LOCATION  : 0x27ff2000
(**) RADEON(0):   Map Changed ! Applying ...
(**) RADEON(0):   Map applied, resetting engine ...
(**) RADEON(0): Updating display base addresses...
(**) RADEON(0): Memory map updated.
(**) RADEON(0): Programming CRTC2, offset: 0x00000000
(**) RADEON(0): Wrote: 0x00000000 0x00000000 0x00000000 (0x0000a400)
(**) RADEON(0): Wrote: rd=0, fd=0, pd=0
(**) RADEON(0): Programming CRTC1, offset: 0x00000000
(**) RADEON(0): Wrote: 0x0000000c 0x00030065 0x00000000 (0x0000a400)
(**) RADEON(0): Wrote: rd=12, fd=101, pd=3
(**) RADEON(0): Ok, leaving now...
Comment 20 Thierry Vignaud 2007-07-31 07:20:18 UTC
I opened bugs #11780 and #11781 for the new crash and the XV issue.
Comment 21 Thierry Vignaud 2007-08-01 11:32:46 UTC
Will these patches be commited into git?
Comment 22 Dave Airlie 2007-08-04 00:52:26 UTC
I've checked the patches from Luc and Novell bug into ati

is anyone still seeing the issue?
Comment 23 kowalski marcin 2007-08-04 03:02:25 UTC
i'm not getting crashes/segfaults now, but i'm still not getting anything on screen as well.

i guess i'll reopen my bug then.
Comment 24 Michel Dänzer 2007-08-09 03:45:23 UTC
*** Bug 11898 has been marked as a duplicate of this bug. ***
Comment 25 Lukasz Wieczorek 2007-08-10 09:34:00 UTC
Since now I am using Slackware 12 and my bugs (ie 11898) related to ATI driver were marked duplicate, i did some additional tests with later versions of driver provided by Patric Volkerding. Slackware 12 is normally provided with 6.6.192 ati driver version, fortunately there exists version 6.6.3 which seems to solve all my problems with stability, resolution and DPMS (bugs 11898, 11911, 11897). 

I would suggest to close this bug then.
Comment 26 Thierry Vignaud 2007-08-10 09:38:51 UTC
6.6.3 is an *older* driver...
Comment 27 Lukasz Wieczorek 2007-08-10 09:46:47 UTC
(In reply to comment #26)
> 6.6.3 is an *older* driver...
> 

Yeahh.. You right- friday, late afternoon :((
Comment 28 Michel Dänzer 2007-08-22 01:04:45 UTC
The crash should be fixed, other issues should be tracked in other bugs.

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.