Bug 35472

Summary: [bisected] [r600] radeondrmfb rendering is broken and running X makes GPU lock-up on RV770 CE (Radeon HD 4730)
Product: Drivers Reporter: Sergey Kondakov (virtuousfox)
Component: Video(DRI - non Intel)Assignee: drivers_video-dri
Status: CLOSED CODE_FIX    
Severity: normal CC: alexdeucher, florian
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.38 Subsystem:
Regression: Yes Bisected commit-id:
Attachments: full dmesg from 2.6.39
.config from 2.6.39
full dmesg from 2.6.37
2.6.39-overview_small.jpg
2.6.39-X_small.jpg
2.6.39-close-up_small.jpg
Xorg.0.log_2.6.37
Xorg.0.log_2.6.39
fix

Description Sergey Kondakov 2011-05-20 04:03:20 UTC
with 2.6.37 it's all OK but since 2.6.38 from very framebuffer initialization screen is filled with dense grey lines looking like ugly grid. also per every 3cm on my 1920x1080/23' screen there is a distinctive whitish vertical line.
when X try to startup i can see cursor and can move it around for a while (that grey grid is there too) but kdm does not starting up and GPU locks up.

it is the same with 2.6.39. here is `dmesg|grep drm` for 2.6.39:
[    0.462282] [drm] Initialized drm 1.1.0 20060810
[    0.462315] [drm] radeon defaulting to kernel modesetting.
[    0.462337] [drm] radeon kernel modesetting enabled.
[    0.462575] [drm] initializing kernel modesetting (RV770 0x1002:0x944E).
[    0.462608] [drm] register mmio base: 0xFDFE0000
[    0.462630] [drm] register mmio size: 65536
[    0.463313] [drm] Detected VRAM RAM=512M, BAR=256M
[    0.463343] [drm] RAM width 128bits DDR
[    0.463526] [drm] radeon: 512M of VRAM memory ready
[    0.463549] [drm] radeon: 512M of GTT memory ready.
[    0.463571] [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
[    0.463594] [drm] Driver supports precise vblank timestamp query.
[    0.463708] [drm] radeon: irq initialized.
[    0.463733] [drm] GART: num cpu pages 131072, num gpu pages 131072
[    0.465260] [drm] Loading RV770 Microcode
[    0.512429] [drm] ring test succeeded in 1 usecs
[    0.512544] [drm] radeon: ib pool ready.
[    0.512584] [drm] ib test succeeded in 0 usecs
[    0.512609] [drm] Enabling audio support
[    0.512805] [drm] Radeon Display Connectors
[    0.512827] [drm] Connector 0:
[    0.512847] [drm]   DVI-I
[    0.512868] [drm]   HPD2
[    0.512889] [drm]   DDC: 0x7e60 0x7e60 0x7e64 0x7e64 0x7e68 0x7e68 0x7e6c 0x7e6c
[    0.512915] [drm]   Encoders:
[    0.512936] [drm]     DFP1: INTERNAL_UNIPHY
[    0.512957] [drm]     CRT2: INTERNAL_KLDSCP_DAC2
[    0.512979] [drm] Connector 1:
[    0.512999] [drm]   DIN
[    0.513028] [drm]   Encoders:
[    0.513049] [drm]     TV1: INTERNAL_KLDSCP_DAC2
[    0.513070] [drm] Connector 2:
[    0.513091] [drm]   DVI-I
[    0.513111] [drm]   HPD1
[    0.513132] [drm]   DDC: 0x7e20 0x7e20 0x7e24 0x7e24 0x7e28 0x7e28 0x7e2c 0x7e2c
[    0.513158] [drm]   Encoders:
[    0.513179] [drm]     CRT1: INTERNAL_KLDSCP_DAC1
[    0.513201] [drm]     DFP2: INTERNAL_KLDSCP_LVTMA
[    0.577285] [drm] Internal thermal controller without fan control
[    0.578307] [drm] radeon: power management initialized
[    0.657478] [drm] fb mappable at 0xD0142000
[    0.657500] [drm] vram apper at 0xD0000000
[    0.657521] [drm] size 8294400
[    0.657541] [drm] fb depth is 24
[    0.657562] [drm]    pitch is 7680
[    0.657632] fbcon: radeondrmfb (fb0) is primary device
[    1.073319] fb0: radeondrmfb frame buffer device
[    1.073349] drm: registered panic notifier
[    1.073379] [drm] Initialized radeon 2.9.0 20080528 for 0000:01:00.0 on minor 0
[  252.565034] WARNING: at drivers/gpu/drm/radeon/radeon_fence.c:246 radeon_fence_wait+0x3a6/0x400()
[  252.565102]  [<ffffffff8137c334>] ? drm_ioctl+0x394/0x450
[  252.565145] [drm] Disabling audio support
[  252.731618] [drm] ring test succeeded in 1 usecs
[  252.908838] [drm:r600_ib_test] *ERROR* radeon: ib test failed (scratch(0x8504)=0xCAFEDEAD)
[  252.908841] [drm:rv770_resume] *ERROR* radeon: failed testing IB (-22).
[  267.523039] WARNING: at drivers/gpu/drm/radeon/radeon_fence.c:246 radeon_fence_wait+0x3a6/0x400()
[  267.523107]  [<ffffffff8137c334>] ? drm_ioctl+0x394/0x450
[  268.216464] [drm] ring test succeeded in 1 usecs
[  268.216473] [drm] ib test succeeded in 1 usecs
[  268.216475] [drm] Enabling audio support
[  273.719044] WARNING: at drivers/gpu/drm/radeon/radeon_fence.c:246 radeon_fence_wait+0x3a6/0x400()
[  273.719114]  [<ffffffff8137c334>] ? drm_ioctl+0x394/0x450
[  273.719159] [drm] Disabling audio support
[  274.411517] [drm] ring test succeeded in 1 usecs
[  274.588784] [drm:r600_ib_test] *ERROR* radeon: ib test failed (scratch(0x8504)=0xCAFEDEAD)
[  274.588787] [drm:rv770_resume] *ERROR* radeon: failed testing IB (-22).
[  290.090036] WARNING: at drivers/gpu/drm/radeon/radeon_fence.c:246 radeon_fence_wait+0x3a6/0x400()
[  290.090103]  [<ffffffff8137c334>] ? drm_ioctl+0x394/0x450
[  290.779828] [drm] ring test succeeded in 1 usecs
[  290.957091] [drm:r600_ib_test] *ERROR* radeon: ib test failed (scratch(0x8504)=0xCAFEDEAD)
[  290.957094] [drm:rv770_resume] *ERROR* radeon: failed testing IB (-22).
[  306.459037] WARNING: at drivers/gpu/drm/radeon/radeon_fence.c:246 radeon_fence_wait+0x3a6/0x400()
[  306.459105]  [<ffffffff8137c334>] ? drm_ioctl+0x394/0x450
[  307.153106] [drm] ring test succeeded in 1 usecs
[  307.330842] [drm:r600_ib_test] *ERROR* radeon: ib test failed (scratch(0x8504)=0xCAFEDEAD)
[  307.330845] [drm:rv770_resume] *ERROR* radeon: failed testing IB (-22).
Comment 1 Sergey Kondakov 2011-05-20 04:05:41 UTC
Created attachment 58692 [details]
full dmesg from 2.6.39
Comment 2 Sergey Kondakov 2011-05-20 04:08:40 UTC
Created attachment 58702 [details]
.config from 2.6.39

created via `make oldconfig` and based on .config from working 2.6.37
Comment 3 Alex Deucher 2011-05-20 04:12:58 UTC
Can you bisect?
Comment 4 Sergey Kondakov 2011-05-20 04:15:58 UTC
Created attachment 58712 [details]
full dmesg from 2.6.37

dmesg from working kernel
Comment 5 Sergey Kondakov 2011-05-20 05:01:00 UTC
you mean like taking kernel's git and bisecting entire commit range between 2.6.37 and 2.6.38 (or, more likely, 2.6.37.4 and 2.6.38-rc4 which i think i've tested) while rebooting every time ? i'm not sure if i up for it but if i am then it may take quite a while.

