Bug 199621

Summary: iMac 2009, Mobility Radeon HD 4670: black screen on boot
Product: Drivers Reporter: Florian Echtler (floe)
Component: Video(DRI - non Intel)Assignee: drivers_video-dri
Status: NEW ---    
Severity: normal CC: alexdeucher, matthewtrescott
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.15.0-20 Subsystem:
Regression: No Bisected commit-id:
Attachments: strace log of xorg when I ran the command that fixes this problem

Description Florian Echtler 2018-05-04 07:57:25 UTC
I'm running Ubuntu 18.04 on a old-ish iMac from 2009. As soon as the kernel modesetting kicks in, I only get a black screen. This is not a duplicate of https://bugzilla.kernel.org/show_bug.cgi?id=100301 - if I try to enable the screen via sysfs or xrandr, I get the following oops in dmesg:

May  4 09:17:19 igor01 kernel: [ 1193.227376] ------------[ cut here ]------------
May  4 09:17:19 igor01 kernel: [ 1193.227377] unknown DP link BW code 0, using 162000
May  4 09:17:19 igor01 kernel: [ 1193.227401] WARNING: CPU: 1 PID: 915 at /build/linux-5s7Xkn/linux-4.15.0/drivers/gpu/drm/drm_dp_helper.c:157 drm_dp_bw_code_to_link_rate+0x41/0x50 [drm_kms_helper]
May  4 09:17:19 igor01 kernel: [ 1193.227401] Modules linked in: rfcomm ccm bnep snd_hda_codec_cirrus snd_hda_codec_generic applesmc input_polldev arc4 coretemp kvm_intel kvm irqbypass uvcvideo videobuf2_vmalloc
 joydev input_leds btusb btrtl btbcm btintel videobuf2_memops videobuf2_v4l2 bluetooth ecdh_generic videobuf2_core videodev media ath9k ath9k_common ath9k_hw ath mac80211 cfg80211 snd_hda_codec_hdmi snd_hda_inte
