Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Software rotation with esp_lvgl_port on ESP32-P4 with ILI9881C display #400

Open
1 task done
dmartauz opened this issue Sep 27, 2024 · 14 comments
Open
1 task done
Labels
Area: LVGL related to LVGL and LVGL port Type: Bug Something isn't working

Comments

@dmartauz
Copy link

dmartauz commented Sep 27, 2024

Board

ESP32-P4-Function-EV-Board

Hardware Description

ILI9881C touchscreen display (8" 800 x 1280 pixels)

IDE Name

esp-idf/master

Operating System

Windows 10

Description

The display natively works in portrait orientation and it is displaying simple tabview. In this orientation it works well.

IMG_20240927_201910708

Because I want to use it in landscape orientation and it seems that ILI9881C does not support hardware rotation I am attempting to use .sw_rotate = true and after uncommenting last line of the code it seems that first rotated frame is drawn correctly but following frames have some offset (shifted LVGL FPS tracker).

IMG_20240927_202104171

After clicking on the tabview also tabview buttons get shifted.

IMG_20240927_202144160

Is master branch of esp_lvgl_port already using PPA in case of ESP32-P4?

Sketch

    const lvgl_port_display_cfg_t disp_cfg = {
        .io_handle = mipi_dbi_io,
        .panel_handle = mipi_dpi_panel,
        .buffer_size = EXAMPLE_MIPI_DSI_LCD_V_RES * EXAMPLE_MIPI_DSI_LCD_H_RES, //EXAMPLE_LVGL_DRAW_BUF_LINES
        .double_buffer = true,
        .hres = EXAMPLE_MIPI_DSI_LCD_H_RES,
        .vres = EXAMPLE_MIPI_DSI_LCD_V_RES,
        .monochrome = false,
        .color_format = LV_COLOR_FORMAT_RGB565,
        .rotation = {
            .swap_xy = false,
            .mirror_x = false,
            .mirror_y = false,
        },
        .flags = {
            .buff_dma = false,
            .buff_spiram = true,
            .sw_rotate = true,
            .swap_bytes = false,
            .full_refresh = false,
            .direct_mode = false,
        }
    };

    const lvgl_port_display_dsi_cfg_t disp_dsi_cfg;

    lvgl_display = lvgl_port_add_disp_dsi(&disp_cfg, &disp_dsi_cfg);
    //lv_display_set_rotation(lvgl_display, LV_DISPLAY_ROTATION_270);

Other Steps to Reproduce

No response

I have checked existing issues, README.md and ESP32 Forum

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@dmartauz dmartauz added Status: Awaiting triage Type: Bug Something isn't working labels Sep 27, 2024
@github-actions github-actions bot changed the title esp_lvgl_port on ESP32-P4 with ILI9881C display esp_lvgl_port on ESP32-P4 with ILI9881C display (BSP-557) Sep 27, 2024
@dmartauz dmartauz changed the title esp_lvgl_port on ESP32-P4 with ILI9881C display (BSP-557) Software rotation with esp_lvgl_port on ESP32-P4 with ILI9881C display Sep 27, 2024
@espzav
Copy link
Collaborator

espzav commented Sep 30, 2024

Hi @dmartauz thank you for reporting this issue. I will check it soon and fix it. The master branch is not using PPA yet, because after performance measurement, the SW rotation was faster than PPA because we are rotationg only small pieces of the whole screen. We are still working on improving performance and looking for the best solution. The PPA rotation is used in this PR: #352

@espzav espzav added Area: LVGL related to LVGL and LVGL port and removed Status: Awaiting triage labels Sep 30, 2024
@dmartauz
Copy link
Author

dmartauz commented Oct 6, 2024

@espzav any update on the fix? In the meantime I am porting my application from S3 with 800x480 parallel display.

@espzav
Copy link
Collaborator

espzav commented Oct 24, 2024

Hello @dmartauz, sorry for delay. I tried in on some screens and examples. In some cases, I see the issue and in some cases it was fixed by this change in LVGL port component:
image
Please, could you try it? I need more time for investigation and check all cases.

@dmartauz
Copy link
Author

@espzav this change fixed the problem, I tried both 90 and 270 degree rotation. Is there any potential to speed up the software rotation? Screen redraw is now noticeably slower when changing tabs. I mean it is still ok (at least for our use-case) but it would be nice to mitigate it somehow. Are you sure PPA will not help?

@espzav
Copy link
Collaborator

espzav commented Oct 24, 2024

@dmartauz thank you for test it. I am happy that it is working. I will do more tests and I will release it soon.
The SW rotation is slower because there is one additional buffer and copying. The PPA should be faster, when there will be redraw of whole screen, not for parts. But there should be used estarnal RAM instead of internal and it is slower too.
We are working on speed up and more usage of PPA. You can try rotation with PPA in this PR: #352 but it is still slower.

@dmartauz
Copy link
Author

dmartauz commented Oct 24, 2024

@espzav I have double buffer with size of V*H resolution (1280x800px) and .trans_size set to 1/10 of the main buffer. I like this setup as from user's perspective the screen is redrawn at once. In this configuration using PPA on the whole screen buffer might make sense, right? PPA rotation implemented in the PR would rotate the screen at once in my case?

@espzav
Copy link
Collaborator

espzav commented Oct 24, 2024

@dmartauz Oh, have you got buffer in SPIRAM (.buff_spiram = true)? The PPA can help you for full buffer, but still it will be called in every flush and it depends on LVGL display settings (e.g.

unsigned int full_refresh: 1;/*!< 1: Always make the whole screen redrawn */
). But I think, if you set buffer to smaller and try to set .buff_dma = true and .buff_spiram = false, I think it can be faster.
For example we are using this size: 1280*50 in 1280x720 in internal RAM (not double buffer).

@dmartauz
Copy link
Author

@espzav I have .buff_spiram = false configured but I guess it must allocate the buffer in SPIRAM internally as for 1280x800px and RGB565 the buffer size needed is 1280x800x2bytes = 2048000bytes, correct?

@dmartauz
Copy link
Author

@espzav In case I set .buff_dma = true then I get "Not enough memory for LVGL buffer allocation" either for buf1 or for rotation buffer. My application probably already consumes most of internal SRAM.

@espzav
Copy link
Collaborator

espzav commented Oct 24, 2024

@dmartauz Oh yes, the DMA capable internal RAM is smaller. Then you can try to set smaller buffer and use DMA. It should be still faster.

@dmartauz
Copy link
Author

@espzav rotation buffer is allocated with the same size as primary buffer?

@espzav
Copy link
Collaborator

espzav commented Oct 29, 2024

@dmartauz yes

@espzav
Copy link
Collaborator

espzav commented Nov 6, 2024

Fix of the SW rotation was merged. Can we close this issue?

@dmartauz
Copy link
Author

dmartauz commented Nov 6, 2024

Yes. I did full clean of my project and tested with 2.4.2. Rotation works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: LVGL related to LVGL and LVGL port Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants