显示驱动
像素点
Rgb 三原色组成每个像素点,而分辨率就是像素点的个数,而argb则是增加了透明通道,
时间参数和时序
- vsync:垂直同步信号,该信号的产生表示一帧新的信号产生
- 会产生一个开始信号,持续时间vspw
- vsync完成后需要持续一段时间,vbp
- vbp信号结束以后就是要显示的行数,显示完所有的行
- 显示完所有的行以后会有一段vfp延时
- hsync:水平同步信号,该信号的产生表示一行新的数据开始显示
- 会产生一个开始信号,维持时间被叫做hspw
- hsync信号完成后需要一段时间延时,这段时间叫hbp
- 接着就是一行像素显示
- 一行像素显示完成以后到hsync下一行信号的产生之间的延时叫做hfp
- 真正显示一行所需的时间就是hspw+hbp+width+hfp
所以视频视频显示的逻辑是先发vspw开始信号->一段vbp延时(稳定需要?)-> n*(hspw行开始信号->hb屏信号->行像素显示信号->hfp作为到下一行开始信号的延时)->vfp作为到下一帧的信号延时。然后这些信号发送给ser 再通过des解码给屏幕
lp display
1 | "vidoeTiming":{ |
TODO:显存学习
serdes
串行器连接在外设中,将并行信号转换为串行信号,解串器将串行信号再解析为并行信号
个人理解
串行解串器的控制是同一个芯片控制还是串行器一个芯片,解串一个芯片,两个分别作为iic的子设备进行控制,主要有几个场景,比如:
- cpu需要将画面显示到屏幕,就把数据发到串行器上,通过解串器输出到屏幕上(我们json中的应该是cpu-serdes-scr链路??
- 摄像头等画面直接通过serdes把画面输出到屏幕上,所以json里面有很多des??
并行数据到串行数据的转换
时钟数据恢复:将并行的像素数据流与时钟信号合并,并用一种叫做 时钟-数据恢复(CDR) 的机制生成同步的时钟信号,用于后续的串行数据传输。
编码:将并行的数据进行编码转换。通常,为了提高信号的传输效率和抗干扰能力,会使用像 8b/10b 编码 或 10b/12b 编码 等方法。
- 8b/10b 编码:这是一种常见的编码方案,能够将每 8 位数据转换为 10 位符号,增加冗余位以减少误码率。
- 10b/12b 编码:这是一种用于高带宽数据传输的编码技术,将 10 位数据映射为 12 位编码,进一步提高信号的可靠性。
串行化:将并行的数据进行串行化,TI 935 会把多个并行数据通道(例如 8 位、10 位或 12 位并行数据)按特定的时序顺序串联成一个单一的 串行数据流。这个串行数据流会通过 高速差分信号对(如 FPD-Link 3 协议中的差分对) 进行传输。具体地,TI 935 使用 FPD-Link 3 协议 中的高速串行链路来将这些并行数据转化为串行数据。FPD-Link 3 协议支持非常高的传输速率,能够有效传输 4.5 Gbps 或更高的速率。
数据打包与封装:将编码后的串行数据通过一对或多对 差分信号对 传输到接收端(通常是解串器 TI 960)。FPD-Link 3 使用的差分信号对(如 LVDS 信号对)能够提供高速、低功耗的长距离传输,支持最大 15 米的传输距离(具体距离取决于数据速率和电缆质量)。
时钟恢复与同步:不仅要将数据串行化,还需要通过 时钟数据恢复(CDR) 技术来保持数据和时钟的同步。这是因为,在串行化数据时,时钟信号被嵌入到数据流中,并通过差分信号传输。在接收端(解串器 TI 960)会从串行信号中恢复出时钟信号,并重新同步数据流。
传输协议
DSI
mipi dsi controller
The APB-to-Generic block bridges the APB operations into FIFOs holding the Generic commands. The block interfaces with the following FIFO: Command FIFO, Write payload FIFO, Read payload FIFO.
上面的架构无非就是体现两件事:
- dsi命令通过apb interface发出
- 视频数据通过dpi interface发出
Generic interface packets are always transported using one of the DSI transmission modes; Video mode or Command mode. If neither of these mode are selected, the packets are not transmitted through the link and the released FIFOs eventually get overflowed.
通用接口数据包总是使用DSI传输模式之一进行传输;视频模式或命令模式。如果不选择这两种模式,则数据包不会通过链路传输,并且释放的fifo最终会溢出。
dpi interface
The DPI interface follows the MIPI DPI specification with pixel data bus width up to 24 bits. It is used to transmit the information in Video mode in which the transfers from the host processor to the peripheral take the form of a real-time pixel stream. This interface allows sending ShutDown (SD) and ColorMode (CM) commands, which are triggered directly by writing to the register of VO_CON[9:8] in the GRF Module. To transfer additional commands(for example, to initialize the display), use another interface such as APB Slave Generic Interface to complement the DPI interface.
The DPI interface can be configured to increase flexibility and promote correct usage of this interface for several systems. These configuration options are as follows:Polarity control: All the control signals are programmable to change the polarity depending on system requirements.
==After the MIPI DSI HOST Controller reset, DPI waits for the first VSYNC active transition to start signal sampling, including pixel data, and preventing image transmission in the middle of a frame.==
If interface pixel color coding is 18 bits and the 18-bit loosely packed stream is disabled, the number of lines programmed in the pixels per lines configuration is a multiple of four. This means that in this mode, the two LSBs in the configuration are always inferred as zero. The specification states that in this mode, the pixel line size should be a multiple of four.
DPl接口遵循MIPI DPI规范,像素数据总线宽度高达24位。它用于以视频方式传输信息,其中从主机处理器到外设的传输采用实时像素流的形式。该接口允许发送ShutDown (SD)和ColorMode (CM)命令,这些命令通过写入GRF模块中的VO_CON[9:8]寄存器直接触发。要传输额外的命令(例如,初始化显示),可以使用其他接口(如APB Slave Generic interface)来补充DPI接口。可以配置DPI接口以增加灵活性,并促进多个系统正确使用该接口。极性控制:所有的控制信号都是可编程的,可以根据系统设备改变极性。在MIPI DSI主机控制器复位后,DPI等待第一个VSYNC主动转换到一个帧。
==如果接口像素颜色编码为18位,并且禁用了18位松散打包流,则在每行像素配置中编程的行数是4的倍数。这意味着在这种模式下,配置中的两个lsb总是被推断为零。规格规定,在此模式下,像素线尺寸应为4的倍数。==
DPI 功能说明
“The DPI interface follows the MIPI DPI specification with pixel data bus width up to 24 bits.
It is used to transmit the information in Video mode in which the transfers from the host processor to the peripheral take the form of a real-time pixel stream. This interface allows sending ShutDown (SD) and ColorMode (CM) commands, which are triggered directly by writing to the register of VO_CON[9:8] in the GRF Module. To transfer additional commands(for example, to initialize the display), use another interface such as APB Slave Generic Interface to complement the DPI interface.”
总结:
- DPI 遵循 MIPI DPI 规范,总线宽度可达 24bit。
- 主要用于 Video Mode 下的实时像素流传输。
- 支持少量命令(SD/CM),通过 GRF VO_CON[9:8] 触发。
- 初始化或更多命令需通过 APB Slave Generic Interface。
原文引用 2:DPI 信号与像素编码
“The DPI interface captures the data and control signals and conveys them to the FIFO interfaces that transmit them to the DSI link. Two different streams of data are presented at the interface; video control signals and pixel data. Depending on the interface color coding, the pixel data is disposed differently throughout the dpipixdata bus. The following table shows the Interface pixel color coding.”
总结:
- DPI 捕获两类信号:视频控制信号 和 像素数据。
- 像素数据在总线上的排列取决于 Interface Pixel Color Coding 配置。
- 文档提供了 16/18/24bit 不同配置下的 R/G/B 位映射表。
原文引用 3:18-bit loosely packed 限制
“If interface pixel color coding is 18 bits and the 18-bit loosely packed stream is disabled, the number of lines programmed in the pixels per lines configuration is a multiple of four. This means that in this mode, the two LSBs in the configuration are always inferred as zero.”
总结:
- 当 18-bit loosely packed 禁用时:
- “pixels per line” 必须是 4 的倍数。
- 配置中的 两位最低有效位被自动置为 0。
- 目的是保证像素数据对齐,避免总线或 PHY 传输错误。
原文引用 4:DPI 配置选项
“These configuration options are as follows: Polarity control: All the control signals are programmable to change the polarity depending on system requirements. After the MIPI DSI HOST Controller reset, DPI waits for the first VSYNC active transition to start signal sampling, including pixel data, and preventing image transmission in the middle of a frame.”
总结:
- Polarity control:控制信号极性可编程。
- VSYNC 对齐:DPI 等待第一个 VSYNC 激活信号再开始采样像素,避免中途传输导致画面错位。
💡 整体理解:
- DPI 接口主要处理 Video Mode 的像素传输 + 少量 SD/CM 命令。
- 初始化或其他控制命令需要 通过 APB Generic Interface。
- 像素数据编码和行数必须遵循规范,保证数据总线和 PHY 传输正确。
- 控制信号极性可调,VSYNC 保证帧同步。
APB Slave Generic Interface
The MIPI DSI HOST Controller supports the transmission or write and read command mode packets as described in the DSI specification. These packets are built using the APB register access. The GEN_PLD_DATA register has two distinct functions based on the operation. Writing to this register sends the data as payload when sending a Command mode packet. Reading this register returns the payload of a read back operation. The GEN_HDR register contains the Command mode packet header type and header data. Writing to this register triggers the transmission of the packet implying that for a long Command mode packet, the packet’s payload needs to be written in advance in the GEN_PLD_DATA register.
APB Slave Interface 与 Command Mode
The APB Slave interface allows the transmission of generic information in Command mode, and follows the proprietary register interface. Commands sent through this interface are not constrained to comply with the DCS specification, and can include generic commands described in the DSI specification as manufacturer-specific.
- APB Slave 接口:用于通过寄存器访问发送 Generic packet(通用命令)或 DCS 命令。
- Command Mode:通过这个接口发送的数据是按需发送,不是持续的视频流。
- Generic Packet:不必符合 DCS 标准,可以是厂商自定义的命令。
- 用途:用来发送控制屏幕的命令,比如初始化、参数设置或者写内存。
2️⃣ GEN_HDR 与 GEN_PLD_DATA
The GEN_PLD_DATA register has two distinct functions based on the operation. Writing to this register sends the data as payload when sending a Command mode packet. Reading this register returns the payload of a read back operation. The GEN_HDR register contains the Command mode packet header type and header data. Writing to this register triggers the transmission of the packet implying that for a long Command mode packet, the packet’s payload needs to be written in advance in the GEN_PLD_DATA register.
- GEN_PLD_DATA(Payload Data)
- 写入:作为 Command Mode 包的 payload
- 读取:返回读回操作的 payload
- GEN_HDR(Header)
- 写入 header 会触发命令包发送
- 对于 长命令包(Long Packet):payload 必须先写入 GEN_PLD_DATA,然后再写 header 发出包
总结:
- 写 payload → 写 header → 控制器开始发送
- FIFO 机制:payload FIFO + command FIFO
3️⃣ 支持的包类型
文档列出了很多可通过 Generic Interface 发送的包,包括:
- Generic Write Short / Long Packet(0-2 参数)
- DCS Write Short / Long Packet
- Read Packet 配置
理解:
- Short Packet 用于简单命令(如设置寄存器)
- Long Packet 用于数据量大的命令(如写显存、Write Memory Start / Continue)
4️⃣ Transmission Mode 的关系
Generic interface packets are always transported using one of the DSI transmission modes; Video mode or Command mode. If neither of these mode are selected, the packets are not transmitted through the link and the released FIFOs eventually get overflowed.
- 任何 Generic 包都必须通过 DSI 传输模式发送
- Video Mode / Command Mode 都可以发送 Generic 包
- 如果都没选:FIFO 写入的数据不会被发送 → FIFO 最终溢出
结论:MODE_CFG 决定控制器整体传输方式,但命令包本身不需要每条切换模式。
5️⃣ APB 接口速率限制
The transfer of packets through the APB bus is based on the following conditions:
The APB protocol defines that the write and read procedure takes two clock cycles each to be executed. This means that the maximum input data rate through the APB interfaces is always half the speed of the APB clock.
- APB 写/读需要 2 个时钟周期 → 最大输入速率 = APB 时钟的一半
- 总线宽度:32 bit → payload 数据以 32bit 总线写入
The DSI link bit rate when using solely APB is equal to (APB clock frequency) *16 Mbps.
- 如果只通过 APB 发送命令包,DSI link 速率 = APB 时钟 * 16 Mbps
- 带宽与 APB 时钟频率成正比
6️⃣ 高带宽命令模式
To drive the APB interface to achieve high bandwidth Command mode traffic transported by the DSI link, the MIPI DSI HOST Controller should operate in the Command mode only and the APB interface should be the only data source that is currently in use.
- 如果要让 Command Mode 最大化带宽:
- 控制器保持 Command Mode(不输出视频)
- APB 接口是唯一数据源
- 这样 APB 拥有整个 DSI link 带宽,不与 Video Mode 或其他输入共享
7️⃣ 写内存命令(Memory Write Commands)
The memory write commands require maximum throughput from the APB interface, because they contain the most amount of data conveyed by the DSI link. While writing the packet information, first write the payload of a given packet into the payload FIFO using the GEN_PLD_DATA register. When the payload data is for the command parameters, place the first byte to be transmitted in the least significant byte position of the APB data bus. After writing the payload, write the packet header into the command FIFO.
- Memory Write Commands(长数据命令):payload 很大,需要 APB 最大带宽
- 写包顺序:
- 先写 payload 到 GEN_PLD_DATA FIFO
- 再写 header 到 GEN_HDR → 触发发送
- 字节顺序:第一个要发的字节写在 APB 总线 LSB
The DCS long packets are encapsulated in a DSI packet. The DSI included in the diagrams.In the follow figures, the Write Memory Command can be replaced by the DCS command Write Memory Start and Write Memory Continue.
- DCS 长包会被封装成 DSI 包
- Write Memory Start / Continue 是典型长包命令,用于写显存 / Framebuffer
✅ 总结核心要点
- APB Interface
- 用于 Command Mode / Generic Packet
- 写 GEN_PLD_DATA → 写 GEN_HDR → 发送
- 支持短包 / 长包 / DCS / Generic
- 模式选择(MODE_CFG)
- Video Mode:连续像素流 + 少量包
- Command Mode:仅发送命令包,带宽最大
- 高带宽 Command Mode
- 控制器保持 Command Mode
- APB 接口独占 → 最大化发送速率
- 内存写 / 长包命令
- payload FIFO 先写数据
- header 写入触发发送
- 注意字节顺序(LSB → 总线)
Transmission of Commands in Video Mode
垂直方向(帧级)
在一帧里,垂直方向的时序顺序是:
1 | VSS(Vertical Sync Start / VSA开始) |
- VSS:帧开始标记,协议短包
- VSA:VSYNC脉冲持续的行数。 – vspw
- VBP:VSYNC结束到有效显示区域开始的空闲行数
- Active Lines:真正显示内容的行
- VFP:有效显示行结束到下一帧 VSS 的空闲行数
水平方向(行级)
每一行的水平时序是:
1 | HSS(Horizontal Sync Start / HSA开始) |
- HSS:行开始短包
- HSA:水平同步脉冲对应的时间段 – hspw
- HBP:脉冲结束到有效像素开始的延时
- Active Pixels:真正显示的像素
- HFP:有效像素结束到下一行 HSS 的间隔