Subject: Re: grfmmap bug?
To: maximum entropy <entropy@zippy.bernstein.com>
From: Leo Weppelman <leo@wau.mis.ah.nl>
List: port-atari
Date: 12/17/1998 15:10:23
On Wed 16 Dec 1998, maximum entropy wrote:
> >Date: Wed, 16 Dec 1998 15:33:02 +0100
> >From: Leo Weppelman <leo@wau.mis.ah.nl>
> >
> >+	if (off >= gi->gd_regsize && off < gi->gd_regsize+gi->gd_fbsize) {
> >+		off -= gi->gd_regsize;
> > 		return (((u_int)gi->gd_fbaddr + off) >> PGSHIFT);
> >+	}
> 
> For the ET4000 that's fine, since gi->gd_regsize is 8192 ( == NBPG*1).
> But I don't think it will work if gi->gd_regsize is not an exact
> multiple of the page size.
> 
> Should the code be changed, or should a comment be added in
> e.g. grfioctl.h that the gd_regsize value must be rounded up to the
> nearest whole page?

Mmmm.... iff (gd_regsize == 64), you call the mmap function like:
     mmap(NULL, <fbsize>, protections & flags, fd, 64)

to map de frame buffer. In my patched expression, this _is_ aligned to
a page boundary (off == 0 before the return!).... am I missing something???

> The reason I was looking at all this is I'm thinking about changing
> the Leonardo driver to a "grf" front end.  The tms34061 chip used by
> the Leonardo only needs 6 bits to address all its registers, so it
> would be most natural to use a gd_regsize of 64.  I realize that a
> whole page will be mapped anyway, so maybe it should be up to the
> front-end driver to do this round-up...

I'm not sure if much time should still be spend on the grf/ite interface...
Over the last 2 weeks or so, I have been looking at the wscons-interface.
This is the interface that is targetted as _the_ generic (== MI) console
interface. I think it is in the interest of the atari-port to see if we can
somehow adopt to it. I have no idea yet, what the impact in coding time
and performance wscons is going to be. Since yesterday evening, I have a
wsdisplay configured on my Hades/et6000 console. I hope to do some work on
the keyboard this weekend. The atari frame buffers as found on the Falcon &
TT and the specialties like the Leonardo and Crazy Dots require a bit more
work (and thought) I'm afraid.

Anyway, this is some food for thought ;-) I hate to spoil programming
efforts!

Leo.