顯示
Display(顯示)群組包含顯示相關設定,例如介面、尺寸及緩衝處理策略。
介面與尺寸
目前有多種顯示介面可搭配使用STM32微控制器,例如:
- 平行RGB (LTDC)
- MIPI DSI
- FMC
- SPI
如果MCU帶有連接到LTDC或FMC的顯示器,TouchGFX Generator可產生程式碼,將影像緩衝區傳輸到連接的顯示器。 而對於DSI和SPI介面來說,驅動程式必須由開發人員自行實作。
Further reading
影像緩衝區像素格式
TouchGFX Generator目前支援以下影像緩衝區像素格式。 使用「客製」顯示介面時,所有選項均可用,否則選項將限制為顯示控制器設定(例如將LTDC影像緩衝區格式設定為「RGB565」,會在TouchGFX Generator將選項限制為「RGB565」)。
- BW (1bpp)
- Grey2 (2bpp)
- Grey4 (4bpp)
- ABRG2222 (8bpp)
- ARGB2222 (8bpp)
- BGRA2222 (8bpp)
- RGBA2222 (8bpp)
- RGB565 (16bpp)
- RGB888 (24bpp)
- ARGB8888 (32bpp)
- XRGB8888 (32bpp)
Note
影像緩衝區跨距
對於部分擁有較大影像緩衝區跨距的顯示介面(如MIPI-DSI),且其跨距大於顯示的實際寬度,若大型跨距與資料封包大小更相符,則可提高到顯示的資料傳輸率。 使用較大的影像緩衝區跨距可設定如下:
- 否 - 影像緩衝區跨距和顯示寬度的大小相同。
- 是 - 允許使用者指定影像緩衝區跨距長度。
緩衝處理策略及位置
下列影像緩衝區策略可透過TouchGFX Generator設定:
- Single Buffer (單一緩衝區):僅使用一個應用程式影像緩衝區。 效能可能會受限,但記憶體用量較少。 可搭配使用「Buffer Location」(緩衝區位置)設定,以將其置於內部RAM之中。 若需更進一步的最佳化,使用者可以定義一個函數來回傳顯示控制器當前正在處理的行。 架構可使用此方法,對在此畫面期間已傳輸至顯示的記憶體進行更新。
- Double Buffer (雙緩衝區):使用兩個影像緩衝區。 通常可提升效能,但記憶體用量更大。
- Partial Buffer - GRAM display - Use one or more user defined chunks of memory as the frame buffer, which are transferred to the GRAM on the display. 此策略適用於不依賴外部RAM,但顯示的完整影像緩衝區可能超過可用記憶體的低成本解決方案。
- Partial Buffer - LTDC driven display - Use a single block of memory that a power-of-2 fraction of the display size, e.g., 1/2, 1/4 or 1/8. This strategy is targeted platforms that do not have external RAM and/or large display resolutions. A LTDC driven display and GFXMMU is required for this strategy.
In the case of Single Buffer, Double Buffer, and Partial Buffer - LTDC driven display users are allowed to configure their location through the "Buffer Location" configuration which offers the following options:
- By Allocation (依分配):允許連結器根據連結器指令碼來放置影像緩衝區記憶體。 預設為內部RAM。
- By Address (依位址):允許使用者定義一個(單)或兩個(雙)影像緩衝區位址。
The Partial Buffer - GRAM display strategy allows the user to define the following parameters:
- 區塊數量(始終放置在內部RAM中)
- 區塊大小(位元組數)
The Partial Buffer - LTDC driven display strategy allows the user to define the following parameter:
- Number of Partial Blocks (default is 4, meaning a framebuffer block 1/4 the size of the display)
To understand some core concepts regarding framebuffer strategies, refer to the Framebuffer Strategies article.
Several scenarios describe how to get started with different display interfaces and framebuffer strategies with concrete examples: