有没有办法将 EGL 绘制到 /dev/fb1 而不是 /dev/fb0,而无需在树莓派上复制数据
Is there any way to draw EGL to /dev/fb1 instead of /dev/fb0 without copying data on a Raspberry Pi?
我在这里找到了一些信息,特别是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);
我发现了另一个我注意到使用fbcp(帧缓冲复制)的驱动程序。https://github.com/juj/fbcp-ili9341
它将HDMI帧缓冲复制到60hz的SPI显示器上,并且不需要安装原始的SPI河,最重要的是它在用户空间中运行
仍然不是我正在寻找的解决方案,但对于任何寻找此信息的人,请尝试上面的驱动程序
相关文章:
- C++17复制构造函数,在std::unordereded_map上进行深度复制
- 在C++程序中输入的文本文件将不起作用,除非文本被复制和粘贴
- 使用strcpy将char数组的元素复制到另一个数组
- 是否可以初始化不可复制类型的成员变量(或基类)
- 为什么在C++中使用私有复制构造函数与删除复制构造函数
- C++ Windows 驱动程序MSB3030无法复制该文件,因为它找不到
- 复制列表初始化的隐式转换的等级是多少
- 当从函数参数中的临时值调用复制构造函数时
- 有可能在Armadillo中复制MATLAB circshift方法吗
- 复制几乎为空的数组的最快方法
- 以下示例中如何避免代码复制?C++/库达
- 如果有一个模板构造函数只有一个泛型参数,为什么我必须有一个复制构造函数
- 为什么需要复制构造函数,在哪些情况下它们非常有用
- 不能将复制初始化与隐式转换的多个步骤一起使用
- 当有分配器意识的容器被复制/移动时,反弹分配器是否被复制/移走
- 为什么复制而不是移动数据元素?
- 文件系统:复制功能的速度秘诀是什么
- 使用仅使用一次的变量调用的复制构造函数.这可能是通过调用move构造函数进行编译器优化的情况吗
- 为什么类中的ostringstream类型的成员会导致";调用隐含删除复制构造函数";错误
- 有没有办法将 EGL 绘制到 /dev/fb1 而不是 /dev/fb0,而无需在树莓派上复制数据