feat(lcd_cam): add DPI bounce buffer support for PSRAM-backed RGB displays#5262
feat(lcd_cam): add DPI bounce buffer support for PSRAM-backed RGB displays#5262fmauNeko wants to merge 7 commits intoesp-rs:mainfrom
Conversation
cc0395f to
5a22130
Compare
There was a problem hiding this comment.
Pull request overview
Adds continuous DPI (RGB parallel) streaming support for PSRAM-backed framebuffers by introducing a GDMA “bounce buffer” pipeline, and fixes a DPI register configuration issue that could stop pixel output after a limited number of cycles.
Changes:
- Fix DPI configuration by setting
lcd_always_out_enfor continuous output. - Add
DmaBounceBuffer+Dpi::send_bounce_buffered()/DpiBounceTransferfor SRAM bounce-buffered streaming from PSRAM. - Add a new
qa-testexample for PandaTouch demonstrating bounce-buffered DPI + double buffering, and document changes in the changelog.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
qa-test/src/bin/lcd_dpi_bounce.rs |
New example demonstrating PSRAM framebuffer + bounce-buffered DPI transfer and buffer swapping on ESP32-S3. |
esp-hal/src/lcd_cam/lcd/dpi.rs |
Implements bounce-buffer infrastructure and transfer type; fixes DPI lcd_always_out_en configuration. |
esp-hal/CHANGELOG.md |
Adds changelog entries for the new bounce-buffer feature and the DPI fix. |
525da3e to
8c4e9e3
Compare
8c4e9e3 to
ae73526
Compare
I should have read this first. If this PR is AI-generated, invest the time to review your work before you submit it. |
…plays Fix lcd_always_out_en not being set in the DPI driver's apply_config(), which caused the LCD_CAM peripheral to stop outputting pixel data after lcd_dout_cyclelen cycles instead of streaming continuously from DMA. Add DmaBounceBuffer and Dpi::send_bounce_buffered() to enable driving large (800x480+) RGB displays with framebuffers in PSRAM, matching the bounce buffer architecture used by ESP-IDF's esp_lcd_panel_rgb.c. Architecture: - Two SRAM bounce buffers with a circular 2-descriptor DMA chain - DpiBounceTransfer::poll() checks for GDMA EOF events and copies the next framebuffer chunk into the completed bounce buffer - Double-buffered rendering via set_back_buffer() / back_buffer() / swap_buffers() for tear-free frame transitions Add lcd_dpi_bounce qa-test example demonstrating the full pipeline on the PandaTouch board (ESP32-S3, 800x480 RGB565, 23MHz, Octal PSRAM).
Review fixes: - Update send_bounce_buffered() docs to reflect polling-only API (ISR binding was removed earlier; docs still mentioned it) - Validate back buffer size in set_back_buffer() to prevent OOB reads when framebuffer pointer is swapped - Break swap_buffers() spin loop on is_done() to avoid deadlock if DMA enters error state CI fixes: - Gate all bounce buffer types behind #[cfg(feature = "unstable")] so critical_section (an optional dep) isn't required in non-unstable builds — fixes esp-hal (xtensa), msrv (xtensa), docs (xtensa) - Fix clippy: map_or(false, ...) -> is_some_and(...)
…dule, use psram_allocator macro
a6515f5 to
28f28ea
Compare
|
New commits in main has made this PR unmergable. Please resolve the conflicts. |
Submission Checklist 📝
cargo xtask fmt-packagescommand to ensure that all changed code is formatted correctly.CHANGELOG.mdin the proper section.Extra:
Pull Request Details 📖
Description
Fix the DPI (RGB parallel) LCD driver and add bounce buffer support for driving large PSRAM-backed framebuffers, matching the architecture used by ESP-IDF's
esp_lcd_panel_rgb.c(source).Bug fix:
lcd_always_out_enwas not set in the DPI driver'sapply_config(), causing the LCD_CAM peripheral to stop outputting pixel data afterlcd_dout_cyclelencycles instead of streaming continuously from DMA. The I8080 driver already set this register correctly — the DPI driver was simply missing it.New feature:
DmaBounceBuffer+Dpi::send_bounce_buffered()enable driving 800×480 (or larger) RGB displays with framebuffers in PSRAM. The architecture uses two SRAM bounce buffers in a circular DMA descriptor chain;DpiBounceTransfer::poll()checks for GDMA EOF events and copies the next framebuffer chunk into the completed bounce buffer. Double-buffered rendering is supported viaset_back_buffer()/back_buffer()/swap_buffers()for tear-free frame transitions.New example:
qa-test/src/bin/lcd_dpi_bounce.rsdemonstrates the full pipeline on the PandaTouch board (ESP32-S3, 800×480 RGB565 at 23 MHz, Octal PSRAM).Future work (separate PR): Changing
hsync_idle_level/vsync_idle_leveldefaults fromLevel::LowtoLevel::Highto match ESP-IDF convention. This is a breaking change that would need thebreaking-change-esp-hallabel. The example setsLevel::Highexplicitly for now.Testing
cargo xtask fmt-packages✅cargo xtask lint-packages --chips esp32s3 esp-hal✅cargo xtask check-changelog✅cargo xtask update-metadata --check✅cargo xtask build examples lcd_dpi_bounce --package qa-test --chip esp32s3✅cargo xtask build examples lcd_dpi --package qa-test --chip esp32s3✅ (existing example unaffected)