i.MX31 PDK Board Alpha Blending

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

i.MX31 PDK Board Alpha Blending

i.MX31 PDK Board Alpha Blending

Enter inside ~/ltibdir/rpm/BUILD and create a directory 'alpha':

$ cd ltib/rpm/BUILD 
$ mkdir alpha 

Enter in 'alpha' dir and create setalpha.c file:

$ cd alpha
#include <stdio.h> 
#include <stdlib.h> 
#include <sys/types.h>
 #include <sys/stat.h> 
#include <fcntl.h> 
#include <sys/ioctl.h> 
#include <unistd.h> 
#include <asm/arch/mxcfb.h>  

int main(int argc, char **argv) 
{ 
             int fb_fd; 
             struct mxcfb_gbl_alpha gbl_alpha;  

             if(argc != 2){ 
                      printf("Usage: %s alpha_val[0-255]\n",argv[0]); 
                      return -1; 
             }  

             fb_fd = open("/dev/fb0",O_RDWR,0); 
             gbl_alpha.enable = 1; 
             gbl_alpha.alpha = atoi(argv[1]); 
             ioctl(fb_fd, MXCFB_SET_GBL_ALPHA, &gbl_alpha); 
             close(fb_fd); 
             return 0; 
} 

Compile it using this command:

./ltib -m shell 
LTIB> cd rpm/BUILD/alpha 
LTIB> gcc -I../linux/include setalpha.c -o setalpha

In your board execute it:

root@freescale /home$ /unit_tests/mxc_v4l2_output.out -iw 320 -ih 240 -ow 480 -oh 640 -d 3 -r 4 -fr 5 qvga.yuv & 

While it is playing execute:

root@freescale /home$ setalpha 128 
root@freescale /home$ cat screen.raw > /dev/fb0

We used frame rate at 5 fps to have more time to execute next two commands.


Comments

Thanks jesseg, I tried this app on iMX6 and worked.

Leo

Yes it works indeed.

I only modified the last include path asm/arch/mxcfb.h with include/linux/mxcfb.h

-  #include <asm/arch/mxcfb.h>

+ #include <include/linux/mxcfb.h>

