ViezeVingertjes opened a new pull request, #22400:
URL: https://github.com/apache/nuttx/pull/22400

   ## Summary
   
   **drivers/lcd: Add CO5300 QSPI AMOLED driver.**
   
   Add a driver for AMOLED panels with the Chipone CO5300 controller, as
   used on the Waveshare ESP32-S3-Touch-AMOLED-2.16 (480x480).  It is the
   first LCD driver on the generic QSPI interface (struct qspi_dev_s).
   
   The driver implements struct lcd_dev_s, so it works with both the LCD
   character driver (/dev/lcdN) and the framebuffer front end (/dev/fbN):
   
   * Commands use QSPI opcode 0x02 with the DCS command in a 24-bit
     address, all on one line (QSPI_COMMAND).
   * Pixels use opcode 0x32 with single-line address and quad data
     (QSPI_MEMORY with QSPIMEM_QUADDATA).  putarea() sets the window once
     and streams the area through a DMA buffer from QSPI_ALLOC(), using
     RAMWR for the first transfer and RAMWRC for the next ones, so CS may
     be released between transfers.  Pixels are converted to big-endian
     while copying, so the source may be in PSRAM.
   * setcontrast() sets the brightness (DCS 0x51); setpower() turns the
     panel on/off and scales the brightness if CONFIG_LCD_MAXPOWER > 1.
   * The panel needs windows with even start and size.  getareaalign()
     reports this.  As the panel cannot be read back, the optional
     CONFIG_LCD_CO5300_SHADOWBUF keeps a copy of the display RAM to widen
     unaligned areas and to support getrun().
   
   The board resets the panel and configures the QSPI bus before calling
   co5300_lcdinitialize().  Resolution, offsets, mirroring, BGR, QSPI
   frequency, initial brightness and transfer size are Kconfig options.
   
   Tested on Waveshare ESP32-S3-Touch-AMOLED-2.16 (480x480 panel on SPI2 at
   40 MHz): the framebuffer test pattern through /dev/fb0 with the shadow
   buffer, and LVGL through /dev/lcd0 without it.  Built with and without
   the shadow buffer, no warnings.
   
   **drivers/lcd/co5300: Add row/column exchange and a transmit thread.**
   
   Use the standard DCS MADCTL bits and add CONFIG_LCD_CO5300_MIRRORV
   (row/column exchange), so that the image can be rotated by 90 degrees.
   
   Speed up the pixel path: convert two pixels per 32-bit word, and add
   CONFIG_LCD_CO5300_TXTHREAD, which splits the transfer buffer in two
   halves and sends one from a kernel thread while the caller fills the
   other one, so that e.g. LVGL renders the next area meanwhile.  The
   panel is initialized before the thread starts; if the thread cannot be
   created, the pixels are sent synchronously.  Commands wait until all
   queued pixels are sent.
   
   Tested on Waveshare ESP32-S3-Touch-AMOLED-2.16 with the LVGL benchmark:
   the average flush time drops from 27 ms to 10 ms (about 20 FPS on
   average, most scenes at the LVGL refresh limit), and the image is
   rotated in hardware to match the board orientation.
   
   ## Impact
   
   * Is new feature added? Is existing feature changed? YES: new driver 
(CONFIG_LCD_CO5300), off by default.
   * Impact on user (will user need to adapt to change)? NO
   * Impact on build (will build process change)? NO
   * Impact on hardware (will arch(s) / board(s) / driver(s) change)? NO
   * Impact on documentation (is update required / provided)? YES: LCD driver 
documentation.
   * Impact on security (any sort of implications)? NO
   * Impact on compatibility (backward/forward/interoperability)? NO
   
   ## Testing
   
   I confirm that changes are verified on local setup and works as intended:
   * Build Host(s): Linux x86_64, xtensa-esp-elf GCC 15.2.0 
