How to speed up the V8 version?

Did you use 2 screen sized buffers for LVGL in v7? If so it really can be slower in v8 because in v7 the 2 buffer were synchronized internally and only the changed areas where redrawn. In v8 this feature doesn’t exist.

You can also try the latest master branch of LVGL, where the display needs to be created a little bit differently but the v7 like buffering is added again if you use DIRECT_MODE with 2 screen sized buffers. Please check out this post for more details about the news in master

Hi,@ kisvegabor,
Many thanks!
Yes, both V7 and V8 are full screen size buffer and the V8 is in direct mode as below and manually copy the invalid area to another buffer for sync in the disp_flush() .

            disp_drv.full_refresh = 0;
	disp_drv.direct_mode = 1;

You means V8 will redrawn all widget each cycle even in the direct mode?
I have tried V9, result neally the same FPS with the V8. I have set the display in direct mode there and
copy the invalid area manually as in V8. You means no need to copy the invalid area in V9? I will try.

lv_disp_t * disp = lv_disp_create(LV_HOR_RES_MAX ,LV_VER_RES_MAX);
lv_disp_set_flush_cb(disp, disp_flush);
lv_disp_set_draw_buffers(disp, ltdc_lcd_framebuf0, ltdc_lcd_framebuf1, sizeof(ltdc_lcd_framebuf0), LV_DISP_RENDER_MODE_DIRECT);

I also doubt maybe the huge amount event interfere the drawn, when I press the touch pad to scroll the marker on the chart , as the fact the V8 have much FPS dropped than the V7 in the same case.

Best Regards,
James

Nope, in direct_mode is draws only the changes.

v9 does it for you. See here in the code.


Can you run a profiler? It’d help a lot to see what LVGL is doing and to see the difference.

Hi,@ kisvegabor,
Many thanks!
If the direct mode of V8 equal to the V7, why the refresh rate differ so much? But per the bench mark test, the V8 win the V7. It is really confusing.
I will test the V9 in detail.

Best Regards,
James

Do you have some sample code for the lv_port_disply for TWO screen-sized buffer in V9? My porting won’t work without the manually invalid area copying.

Best Regards,
James

How did you initialized the buffer and display in v9?

Hi,@ kisvegabor,
I am using the double full size frame buffer and switch them in the ISR fof STM32H7. The init. code was as below:

lv_disp_t * disp = lv_disp_create(LV_HOR_RES_MAX ,LV_VER_RES_MAX);
lv_disp_set_flush_cb(disp, disp_flush);
lv_disp_set_draw_buffers(disp, ltdc_lcd_framebuf0, ltdc_lcd_framebuf1, sizeof(ltdc_lcd_framebuf0), LV_DISP_RENDER_MODE_DIRECT);

In the disp_flush(), trigered an ISR and switch the frame buffer address in the ISR.
I have found that the display will not proper sync. even without the DMA2D functions, if not doing the manual copy. If I do as V8 , it display normally.

Best Regards,
James

Sorry, there was bug in the master branch. I’ve just fixed and tested it.

Does it work on your end too?

Hi,@ kisvegabor,
Many Thanks!

It can’t work and if bypass the code for copying the invalid area in the _lv_disp_refr_timer(), instead by the manual copying as V8, it works.
The FPS of the live waveform chart is similar to the V8 , around 8, vs 11 in V7 ,and also drop to 6 when keeping scrolling the marker, same with V8 and slower than the 10 in V7.
Where might be the bottleneck of the scrolling speed comparing to the V7?
I had enabled the DMA2D in both case.
The bench mark example can’t running and I am trying fixing. The wigget and music example work well. The speed when scrolling the tabview page in the widget example is similar to my waveform chart

Beat Regards,
James

So don’t it work even after the fix? Can you debug if this code is really executed?

Hi,@ kisvegabor,
Many Thanks!
It won’t work after the fix and I had tracked the code have been executed but abnormal.
I will confirm it today.

Best Regards,
James

Hi,@ kisvegabor,
Many Thanks!
The fix worked! I made a mistake yesterday
But the bench mark example still can’t running. It is running to a hardfault. Does it work in your side?

Best Regards,
James

It works for me. Do you see what causes the hard fault?
At which step does it fail?

Hi,@ kisvegabor,
Many Thanks!
When just running the bench mark example , it works but look abnormal, please refer to the photo. Something is wrong under the LV_DEMO_BENCHMARK_MODE_RENDER_ONLY mode.


Best Regards,
James

I’m testing it in the simulator and it works well for me.
However with LV_DEMO_BENCHMARK_MODE_RENDER_ONLY nothing should be shown on the screen.

How does it work in LV_DEMO_BENCHMARK_MODE_REAL?

Hi,@kisvegabor,
In my side, the two mode result the same,crashed object. The tick fot the timer handler is 20ms.

My screen is 1024*600 and is in the double framebuffer mode.

EDIT: I found lv_draw_stm32_dma2d_buffer_copy() have issue. Replaced by my buffer copy, the benchmark worked.

Best regards,
James

Huh, great news! I was out of ideas :slight_smile:

It’s strange that v9 is so much slower. Do the results look different with software rendering? (i.e without DAM2D)

Hi,@kisvegabor,
When define the #define LV_USE_GPU_STM32_DMA2D 0 , the bench mark result is the same with when it is on.
But the lv_draw_stm32_dma2d_blend_map() is really executed when using the DMA2D.

Best regards,
James

I see. v9 is mno ready yet and the performance is not optimized yet. Anyway, is it fast enough for you as it is?

Hi,@kisvegabor,
Many thanks!
Per my benchmark test , the V8 is the fastest , but in my project the V7 is the winner and nearlly 20% faster than the V8. What might be the reason and any possible optimization?
I hope the V9 catching up soon.

Best regards,
James