Bug 14001

Summary: Screen corruption on dual-link DVI with r500.
Product: xorg Reporter: Chris Ball <chris-fdbugs>
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: bernie
Version: git   
Hardware: x86 (IA32)   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Photo after running "X"
none
Photo after logging in
none
Xorg.0.log
none
xorg.conf
none
avivotool regs all, under fglrx
none
avivotool regs all, under radeon
none
regs all diff from radeon to fglrx
none
Patch to clear scaler registers
none
atom scaler code none

Description Chris Ball 2008-01-09 18:39:36 UTC
Hi, 

I have an Apple 30" display and X1650 PCIe.  1280x800 works fine, but 2560x1600 generates corruption, as shown as in the two attached screenshots.

airlied and agd5f helped on IRC, and we tried a few things:

* it's not DRM; same happens with DRM off.
* turning ColorTiling off doesn't help.
* it's not a sync polarity problem.
* it's not a regression; although this was working on ajax's monitor around Nov 20th, a Nov 20th checkout doesn't work here.
* it *does* work in fglrx.

Log attached.  Tomorrow I'll run "avivotool regs all" with fglrx and radeon and attach that.
Comment 1 Chris Ball 2008-01-09 18:44:50 UTC
Created attachment 13628 [details]
Photo after running "X"
Comment 2 Chris Ball 2008-01-09 18:45:23 UTC
Created attachment 13629 [details]
Photo after logging in
Comment 3 Chris Ball 2008-01-09 18:47:43 UTC
Created attachment 13630 [details]
Xorg.0.log
Comment 4 Chris Ball 2008-01-09 18:48:18 UTC
Created attachment 13631 [details]
xorg.conf
Comment 5 Chris Ball 2008-01-10 11:46:01 UTC
Created attachment 13648 [details]
avivotool regs all, under fglrx
Comment 6 Chris Ball 2008-01-10 11:46:21 UTC
Created attachment 13649 [details]
avivotool regs all, under radeon
Comment 7 Chris Ball 2008-01-10 15:11:51 UTC
Created attachment 13654 [details]
regs all diff from radeon to fglrx
Comment 8 Chris Ball 2008-01-12 13:29:49 UTC
I have this fixed now!  I don't yet understand the fix, though.

I noticed that radeon worked when run *after* fglrx, which made things
a lot easier -- fglrx was obviously changing a necessary register that
radeon doesn't touch.  Finding that register was difficult; the 
<0x1000 registers weren't helping anything, and the "regs all" diff
between radeon-before-fglrx (failing case) and radeon-after-fglrx
(working case) had >100 registers in.

I wrote a perl script which takes two "avivotool regs all" dumps, the
first assumed to be the working state and the second assumed to be the
bad state, and sets every register currently in the bad state to the
good state, with a one second delay between each regset for you to see
whether it fixed the problem on the screen.  The script is here:

   http://dev.laptop.org/~cjb/apply-regs-diff.pl

This found the culprit register, which is a set of two:  0x6590
(which radeon_reg.h knows to be AVIVO_D1SCL_SCALER_ENABLE) and 0x6594.
Neither of these are touched by radeon, but the problem state is when
they are set; fglrx clears them, and they aren't changed by radeon at 
all.  The default state at bootup, before any drivers have been loaded, 
is for them to be set.

So, the attached works-for-me patch clears just those two registers 
at load-time.  The placement in atombios_crtc.c is just a guess, and 
I haven't commented the writes because I don't expect them to be
committed while 0x6594 remains magic.  How would I learn more about
these registers?  The AMD docs don't seem to cover them.

By the way, I'm sure other people have similar tools to my perl
script, but I don't know where any are.  You're welcome to include
my script with avivotool/radeontool if you'd like to.
Comment 9 Chris Ball 2008-01-12 13:32:19 UTC
Created attachment 13678 [details] [review]
Patch to clear scaler registers
Comment 10 Alex Deucher 2008-01-12 17:52:00 UTC
Created attachment 13683 [details] [review]
atom scaler code

Does this patch help?  This will disable the scaler if scaling is not enabled.  Enabling doesn't work just yet.
Comment 11 Chris Ball 2008-01-14 13:00:43 UTC
(In reply to comment #10)
> Does this patch help?  This will disable the scaler if scaling is not enabled. 
> Enabling doesn't work just yet.

Yep, works, thanks.  Can your patch be committed?
Comment 12 Alex Deucher 2008-01-14 13:14:56 UTC
committed.  thanks!

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.