Subject: 3100 cmap entries
To: None <arnej@pvv.unit.no, mellon@fugue.com>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: port-pmax
Date: 01/15/1996 13:45:24
Arne replies:
> > >If you want to change only the last color (255),
> > >then index=255, count=1, so sum=256 is valid.
> > >Actually I managed to convince myself it should be 257 once,
> > >but I've now come to my senses :-)
> >
> > Oops, sorry. But then surely a count of 0 is invalid,
> > and the in-range test for count should be "count < 1" ?
>
>argh, yes of course.
I think we're heading towards a consensus here. The acceptable
ranges are:
0 <= index <= 255;
1 <= count <= 256,
1 <= count + index <= 256,
If someone could actually *try* this on a 3100, please let me know if it works.
I expect the cfb RAMDAC driver needs a similar fix.
next on the menu: screenblank??
thanks
--Jonathan
--- src/sys/arch/pmax/dev/bt478.c.orig Mon Dec 11 21:37:26 1995
+++ src/sys/arch/pmax/dev/bt478.c Mon Jan 15 14:51:47 1996
@@ -266,22 +266,25 @@
u_char *cmap;
int i;
- if (index > 256 || index < 0 || index + count > 256)
+ if (index < 0 || count < 1 || index + count > 256)
return EINVAL;
cmap_bits = (u_char *)bits;
cmap = (u_char *)(fi -> fi_cmap_bits) + index * 3;
- vdac->mapWA = index; MachEmptyWriteBuffer();
for (i = 0; i < count; i++) {
- cmap [(i + index) * 3]
- = vdac->map = cmap_bits [i * 3];
+ vdac->mapWA = i + index; MachEmptyWriteBuffer();
+
+ cmap [i * 3] = cmap_bits [i * 3];
+ vdac->map = cmap_bits [i * 3];
MachEmptyWriteBuffer();
- cmap [(i + index) * 3 + 1]
- = vdac->map = cmap_bits [i * 3 + 1];
+
+ cmap [i * 3 + 1] = cmap_bits [i * 3 + 1];
+ vdac->map = cmap_bits [i * 3 + 1];
MachEmptyWriteBuffer();
- cmap [(i + index) * 3 + 2]
- = vdac -> map = cmap_bits [i * 3 + 2];
+
+ cmap [i * 3 + 2] = cmap_bits [i * 3 + 2];
+ vdac -> map = cmap_bits [i * 3 + 2];
MachEmptyWriteBuffer();
}
return 0;