On 6/1/05, Lourens Veen <[EMAIL PROTECTED]> wrote:
> On Wednesday 01 June 2005 01:12, Timothy Miller wrote:
> > On 5/31/05, Lourens Veen <[EMAIL PROTECTED]> wrote:
> >
> > > 8 bit is a palette lookup, which with a block ram (in 512x36 mode so we
> > > can get the RGB values in one lookup) is trivial as well. The problem may
> > > be loading the palette with the RAM in 512x36 mode, since that is done
> > > bytewise IIRC. Maybe we could fetch the 36-bit line when the address
> > > register is written, and then write back the line with the new value in
> > > it when the data register is written after that. I don't think that that
> > > should be a performance problem.
> >
> > It just occurred to me that we might be able to use the palette in the
> > main video controller.  I'm going to design it with various modes that
> > allow for lookup of the RGB going out.  So all we need to do is give
> > the VGA palette some way to get at that.  When the video is
> > translated, we can convert paletted to paletted, just arranged
> > differently and let the video controller to the lookup.
> 
> Ah, yes, gamma correction. Which doesn't exist in the VGA standard, so if we
> have a lookup table there anyway, we could abuse it for palettes. It would
> have to be a somewhat beefier lookup table than usually used for gamma
> correction on video cards though. OTOH, it will probabl be in block ram
> anyway; on the 3S4000 we'll have plenty of those. All that's needed then is
> that instead of doing a lookup for red, green and blue using the R, G and B
> parts of the pixel, all of them have the same input (e.g. R). Then we just
> write the palette indexes into that one channel, and let the video controller
> do the lookup.

I'm going to do a couple of different useful modes.  There will be
three tables, each for R, G, and B, but since there are more than 256
entries in the block RAMs in 8-bit modes, we can play some tricks.  We
normally do a lookup of R, G, and B in the first 256 entries of their
respective tables, but we can do other stuff... for instance:

(1) If the alpha channel (upper 8 bits) is zero, we lookup like
normal.  But if the alpha channel is nonzero, we use the alpha channel
as the R, G, and B indexes into the second 256 entries in the table. 
This gives us an 8-bit pseudocolor overlay.

(2) Use the upper 8 bits as a "window ID" that gets multiplied by 256
and added to R, G, and B.  This lets us have N 24-bit gamma tables. 
This can also be used to do 24-bit truecolor and 8-bit pseudocolor at
the same time, if in the latter case, R, G, and B are all the same
value.


Another question is what we can do with extra bits in the LUT lookup. 
If the memories are in 18-bit mode, that gives us 1024 entries, or 4
palettes.  We can only send 8 bits to the monitor, but if we do
temporal modulation, we can give the illusion of greater color
precision for gamma correction.  The remaining 10 bits could be used
for a variety of things, including temporal modulation patterns.


Anyhow, the bottom line is that we can intercept the VGA palette
writes, format them appropriately for our LUT, and then we can also
format the pixels right during translation, and everything works out
great, where some of the LUT work is done by the video controller.

_______________________________________________
Open-graphics mailing list
[email protected]
http://lists.duskglow.com/mailman/listinfo/open-graphics
List service provided by Duskglow Consulting, LLC (www.duskglow.com)

Reply via email to