Skip to main content
Associate III
August 12, 2025
Solved

Issues with SVG image rendering

  • August 12, 2025
  • 15 replies
  • 2208 views

Hi,

I have a project derived from the demo6 from ST on the STM32U5G9J-DK1 devkit, where I want to display SVG images. The only difference is that the rounded display of the original kit has been substituted with another rounded display of the same resolution (480x480 pixels) but smaller. The PCB of the display is then different as well as the display driver chip which is driven through MIPI-DSI commands (and not using video mode of MIPI-DSI like the original demo is). I'm using latest version of TGFX 4.25.0.

All the subdemos of this demo6 project are working the same as on the original display, but not the SVG subdemo. All the .SVG images of this specific sub demo, which should animate and start bouncing on the screen, are simply not rendered at all. I only see the background image which is a .PNG file. And I can come back on the main screen as the touch display is working.

I tried to strip down this demo6 project and display a simple background .PNG image and on top of this last, some .SVG images. The background image is again displayed as it should, but none of the .SVG images.

As I've seen some other having difficulties with .SVG images I tried to change the portrait/landscape mode, without seeing any change. I tried to modify the canvas buffer size, and I didn't see any change. I checked the code inside MX_DCACHE2_Init() function and I have the two lines which were advised there.

I'm running out of ideas on the reasons why .SVG images cannot be rendered. So far, the only difference I can see is around these MIPI-DSI commands usage but since all the rest of subdemos are working as expected, I don't think that this can be related. There must be something not going well before this stage, when all the images should be rendered inside the framebuffer. But I don't understand why this is related to .SVG images rendering.

Any idea or hint are welcome.

Best answer by mathiasmarkussen

We have identified the issue, which is a bug in the precompiled library, and will also affect anyone using the "use larger framebuffer stride" option in TouchGFX with NeochromVG.

A fix will be included in TouchGFX 4.26, which should be available shortly.

15 replies

apadomAuthor
Associate III
August 20, 2025

@mathiasmarkussen 
My hardware is now fixed, so I could test again your hints. Unfortunately, it doesn't change the behaviour.
I did a very simple application with a background containing a .PNG image and on top of this last a .SVG with the preexisting SVG assets of TGFX (the TGFX logo).

On simulator everything is rendered. On target only the background appears.

We have an NDA signed with you. How can I privately send you a zip archive of our code?

Lead II
August 20, 2025

have you tried rendering a touchgfx shape?

"Kudo posts if you have the same problem and kudo replies if the solution works.Click ""Accept as Solution"" if a reply solved your problem. If no solution was posted please answer with your own."
apadomAuthor
Associate III
August 20, 2025

@unsigned_char_array 
Thank you for your suggestion. I added a circle shape to my project and it's rendered as expected on the target.
Would this mean that anything linked to vector rendering would finally work at HW level?

Lead II
August 20, 2025

@apadom wrote:

@unsigned_char_array 
Thank you for your suggestion. I added a circle shape to my project and it's rendered as expected on the target.
Would this mean that anything linked to vector rendering would finally work at HW level?


I guess. But I don't have enough knowledge of the internal workings of the vector library. But to my understanding the vector library works by rendering primitive shapes.

"Kudo posts if you have the same problem and kudo replies if the solution works.Click ""Accept as Solution"" if a reply solved your problem. If no solution was posted please answer with your own."
ST Employee
August 21, 2025

TouchGFX shapes are rendered in software.

@apadom I've sent you a message through the forum, can you attach the project there, then I'll have a look?

ST Employee
August 21, 2025

One thing you could try is to simplify your transfer setup. A setup similar to yours is used for the current board setup for STM32F4769-DK.

TouchGFX sets the LTDC framebuffer base on vsync using TouchGFXGeneratedHAL::setTFTFrameBuffer(address).

You should basically be able to replace the code you pasted above with this:

void HAL_DSI_TearingEffectCallback(DSI_HandleTypeDef* hdsi)
{
 GPIO::set(GPIO::VSYNC_FREQ);
 HAL::getInstance()->vSync();
 OSWrappers::signalVSync();
 if (refreshRequested)
 {
 // Start transfer
 HAL_DSI_Refresh(hdsi);
 refreshRequested = false;
 }
 else
 {
 GPIO::clear(GPIO::VSYNC_FREQ);
 }
}

void HAL_DSI_EndOfRefreshCallback(DSI_HandleTypeDef* hdsi)
{
 GPIO::clear(GPIO::VSYNC_FREQ);
}

 Edit: I see you have replaced the call to TouchGFXGeneratedHAL::setTFTFrameBuffer(), but the actual call from the framework is to setLtdcFrameBuffer(uint32_t adr) in TouchGFXHAL.cpp, so you do track that correctly, and the code above should work still.

You should not call setLtdcFrameBuffer() manually.

This may actually be your issue, the frame buffers are swapped twice on every frame, so the copy of SVGs from the stencil buffer to the framebuffer happens after your manual swap.

apadomAuthor
Associate III
August 21, 2025

@mathiasmarkussen 
Thank you for these explanations and fixes. Unfortunately it doesn't solve this issue. The rendering results are the same: only the .PNG background and the circular shape are rendered.

I will send you the code privately, through the link I received.

Thank you.

mathiasmarkussenBest answer
ST Employee
August 28, 2025

We have identified the issue, which is a bug in the precompiled library, and will also affect anyone using the "use larger framebuffer stride" option in TouchGFX with NeochromVG.

A fix will be included in TouchGFX 4.26, which should be available shortly.

apadomAuthor
Associate III
September 26, 2025

I can confirm here that this issue with SVG rendering has been solved with TGFX 4.26.0.
Thank you for this fix.

Visitor II
October 13, 2025

Hi — same MCU here (STM32U5G9NJ).

Everything was working in TouchGFX 4.24.2: SVG Image rendered fine with my project settings.

After upgrading to 4.26.0, the exact same project behaves differently:

  • Vector Rendering = Software → SVG renders correctly

  • Vector Rendering = Hardware → nothing is drawn (blank)

What I’ve tried

  • Clean rebuild, deleted build folders, and Re-Generate Code in CubeMX

  • Framebuffer RGB565 (also tried ARGB8888)

  • Minimal inline-styled SVG (no CSS, no filters)

  • Vector Font Rendering: Enabled

  • Toggled “Use larger framebuffer stride” both ways

Questions

  1. On STM32U5G9NJ, is Hardware mode supposed to render SVG in 4.26.0, or should we stick to Software for SVG on this device?

  2. If Hardware mode should work, could you share the exact CubeMX/Designer options that make it render in 4.26.0?

  3. If there were behavior changes from 4.24.2 → 4.26.0 affecting SVG, is there a migration note or recommended setting to keep Hardware mode working?