Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    T113奇怪的屏幕刷新问题

    其它全志芯片讨论区
    7
    12
    4783
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      efancier LV 6 last edited by

      发现T113一个奇怪的屏幕刷新问题,LCD使用的RGB接口,7寸屏,800x480分辨率,lvgl8 官方 framebuffer的例子,

      发现动图的有横向刷新不全,SDK 使用的是 buildroot
      https://bbs.aw-ol.com/topic/1290/芒果派-麻雀-dual-t113使用buildroot一键构建

      排查问题的过程中发现如果使用Tina的SDK,就没有这个问题,然而 Tina的内核版本跟Buildroot的版本是一样的,都是5.4.61,这样排除硬件问题,那么什么地方的不一样会导致这个问题呢?内核配置,设备树,还是常驻内存的其它应用导致的?哪位碰到过类似的问题可以指导一下的

      P YuzukiTsuru 2 Replies Last reply Reply Quote Share 0
      • P
        peter_yyp LV 2 @efancier last edited by

        @efancier

        和我在调试遇到的问题类似,跑R-G-B的时候切换的中间有花屏......

        A 1 Reply Last reply Reply Quote Share 0
        • A
          anruliu LV 6 @peter_yyp last edited by

          @peter_yyp 看起是fb0有开cache,但是写完一帧数据后,没有刷cache导致的,检查内核申请fb时看看是不是带了cache标志

          P 1 Reply Last reply Reply Quote Share 0
          • P
            peter_yyp LV 2 @anruliu last edited by

            @anruliu 以下是代码,请帮忙看一下,感谢大佬

            #include "stdio.h"
            #include "stdint.h"
            #include "string.h"
            #include <sys/mman.h>
            #include <sys/ioctl.h>
            #include <fcntl.h>
            #include "fbio.h"
            #include "linux/fb.h"
            #include <unistd.h>
            #include <sys/time.h>
            #include "stdio.h"
            
            #define FBDEV_PATH  "/dev/fb0"
            
            int fbfd = 0;
            struct fb_var_screeninfo vinfo;
            
            uint8_t * fbdev_init() {
              uint8_t * fbp = 0;
              struct fb_fix_screeninfo finfo;
              uint32_t screensize = 0;
            
              fbfd = open(FBDEV_PATH, O_RDWR);
              
              if(fbfd == -1) {
                perror("Error: cannot open framebuffer device");
                return fbp;
              }
            
              printf("The framebuffer device was opened successfully.\n");
            
              struct fbtype fb;
              unsigned line_length;
            
            
              // Get fixed screen information
              if (ioctl(fbfd, FBIOGET_FSCREENINFO, &finfo) == -1) {
                perror("Error reading fixed information");
                return fbp;
              }
            
              // Get variable screen information
              if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo) == -1) {
                perror("Error reading variable information");
                return fbp;
              }
            
              // Figure out the size of the screen in bytes
              screensize =  finfo.smem_len; //finfo.line_length * vinfo.yres;    
            
              // Map the device to memory
              fbp = (char *)mmap(0, screensize, PROT_READ | PROT_WRITE, MAP_SHARED, fbfd, 0);
            
              printf("%dx%d, %dbpp, size: %d; ptr: %08X\n", vinfo.xres, vinfo.yres, vinfo.bits_per_pixel, screensize, fbp);
              
              if ((intptr_t)fbp == -1) {
                perror("Error: failed to map framebuffer device to memory");
                return fbp;
              }
              
              memset(fbp, 0x00, screensize);
             
              return fbp;
            }
            
            void fb_try_pan(uint32_t offset) {
              vinfo.xoffset = 0;
              vinfo.yoffset = offset;
              vinfo.activate = FB_ACTIVATE_VBL;
            
              int res = ioctl(fbfd, FBIOPAN_DISPLAY, &vinfo);
            
              if (res==-1) {
                printf("fb_try_pan res: %d\n", res);
                perror("fb_try_pan res:");
              }
            }
            
            int cur_fb=0;
            
            void fill_fb(uint32_t * fb, uint32_t pattern) {
              struct timeval tv;
              uint32_t fb_num=1;
            
              if (cur_fb==1) {  // Draw on inactive buf
                fb_num=0;
              }
            
              gettimeofday(&tv,NULL);
              long st = 1000000 * tv.tv_sec + tv.tv_usec;
            
              printf("Draw on buf %d. Current buf: %d\n", fb_num, cur_fb);
              
              for (uint32_t i=0; i<1024*600; i++) {
                fb[i+fb_num*1024*600]=pattern;
              }
            
              if (cur_fb==1) {  // Draw on inactive buf
                printf("Activate buf 0\n");
                fb_try_pan(600);
                fb_try_pan(0);
                cur_fb=0;
              }
                else
              {
                printf("Activate buf 1\n");
                fb_try_pan(0);
                fb_try_pan(600);
                cur_fb=1;
              } 
            
              gettimeofday(&tv,NULL);
              long end = 1000000 * tv.tv_sec + tv.tv_usec;
              long t=end-st;
            
              printf("time: %d, fps: %d\n", t, 1000000/t);
            
              usleep(1000000);
            }
            
            int main(void) {
              uint32_t * fb;
              printf("Hello my T133 board\n");
            
              fb=(uint32_t *)fbdev_init();
            
              if (fb==NULL) {
                return 0;
              }
            
              fb_try_pan(0);
             
              while (1) {
                printf("RED!!!\n");
                fill_fb(fb, 0x01FF0000);
                printf("GREEN!!!\n");
                fill_fb(fb, 0x0100FF00);
                printf("BLUE!!!\n");
                fill_fb(fb, 0x010000FF);
                printf("BLACK!!!\n");
                fill_fb(fb, 0x01000000);
                printf("WHITE!!!\n");
                fill_fb(fb, 0x01FFFFFF);
              }
            #endif
            }
             
            
            A 1 Reply Last reply Reply Quote Share 0
            • A
              anruliu LV 6 @peter_yyp last edited by

              @peter_yyp 不是上层应用,是内核代码dev_disp.c,dev_fb.c

              1 Reply Last reply Reply Quote Share 0
              • E
                EastSoft LV 2 last edited by

                遇到了一样的问题,T113的longan sdk,使用qt ,也是按下一个按键或者界面切换时候,出现一些条纹,然后条纹两秒内显示。跟上面lvgl界面一样的效果.

                1 Reply Last reply Reply Quote Share 0
                • E
                  Evlers LV 6 last edited by

                  • 我将tin跟buildroot两个SDK内核文件取出进行对比:drivers/video/fbdev/sunxi/disp2/disp/dev_disp.c
                  • 对比后发现buildroot中的__disp_ion_alloc_coherent函数使用ION_FLAG_CACHED标志进行内存分配
                    7c8c71fa-6c30-404b-9ad9-c28b5c5c80a2-image.png
                  • 使用cache的情况下,数据写入到fb中会出现不及时的现象,关闭此标志就没这个问题了。
                  1 Reply Last reply Reply Quote Share 0
                  • YuzukiTsuru
                    柚木 鉉 LV 9 @efancier last edited by YuzukiTsuru

                    @efancier buildroot更新了,修复了i2c,de,uart等一堆问题,source envsetup.sh 更新然后重新make xxxx_defconfig就行了

                    E E A 3 Replies Last reply Reply Quote Share 1
                    • E
                      Evlers LV 6 @YuzukiTsuru last edited by

                      @yuzukitsuru 幸苦😊

                      1 Reply Last reply Reply Quote Share 0
                      • E
                        efancier LV 6 @YuzukiTsuru last edited by

                        @yuzukitsuru ,辛苦了,谢谢!

                        1 Reply Last reply Reply Quote Share 0
                        • A
                          a892755772 LV 5 @YuzukiTsuru last edited by

                          @yuzukitsuru 最新版本的 t113-s3 480X272显示还是有问题 需要改什么地方吗

                          YuzukiTsuru 1 Reply Last reply Reply Quote Share 0
                          • YuzukiTsuru
                            柚木 鉉 LV 9 @a892755772 last edited by

                            @a892755772 更新Buildroot-YuzukiSBC,运行sync_update 命令

                            1 Reply Last reply Reply Quote Share 0
                            • 1 / 1
                            • First post
                              Last post

                            Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

                            行为准则 | 用户协议 | 隐私权政策