From mboxrd@z Thu Jan 1 00:00:00 1970 From: jmk@plan9.bell-labs.com To: 9fans@cse.psu.edu Subject: Re: [9fans] What are the steps to add new video drivers? MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Message-Id: <20010330165229.7B33619A01@mail.cse.psu.edu> Date: Fri, 30 Mar 2001 11:52:27 -0500 Topicbox-Message-UUID: 77b3b20a-eac9-11e9-9e20-41e7f4b1d025 On Fri Mar 30 09:47:25 EST 2001, mike@trolltech.com wrote: > > jmk@plan9.bell-labs.com wrote: > > My advice is to install Plan 9 on a machine that has a suitable video > > board, then you can go through the driver development cycle in a more > > friendly environment. > > > > Having support for Nvidea cards would be great, by the way. > > Indeed, I keep thinking that I'd like to take a whack at getting my TNT2 Ultra > working. Unfortunately my Copious Free Time hasn't yet been copious enough to > let me gather together the necessary computers; it seems like you're talking > about at least three for something like a normal environment: an operational > terminal for development, a file server, and a machine with the card you're > developing for. > Basically you need somewhere to compile aux/vga and a new kernel with a stub driver for the card. The machine with the new card needs to be able to boot the newly compiled kernel and be attached to the fileserver that has the hacked aux/vga binary somewhere. Here's the kernel stub I used when I briefly looked at the GeForce256 when one arrived in a server I'd ordered - vgageforce256.c: #include "u.h" #include "../port/lib.h" #include "mem.h" #include "dat.h" #include "fns.h" #include "io.h" #include "../port/error.h" #define Image IMAGE #include #include #include #include "screen.h" static ulong geforce245linear(VGAscr* scr, int* size, int* align) { ulong aperture, oaperture; int oapsize, wasupamem; Pcidev *p; oaperture = scr->aperture; oapsize = scr->apsize; wasupamem = scr->isupamem; aperture = 0; if(p = pcimatch(nil, 0x10DE, 0)){ switch(p->did){ case 0x0101: aperture = p->mem[1].bar & ~0x0F; *size = p->mem[1].size; break; default: break; } } if(wasupamem){ if(oaperture == aperture) return oaperture; upafree(oaperture, oapsize); } scr->isupamem = 0; aperture = upamalloc(aperture, *size, *align); if(aperture == 0){ if(wasupamem && upamalloc(oaperture, oapsize, 0)){ aperture = oaperture; scr->isupamem = 1; } else scr->isupamem = 0; } else scr->isupamem = 1; return aperture; } VGAdev vgageforce256dev = { "geforce256", nil, /* enable */ nil, /* disable */ nil, /* page */ geforce245linear, /* linear */ nil, /* drawinit */ nil, /* fill */ }; and here's a stub for aux/vga - geforce256: #include #include #include #include "vga.h" /* * GeForce256. */ static void snarf(Vga* vga, Ctlr* ctlr) { USED(vga); ctlr->flag |= Fsnarf; } static void options(Vga* vga, Ctlr* ctlr) { USED(vga); ctlr->flag |= Foptions; } static void init(Vga* vga, Ctlr* ctlr) { USED(vga); ctlr->flag |= Finit; } static void load(Vga* vga, Ctlr* ctlr) { USED(vga); ctlr->flag |= Fload; } static void dump(Vga* vga, Ctlr* ctlr) { USED(vga, ctlr); } Ctlr geforce256 = { "geforce256", /* name */ snarf, /* snarf */ options, /* options */ init, /* init */ load, /* load */ dump, /* dump */ }; At this point I usually write the snarf and dump functions; with the GeForce256 I looked at the register set of the card as described in the XFree86 code (the only 'documentation') and decided I didn't have the strength. --jim