G550 Dual-head questions

Alex Deucher alexdeucher at gmail.com
Sun Jul 24 14:39:06 PDT 2005


On 7/24/05, Daniil V. Kolpakov <dan at solutions.lv> wrote:
> Alex, thanks for the feedback! More questions follow...
> 
> > > My thoughts:
> > >
> > >  1) G550 has videomodes like 2048x768;
> > >  2) It's possible to setup the 1024x768 mode with virtual size
> > >     of 2048x768 in the clone mode; DRI&xv works
> > >  3) mga driver can do dual-head, so I guess it could program both heads
> > >     to use the same framebuffer, with different viewports?
> >
> > Exactly.  that bascially all mergedfb is.  One big framebuffer with
> > two viewports looking into it.  You'll need to program both crtcs and
> > write an adjustframe() function to handle the crtc offsets.  One
> > possible limitation is the max coordinates size handled by the drawing
> > engine.  The size of your merged desktop will be limited by the max
> > size your drawing engine can handle.
> [...]
> > the easiest way to start messing with dualhead, IMHO, is to try and
> > get the first instance of the driver to initialize the proper mode on
> > each crtc.  Just start out with a cloned desktop.  Once you get that
> > create a large virtual desktop and hack the adjustframe() function to
> > set the crtc offsets to different values.  then work from there to
> > integrate some of the other more advanced features.
> 
> Actually, I've started with something like that;
> 
> In the end of the MGAScreenInit() in mga_driver.c, where the viewport is set,
> I've added the following:
> 
>     pScrn->AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
>     /*dan*/
>     xf86DrvMsg(scrnIndex, X_ERROR,
>                "pScrn->virtualX: %d, pScrn->virtualY: %d\n",
>                 pScrn->virtualX, pScrn->virtualY);
>     xf86DrvMsg(scrnIndex, X_ERROR, "frameX1-frameX0+1: %d\n",
>                 pScrn->frameX1-pScrn->frameX0+1);
>     if(pScrn->frameX1 - pScrn->frameX0 + 1 == (pScrn->virtualX) / 2){
>         MGAAdjustFrameCrtc2(0, (pScrn->virtualX) / 2, 0, 0);
>         MGAAdjustFrame(0, 0, 0, 0);
>     }
>     /*\dan*/
> 
> The first "pScrn->AdjustFrame()" line is the original code. Then, I check if
> the setup is 1024x768/2048x768-virtual, and call different adjustFrame()'s,
> for the first and the second SRTC. The xorg.conf used has:
> 
> Section "Screen"
> [...]
>     Subsection "Display"
>         Depth 24
>         Virtual 2048 768
>         Modes "1024x768"
>     EndSubsection
> [...]
> 
> and
> 
> Section "ServerLayout"
>     Identifier "layout1"
>     InputDevice "Keyboard1" "CoreKeyboard"
>     InputDevice "Mouse1" "CorePointer"
>     Screen "screen1"
> EndSection
> 
> That is, a single-head (or clone) config.
> 
> So, when I've made mentioned change to the driver, I've found that both
> MGAAdjustFrameCrtc2() and MGAAdjustFrame() operate on both heads. The code
> results in moving the viewport to the start of the framebuffer (both heads),
> and if I comment out MGAAdjustFrame(), leaving just MGAAdjustFrameCrtc2(),
> viewport is set to the end (the part from the right) of the framebuffer, on
> both heads again. MGAAdjustFrameCrtc2()/MGAAdjustFrame() do the same thing.
> Why? I guess that's because the card is set into the clone mode. How to setup
> the card so it allowed separate viewport adjustment? I guess, MGAGRestore()
> from the mga_dacG.c can do that, but I don't know how to call it correctly.
> 

You need to set the mode on crtc2 as well.  I suspect what is
happening is that one crtc is driving both outputs.  most dualhead
drivers have two intertwined code paths for setting modes on each
crtc.  The first one and then, A second one guarded by
pMga->IsSecondary or pMga->SecondCRTC, or something similar. 
Unforunately, I'm not too familiar with the mga code as I haven't
looked at it in a while.

> > Take a look at the sis driver too.  Thomas has done most of the
> > mergedfb pioneering.  In the radeon driver, I separated out most of
> > the mergedfb stuff into radeon_mergedfb.c/h when I added mergedfb
> > support to radeon.  If you have any questions along the way feel free
> > to ask.  I'd be happy to explain anything you have questions about.
> 
> Thanks alot!
> 
> For a start, do any documentation on the driver writing exist? I need to
> understand the order in which the initialisation takes place (and the order
> in which functions from mga_driver.c are called).

http://www.x.org/X11R6.8.2/doc/DESIGN.html is a good guide.  then look
though the other drivers.  In general, it's:
probe()
preinit()
screeninit()

Alex

> 
> --
> /dev/brains: permission denied
> 
> Please avoid sending me Word or PowerPoint attachments.
> See http://www.gnu.org/philosophy/no-word-attachments.html
>



More information about the xorg mailing list