Subject: Re: framebuffer access
To: Radek Kujawa <streamer@cytrynka.infoland.int.pl>
From: Michael <macallan18@earthlink.net>
List: port-sparc64
Date: 11/13/2005 13:20:42
Hello,

> Yes, I know about WSDISPLAYIO_GINFO, I did my homework and read
> wsdisplay(4) ;). I meant returning information about endinness and
> RGB/BGR/something else in organization field of structure. This will
> certainly help in the future (and on other ports).

Definitely.

> I'm willing to write it, but I don't know how info about fb
> organization should be returned.

Writing it is not the problem, that's more or less trivial. We'd need to
come up with something suitable first.

> For example mach64 has two views. Supporting different views will add
> complexity to the API. I don't know if it's the right thing to do.

I'm not sure we should support multiple views in wscons, we can do it
using the Sun fb devices. So far wscons used to return the view it uses
itself, eg. something matching host endianness.

> #define WSDISPLAY_FB_UNKNOWN		0
> #define WSDISPLAY_FB_PSEUDOCOLOR	1	/* 8-bit, colormap */
> #define WSDISPLAY_FB_RGB24_PLAIN	2	/* 24-bit RGB, plain */
> #define WSDISPLAY_FB_RGB24_SWAPENDIAN	3	/* ^ endianness swapped */
> #define WSDISPLAY_FB_OTHERFANCYMODE     4	/* ... */
> (...)

I think this should be a flag field, like one flag for endianness
conversion, a couple bits for colour format and so on. 

And I'd prefer something like this:

struct wsdisplay_view {
	size_t   size;
	offset_t offset;
	uint32_t width, height;
	uint32_t stride, depth;
	uint32_t flags; /* colour format, conversion etc. */
}

and then
struct wsdisplay_view_info {
	struct wsdisplay_view *views;
	uint32_t count;
}

so we can just return the number of views when the pointer is NULL -
after all the userland program has to provide the memory for the view
table and just guessing it is ugly. Most PCI boards will only support 2
views, but others, like the ffb, could do many more which don't
necessarily use the same depth or organization. Or think video overlays
- these could be exposed as different views but geometry and colour
depth/format may be something completely different ( like YUV ).

Hmm, supporting video overlays here is probably overkill.

have fun
Michael