Skip to content

Add PPA hardware-accelerated rotation for 90/270 degrees on ESP32-P4#140

Draft
agillis wants to merge 3 commits intoclydebarrow:lvgl-9.4from
agillis:ppa_rotate_90
Draft

Add PPA hardware-accelerated rotation for 90/270 degrees on ESP32-P4#140
agillis wants to merge 3 commits intoclydebarrow:lvgl-9.4from
agillis:ppa_rotate_90

Conversation

@agillis
Copy link

@agillis agillis commented Feb 26, 2026

What does this implement/fix?

Adds ESP32-P4 PPA (Pixel Processing Accelerator) hardware-accelerated screen rotation for 90° and 270° display orientations in the LVGL component.

The ESP32-P4's PPA SRM (Scale-Rotate-Mirror) engine performs the pixel rotation in hardware, which is significantly faster than software rotation. When PPA is not available or for 0°/180° rotations (handled natively by the display driver), the existing software fallback is used.

Changes:

  • lvgl_esphome.cpp: Added PPA SRM rotation in draw_buffer_() for 90°/270° cases with software fallback for all angles. Added aligned buffer allocation and PPA client registration in setup().
  • lvgl_esphome.h: Added ppa_client_ and rotate_buf_size_ members under #ifdef USE_ESP32_VARIANT_ESP32P4.

Dependencies:

This PR targets clydebarrow's lvgl-9.4 branch (PR esphome#12312 on esphome/esphome).

Test Environment:

  • ESP32-P4 (Waveshare ESP32-P4-WIFI6-TOUCH-LCD-7B)
  • Tested with 90° and 270° rotation

andrew and others added 3 commits February 20, 2026 15:17
Add hardware-accelerated rotation using the ESP32-P4 PPA (Pixel Processing
Accelerator) engine instead of software rotation. Falls back to software
rotation on non-P4 platforms or if PPA registration fails.

Key changes:
- Use PPA SRM (Scale-Rotate-Mirror) operations for 90/180/270 degree rotation
- Allocate DMA-compatible cache-line-aligned buffers for PPA compatibility
- Register PPA client during setup with automatic fallback to software rotation
180-degree rotation can be handled natively by the display driver,
so PPA hardware acceleration is only needed for 90 and 270 degrees.
@github-actions
Copy link

To use the changes from this PR as an external component, add the following to your ESPHome configuration YAML file:

external_components:
  - source: github://clydebarrow/esphome@pull/140/head
    components: [lvgl]
    refresh: 1h

(Added by the PR bot)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant