Linux应用程序开发基础知识-Framebuffer

本文介绍了Linux系统中使用Framebuffer进行应用程序开发的基础知识。Framebuffer作为内存中保存图像帧的区域,其大小取决于LCD的分辨率和颜色位数。LCD的操作原理包括驱动程序设置LCD控制器、APP通过ioctl获取分辨率和BPP,以及通过mmap映射并写入Framebuffer数据。
摘要由CSDN通过智能技术生成

        在 Linux 系统中通过 Framebuffer 驱动程序来控制 LCD。 Frame 是帧的意思, buffer 是缓冲的意思,这意味着 Framebuffer 就是一块内存,里面保存着一帧图像。 Framebuffer 中保存着一帧图像的每一个像素颜色值,假设 LCD 的分辨率是 1024x768,每一个像素的颜色用 32 位来表示,那么 Framebuffer 的大小就是:1024x768x32/8=3145728 字节。
 LCD 的操作原理:
① 驱动程序设置好 LCD 控制器:
根据 LCD 的参数设置 LCD 控制器的时序、信号极性;
根据 LCD 分辨率、 BPP 分配 Framebuffer。
② APP 使用 ioctl 获得 LCD 分辨率、 BPP
③ APP 通过 mmap 映射 Framebuffer,在 Framebuffer 中写入数据
 

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <stdio.h>
#include <string.h>
#include <linux/fb.h>
#include <unistd.h>

unsigned int fd_fb;
unsigned int line_width, pixel_width, sc
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值