Subject: Re: Adding video mode info to struct wsscreen_descr
To: None <thorpej@wasabisystems.com>
From: TAKEMURA Shin <takemura@netbsd.org>
List: tech-kern
Date: 07/10/2002 11:11:37
From: Jason R Thorpe <thorpej@wasabisystems.com>
Subject: Re: Adding video mode info to struct wsscreen_descr
Date: Tue, 9 Jul 2002 07:38:26 -0700

> On Tue, Jul 09, 2002 at 07:21:37PM +0900, Bang Jun-Young wrote:
> 
>  > Some of you may know that I have been working on raster graphics
>  > mode VGA driver and Mach64 framebuffer driver for some time. In order
>  > to make video mode switching cleaner and simpler on those drivers,
>  > I'd like to add a new member to struct wsscreen_descr. See below:
> 
> How about just a "void *modecookie" or something that points to an
> object that is opaque to wscons itself?  Why does wscons need to know
> about the dot clock, etc?  Only the VGA support routines need to know
> about that.

I think you can freely add any members to struct wsscreen_descr like 
below. Or you can retreive your mode data searching with 'name' member
of struct wsscreen_descr, which shuld be identical.

struct my_descr {
	struct wsscreen_descr base;
	struct video_modetiming *mode;
};

struct my_descr mydesc = { /* snipped */ };

const struct wsscreen_descr *my_scrlist[] = {
	(struct wsscreen_descr *)&mydesc,
};

struct wsscreen_list my_screenlist = { 1, my_scrlist };

void
myattach(struct device *parent, struct device *self, void *aux)
{
	struct wsemuldisplaydev_attach_args wa;

	wa.scrdata = &my_screenlist;
	wa.accessops = &my_accessops;
	wa.accesscookie = self;

	config_found(self, &wa, wsemuldisplaydevprint);
}

int
my_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
    int *curxp, int *curyp, long *attrp)
{
	struct my_descr *mydesc = (struct my_descr *)type;
	struct video_modetiming *mode = mydesc->mode;

}

Takemura