IMX6 color key for 16 bit frame buffer

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IMX6 color key for 16 bit frame buffer

706 Views
richogrady
Contributor II

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?

Labels (1)
0 Kudos
2 Replies

550 Views
art
NXP Employee
NXP Employee

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

0 Kudos

550 Views
richogrady
Contributor II

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.

0 Kudos