Render time optimization

What do you want to achieve?

Best possible render time with the setup below.
MCU - STM32U585
SPI Display - 128x400 LCD

UI - Custom images and animations on it, like a slider and a progress bar, are prepared.

Custom slider screen render time is around 40ms. On concurrent use of the same, it goes around 70ms. Whereas the actual slider widget render time is around 20ms.

How to achieve the best render time?
What are the possible optimization techniques?
Any reference available for render time calculation and comparison?

What have you tried so far?

  1. Enabled DMA2D
  2. Display SPI frequency 40mhz
  3. Image used ARGB8888 and RGB565
  4. SPI DMA enabled.
  5. Single buffer use due to memory limitation.

Code to reproduce

/*You code here*/

Screenshot and/or video

Environment

  • MCU/MPU/Board: STM32U585
  • LVGL version: LVGL v9.4

Hi @fbiego,
Do you have any input for this?

Can you share your code implementation? Also, if possible, run the benchmark demo and post the results

Hi @fbiego,

We can flash the benchmark demo on our device.

However, to measure the render time with default LVGL functionality, when we enable the macros, “#define** LV_USE_SYSMON 1” & “#define** LV_USE_PERF_MONITOR 1”, lv_init() fails.

We are trying to measure render time manually with the GPIO as follows:
HAL_GPIO_WritePin(RENDER_TIME_GPIO_Port, RENDER_TIME_Pin, GPIO_PIN_SET);
lv_timer_handler();
HAL_GPIO_WritePin(RENDER_TIME_GPIO_Port, RENDER_TIME_Pin, GPIO_PIN_RESET);

Please let us know if you have any suggestions.

Please find attached lv_conf.h file for your reference.

lv_conf.h (51.6 KB)

Hi @fbiego ,

Please refer the table below for render time measurement for benchmark demo.

Screen Name Max Render Time
Empty screen 27.067 ms
Moving wallpaper 37.113 ms
Single rectangle 12.308 ms
Multiple rectangles 25.496 ms
Multiple RGB images 14.047 ms
Multiple ARGB images 15.134 ms
Rotated ARGB images 88.924 ms
Multiple labels 38.824 ms
Screen sized text 119.325 ms
Multiple arcs 39.743 ms
Containers 38.46 ms
Containers with overlay 38.99 ms
Containers with opa 46.62 ms
Containers with opa_layer 56.64 ms
Containers with scrolling 58.617 ms
Widgets demo 171.188 ms

The render time seems a bit high.
Are you using LTDC?
https://docs.lvgl.io/master/integration/chip_vendors/stm32/ltdc.html

Does the display you are using have built in memory? If you don’t know then tell me what the model number is for the display IC and I will tell you if it does or doesn’t.

It sounds like you are using a single buffer that is width * height * bytes_per_pixel in size. If the display you are using has built in memory (GRAM) then you can actually set that size so it is a lot smaller. like 1/10th the size. make 2 buffers that size and allocate them in DMA memory and set up proper double buffering using DMA with setting the render type to PARTIAL in lvgl. Don’t forget you will need to register a callback with the SPI driver for your MCU to get signaled that a transmission has completed. in that callback is when you call the flush ready function in lvgl.

Enabling double buffering using partial buffers is going to be a lot faster. 40mhz SPI is slow to begin with and that is going to be your bottleneck especially with a display that is 128 * 400 in size. That’s a lot of data it is going to be sending at a pretty slow speed.

@fbiego We are not using LTDC.

@kdschlosser ,
We have tried the partial frame buffer, but when the frame was uploaded to display over SPI, only some part of the display got updated, and not the full display. So, this approach does not work for us.

While using the double frame buffer, render time is already coming high. So, it’s not helping much.

Could you help to confirm whether the way we are measuring render time is correct or not? Is there any other way to measure the render time?

When using the default LVGL macro “LV_USE_PERF_MONITOR” to measure it, the LVGL init crashes. Do you have any suggestion that how we can enable it so that the LVGL itself print the render time?

You still have not told me what the model number is for the display IC…

Hi @kdschlosser ,
Sorry, I missed it.

Display driver IC used is - RM690A0