We are using frame buffers with 16 bit color (fb0 and fb1). If we choose a 16 bit color key how do we convert that to the 24 bit value that gets submitted via IOCTL MXCFB_SET_CLR_KEY?
We did some head banging to figure this out. Wish it was documented somewhere, if it is please advise.
For a 16 bit RGB565 color:
red = ((color16 & 0xf800) >> 11) * 256 / 0x1f;
grn = ((color16 & 0x07e0) >> 5) * 256 / 0x3f;
blu = ((color16 & 0x0001f) >> 0) * 256 / 0x1f;
if(red > 0xff) red = 0xff;
if(grn > 0xff) grn = 0xff;
if(blu > 0xff) blu = 0xff;
color24 = (red << 16) + (grn << 8) + (blu << 0);
Not sure this is exactly how they implemented it, but it works.
There are various ways of mapping the 16-bit color value to 24-bit wide LCD bus, and they may depend on the processor type. What exactly processor do you use?
Have a great day,Artur
Retrieving data ...