Hi,
I have an interface with several tabs and buttons that works fine, as you can see on one of the videos attached. But when I set LV_USE_DRAW_SDL to 1 in lv_conf.h, i get a lot of display problems, like buttons appearing and disappearing, tabs switching automatically etc. as you can see in the other video. I also noticed an increased duration in drawing charts (about 3 seconds for 300 points, while the same chart is instantly drawn when LV_USE_DRAW_SDL is set to 0).
Does anyone have an idea why this behavior occurs ?
I’m currently using LVGL 9.2.
Thanks in advance
The files
I forgot to say that the problem appears when running on an NXP i.MX 8, but not when running on the simulator.
Same issue here with imx8 processor.
It works fine without LV_USE_DRAW_SDL but when it is activated, there is a buffer swapping issue. I think this is related to the triple buffing mechanism used by the opengles2 backend used by SDL on this kind of hardware. We can clearly see 3 residual images which are swapping on a refresh of an LVGL object. I ‘have tried a few things to fix this without luck (one solution is to copy the current SDL surface to a backup texture, present the current render then, copy back the texture to the next render, but performances are awful).
It is a shame because when running benchmark, activating SDL drawing divides by 2 or 3 the CPU usage.
Does someone can confirm this behaviors on a system that is using opengles2 ?
Best regards
just for the sake of asking the silly question. Why would you be using SDL to render instead of using the build in graphics accelerator for that MCU??
SDL is only going to make the calls to the OS fpor doing the rendering. The came calls are made if running the simulator or running it on an embedded device. So if it works on the simulator I would have to guess that there is something off with the OS on the embedded device.
SDL is also not written to really be “device” specific. It does have special things that are doing in order for it to work on a raspberry pi. I would guess that something along those lines would also need to be done for your specific MCU. I would say that SDL doesn’t support the MCU you are using and it is using the vanilla calls made to the OS and that is what is causing the issues.
That’s just taking a stab at a guess as to what is going on.
I can also tell you that the drawing that SDL does for LVGL is not using opengl at all.
It looks like it is only using SDL for blending layers and for filling. No rendering primitives are being used. Things like circles, lines, etc…
Thank you for your reply.
You are right, SDL is not written to be device specific, but it uses what is available on the system, in the case of my imx8 it uses Wayland driver and opengles2 renderer. The imx8 GPU driver is openglES compliant. So, when you use SDL with hardware acceleration activated, you are using the MCU graphic accelerator.
You are also right about the primitive rendering, they come from the software renderer, but directly drawn on an SDL texture and the blending is done by SDL (so everything stays in the GPU “work area”) which is not a negligible part of the final rendering.
Anyway, I think using SDL is a good abstraction layer for LVGL to have hardware acceleration on lots of MCU that are running an embedded Linux distro.