IMX6 color key for 16 bit frame buffer

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

IMX6 color key for 16 bit frame buffer

1,878 次查看
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?

标签 (1)
0 项奖励
回复
2 回复数

1,722 次查看
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 项奖励
回复

1,722 次查看
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 项奖励
回复