FB_ILI9341 80fps up to 100fps | memcpy(); 387 fps minimal



  • @Maximilian-Gerhardt In this topic ffmpeg side you can find BMP image conversion, i am using ffmpeg, gimp, imagemagic(convert) all the image job, quick tip:

    mkdir ~/sequence
    # basically we have 2 steps for conversion in ffmpeg
    
    # 1. convert the video to resolotion of display, in my case 320x240(4:3 ratio)
    ffmpeg -i the-prey-video.xyz -vf scale=320:240 scaled.mp4 
    
    # 2. create the sequence files from given video
    ffmpeg -i scaled.mp4 -pix_fmt rgb565 -r 25/1 ~/sequence/seq%0001d.bmp
    
    # if you want to convert one image file(png,jpeg,bmp) to rgb565 bmp
    ffmpeg -i some-image-file.png  -vf scale=320:240  -pix_fmt rgb565 exported-image.bmp
    
    

    thats it.


    Tested right now, when the files located in ram (/tmp) on omega it gives stable 100fps. In here 100fps notro's wiki says "Thus above fps=20 we only have 4 distinct values: 100/25=4, 100/26=3, 100/34=2, 100/51=1 (integer division)" in here so i think it can go further. Simple math says we have 96Mhz spi frequency hardware limit.

    on the other hand -> mt7688 datasheet says:


    27:16 rs_clk_sel Register Space SPI clock frequency select.
    0: SPI clock frequency is hclk/2. (50% duty cycle, duty cycle is the ratio of the output high time to the total cycle time)
    1: SPI clock frequency is hclk/3. (33.33% or 66.67% duty cycle)
    2: SPI clock frequency is hclk/4. (50% duty cycle)
    3: SPI clock frequency is hclk/5. (40% or 60% duty cycle)
    4095: SPI clock frequency is hclk/4097
    page 143

    I think we could'nt get the max freq... i do'nt know that, ok then i will prepare a document "how to fbtft supported image" today, see you soon.



  • @Maximilian-Gerhardt I think activated kernel_menuconfig items are triggers some packages in the image, Build process step by step it works!



  • Nice work!
    Can we run some number just to validate my understanding is correct...

    If it's 320x240 ( @ 16 bit/pixel) per image frame
    and such individual (different) frames are transfer 80 times per second, thus
    320x240x16x80 = 98.304 Megabits per second, not considering SPI overhead (and I am thinking the SPI protocol engine is hardware based fetching directly from RAM space.)

    Later post stated 12 fps, which will be
    320x240x16x12 = 14.8 MHz pixel clock (not padded with SPI and frame fetching overhead), while SPI is clocked at 48MHz.
    <-- here I am assuming MT7688 SoC is doing something else (such as running other code, e.g., build new frames, housekeeping, application code, etc.)

    In my view, the usability would be how much of the CPU time is left over for Omega2+ to perform its regular job (other than screen refreshing)? Do you have a guesstimate?

    ccshello



  • @ccs-hello said in FB_ILI9341 80fps up to 100fps:

    I am thinking the SPI protocol engine is hardware based fetching directly from RAM space

    Yes, that's exactly what it is. The other question " how much of the CPU time is left over for Omega2+ to perform its regular job " i2ve just test it, it seems to be ok, but i did'nt test it for durability, just push the work load to omega2 and its just fine;

    1. 25fps ram loaded bmp sequence push to /dev/fb0 using sleep microseconds
    2. 3 ssh connection + serial console,
    3. working top application,
    4. shiftOut application that drives 7 segment lcd using 8bit shiftregister on omega
    5. web site download using wget in to omega2

    0_1532870719393_bb131055-0a20-4b43-86b1-f00af9dbbdb0-image.png

    0_1532877215933_e186dbc3-3836-4f48-8a4b-8079a0f56a63-image.png

    bmp push to /dev/fb0

    #!/usr/bin/env sh
    
    echo "mkdir /tmp/kizu"
    echo "cp -v /tmp/mounts/USB-A1/kizuwa/* /tmp/kizu"
    
    if [ -d /tmp/kizu ]; then
    while : # infinite loop
            do
                    for i in `ls -v /tmp/kizu/*.bmp`
                    do 
    
                    $(cat $i > /dev/fb0) > /dev/null
                            # opkg install coreutils-sleep (microsecond sleep)
                            # this way this script will work 25 times in a second 
                            # human eyes can't grab above this value so this is ok.
                    echo $i
                    sleep 0.04
    
                    done
            done
    fi
    

    website download

    wget -mkEpnp --no-check-certificate https://docs.onion.io/omega2-docs/
    

    workload test video : https://www.youtube.com/watch?v=IFDwKkcWwDg

    screen record video : https://www.youtube.com/watch?v=RJgqwcGm7vQ



  • I am currently working on getting DirectFB (https://github.com/deniskropp/DirectFB) to work with the Omega2. DirectFB is an abstraction layer above fbdev (which provides /dev/fb0).

    Based on DirectFB, one can build SDL, with which games can be built. DirectFB also includes a C++ wrapper and example programs which implement a image viewer and video player (dfbplay) with lots of formats (MPEG, AVI, ...)

    I am so close to getting DirectFB running on this thing. So close.

    Basically I get DirectFB to compile. But during startup, it just hangs. I have debug output available, but since I haven't yet worked with DirectFB (or have a working reference system), it's hard for me to find the error. Especially since I had to patch DirectFB to get it compile under the gcc-musl toolchain at all..

    If anyone is willing to help or test this, I have more info at the original OpenWRT/LEDE forum post at https://forum.openwrt.org/t/need-debugging-help-with-directfb-lede/19985. The responses there: Zero.

    This is a stepping stone to getting a multimedia experience running directly on the Omega2, and possible more complicated games / emulators.



  • Thank you for your hard work, @Maximilian-Gerhardt . I am willing to help or test this, actually i cloned directfb, and lvgl_project, but i couldn't create time for the full scale display manager because of my project.
    I've nearly finished a prototype device for education purpose using fbtft on omega, plus atmel328 that drives touch screen and rc522 rfid R/W, display on/off, some digital controls ...
    After this project i will take my time, firstly chrooted debian i am thinking of, this way i can find a way out or might be see a workaround. After than that, not for just prototype, from top to toe openwrt lede specialist, I am aiming for. I am lack of knowledge for the full scale solution but all of us together is another thing. If this thing works Omega2 will be a fullscale computer šŸ™‚
    In a month or so i will be dive deeper i think.

    0_1536252720309_Screenshot_20180829_103932.png

    0_1536252744001_Screenshot_20180905_222731.png



  • Any updates on this? šŸ™‚



  • @brolly759 Sorry for the late reply, i saw the post now.

    Actually there are but that is not a finished code(even beta).

    My work partner and I parted ways, and the project was canceled so i don't code it further.

    In the code there are lots of comment lines with Turkish language, when i create a free time i can change the comment lines and push the "unfinished code" to github. If it'll work for someone i will be glad.

    Some of the functions.

    /* Color conversion */
    	typedef struct
    	hex2rgb
    	{
    		unsigned int
    			hexValue;
    		unsigned short int
    			r, g, b;
    	} hex2rgb;
    
    	hex2rgb
    		parseRgb888( hex2rgb  hexValue );
    
    	hex2rgb
    		parseRgb565( hex2rgb  hexValue );
    
    	hex2rgb
    		color565( char *hexVal );
    	
    	hex2rgb
    		color888( char *hexVal );
    
    ---
    
    /* Color conversion */
    hex2rgb
    	parseRgb565 ( hex2rgb hexParse )
    	{
    		hex2rgb hexParsed888, parsed;
    		hexParsed888 = parseRgb888( hexParse );
    		parsed.hexValue = ( ( hexParsed888.r >> 3 ) << 11 ) | ( ( hexParsed888.g >> 2 ) << 5 ) | ( hexParsed888.b >> 3 );
    		parsed.r = ( ( parsed.hexValue >> 11 ) & 0x1F );
    		parsed.g = ( ( parsed.hexValue >> 5 ) & 0x3F );
    		parsed.b = ( parsed.hexValue & 0x1F );
    		//printf( "Output\nHex 565: #%04X\n", parsed.hexValue );
    	return parsed;
    	}
    
    ---
    
    hex2rgb
    	parseRgb888( hex2rgb hexParse )
    	{
    		hex2rgb parsed;
    		parsed.r = ( ( hexParse.hexValue >> 16 ) & 0xff );
    		parsed.g = ( ( hexParse.hexValue >> 8 ) & 0xff );
    		parsed.b = ( ( hexParse.hexValue >> 0 ) & 0xff );
    		//printf( "Output\nHex 888: #%06X\n", hexParse.hexValue );
    		//printf( "RGB (%d, %d, %d)\n", parsed.r, parsed.g, parsed.b );
    	return parsed;
    	}
    
    ---
    
    hex2rgb
    	color565( char *hexVal )
    	{
    		hex2rgb hex24, hexParsed565;
    		sscanf( hexVal , "%06x", &hex24.hexValue );
    		//~ hexParsed888 = parseRgb888( hex24 );
    		hexParsed565 = parseRgb565( hex24 );
    		//~ printf ( "Hex24\t#%06X\nRGB888 (%d, %d, %d)\n\n", hex24.hexValue ,hexParsed888.r, hexParsed888.g, hexParsed888.b );
    		//~ printf ( "Hex16\t#%04X\nRGB565 (%d, %d, %d)\n", hexParsed565.hexValue, hexParsed565.r, hexParsed565.g, hexParsed565.b );
    		return hexParsed565;
    	}
    
    ---
    
    hex2rgb 
    	color888( char *hexVal )
    	{
    		hex2rgb hex24, hexParsed888;
    		sscanf( hexVal , "%06x", &hex24.hexValue );
    		hexParsed888 = parseRgb888( hex24 );
    		//~ hexParsed565 = parseRgb565( hex24 );
    		//~ printf ( "Hex24\t#%06X\nRGB888 (%d, %d, %d)\n\n", hex24.hexValue ,hexParsed888.r, hexParsed888.g, hexParsed888.b );
    		//~ printf ( "Hex16\t#%04X\nRGB565 (%d, %d, %d)\n", hexParsed565.hexValue, hexParsed565.r, hexParsed565.g, hexParsed565.b );
    		return hexParsed888;
    	}
    
    ---
    void
    	drawEmbedBmp ( struct fb_info *fb_info,
    				   char *bmpFile, unsigned int bmpFile_len )
    	{
    		memcpy( fb_info->ptr, &bmpFile[0], bmpFile_len );
    	}
    
    
    

    0_1545005874196_fbc5edfe-f22a-466e-bc5a-e03c8c78d848-image.png



  • Well fingers crossed you get this working šŸ˜‰



  • Hello, great work you can, it would help us a lot to have a vagrant file. Do you have the firmware compiled? Could you provide it?


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.