l snd_hda_codec snd_hda_core snd_hwdep snd_pcm snd_seq_midi snd_seq_midi_event snd_rawmidi shpchp snd_seq snd_seq_device snd_timer snd soundcore apple_bl mac_hid sch_fq_codel parport_pc ppdev lp parport ip_table
s x_tables autofs4 hid_appleir uas usb_storage hid_generic usbhid hid pata_acpi radeon i2c_algo_bit ttm firewire_ohci drm_kms_helper syscopyarea sysfillrect firewire_core sysimgblt crc_itu_t forcedeth fb_sys_fop
s
May  4 09:17:19 igor01 kernel: [ 1193.227454]  ahci drm libahci i2c_nforce2
May  4 09:17:19 igor01 kernel: [ 1193.227459] CPU: 1 PID: 915 Comm: Xorg Tainted: G        W        4.15.0-20-generic #21-Ubuntu
May  4 09:17:19 igor01 kernel: [ 1193.227460] Hardware name: Apple Inc. iMac10,1/Mac-F2268DC8, BIOS    IM101.88Z.00CC.B00.0909031926 09/03/09
May  4 09:17:19 igor01 kernel: [ 1193.227467] RIP: 0010:drm_dp_bw_code_to_link_rate+0x41/0x50 [drm_kms_helper]
May  4 09:17:19 igor01 kernel: [ 1193.227469] RSP: 0018:ffff9e06415e7ad8 EFLAGS: 00010282
May  4 09:17:19 igor01 kernel: [ 1193.227471] RAX: 0000000000000000 RBX: ffff8f00362f1000 RCX: 0000000000000006
May  4 09:17:19 igor01 kernel: [ 1193.227472] RDX: 0000000000000007 RSI: 0000000000000096 RDI: ffff8f003fd16490
May  4 09:17:19 igor01 kernel: [ 1193.227474] RBP: ffff9e06415e7ae0 R08: 0000000000000001 R09: 0000000000000fe6
May  4 09:17:19 igor01 kernel: [ 1193.227475] R10: 0000000000000040 R11: 0000000000000000 R12: 000000000000fde8
May  4 09:17:19 igor01 kernel: [ 1193.227477] R13: ffff8f00362f1000 R14: 0000000000000018 R15: ffff8f002b0bddc4
May  4 09:17:19 igor01 kernel: [ 1193.227479] FS:  00007f9d8d3c9600(0000) GS:ffff8f003fd00000(0000) knlGS:0000000000000000
May  4 09:17:19 igor01 kernel: [ 1193.227481] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
May  4 09:17:19 igor01 kernel: [ 1193.227482] CR2: 00007f9d8d3e2000 CR3: 0000000233cac000 CR4: 00000000000406e0
May  4 09:17:19 igor01 kernel: [ 1193.227483] Call Trace:
May  4 09:17:19 igor01 kernel: [ 1193.227513]  radeon_dp_get_dp_link_config+0x45/0x150 [radeon]
May  4 09:17:19 igor01 kernel: [ 1193.227542]  radeon_dp_mode_valid_helper+0x4e/0xb0 [radeon]
May  4 09:17:19 igor01 kernel: [ 1193.227558]  ? drm_mode_connector_list_update+0x113/0x180 [drm]
May  4 09:17:19 igor01 kernel: [ 1193.227581]  radeon_dp_mode_valid+0xcd/0xd0 [radeon]
May  4 09:17:19 igor01 kernel: [ 1193.227589]  drm_helper_probe_single_connector_modes+0x418/0x710 [drm_kms_helper]
May  4 09:17:19 igor01 kernel: [ 1193.227607]  drm_mode_getconnector+0x15d/0x340 [drm]
May  4 09:17:19 igor01 kernel: [ 1193.227610]  ? import_iovec+0x3a/0xe0
May  4 09:17:19 igor01 kernel: [ 1193.227627]  ? drm_mode_connector_property_set_ioctl+0x60/0x60 [drm]
May  4 09:17:19 igor01 kernel: [ 1193.227641]  drm_ioctl_kernel+0x5f/0xb0 [drm]
May  4 09:17:19 igor01 kernel: [ 1193.227655]  drm_ioctl+0x31b/0x3d0 [drm]
May  4 09:17:19 igor01 kernel: [ 1193.227672]  ? drm_mode_connector_property_set_ioctl+0x60/0x60 [drm]
May  4 09:17:19 igor01 kernel: [ 1193.227691]  radeon_drm_ioctl+0x4f/0x90 [radeon]
May  4 09:17:19 igor01 kernel: [ 1193.227694]  do_vfs_ioctl+0xa8/0x630
May  4 09:17:19 igor01 kernel: [ 1193.227696]  ? __sys_recvmsg+0x80/0x90
May  4 09:17:19 igor01 kernel: [ 1193.227699]  SyS_ioctl+0x79/0x90
May  4 09:17:19 igor01 kernel: [ 1193.227701]  ? SyS_clock_gettime+0x88/0xb0
May  4 09:17:19 igor01 kernel: [ 1193.227704]  do_syscall_64+0x73/0x130
May  4 09:17:19 igor01 kernel: [ 1193.227706]  entry_SYSCALL_64_after_hwframe+0x3d/0xa2
May  4 09:17:19 igor01 kernel: [ 1193.227708] RIP: 0033:0x7f9d8a7c25d7
May  4 09:17:19 igor01 kernel: [ 1193.227709] RSP: 002b:00007fff59e6d978 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
May  4 09:17:19 igor01 kernel: [ 1193.227712] RAX: ffffffffffffffda RBX: 0000559d87d158d0 RCX: 00007f9d8a7c25d7
May  4 09:17:19 igor01 kernel: [ 1193.227713] RDX: 00007fff59e6d9b0 RSI: 00000000c05064a7 RDI: 000000000000000c
May  4 09:17:19 igor01 kernel: [ 1193.227715] RBP: 00007fff59e6d9b0 R08: 0000000000000001 R09: 0000000000000000
May  4 09:17:19 igor01 kernel: [ 1193.227716] R10: 0000000000000000 R11: 0000000000000246 R12: 00000000c05064a7
May  4 09:17:19 igor01 kernel: [ 1193.227718] R13: 000000000000000c R14: 000000000000000c R15: 00007fff59e6d9b0
May  4 09:17:19 igor01 kernel: [ 1193.227719] Code: 3d 08 00 74 2d 40 80 ff 06 b8 d0 78 02 00 74 22 55 40 0f b6 f7 48 c7 c7 b8 0b 12 c0 48 89 e5 48 83 ec 08 89 45 fc e8 8f f0 77 c9 <0f> 0b 8b 45 fc c9 c3 f3 c3 66 0f 1f 44 00 00 66 66 66 66 90 55 
May  4 09:17:19 igor01 kernel: [ 1193.227764] ---[ end trace d2b3e21bce6f63f8 ]---

