Bug 1760

Summary: [ATI/r128] Dualhead support for r128
Product: xorg Reporter: Alex Deucher <alexdeucher>
Component: Driver/rage128Assignee: Alex Deucher <alexdeucher>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: high CC: dberkholz, vojta
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
URL: http://www.botchco.com/alex/r128/r128dh.diff
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 400    
Attachments:
Description Flags
r128 dualhead patch
none
workign patch
none
latest patch
none
newest patch
none
awful-multihead-ati-hack-1.patch none

Description Alex Deucher 2004-11-01 17:57:18 UTC
I started writing Dualhead support for r128.  the current patch doesn't work
quite yet.  I'm able to set up the PLLs ok, but when dualhead is enabled, the
LCD is screwed up and the vga port doesn't produce a signal.  I suspect there is
a special ordering needed for restoring the relevant crtc, etc. registers, but I
haven't had time to sort it out yet.  If someone is motivated to fix things I'm
open to patches.  Otherwise I'll try and get to it at some point.
Comment 1 Alex Deucher 2004-11-01 17:59:01 UTC
Created attachment 1207 [details] [review]
r128 dualhead patch

current patch.	also avaialble here:
http://www.botchco.com/alex/r128/r128dh.diff
Comment 2 Alex Deucher 2004-11-01 18:00:07 UTC
taking bug
Comment 3 Alex Deucher 2004-11-07 00:08:53 UTC
Created attachment 1229 [details] [review]
workign patch

I finally got dualhead working on r128.  It still needs some cleanup and there
are a few bugs I haven't worked out yet:

- modes on crtc2: the right side flickers and has some artifacts
- doesn't play well with the bios: if you have both the crt and the lcd active
when you start X in dualhead mode, both crtcs will flicker horribly.  Not sure
why yet.  workaround is to switch to lcd only before starting dualhead X.

Other than that it works fine in basic testing.
Comment 4 Alex Deucher 2004-11-10 06:40:27 UTC
new patch:
http://www.botchco.com/alex/r128/r128dh.diff

Corruption onf crtc2 is now fixed.  thanks to Aymeric Vincent for the clues that
led to the fix (bad shift in dda2_on_off in InitDDA2Registers()).  The only
problem that remains now is that SwitchMode() doesn't work right on crtc2.  The
mode on crtc2 gets set correctly on server startup and by switching to another
VT and back, but not when using switchmode().  when you use switchmode() crtc2
ends up with these very odd modes or modes that are out of sync.  if you switch
to one of these modes and then swicth to another VT and back the proper mode
gets set on crtc2.  I can't seem to figure out why.  I tried resetting the modes
on both crtc2 and crtc1 when switchmode() is called on crtc2; I tried several
different mode restore orderings, and several other things (turning off the
dac/unsourcing crtc2, etc.), but none had any effect.  Ideas welcome.
Comment 5 Alex Deucher 2004-11-24 17:31:26 UTC
Created attachment 1368 [details] [review]
latest patch

attaching latest patch. SwitchMode() doesn't work unless you change VTs
Comment 6 Alex Deucher 2004-12-16 20:18:42 UTC
ppc users will need to also apply the patch in bug 2089 to get dualhead working.
Comment 7 Alex Deucher 2004-12-19 11:51:02 UTC
Created attachment 1570 [details] [review]
newest patch

applied to HEAD
Comment 8 Alex Deucher 2005-02-11 06:36:30 UTC
closing for now.  If anything comes up, reopen.
Comment 9 Adam Jackson 2005-11-19 13:52:00 UTC
*** Bug 5023 has been marked as a duplicate of this bug. ***
Comment 10 Adam Jackson 2005-11-19 13:54:55 UTC
alex, this patch is dlloader-dirty.  you define gR128EntityIndex in ati_drv.so
but reference it from r128_drv.so, which means r128 can't be loaded directly
anymore.
Comment 11 Alex Deucher 2005-11-22 07:53:20 UTC
(In reply to comment #10)
> alex, this patch is dlloader-dirty.  you define gR128EntityIndex in ati_drv.so
> but reference it from r128_drv.so, which means r128 can't be loaded directly
> anymore.

However we decide to tackle this, radeon will need a similar fix.
Comment 12 Adam Jackson 2005-11-30 15:44:04 UTC
Created attachment 3948 [details] [review]
awful-multihead-ati-hack-1.patch

something like this, i think:

if loadable server
   if symbol exists
      return its value
   else
      return -1
else
   symbol always exists because ati is built-in, so just return value

i think this is the right semantics, but it's certainly disgusting.  the ati
wrapper driver desperately needs to die.
Comment 13 Kevin E. Martin 2005-12-11 05:35:51 UTC
This looks right to me too.

I've tested it with both "ati" and "r128" on a R128Pro card and with both "ati"
and "radeon" on a R100 card, and it appears to work in all cases.
Comment 14 Adam Jackson 2005-12-15 06:38:58 UTC
applied to modular and monolithic ati driver, closing.

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.