Bug 90187

Summary: [PRIME] Xorg segfaults during startup when loading the xf86-video-ati driver
Product: xorg Reporter: Mike Lothian <mike>
Component: Driver/RadeonAssignee: xf86-video-ati maintainers <xorg-driver-ati>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: adnan_16a2, dex+fdobugzilla, mike, paulo.miguel.dias
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Xorg.0.log Broken
none
Xorg.0.log Working
none
Skip disabled CRTCs also in the !set_hw case
none
Skip disabled CRTCs also in the !set_hw case v2 none

Description Mike Lothian 2015-04-26 17:58:45 UTC
Created attachment 115354 [details]
Xorg.0.log Broken

The xf86-video-ati driver has been segfaulting on me the last few days I've git bisected to:

# bad: [80f3d727f93cb6efedd2b39338d2301035965fe2] On screen resize, clear the new buffer before displaying it
git bisect bad 80f3d727f93cb6efedd2b39338d2301035965fe2
# good: [43159ef400c3b18b9f4d3e6fa1c4aef2d60d38fe] Add Option "TearFree" v4
git bisect good 43159ef400c3b18b9f4d3e6fa1c4aef2d60d38fe
# good: [37874a4eeace5df04b02c8fc28f67b824e3f0f5f] Defer initial drmmode_copy_fb call until root window creation
git bisect good 37874a4eeace5df04b02c8fc28f67b824e3f0f5f
# good: [37874a4eeace5df04b02c8fc28f67b824e3f0f5f] Defer initial drmmode_copy_fb call until root window creation
git bisect good 37874a4eeace5df04b02c8fc28f67b824e3f0f5f
# good: [37874a4eeace5df04b02c8fc28f67b824e3f0f5f] Defer initial drmmode_copy_fb call until root window creation
git bisect good 37874a4eeace5df04b02c8fc28f67b824e3f0f5f
# bad: [a4a8cdbcc10c1c5f07485a2af9e9e81e490c3e1d] Update scanout pixmap contents before setting a mode with it
git bisect bad a4a8cdbcc10c1c5f07485a2af9e9e81e490c3e1d
# bad: [a4a8cdbcc10c1c5f07485a2af9e9e81e490c3e1d] Update scanout pixmap contents before setting a mode with it
git bisect bad a4a8cdbcc10c1c5f07485a2af9e9e81e490c3e1d
# bad: [673e1c7637687c74fc9bdeeeffb7ace0d04b734f] Defer initial modeset until the first BlockHandler invocation
git bisect bad 673e1c7637687c74fc9bdeeeffb7ace0d04b734f
# first bad commit: [673e1c7637687c74fc9bdeeeffb7ace0d04b734f] Defer initial modeset until the first BlockHandler invocation

I'm unable to revert the first bad commit- I've also not seen anyone complain so I'm assuming it's PRIME related:

00:02.0 VGA compatible controller [0300]: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller [8086:0116] (rev 09)
01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Whistler [Radeon HD 6630M/6650M/6750M/7670M/7690M] [1002:6741] (rev ff)
Comment 1 Mike Lothian 2015-04-26 17:59:49 UTC
Created attachment 115355 [details]
Xorg.0.log Working

Attaching logs
Comment 2 Michel Dänzer 2015-04-27 03:26:45 UTC
Please get a full backtrace with gdb and debugging symbols available for /usr/lib64/xorg/modules/drivers/radeon_drv.so and /usr/bin/X(org). See http://wiki.x.org/wiki/Development/Documentation/ServerDebugging/ for information about how to do that.

P.S. I appreciate you adding me to the CC list, but I already get two mails for each update without that, I don't need a third one. :)
Comment 3 Daniel Exner 2015-04-27 19:45:07 UTC
I can confirm the same for:

00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
01:00.0 Display controller: Advanced Micro Devices, Inc. [AMD/ATI] Mars [Radeon HD 8730M] (rev ff)

If I add a manual conf file for the ATI card it works, the same for a conf file for intel only.

I'll try to get a backtrace.
Comment 4 Daniel Exner 2015-04-27 21:54:45 UTC
Hope this helps:

(gdb) bt f
#0  0x00007fb6a51c3ed7 in drmmode_set_desired_modes (pScrn=0xd6b470, drmmode=0xd71cb8, set_hw=0) at drmmode_display.c:2154
        crtc = 0xe0f0c0
        drmmode_crtc = 0xe0fb90
        output = 0x0
        o = 0
        config = 0xe0ef50
        c = 0
#1  0x00007fb6a51b7c61 in RADEONCreateScreenResources_KMS (pScreen=0xd69520) at radeon_kms.c:251
        pScrn = 0xd6b470
        info = 0xd71a30
        pixmap = 0x7fb6a869f2a0 <__glXDRI2Provider+16>
        surface = 0x12adf10
#2  0x00000000004df9b4 in xf86CrtcCreateScreenResources (screen=0xd69520) at xf86Crtc.c:709
        scrn = 0xd6b470
        config = 0xe0ef50
#3  0x00000000004459a1 in dix_main (argc=1, argv=0x7ffe59115698, envp=0x7ffe591156a8) at main.c:213
        pScreen = 0xd69520
        i = 0
        alwaysCheckForInput = {0, 1}
#4  0x00000000004286a1 in main (argc=1, argv=0x7ffe59115698, envp=0x7ffe591156a8) at stubmain.c:34
No locals.
Comment 5 Michel Dänzer 2015-04-28 01:00:35 UTC
Created attachment 115388 [details] [review]
Skip disabled CRTCs also in the !set_hw case

Does this patch fix the problem?
Comment 6 Michel Dänzer 2015-04-28 01:13:53 UTC
*** Bug 90198 has been marked as a duplicate of this bug. ***
Comment 7 Mike Lothian 2015-04-28 07:04:57 UTC
The patch fixes things for me

Thanks
Comment 8 Michel Dänzer 2015-04-28 08:17:54 UTC
Created attachment 115391 [details] [review]
Skip disabled CRTCs also in the !set_hw case v2

Does this patch instead of the previous one fix the problem as well?
Comment 9 Mike Lothian 2015-04-28 08:18:48 UTC
I'll check tonight
Comment 10 Mike Lothian 2015-04-28 16:50:43 UTC
I can confirm that fixes the issue too
Comment 11 Daniel Exner 2015-04-28 21:35:41 UTC
I can also confirm that the patch fixes this for me.
Comment 12 Michel Dänzer 2015-05-01 01:22:32 UTC
commit 1584dc545c78e0bce8d4b4b9f26b568e2c211453
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Tue Apr 28 17:14:11 2015 +0900

    Skip disabled CRTCs in drmmode_set_desired_modes() even if set_hw == FALSE
    
    Not skipping a disabled CRTC results in a crash.
Comment 13 Mike Lothian 2015-05-01 07:26:07 UTC
Thanks, upstream is working great again without patches

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.