tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: wdisplay pixel format


On Thu, 15 Sep 2011 19:05:47 -0500
Frank Zerangue <> wrote:

> I am implementing a device driver using wscons for my display device.
> Does anyone know how a user land program that opens the device (such as X11) 
> will know what the pixel format will be for the frame buffer?
> I  see there is an ioctl tag WSDISPLAYIO_GTYPE to get display type, 
> WSDISPLAYIO_GINFO to get frame buffer metrics height, width, depth, cmsize, 
> and WSDISPLAYIO_LINEBYTES to get the stride. But how does the program that 
> opens the device know the pixel format?

You'll have to guess:
- anything in 8 bit or less is colour indexed
- anything 16 bit is either (extremely likely) RGB565 or (I know of no 
wsdisplay driver using this format) RGB555
- anything 24 or 32bit is RGB888 or XRGB8888 on most hardware. Exceptions are:
   - SBus and UPA framebuffers tend to run in XBGR8888 ( AG-10e is an exception 
but that's really a glint behind and sbus-pci bridge )
   - SGI graphics hardware may use RGBX8888 but things are more complicated 
there anyway, in most cases you won't be able to map the framebuffer anyway or 
what you'll get may not be linear
   - some Sun firmware likes to initialize 24bit modes as BGR even on PCI 
hardware but we run in 8 bit on all of these and you have to jump through some 
extra hoops to get there
So, most wsdisplay drivers will hand you an 8bit colour-indexed framebuffer, if 
you get higher colour depth it will be RGB unless you're on a Sun or SGI.

have fun

Home | Main Index | Thread Index | Old Index