9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: jmk@plan9.bell-labs.com
To: 9fans@cse.psu.edu
Subject: Re: [9fans] What are the steps to add new video drivers?
Date: Fri, 30 Mar 2001 11:52:27 -0500	[thread overview]
Message-ID: <20010330165229.7B33619A01@mail.cse.psu.edu> (raw)

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 <draw.h>
#include <memdraw.h>
#include <cursor.h>
#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 <u.h>
#include <libc.h>
#include <bio.h>

#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


             reply	other threads:[~2001-03-30 16:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-30 16:52 jmk [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-03-30 16:58 jmk
2001-03-30 16:12 forsyth
2001-03-30 14:18 jmk
2001-03-30 14:46 ` Mike Acar
2001-03-30  8:37 Richard Greenblott

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010330165229.7B33619A01@mail.cse.psu.edu \
    --to=jmk@plan9.bell-labs.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).