Subject: Re: XFree's sunffb
To: None <port-sparc64@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: port-sparc64
Date: 10/18/2005 00:01:20
>> should we preserve the old driver somehow so people who want it can
>> still have 8bit?
> do you mean support for running the framebuffer itself in 8bit mode?
> or do you mean some kinda fancy FFB-quirky support for 8bit visuals
> when the framebuffer is in 24bit mode,

Um, I don't know the ffb, but I know some other Sun 24/8 framebuffers,
like the cg14 or the s24.  These aren't peecee video cards; they don't
have "8bit mode" and "24bit mode".  Typically they have an 24bpp view
of video RAM (more often a 32bpp view with 8 bits missing out of each
32) and an 8bpp view - sometimes multiple 8bpp views.  There usually is
another view accessing bits which control, per-pixel, how the remaining
bits are displayed.

For example (hypothetical but not unlike real framebuffers), a
framebuffer could have 26 bits of video memory per pixel, where two
bits control how the other 24 are used:
	00	bbbbbbbbggggggggrrrrrrrr 8/8/8 TrueColor
	01	xxxxxxxxxxxxxxxxpppppppp 8bpp PseudoColor, map A
	10	xxxxxxxxppppppppxxxxxxxx 8bpp PseudoColor, map B
	11	ppppppppxxxxxxxxxxxxxxxx 8bpp PseudoColor, map C
Such hardware would, in X terms, have one 24bpp TrueColor visual and
three 8bpp PseudoColor visuals.  (It would probably have corresponding
8bpp visuals of the other five types as well, but that's a frill.)

The hardware would most likely provide, through the magic of address
decoding logic, at least four and quite likely five or six views of the
framebuffer memory: a 24bpp view (probably addressed as 32bpp with 8
missing bits out of every 32), three 8bpp views, and either a 26bpp
view (probably 32bpp with 6 missing bits) or a 2bpp view (probably 8bpp
with 6 missing bits out of every 8).  The X server would then write the
select bits according to which visual each pixel goes with, while
treating the 24bpp and 8bpp views as memory-mapped framebuffers.  (It
may well do more if the hardware provides acceleration for some
operations, but that's an ignorable frill for the purposes of this
discussion.)

There is no 8bpp mode or 24bpp mode in the sense that peecee video
hardware has; the hardware is always in 26bpp mode, and you can see it
as 8bpp or 24bpp if you feel like it, by accessing the video memory
through the appropriate view (and writing the enable bits suitably, if
you want the displayed pixels to match the view you're looking at).

(Actually, the cg14 _does_ have a real 8bit mode which uses only ¼ of
the video RAM, but the 24bpp mode functions approximately as described
above; it's entirely possible to have the hardware in 24bpp mode and
still use it as 8bpp.)

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B