%3CLINGO-SUB%20id%3D%22lingo-sub-1112226%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Ei.MX31%20PDK%20Board%20Alpha%20Blending%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1112226%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EEnter%20inside%20~%2Fltibdir%2Frpm%2FBUILD%20and%20create%20a%20directory%20'alpha'%3A%3C%2FP%3E%3CPRE%20class%3D%22jive-pre%22%3E%24%20cd%20ltib%2Frpm%2FBUILD%20%0A%24%20mkdir%20alpha%20%3C%2FPRE%3E%3CP%3EEnter%20in%20'alpha'%20dir%20and%20create%20setalpha.c%20%3CA%20href%3D%22http%3A%2F%2Fwww.imxdev.org%2Fwiki%2Findex.php%3Ftitle%3DI.MX31_PDK_Board_Alpha_Blending%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20style%3D%22text-decoration%3A%20underline%3B%22%20title%3D%22Powered%20by%20Text-Enhance%22%20target%3D%22_blank%22%3Efile%3C%2FA%3E%3A%3C%2FP%3E%3CPRE%20class%3D%22jive-pre%22%3E%24%20cd%20alpha%3C%2FPRE%3E%3CPRE%20class%3D%22jive-pre%22%3E%23include%20%3CSTDIO.H%3E%20%0A%23include%20%3CSTDLIB.H%3E%20%0A%23include%20%3CSYS%3E%0A%20%23include%20%3CSYS%3E%20%0A%23include%20%3CFCNTL.H%3E%20%0A%23include%20%3CSYS%3E%20%0A%23include%20%3CUNISTD.H%3E%20%0A%23include%20%3CASM%3E%26nbsp%3B%20%0A%0Aint%20main(int%20argc%2C%20char%20**argv)%20%0A%7B%20%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20int%20fb_fd%3B%20%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20struct%20mxcfb_gbl_alpha%20gbl_alpha%3B%26nbsp%3B%20%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20if(argc%20!%3D%202)%7B%20%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20printf(%22Usage%3A%20%25s%20alpha_val%5B0-255%5D%5Cn%22%2Cargv%5B0%5D)%3B%20%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20return%20-1%3B%20%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%26nbsp%3B%20%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20fb_fd%20%3D%20open(%22%2Fdev%2Ffb0%22%2CO_RDWR%2C0)%3B%20%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20gbl_alpha.enable%20%3D%201%3B%20%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20gbl_alpha.alpha%20%3D%20atoi(argv%5B1%5D)%3B%20%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20ioctl(fb_fd%2C%20MXCFB_SET_GBL_ALPHA%2C%20%26amp%3Bgbl_alpha)%3B%20%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20close(fb_fd)%3B%20%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20return%200%3B%20%0A%7D%20%0A%3C%2FASM%3E%3C%2FUNISTD.H%3E%3C%2FSYS%3E%3C%2FFCNTL.H%3E%3C%2FSYS%3E%3C%2FSYS%3E%3C%2FSTDLIB.H%3E%3C%2FSTDIO.H%3E%3C%2FPRE%3E%3CP%3ECompile%20it%20using%20this%20command%3A%3C%2FP%3E%3CPRE%20class%3D%22jive-pre%22%3E.%2Fltib%20-m%20shell%20%0ALTIB%26gt%3B%20cd%20rpm%2FBUILD%2Falpha%20%0ALTIB%26gt%3B%20gcc%20-I..%2Flinux%2Finclude%20setalpha.c%20-o%20setalpha%0A%3C%2FPRE%3E%3CP%3EIn%20your%20board%20execute%20it%3A%3C%2FP%3E%3CPRE%20class%3D%22jive-pre%22%3Eroot%40freescale%20%2Fhome%24%20%2Funit_tests%2Fmxc_v4l2_output.out%20-iw%20320%20-ih%20240%20-ow%20480%20-oh%20640%20-d%203%20-r%204%20-fr%205%20qvga.yuv%20%26amp%3B%20%3C%2FPRE%3E%3CP%3EWhile%20it%20is%20playing%20execute%3A%3C%2FP%3E%3CPRE%20class%3D%22jive-pre%22%3Eroot%40freescale%20%2Fhome%24%20setalpha%20128%20%0Aroot%40freescale%20%2Fhome%24%20cat%20screen.raw%20%26gt%3B%20%2Fdev%2Ffb0%0A%3C%2FPRE%3E%3CP%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CDIV%20style%3D%22background-color%3A%20%23eeeeff%3B%20padding-left%3A%2030px%3B%20width%3A%2060%25%3B%20margin-left%3A%2020%25%3B%22%3E%3CP%20class%3D%22note%22%3EWe%20used%20frame%20rate%20at%205%20fps%20to%20have%20more%20time%20to%20execute%20next%20two%20commands.%3C%2FP%3E%3C%2FDIV%3E%3CP%3E%3CSPAN%20class%3D%22mce_paste_marker%22%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1112228%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20i.MX31%20PDK%20Board%20Alpha%20Blending%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1112228%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EYes%20it%20works%20indeed.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EI%20only%20modified%20the%20last%20include%20path%20asm%2Farch%2Fmxcfb.h%20with%20include%2Flinux%2Fmxcfb.h%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E-%26nbsp%3B%20%23include%20%3CASM%3E%20%3C%2FASM%3E%3C%2FP%3E%3CP%3E%2B%20%23include%20%3CINCLUDE%3E%3C%2FINCLUDE%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1112227%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20i.MX31%20PDK%20Board%20Alpha%20Blending%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1112227%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThanks%20%3CA%20class%3D%22jx-jive-macro-user%22%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fpeople%2Fjesseg%22%20target%3D%22_blank%22%3Ejesseg%3C%2FA%3E%2C%20I%20tried%20this%20app%20on%20iMX6%20and%20worked.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3ELeo%3C%2FP%3E%3C%2FLINGO-BODY%3E
No ratings
Version history
Last update:
‎09-10-2020 02:17 AM
Updated by: