我在这里找到了一些信息,特别是EGL没有使用/ dev / fb *层https://www.raspberrypi.org/forums/viewtopic.php?t=58952
但是,我想知道是否有一种方法可以交换/ dev / fb0和/ dev / fb1,或者完全摆脱/ dev / fb0?
/ dev / fb0是hdmi输出,/ dev / fb1是SPI显示
我不需要hdmi显示器,如果有一种方法可以永久禁用它,那么SPI显示器将成为主要的fb0显示器,那将是可行的。
我有以下代码mmap
用于帧缓冲区,但是它们具有不同的颜色深度,所以我无法对其进行记忆,并且逐像素复制非常缓慢
有没有更好的方法可以做到这一点?
谢谢
uint16_t *fbp0;
uint16_t *fbp1;
DISPMANX_DISPLAY_HANDLE_T display;
DISPMANX_RESOURCE_HANDLE_T resourceHandle;
VC_RECT_T rect;
struct fb_fix_screeninfo finfo;
uint32_t pixels;
const char *device = "/dev/fb1";
int fbfd = open(device, O_RDWR);
if (fbfd == -1) {printf("cannot open framebuffer device");return;}
if (ioctl(fbfd, FBIOGET_FSCREENINFO, &finfo) == -1) {printf("cannot get framebuffer fixed information");return;}
struct fb_var_screeninfo vinfo;
if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo) == -1) {printf("cannot get framebuffer variable information");return;}
if((vinfo.xres * 2) != finfo.line_length) {printf("assumption failed ... framebuffer lines are padded");return;}
if ((vinfo.xres % 16) != 0) {printf("framebuffer width must be a multiple of 16");return;}
if (vinfo.bits_per_pixel != 16){printf("framebuffer is not 16 bits per pixel");return;}
fbp1 = (uint16_t*)mmap(0,finfo.smem_len,PROT_READ | PROT_WRITE,MAP_SHARED,fbfd,0);
if (fbp1 == MAP_FAILED){printf("cannot map framebuffer into memory");return;}
memset(fbp1, 0, finfo.smem_len);vc_dispmanx_resource_create(VC_IMAGE_RGB565,vinfo.xres,vinfo.yres, &image_ptr);
device = "/dev/fb0";
fbfd = open(device, O_RDWR);
if (fbfd == -1) {printf("cannot open framebuffer device"); return;}
if (ioctl(fbfd, FBIOGET_FSCREENINFO, &finfo) == -1) {printf("cannot get framebuffer fixed information"); return;}
if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo) == -1) {printf("cannot get framebuffer variable information"); return;}
if ((vinfo.xres % 16) != 0) {printf("framebuffer width must be a multiple of 16"); return;}
fbp0 = (uint16_t*)mmap(0, finfo.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fbfd, 0);
if (fbp0 == MAP_FAILED){printf("cannot map framebuffer into memory"); return;}
memset(fbp0, 0, finfo.smem_len);
答案 0 :(得分:0)
我发现了另一个我注意到使用fbcp(帧缓冲区副本)的驱动程序。 https://github.com/juj/fbcp-ili9341
它可以在60hz的分辨率下将HDMI帧缓冲区复制到SPI显示器上,效果很好,不需要安装原始的SPI river,并且最好在用户空间中运行
仍然不是我正在寻找的解决方案,但是对于任何需要此信息的人,请尝试上面的驱动程序