(esp-15.2.0_20251204), riscv32-esp-elf GCC 15.2.0 for the ESP32-C3 build.
   * Target(s): Waveshare ESP32-S3-Touch-AMOLED-2.16 (ESP32-S3R8, 16 MB flash, 
8 MB PSRAM).
   * On the board (480x480 panel on SPI2, board support follows in a separate 
PR): fb example on /dev/fb0 with the shadow buffer; LVGL widgets demo and 
benchmark on /dev/lcd0 with the transmit thread. Note: on ESP32-S3 the driver 
also needs fixes to the ESP32-S3 QSPI driver (mode bits, QSPIMEM I/O width 
flags, cache handling), which will be submitted separately.
   
   Builds (each on current master plus this PR only):
   
   * PASS pr/co5300-lcd plain esp32s3-devkit:nsh drivers lib (warnings: 0)
   * PASS pr/co5300-lcd shadow esp32s3-devkit:nsh drivers lib, SHADOWBUF 
(warnings: 0)
   * PASS pr/co5300-lcd thread esp32s3-devkit:nsh drivers lib, TXTHREAD 
(warnings: 0)
   * PASS pr/co5300-lcd sim sim:nsh x86_64, SHADOWBUF+TXTHREAD (co5300.c 
compiles, warnings: 0; link needs a board_lcd_initialize())
   
   Testing logs before change:
   
   ```
   Benchmark Summary (9.2.2 )
   Name, Avg. CPU, Avg. FPS, Avg. time, render time, flush time
   Empty screen, 62%, 12, 49, 3, 46
   Moving wallpaper, 74%, 12, 59, 10, 49
   Single rectangle, 17%, 20, 1, 0, 1
   Multiple rectangles, 40%, 19, 20, 8, 12
   Multiple RGB images, 60%, 18, 30, 8, 22
   Multiple ARGB images, 68%, 14, 42, 18, 24
   Rotated ARGB images, 91%, 3, 233, 183, 50
   Multiple labels, 64%, 19, 30, 28, 2
   Screen sized text, 86%, 5, 149, 106, 43
   Multiple arcs, 30%, 19, 11, 10, 1
   Containers, 61%, 17, 34, 22, 12
   Containers with overlay, 79%, 10, 78, 37, 41
   Containers with opa, 69%, 14, 44, 25, 19
   Containers with opa_layer, 79%, 9, 82, 66, 16
   Containers with scrolling, 82%, 9, 87, 42, 45
   Widgets demo, 85%, 6, 104, 66, 38
   All scenes avg.,65%, 12, 65, 39, 26
   ```
   
   Testing logs after change:
   
   ```
   Benchmark Summary (9.2.2 )
   Name, Avg. CPU, Avg. FPS, Avg. time, render time, flush time
   Empty screen, 80%, 25, 30, 9, 21
   Moving wallpaper, 94%, 24, 37, 20, 17
   Single rectangle, 14%, 28, 2, 0, 2
   Multiple rectangles, 47%, 29, 16, 9, 7
   Multiple RGB images, 69%, 29, 22, 16, 6
   Multiple ARGB images, 90%, 25, 33, 26, 7
   Rotated ARGB images, 98%, 3, 244, 228, 16
   Multiple labels, 83%, 28, 26, 22, 4
   Screen sized text, 97%, 7, 130, 113, 17
   Multiple arcs, 48%, 29, 13, 10, 3
   Containers, 59%, 28, 19, 16, 3
   Containers with overlay, 97%, 12, 75, 58, 17
   Containers with opa, 72%, 27, 25, 21, 4
   Containers with opa_layer, 95%, 12, 74, 68, 6
   Containers with scrolling, 97%, 13, 68, 51, 17
   Widgets demo, 97%, 9, 89, 75, 14
   All scenes avg.,77%, 20, 56, 46, 10
   ```
   
   ## PR verification Self-Check
   
   * [x] This PR introduces only one functional change.
   * [x] I have updated all required description fields above.
   * [x] My PR adheres to Contributing Guidelines and Documentation (git commit 
title and message, coding standard, etc).
   * [ ] My PR is still work in progress (not ready for review).
   * [x] My PR is ready for review and can be safely merged into a codebase.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

  • [PR] drivers/lcd: Add CO5300 ... ViezeVingertjes (via GitHub) via commits

Reply via email to