There are some test cases used to show alpha effect in previous unit_tests, but it is not found in latest Linux BSP release. So I prepare a simple test code to perform colorkey, global alpha, local alpha or alpha in pixel option for video combining, it could be useful when customer wants to see the effect.
I have checked test code on MX6Q ARM2 board and Linux release package is L3.0.15_12.05.01_ER_source.tar.gz.
Test based on the following assumptions:
1. Video combining is performed by the DP, BG video --> /dev/fb0, FG UI --> /dev/fb1
2. Panel resolution is 1024x768
Here are test steps:
1. Play a video or a picture on /dev/fb0.
2. Use fb_setup to setup fb1.
It will fill pixel value in frame buffer and alpha value in alpha buffer as below.
Frame buffer in RGBA mode:
for (i = 0; i < fb_var.yres; i++)
for (j = 0; j < fb_var.xres; j++)
if (i < fb_var.yres / 4)
pbuf[i * screen_width + j] = 0xFF000080; //Red pixel with alpha value 0x80 in first region
else if (i < fb_var.yres / 2)
pbuf[i * screen_width + j] = 0x00FF00FF; //Green pixel opaque in second region
else if (i < fb_var.yres * 3 / 4)
pbuf[i * screen_width + j] = 0x0000FF00; //Blue pixel transparent in third region
pbuf[i * screen_width + j] = 0xFFFFFFFF; //White pixel opaque in fourth region
memset(alpbuf, 0xFF, alp_size/4); //Alpha value is 0xFF in first region
memset(alpbuf+alp_size/4, 0xAA, alp_size/4); //Alpha value is 0xAA in second region
memset(alpbuf+alp_size/2, 0x80, alp_size/4); //Alpha value is 0x80 in third region
memset(alpbuf+alp_size*3/4, 0x55, alp_size/4); //Alpha value is 0x55 in fourth region
3. Use alpha_test to check colorkey, global alpha, local alpha and alpha in pixel effect.
colorkey on: ./alpha_test colorkey_on <colorkey value> //colorkey value, such as 0xFF0000 for red
colorkey off: ./alpha_test colorkey_off
global alpha: ./alpha_test alpha_global <alpha value> //alpha value, such as 0x80
local alpha: ./alpha_test alpha_local //alpha effect is accordant with alpha buffer set in step 2
alpha in pixel: ./alpha_test alpha_pixel //alpha effect is accordant with alpha value in pixel set in step 2
alpha off: ./alpha_test alpha_off
Original Attachment has been moved to: fb_setup.zip
Original Attachment has been moved to: alpha_test.zip