meanwhile i will also try to get a photograph of the screen. but also not today, probably. any easily gathered info, however, i can drop anytime.
Comment 6 Sergey Kondakov 2011-05-20 14:42:06 UTC
Created attachment 58732 [details]
2.6.39-overview_small.jpg

this is how screen looks like with this glitch since 2.6.38.
all is ok on another PC with r300.
Comment 7 Sergey Kondakov 2011-05-20 14:43:16 UTC
Created attachment 58742 [details]
2.6.39-X_small.jpg

this is all that X manages to draw with >=2.6.38
Comment 8 Sergey Kondakov 2011-05-20 14:48:45 UTC
Created attachment 58752 [details]
2.6.39-close-up_small.jpg

close-up on radeondrmfb area where stuff is drawable at all (it always like that when TV is connected via S-video=>Composite cabling)
Comment 9 Sergey Kondakov 2011-05-20 14:51:08 UTC
Created attachment 58762 [details]
Xorg.0.log_2.6.37

X log with normal kernel
Comment 10 Sergey Kondakov 2011-05-20 14:53:25 UTC
Created attachment 58782 [details]
Xorg.0.log_2.6.39

X log with bad kernel
Comment 11 Sergey Kondakov 2011-06-26 07:08:09 UTC
i tried 3.0.0-rc4 today. glitch is still present but i tried changing kernel config from:
CONFIG_FIRMWARE_IN_KERNEL=y
CONFIG_EXTRA_FIRMWARE="radeon/R600_rlc.bin radeon/R700_rlc.bin"
CONFIG_EXTRA_FIRMWARE_DIR="/lib/firmware"

