Skip to content

Conversation

@kevinresol
Copy link

ESP-BSP Pull Request checklist

Note: For new BSPs create a PR with this link.

  • Version of modified component bumped
  • CI passing

Change description

For LVGL9 direct mode, currently it is restricted to RGB and DSI displays. But I think it should not be limited to those because it is just a normal fullscreen buffer which will just work fine in any display. However we need to properly handle bytes swapping. In particular, we should only swap bytes in the dirty area instead of the entire buffer.

This PR addresses both issues.

Note: version of component not bumped but added changelog in the "unreleased" section

Copilot AI review requested due to automatic review settings July 15, 2025 08:32
@CLAassistant
Copy link

CLAassistant commented Jul 15, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR extends direct mode support in LVGL9 by performing byte swapping only within the dirty area and generalizing full-screen drawing to all display types. Key changes include:

  • Introduce lvgl_port_draw_sw_rgb565_swap_area to swap bytes per dirty region instead of the entire buffer.
  • Update the flush callback to call the new swap function when in direct mode and adjust drawing logic to always use full-screen bitmap transfers for direct mode and full refresh.
  • Add a changelog entry under “Unreleased” for the direct mode enhancements.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
components/esp_lvgl_port/src/lvgl9/esp_lvgl_port_disp.c Added area-based byte swap function and updated flush/draw logic for direct mode.
components/esp_lvgl_port/CHANGELOG.md Recorded “Properly swap bytes and draw to display for direct mode in LVGL9” in Unreleased section.
Comments suppressed due to low confidence (4)

components/esp_lvgl_port/src/lvgl9/esp_lvgl_port_disp.c:761

  • The new function lvgl_port_draw_sw_rgb565_swap_area lacks a doc comment explaining its purpose, parameters, and behavior. Consider adding a brief description to aid future maintainability.
static void lvgl_port_draw_sw_rgb565_swap_area(void *buf, uint32_t screen_width, uint32_t screen_height, const lv_area_t *area) {

components/esp_lvgl_port/src/lvgl9/esp_lvgl_port_disp.c:761

  • There are no unit tests for lvgl_port_draw_sw_rgb565_swap_area to verify correct byte swapping across various area sizes and boundary conditions. Adding tests would help catch edge cases.
static void lvgl_port_draw_sw_rgb565_swap_area(void *buf, uint32_t screen_width, uint32_t screen_height, const lv_area_t *area) {

components/esp_lvgl_port/src/lvgl9/esp_lvgl_port_disp.c:686

  • This unconditionally draws the full screen for any panel when in direct mode or full_refresh, which may overwrite regions on displays that support partial updates. Consider restoring region-based drawing for non-RGB/DSI panels or reintroducing a disp_type check.
    if (disp_ctx->flags.direct_mode || disp_ctx->flags.full_refresh) {

components/esp_lvgl_port/src/lvgl9/esp_lvgl_port_disp.c:689

  • [nitpick] Add a space after if for consistency with the project’s coding style, i.e., use if (disp_ctx->disp_type ... for readability.
            if(disp_ctx->disp_type == LVGL_PORT_DISP_TYPE_RGB || disp_ctx->disp_type == LVGL_PORT_DISP_TYPE_DSI) {

@github-actions github-actions bot changed the title Properly swap bytes and draw to display for direct mode in LVGL9 Properly swap bytes and draw to display for direct mode in LVGL9 (BSP-700) Jul 15, 2025
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.

2 participants