欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

浅析Lcd驱动基于framebuffer框架(一)

程序员文章站 2022-07-14 09:38:14
...

1.framebuffer是什么?
2.soc内部lcdc的概念,功能,对应的功能框图

1是什么

framebuffer 作为一个图像硬件的抽象,允许应用层软件通过预先定义好的接口取访问,linux下一切皆文件,framebuffer对应的设备节点 通常在 /dev/fb* 下

1.1用户角度

framebuffer(帧缓冲)同于/dev/* 下的其它设备。它是一个主设备号为29 次设备号对应 registered_fb (结构体指针数组,全局,变量,位于fbmem.c 下)的index。

(一)常见操作

cp /dev/fb0 myfile 实现拍照
dd if=/dev/fb0 of=/dev/zero bs=(块字节数)count=(块数)
个人理解:bs*count==fb缓存的长度才能实现清屏的目的
linux dd命令可参考 link

1.2 开发者角度

framebuffer 类似于/dev/mem 一个存储设备,你可以read write seek mmap
/dev/fb* 允许ioctl 获取fb的信息(可变信息,包括分辨率,位宽具体可见fb_var_screeninfo,不可改信息,fb_fix_screeninfo)

1.3video mode timing

就如我们日常接触的fbs(每秒传输帧数)
对于电子枪绘制打点的速度取决dotclock
如果知道

For a dotclock of e.g. 28.37516 MHz (millions of cycles per second),
each pixel is 35242 ps (picoseconds) long:

1/(28.37516E6 Hz) = 35.242E-9 s

If the screen resolution is 640x480, it will take

640*35.242E-9 s = 22.555E-6 s

to paint the 640 (xres) pixels on one scanline. But the horizontal
retrace also takes time (e.g. 272 `pixels’), so a full scanline takes

(640+272)*35.242E-9 s = 32.141E-6 s

We’ll say that the horizontal scanrate is about 31 kHz:

1/(32.141E-6 s) = 31.113E3 Hz

A full screen counts 480 (yres) lines, but we have to consider the
vertical retrace too (e.g. 49 `lines’). So a full screen will take

(480+49)*32.141E-6 s = 17.002E-3 s

The vertical scanrate is about 59 Hz:

1/(17.002E-3 s) = 58.815 Hz

This means the screen data is refreshed about 59 times per second
浅析Lcd驱动基于framebuffer框架(一)

如果知道dotclock以及hsync_len 和 vsync_len 即可求得fps

2 lcdc

lcdc(lcd控制器)

功能概述:LCDC是将系统需要显示的数据经过处理后输出到LCD显示驱动器的液晶显示控制模块 ,在用户初始化配置后,LCDC将自动进行读取数据、缓存数据、处理数据以及输出符合时序要求的控制和数据信号等操作

功能框图:
浅析Lcd驱动基于framebuffer框架(一)LCDDMA 负责 视频数据的搬运传送至lcd驱动器,无需cpu参与,即可显示在lcd屏上。
REGBANK 可编程控制寄存器组 配置寄存器
VIDPRCS 负责接收LCDDMA的数据转化为合适的数据格式,经由端口 VD 传送数据值lcd驱动器
TIMRGEN 可编程逻辑 多路开关来选择输出的类似于 HSYNC VSYNC的控制信号