to:
CONFIG_FIRMWARE_IN_KERNEL=y
CONFIG_EXTRA_FIRMWARE=""

got an error:
[    0.538980] [drm] Loading RV770 Microcode
[   60.896109] [drm:rv770_startup] *ERROR* Failed to load firmware!

but KMS launched with no grid and X started up too!

there is no acceleration however and mesa runs from llvmpipe instead of r600g.
Comment 12 Sergey Kondakov 2011-06-29 07:51:30 UTC
ok, i've got some time & patience to do a bisect and this is what it came up with:
9535ab7323351bacf02d82af79921df1d6594969 is the first bad commit
commit 9535ab7323351bacf02d82af79921df1d6594969
Author: Alex Deucher <alexdeucher@gmail.com>
Date:   Mon Nov 22 17:56:18 2010 -0500

    drm/radeon/kms: setup mc chremap properly on r7xx/evergreen
    
    Should improve performance slightly and possibly fix some
    issues.
    
    Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

:040000 040000 14a61521aaac9fab80f19b41a6762c8ad21eb237 7b084f2dc2f42c928ffd09792f43815180d13057 M      drivers

looks like that commit really changes RV770 behaviour in not a nice way
Comment 13 Sergey Kondakov 2011-06-29 09:06:43 UTC
it's definitely it - i took 2.6.39 kernel and reverted RV770-specific part of that commit and it runs as expected.
please, revert or fix.
Comment 14 Alex Deucher 2011-06-29 13:38:42 UTC
Created attachment 63872 [details]
fix

The attached patch should fix the issue.
Comment 15 Sergey Kondakov 2011-06-30 08:40:55 UTC
yep, patch works.
is it going to be merged in mainline ? to what version ?
Comment 16 Alex Deucher 2011-06-30 13:01:42 UTC
I've sent the patch to Dave and cc'ed stable.  If it doesn't make 3.0, it will show up in 3.1 and get into older kernels via stable.
Comment 17 Sergey Kondakov 2011-06-30 13:14:49 UTC
thanks !
Comment 18 Florian Mickler 2011-07-05 10:43:27 UTC
A patch referencing this bug report has been merged in Linux v3.0-rc6:

commit daf54f1f363a61c618662ef66d4bf09d2b090941
Author: Alex Deucher <alexdeucher@gmail.com>
Date:   Thu Jun 30 08:59:55 2011 -0400

    drm/radeon/kms: Fix chremap setup on RV770 CE