cancel
Showing results for 
Search instead for 
Did you mean: 

Issues with SVG image rendering

apadom
Associate III

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.

31 REPLIES 31

Have you tried rendering a static SVG image? Please include the code.

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.
apadom
Associate III

As written in my post, yes. I did try to simply put .SVG images on top of a .PNG image as a background. So all static. And the results were the same.

Does it fail to render in the simulator too?
Please share code so we can reproduce.

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.
apadom
Associate III

In all cases everything is rendered correctly under the simulator.
The issue only happens on the target.

Prior to share code with you, I'm sorry to ask you this but, you're not an ST employee, that's correct?

By the way, it's mainly the demo6 project which exists inside the designer for this specific board. And then some changes to use the MIPI DSI commands mode instead of the video mode. 

 

 


@apadom wrote:

Prior to share code with you, I'm sorry to ask you this but, you're not an ST employee, that's correct?


I'm not. Since you mentioned you basically stripped an example project I don't understand why you are hesitant sharing code.

 


@apadom wrote:

In all cases everything is rendered correctly under the simulator.
The issue only happens on the target.



Interesting. If the SVG wasn't static I would suspect it might not render quickly enough. But since it is static I don't understand why it is not rendering.

Perhaps cache is not cleared? Do you use double buffering? Have you configured enough stack? What about only using a very basic SVG image such as a single square.

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.
apadom
Associate III

> I'm not. Since you mentioned you basically stripped an example project I don't understand why you are hesitant sharing code.

I have two versions derived from this demo6 project. 

The first one is a stripped down version of this demo6, on which I added new screens and artwork from a designer. I cannot share this work without an NDA. Therefore my question. I'm sure you understand.

I don't have much resources taken in this first project compared to the original demo6. I would even say that it's less since I have less assets and of smaller size in bytes (and SVG are even less complex then what you see in this demo6). And I have a mix of .PNG and .SVG. And they all render correctly under the Simulator. And only on the target all .SVG assets are not rendered at all. 

It's very simple. There's no animation. It's a simple .SVG image object dropped on top of a .PNG background.

The second version is the demo6 project you can find on designer, with minimal adaptations to make the display and touchscreen work, as I explained in my original post. The only changes linked to the new display are this MIPI-DSI commands.

I moved back to the original demo6 just to check that it was not my screens design or their contents which would explain this weird behavior on the target. But obviously not, since the demo6 and its specific SVG demo isn't working on target as well.

Perhaps cache is not cleared? Do you use double buffering? Have you configured enough stack? What about only using a very basic SVG image such as a single square.

Yes, double buffering is being used.
The .SVG image is basic in first project: a circle filled with a color and a very simple vector icon in it.
You mention the stack size: does a .SVG image rendering would be more complex that it would require more code and calls? 

You mention the cache not being cleared. Are you referring to the same SRAM cache disabling as what I linked in my original post?


@apadom wrote:

Perhaps cache is not cleared? Do you use double buffering? Have you configured enough stack? What about only using a very basic SVG image such as a single square.

Yes, double buffering is being used.
The .SVG image is basic in first project: a circle filled with a color and a very simple vector icon in it.
You mention the stack size: does a .SVG image rendering would be more complex that it would require more code and calls? 


Yes. That's my reasoning. I don't know if you use FreeRTOS or a loop. But you need to make sure the rendering task has enough stack. If it doesn't there is no guarantee it will work. I recently checked my stack usage and found out I didn't have enough stack so I needed to increase it. I think I got around 3 or 4k of stack usage so I set my stack to 8k just in case.

 


@apadom wrote:

You mention the cache not being cleared. Are you referring to the same SRAM cache disabling as what I linked in my original post?


I don't know how you configured your MPU and if you have caching enabled or not. I have a project where I have external RAM and flash that requires cache for performance (otherwise there were artifacts, even with double buffering). But the MPU configuration was complicated. And I needed to write my own cache clear functions that only cleared cache of the parts of the frame buffer that were changed. So either disable it completely or configure it.properly.

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.
apadom
Associate III

I remarked something a bit odd regarding the .SVG images part of the demo6:

apadom_1-1755008300431.png

For all .PNG files, there are some settings you can alter.
But nothing for .SVG files.

If I would want to put .SVG resources in a specific section (external or internal flash), it doesn't seem possible there. Same for the rotation directly from the designer.

I guess it means that .SVG resources location need to be managed by user code.
Or? 

apadom
Associate III

@unsigned_char_array 
Thank you for these explanations on the cache and the stack. I'll have a special look at these.