Best, Florian
Comment 1 Florian Echtler 2018-05-04 11:07:33 UTC
Side note: this bug has been persisting since at least 4.11, I think the last time it worked was somewhere around kernel 4.8.
Comment 2 Florian Echtler 2018-05-04 11:10:00 UTC
Side note two: this is the 27" 2009 iMac model, the exact video card is:

02:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] RV730/M96-XT [Mobility Radeon HD 4670]
Comment 3 Florian Echtler 2018-05-04 11:15:30 UTC
One more update, sorry for the noise: I've been digging through the old Ubuntu kernel release schedules, and I'm pretty sure that the display worked with 4.8, but started turning blank once I had updated to 4.10. Does that information help anyone to pinpoint the error?
Comment 4 Alex Deucher 2018-05-09 04:59:19 UTC
Can you bisect?
Comment 5 Florian Echtler 2018-05-09 05:30:41 UTC
I know how it's supposed to work in theory, I'll give it a try. Do you know if there's a kernel repository that also carries the Ubuntu patches?
Comment 6 Matthew Trescott 2018-06-28 00:26:09 UTC
Created attachment 276935 [details]
strace log of xorg when I ran the command that fixes this problem

I have a 21.5-inch Mid-2010 iMac with the same Mobility Radeon HD 4670 GPU. It also exhibits this problem (the solution in #100301 doesn't work either); however I can temporarily fix it by running the following command (I had to type it blindly because it won't work over SSH):

xrandr -d :0 --output eDP-1 --crtc 1

After which everything works well, including backlight control via /sys/class/backlight/radeon_bl0/brightness. The fix does not persist across reboots or even across log-out/log-in cycles (I guess the handoff between Xorg and radeondrmfb triggers some sort of reset and the problem comes back).

I'm on kernel 4.17.2 (Arch Linux). I'm no Linux graphics expert, but I did capture an strace of all the ioctl calls from Xorg during while running the above command as well as monitoring sysfs with inotifywait. Nothing relevant happened in sysfs, but there were a few interesting system calls from when I ran the command that I've attached.
Comment 7 Matthew Trescott 2018-06-28 11:36:30 UTC
I should note that that xrandr command, if run while the display is on, will turn it off. It seems to act as a sort of toggle.
Comment 8 Matthew Trescott 2018-07-06 15:01:41 UTC
I compiled and installed Linux 4.8 using the Arch Linux scripts. It seemed to have no effect on this bug.
Comment 9 Matthew Trescott 2018-07-07 23:51:06 UTC
There is something else strange here. Even if I run the command I mentioned above, xrandr --verbose always says that output eDP-1 is using CRTC 0. It never changes, even though the screen turns on and off. I suppose the X server uses some magic ioctl calls or something that fixes it when it tries to switch to CRTC 1.