Navigation

    全志在线开发者论坛

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

    tina 新建图层问题

    Linux
    1
    2
    1494
    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.
    • Y
      yuwei LV 6 last edited by

      按照文档的资料新建了一个图层

      #include <sys/types.h>
      #include <sys/stat.h>
      #include <fcntl.h>
      #include "sunxi_display2.h"
      #include <stdio.h>
      #include <string.h>
      #include <sys/ioctl.h>
      #include <sys/mman.h>
      #include <stdlib.h>
      
      int dispfd = 0;
      
      
      unsigned int addr[800*480] = {0xFF};
      
      
      static void disp_set_add(void){
      
              unsigned long arg[3] = {0};
              struct disp_layer_config config;
              unsigned int width = 480;
              unsigned int height = 800;
              unsigned int ret = 0;
              memset(&config, 0, sizeof(struct disp_layer_config));
      
              /*设置图层参数*/
              config.channel = 0;
              config.layer_id = 0;
              config.enable = 1;
              config.info.mode = LAYER_MODE_BUFFER;
      //      config.info.fb.addr[0] = (unsigned long long)0x48400000;
              config.info.fb.addr[0] = (unsigned long long)addr;
              config.info.fb.size[0].width = width;
              config.info.fb.size[0].height = height;
              config.info.fb.align[0] = 4;
              config.info.fb.format = DISP_FORMAT_ARGB_8888;
      
      
              /*设置crop 裁剪区域大小*/
              config.info.fb.crop.x = 0;
              config.info.fb.crop.y = 0;
              config.info.fb.crop.width = (unsigned long long)width << 32;
              config.info.fb.crop.height = (unsigned long long)height << 32;
      
      
              config.info.fb.flags = DISP_BF_NORMAL;
              config.info.fb.scan = DISP_SCAN_PROGRESSIVE;
              config.info.alpha_mode = 2;
              config.info.alpha_value = 0xFF;
              config.info.zorder = 20;
      
              /*设置窗口大小*/
              config.info.screen_win.x = 0;
              config.info.screen_win.y = 0;
              config.info.screen_win.width = width;
              config.info.screen_win.height = height;
              config.info.id = 0;
      
              arg[0] = 0; //显示器0
              arg[1] = (unsigned long)&config; //图层配置
              arg[2] = 1; //设置一个图层
      
              ret = ioctl(dispfd, DISP_LAYER_SET_CONFIG, (void*)arg);
              if(ret < 0){
                      printf("disp_set_add fail to set layer info\n");
              }
      }
      
      int main(int argc,char ** argv){
      
              dispfd = open("dev/disp",O_RDWR);
              if(dispfd < 0){
                      printf("open display device fail!!!\n");
                      return -1;
              }
              disp_set_add();
              while(1){
      //              memset(addr, 0xFF , 100);
              }
      
      }
                                                                                                                                           62,0-1        64%
      

      编译传到板子里运行发现的确增加了一个图层但是,屏幕却花屏了

      1 Reply Last reply Reply Quote Share 0
      • Y
        yuwei LV 6 last edited by

        7d037836-9569-4e9b-8b30-515b86cb00ec-image.png

        图层信息

        有大佬知道是什么原因吗?

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

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

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