Skip to content

Investigate byte swapping requirement for ILI9341 display controller #1

@ajlennon

Description

@ajlennon

Background

Currently, the ESP-IDF display driver swaps bytes for each pixel to match TFT_eSPI's behavior when pushColors is called with swap=true. This byte swapping is done in software in the flush function.

Investigation Needed

  1. Is byte swapping required?

    • Check if the ILI9341 display controller or the specific display module requires byte swapping
    • Determine if this is a hardware requirement or just matching TFT_eSPI's behavior
    • Test if removing byte swapping causes color issues
  2. Performance Optimization

    • Byte swapping is currently done in software for every pixel, which adds CPU overhead
    • Investigate if we can:
      • Configure the display controller to accept native byte order (avoid swapping)
      • Use hardware features (DMA, SPI) to handle byte swapping
      • Optimize the byte swap operation (SIMD, lookup tables, etc.)
      • Pre-swap image data during conversion instead of runtime
  3. Image Display Performance

    • Current implementation swaps bytes during flush, which happens for every LVGL refresh
    • Consider pre-swapping image data during PNG to RGB565 conversion
    • This would eliminate runtime byte swapping for static images (logos, splashscreen)

Related Code

  • src/lvgl_display.cpp: lvgl_display_flush() function performs byte swapping
  • tools/convert_logo.py: Image conversion script (could be modified to pre-swap bytes)

Expected Outcome

Determine the most efficient approach:

  • If byte swapping is required: optimize the swap operation or move it to image conversion
  • If byte swapping is not required: remove it to improve performance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions