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



  • I'll take a time and prepare a document for it.

    • Omega2p
    • edit: b192 Stock Rom When I build the image i saved it named omega2p without thinking later... It's a custom image, i am writing a Here is the tutorial of how to build an image that supports to fbtft kernel modules.
    • ILI9341 2.8" TFTLCD SPI
    • ILI9341 FBTFT Staging drivers and modules
      400 piece of 320x240 16bit bmp files that located in a usb flashdisk, it takes 4 - 6 seconds to display on the screen,
      it means 80fps - 100fps 🙂

    UPDATE 16th Aug

    • Compiled C binary which includes "C include file style bmp" files, shows [ 387 fps ] minimal rate. memcpy() used. (Omega2+)
    • Compiled C binary, memcpy() fill_screen one color 1000 times -> [ 432 fps ]
    • Compiled C binary, memcpy() fill_screen 21 color 1000 times -> [ 439 fps ]
    root@Omega-C617:~# ./display_init.sh 
    [  893.580854] m25p80 spi32766.0: spi-nor spi32766.0 40000kHz 8 bits mode=0x00
    [  893.604237] fb_ili9341 spi32766.1: fbtft_request_gpios: 'reset' = GPIO2
    [  893.611014] fb_ili9341 spi32766.1: fbtft_request_gpios: 'dc' = GPIO3
    [  893.910937] fb_ili9341 spi32766.1: Display update: 3098 kB/s, fps=0
    [  893.917669] graphics fb0: fb_ili9341 frame buffer, 320x240, 150 KiB video memory, 3072 KiB DMA buffer memory, fps=100, spi32766.1 at 96 MHz
    [  893.930418] fbtft_device: GPIOS used by 'fb_ili9341':
    [  893.935553] fbtft_device: 'reset' = GPIO2
    [  893.939630] fbtft_device: 'dc' = GPIO3
    [  893.943448] m25p80 spi32766.0: spi-nor spi32766.0 40000kHz 8 bits mode=0x00
    [  893.950540] fb_ili9341 spi32766.1: fb_ili9341 spi32766.1 96666kHz 8 bits mode=0x03
    

    display init script

    #!/usr/bin/env sh
    
    # init islemleri
    insmod /root/modules/fb_sys_fops.ko
    insmod /root/modules/fb.ko
    insmod /root/modules/backlight.ko
    insmod /root/modules/sysfillrect.ko
    insmod /root/modules/syscopyarea.ko
    insmod /root/modules/sysimgblt.ko
    insmod /root/modules/fbtft.ko
    insmod /root/modules/fb_ili9341.ko
    
    insmod /root/modules/fbtft_device.ko custom name="fb_ili9341" busnum=32766 cs=1 speed=96666000 mode=3 fps=100 txbuflen=3145728 buswidth=8 bgr=1 gpios=reset:2,dc:3 width=240 height=320 verbose=3 rotate=90 debug=2 
    

    display deinit script

    #!/usr/bin/env sh
    
    rmmod /root/modules/fbtft_device.ko
    
    rmmod /root/modules/fb_ili9341.ko
    rmmod /root/modules/fbtft.ko
    rmmod /root/modules/sysimgblt.ko
    rmmod /root/modules/syscopyarea.ko
    rmmod /root/modules/sysfillrect.ko
    rmmod /root/modules/backlight.ko
    rmmod /root/modules/fb.ko
    rmmod /root/modules/fb_sys_fops.ko
    

    ** AC-DC Back In Black's frames, resized to 320x240 bmp sequence using ffmpeg 🙂 **
    0_1532683009575_AC-DC-frames.png

    Videos

    Screen Capture of test - https://www.youtube.com/watch?v=GBBR2sLSVD8

    Display Video - https://www.youtube.com/watch?v=XojAurGh5IM


    Log in to reply
     


  • AWESOME!! I've wanted to work on this for a whole eternity, but got discouraged with my problems with SPI. I knew a kernel-level driver would be much faster than what I've been working on with user-space calls into the SPI device.

    Also great to know that my tutorial on kernel module compiling helped 😉

    Now the icing of the cake:

    • can we build X11 and configure it to work with /dev/fb0?
    • can we get a graphical desktop running? Enlightenment?
    • can we cross-compile libs like libsdl2 or mesa3D to the Omega2?
    • can we get more powerhungry emulators running?
    • can we finally prove LadyAda from Adafruit wrong who said that the Omega2 can't run Doom? (https://www.youtube.com/watch?v=2QdU2wXnwGE (5:40 min)

    I'm eagerly awaiting your writeup and code on this.



  • @Maximilian-Gerhardt actually i did nothing, parts are allways on the desk. After red your kernel driver compile topic i catch a glimps that i did not copy the ".ko" files in to omega :D, i know this is laughable but i could'nt find the solution until read this topic of yours.
    simply put
    make kernel_menuconfig
    Append neccecary parts and compile,
    after the compilation process

    fb_sys_fops.ko
    fb.ko
    backlight.ko
    sysfillrect.ko
    syscopyarea.ko
    sysimgblt.ko
    fbtft.ko
    fb_ili9341.ko
    fbtft_device.ko
    

    copy these files in to omega's /root/modules/ folder.
    this part as simple as breathe but actual problem is how to fbtft_device.ko configuration.
    This is the best part, after inspecting fbtft's all the source code i decide to bruteforce 😄
    load one of the kernel module, give the error, find the neccecity file, insmod that and again and again. that's it after no error insmod fbtft_device custom init save my day.

    insmod /root/modules/fbtft_device.ko custom name="fb_ili9341" busnum=32766 cs=1 speed=96666000 mode=3 fps=100 txbuflen=3145728 buswidth=8 bgr=1 gpios=reset:2,dc:3 width=240 height=320 verbose=3 rotate=90 debug=2 
    

    I learnt that we have 96Mhz clock, i did'nt know this.(If i'm not wrong 40Mhz is in the datasheet of mt7688)


    I am learning how to write framebuffer application, i think i can write a simple framework that work like css or something similar.
    The questions:

    • can we build X11 and configure it to work with /dev/fb0?
      • after simple search i found fbgui, and littlevgl, i did not push all the way to x11 but i am researching for a while. It's possible I gues.
    • can we get a graphical desktop running? Enlightenment?
      • Yes! I will write that i hope 🙂 but not a rival of KDE 😄
    • can we cross-compile libs like libsdl2 or mesa3D to the Omega2?
      • I did not look that but when i researching fbtft i came across something mesa with openwrt
    • can we get more powerhungry emulators running?
      • I do'nt think so, i tried ffmpeg 320x240 video to bmp sequence 25fps but 12fps is the limit of omega2p's, on the other hand we probably use omega2p cluster 10 of them 😄
    • can we finally prove LadyAda from Adafruit wrong who said that the Omega2 can't run Doom?
      • I do'nt know, really. I believe that omega2 is strong enough to do more, playing doom1 exactly can, i play that 25Mhz Cpu computer in 1990's but doom 3 and after releases (if there are) ? mmm i do'nt think so for now, floating point units a must for the job.


  • @Maximilian-Gerhardt I will prepare how to for the kernel_menuconfig, right now i share fbtft and virtual console modules and init/deinit scripts

    I forgat that you are using ili9325, just compiled it, here is the module fb_ili9325.ko


    ps. after fbtft_device init virtual console does'nt work properly.
    ps2. when trying send the image files simply 1st run take the images allocation in to the buffer, and file access will be faster.
    this is my test script

    #!/usr/bin/env sh
    
    fps=$((1000000/20))
    
    if [ ! -z $1 ]; then
            fps=$((1000000/$1))
            echo $fps
    fi
    
    #img_count=1;
    #timer=0;
    start_second=$(date +"%S")
    while true
    do 
            #for i in `ls -v /root/flashdisk/sequence/*.bmp`
            #for i in `ls -v /root/msd/sequence/*.bmp`
            i=1
            while [ $i -lt 5000 ]
            do 
                    #echo $i
                    #cat $i > /dev/fb0
                    # cat /root/flashdisk/sequence/file$i.bmp > /dev/fb0
                    cat /tmp/mounts/USB-A1/sequence/file$i.bmp > /dev/fb0
                    echo /tmp/mounts/USB-A1/sequence/file$i.bmp
                    #sleep 0.001
                    #img_count=$(($img_count + 1))
                    #usleep $fps
                    #timer=$(($timer+$fps+1))
                    #echo $timer
                    #if [ $timer -gt 1000000 ]; then
                    #       echo $img_count
                    #       timer=0
                    #       exit
                    #fi
                    i=$(($i+1))
                    if [ $i -gt 400 ]; then
                            echo $start_second" -"$(date +"%S") >> refresh.log
                            # exit
                            i=1
                            start_second=$(date +"%S")
                    fi
            done
    done
    

    fbtft and virtual console modules

    scripts that include modules init/deinit orders

    -rwxr-xr-x 1 yasin yasin  316 Tem 27 19:56 display_deinit.sh
    -rwxr-xr-x 1 yasin yasin 1136 Tem 27 19:56 display_init.sh
    -rwxr-xr-x 1 yasin yasin  321 Tem 27 19:56 fbcon_deinit.sh
    -rwxr-xr-x 1 yasin yasin  334 Tem 27 19:56 fbcon_init.sh
    

    kernel modules

    -rwxr-xr-x 1 yasin yasin 11196 Tem 27 19:56 backlight.ko
    -rwxr-xr-x 1 yasin yasin  6280 Tem 27 19:56 bitblit.ko
    -rwxr-xr-x 1 yasin yasin  6684 Tem 27 19:56 fbcon_ccw.ko
    -rwxr-xr-x 1 yasin yasin  6620 Tem 27 19:56 fbcon_cw.ko
    -rwxr-xr-x 1 yasin yasin 42636 Tem 27 19:56 fbcon.ko
    -rwxr-xr-x 1 yasin yasin  3504 Tem 27 19:56 fbcon_rotate.ko
    -rwxr-xr-x 1 yasin yasin  6812 Tem 27 19:56 fbcon_ud.ko
    -rwxr-xr-x 1 yasin yasin  5688 Tem 27 19:56 fb_ili9341.ko
    -rwxr-xr-x 1 yasin yasin 69260 Tem 27 19:56 fb.ko
    -rwxr-xr-x 1 yasin yasin  3056 Tem 27 19:56 fb_sys_fops.ko
    -rwxr-xr-x 1 yasin yasin 34692 Tem 27 19:56 fbtft_device.ko
    -rwxr-xr-x 1 yasin yasin 38332 Tem 27 19:56 fbtft.ko
    -rwxr-xr-x 1 yasin yasin  9336 Tem 27 19:56 font.ko
    -rwxr-xr-x 1 yasin yasin  7420 Tem 27 19:56 lcd.ko
    -rwxr-xr-x 1 yasin yasin  2872 Tem 27 19:56 softcursor.ko
    -rwxr-xr-x 1 yasin yasin  4236 Tem 27 19:56 syscopyarea.ko
    -rwxr-xr-x 1 yasin yasin  5116 Tem 27 19:56 sysfillrect.ko
    -rwxr-xr-x 1 yasin yasin  3948 Tem 27 19:56 sysimgblt.ko
    -rwxr-xr-x 1 yasin yasin  3948 Tem 27 19:56 tileblit.ko
    


  • This post is deleted!


  • This post is deleted!


  • I'm using a ILI9341 display ("2.8 TFT SPI 240x320"). I've tried loading your modules on a newly upgraded b192 firmware but encounter missing references.

    root@Omega-C465:~/modules# ./display_init.sh
    failed to insert /root/modules/fb.ko
    failed to insert /root/modules/fbtft.ko
    failed to insert /root/modules/fb_ili9341.ko
    failed to insert /root/modules/fbtft_device.ko
    
    [  340.557995] fb: Unknown symbol fb_find_logo (err 0)
    [  340.563270] fb: Unknown symbol fb_mode_option (err 0)
    [  340.654413] fbtft: Unknown symbol unregister_framebuffer (err 0)
    [  340.660810] fbtft: Unknown symbol fb_deferred_io_init (err 0)
    [  340.666885] fbtft: Unknown symbol fb_deferred_io_cleanup (err 0)
    [  340.673171] fbtft: Unknown symbol framebuffer_alloc (err 0)
    [  340.679135] fbtft: Unknown symbol register_framebuffer (err 0)
    [  340.685397] fbtft: Unknown symbol framebuffer_release (err 0)
    [  340.704371] fb_ili9341: Unknown symbol fbtft_remove_common (err 0)
    [  340.710879] fb_ili9341: Unknown symbol fbtft_probe_common (err 0)
    [  340.738748] fbtft_device: Unknown symbol fbtft_write_gpio16_wr_latched (err 0)
    [  340.746528] fbtft_device: Unknown symbol fbtft_dbg_hex (err 0)
    

    fb_find_logo seems to from the video module (https://elixir.bootlin.com/linux/latest/ident/fb_find_logo). Did you also encounter this error? Is a kernel module file missing maybe? Or did is my current firwmare just bad?

    (PS: Sorry to spam this thread, but there's no private messaging possibility on this forum :()



  • @Maximilian-Gerhardt said in FB_ILI9341 80fps up to 100fps:

    unregister_framebuffer

    It's in not a spam and I'll gladly help for this

    I could not generate same error but it generated by fb.ko
    0_1532714362163_b070e095-9bdb-46a7-8ba2-880e05ee66c5-image.png

    Would you try to load modules in this order

    insmod /root/modules/fb_sys_fops.ko
    insmod /root/modules/fb.ko
    insmod /root/modules/backlight.ko
    insmod /root/modules/sysfillrect.ko
    insmod /root/modules/syscopyarea.ko
    insmod /root/modules/sysimgblt.ko
    insmod /root/modules/fbtft.ko
    insmod /root/modules/fb_ili9341.ko
    

    I am reverting to b192, and feed back to you.



  • @unique1984 said in FB_ILI9341 80fps up to 100fps:

    I am reverting to b192, and feed back to you.

    B192 is the already newest, the same firmware you mentioned in the first post

    I reflashed the firmware from web and from USB onto a Omega2 using http://repo.onion.io/omega2/images/ (omega2p-v0.2.0-b192.bin) https://docs.onion.io/omega2-docs/updating-the-omega.html and https://docs.onion.io/omega2-docs/Firmware-Flashing-from-USB-storage.html, I still get the same errors.

    Either my Omega2's flash is doing weird stuf (file corruption) or something else. Can anyone else test this? It obviously works from your video but I can't reproduce :(.



  • @Maximilian-Gerhardt I am getting same errors 😞 there are 2 possibilities,

    1. I mixed the my image with the stock image b192
    2. I am missing a step of mine.

    both of them are my stupidity.

    here is my custom image file, and it works(just flashed) 1st possibilty is higher, but i sure of it i was using the b192 (#!) i'll inspect this further but right now time is 22:00 here and i dont want to miss bloody moon.


    custom lede images omega2 and omega2p


    ps. in the display_init.sh file there is a line cat rgb565_0degree.bmp > /dev/fb0 you can comment that line it was there for the test purpose.



  • Yep, this works like a charm! 🙂

    [  254.231106] m25p80 spi32766.0: spi-nor spi32766.0 40000kHz 8 bits mode=0x00
    [  254.238192] spidev spi32766.1: spidev spi32766.1 40000kHz 8 bits mode=0x00
    [  254.245322] spidev spi32766.1: Deleting spi32766.1
    [  254.274384] fb_ili9341 spi32766.1: fbtft_request_gpios: 'reset' = GPIO2
    [  254.281148] fb_ili9341 spi32766.1: fbtft_request_gpios: 'dc' = GPIO3
    [  254.581036] fb_ili9341 spi32766.1: Display update: 3100 kB/s, fps=0
    [  254.587786] graphics fb0: fb_ili9341 frame buffer, 320x240, 150 KiB video memory, 3072 KiB DMA buffer memory, fps=100, spi             32766.1 at 96 MHz
    [  254.600541] fbtft_device: GPIOS used by 'fb_ili9341':
    [  254.605665] fbtft_device: 'reset' = GPIO2
    [  254.609742] fbtft_device: 'dc' = GPIO3
    [  254.613560] m25p80 spi32766.0: spi-nor spi32766.0 40000kHz 8 bits mode=0x00
    [  254.620643] fb_ili9341 spi32766.1: fb_ili9341 spi32766.1 96666kHz 8 bits mode=0x06
    

    0_1532721992252_IMG_20180727_220541.jpg

    I modified this program to work with the 16 bit framebuffer and elimate some checks

    /* fbgrad: draw gradient using framebuffer.
       run in console, X11 would overwrite everything immediatelly.
       (c) Lev, 2018, MIT licence
    */
    
    
    #include <stdint.h>
    #include <stdlib.h>
    
    typedef uint_fast16_t uint;
    
    typedef struct {
        char    *buffer;
        size_t  size,
                bytes_per_pixel, bytes_per_line,
                width, height;
        uint    red, green, blue;
    } Screen;
    
    #include <stdio.h>
    
    #include <fcntl.h>
    #include <linux/fb.h>
    #include <linux/kd.h>
    #include <sys/mman.h>
    #include <sys/ioctl.h>
    #include <unistd.h>
    #include <time.h>
    
    #define fbdev "/dev/fb0"
    #define ttydev "/dev/tty"
    
    typedef struct {
        uint_fast8_t    r, g, b, a;
    } Color;
    
    #define Die(Msg, ...) { \
        fprintf (stderr, "fbgrad: " Msg ".\n", __VA_ARGS__); \
        exit(1); \
    }\
    
    #define Assumption(Cond, Msg) \
        if (!(Cond)) { \
            fprintf (stderr, "fbgrad: failed assumption: %s\n", Msg);\
            exit(2);\
        }
    
    int main (int argc, char **argv) {
        //int ttyfd = open (ttydev, O_RDWR);
        //if (ttyfd < 0)
        //    Die ("cannot open \"%s\"", ttydev);
    
        //if (ioctl (ttyfd, KDSETMODE, KD_GRAPHICS) == -1)
        //    Die ("cannot set tty into graphics mode on \"%s\"", ttydev);
    
        int fbfd = open (fbdev, O_RDWR);
        if (fbfd < 0)
            Die ("cannot open \"%s\"", fbdev);
    
        struct fb_var_screeninfo vinf;
        struct fb_fix_screeninfo finf;
    
        if (ioctl (fbfd, FBIOGET_FSCREENINFO, &finf) == -1)
            Die ("cannot open fixed screen info for \"%s\"", fbdev);
    
        if (ioctl (fbfd, FBIOGET_VSCREENINFO, &vinf) == -1)
            Die ("cannot open variable screen info for \"%s\"", fbdev);
    
        /*Assumption ((vinf.red.offset%8) == 0 && (vinf.red.length == 8) &&
                    (vinf.green.offset%8) == 0 && (vinf.green.length == 8) &&
                    (vinf.blue.offset%8) == 0 && (vinf.blue.length == 8) &&
                    (vinf.transp.offset) == 0 && (vinf.transp.length == 0) &&
                    vinf.xoffset == 0 && vinf.yoffset == 0 &&
                    vinf.red.msb_right == 0 &&
                    vinf.green.msb_right == 0 &&
                    vinf.blue.msb_right == 0,
                    "Color masks are 8bit, byte aligned, little endian, no transparency."
        );*/
    
        Screen s = {
            .size            = finf.line_length * vinf.yres,
            .bytes_per_pixel = vinf.bits_per_pixel / 8,
            .bytes_per_line  = finf.line_length,
            .red             = vinf.red.offset/8,
            .green           = vinf.green.offset/8,
            .blue            = vinf.blue.offset/8,
            .width           = vinf.xres,
            .height          = vinf.yres
        };
    
        s.buffer = mmap (0, s.size, PROT_READ | PROT_WRITE, MAP_SHARED, fbfd, 0);
    
        if (s.buffer == MAP_FAILED)
            Die ("cannot map frame buffer \"%s\"", fbdev);
    
        int time_start = time (NULL);
    
        uint border = vinf.xres/2;
        for (uint t = 0; t < 255*1; t++) {
            for (uint y = 0; y < vinf.yres; y++) {
                for (uint x = 0; x < vinf.xres; x++) {
                    uint pix_offset = x * s.bytes_per_pixel + y * s.bytes_per_line;
                    // PIXEL FORMAT IS  RGB565, in BGR format
                    if(/*t < 255*10/2*/ x < border) {
    					s.buffer[pix_offset] = 0B00000000;
    					s.buffer[pix_offset+ 1] = 0B11111000;
                    } else {
                        s.buffer[pix_offset+ 1] = 0B00000000;
                        s.buffer[pix_offset] = 0B11111000;
                    }
    
                    //s.buffer[pix_offset + s.red] = x * 255 / s.width;
                    //s.buffer[pix_offset + s.green] = y * 255 / s.height;
                    //s.buffer[pix_offset + s.blue] = t;
                }
            }
        }
    
        int time_end = time(NULL);
    
        munmap (s.buffer, s.size);
    
        /*if (ioctl (ttyfd, KDSETMODE, KD_TEXT) == -1)
            Die ("cannot set tty into text mode on \"%s\"", ttydev);
    */
        close (fbfd);
        //close (ttyfd);
    
        printf ("FPS: %.2f.\n", 255.0 / (time_end - time_start));
    
        return EXIT_SUCCESS;
    }
    

    This access method (memory-mapped buffer, byte-wise writes) gives circa 255FPS [TIMING NOT ACCURATE, USES time() in seconds). There are probably fast access ways than this (write whole image in one go). I need to look into the DirectFB layer for that maybe.

    But this is extremely cool. /dev/fb0 works on a custom firmware image. Wondering what prevented it from running on the stock image.

    For anyone wondering what the pin connections are:

    • VCC -> 3.3V
    • GND -> GND
    • CS -> CS1 (GPIO pin 6)
    • RESET -> GPIO 2
    • DC -> GPIO 3
    • MOSI -> GPIO 8
    • SCLK -> GPIO 7
    • LED -> to 5V over 50 Ohms resistor or over 10 Ohms to 3.3V (power LED backlight, needs small current limiting)
    • MISO -> GPIO 9

    When you're back, could you tell us how you converted the BMP images (e.g. logo.bmp) to the needed 16-bit format so that they are displayed correctly? I could not get this to work directly, I can only save it in 8 or 24 bit format, and the image looks garbeled on the display.

    EDIT: Tool reports 85 FPS when using different pixel computation.

    unsigned short ConvertRGB888toRGB565(unsigned int sourceColor)
    {
    	unsigned int red = (sourceColor & 0x00FF0000) >> 16;
    	unsigned int green = (sourceColor & 0x0000FF00) >> 8;
    	unsigned int blue =  sourceColor & 0x000000FF;
    	return (red >> 3 << 11) + (green >> 2 << 5) + (blue >> 3);
    }
    
    				unsigned int targetCol = ((uint8_t)( x * 255 / s.width) << 16)
    						| ((uint8_t)(y * 255 / s.height) << 8)
    						| (uint8_t) t;
    
    				unsigned short targetColor16 = ConvertRGB888toRGB565(targetCol);
    
    				s.buffer[pix_offset] = targetColor16 & 0xff;
    				s.buffer[pix_offset + 1] = targetColor16 >> 8;
    
    


  • @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 😉


Log in to reply
 

1 out of 21

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