cancel
Showing results for 
Search instead for 
Did you mean: 

Performance issues with many images rotated using the Texture Mapper

scottSD
Senior III

I have an application where I will need to rotate multiple images at the same time and am seeing performance issues. I have tried it on the STM32F746G-Discovery as well as the newer STM32F750-Discovery and am seeing the RENDER_TIME run out and of course this causes frame skipping and then slight jerks in the rotation of the images.

I see similar issues when rotating shapes instead of images (although it is much better).

What things can I do to improve performance?

5 REPLIES 5

Hi @scottSD​ 

The texture mapper is a computational expensive operation and requires fast access to the assets which needs to be transformed.

Here are some pointers to consider when using the Texture Mapper:

  1. Size of assets, keep the amount of unnecessary transparent pixels to a minimum
  2. Where are the assets stored, internal or external -> internal storage is usually faster than external
  3. Nearest-neighbor or Bilinear interpolation, sometimes it is OK so sacrifice some quality to gain some performance (Nearest-neighbor is faster)
  4. Using Framerate compensation, allows the application to tick multiple times before rendering (See section "Compensating for reduced frame rate" https://touchgfx.zendesk.com/hc/en-us/articles/205377782-Timing-and-TFT-Controller-Integration).

/Anders

Anders,

Thanks for the input. I am aware of most of these suggestions. I am currently evaluating on a number of STM32 Discovery boards to determine if ST has enough graphics horsepower for our application. We need to rotate a number of images (sometimes simultaneously) . I have tried rotating Shapes instead and they perform much better, but I am unsure if the level of detail using a Shape is adequate.

Since I am just evaluating, I am not sure if the assets are stored in internal or external. I started with blank designs for the kits so I assume it is set at default? Where can I find what it is set to?

Kits I am using are STM32F769i-Discovery, STM32F746G-Discovery, and STM32H750-Discovery.

Also, is there a way to change the frame rate on these kits? The framerate is currently about 60Hz and I wonder if rendering at slower framerate (not just using Framerate compensation) would help. I have  hal.setFrameRateCompensation to true and this did help somewhat.

Hi @scottSD​ ,

By default all assets used by TouchGFX Designer are placed in external flash, in a section called "ExtFlashSection".

The easiest way of changing the location of assets is to insert a ".int" to the image files you want to place in internal flash.

Let's say you have an image called "myImage.png" then change the name to "myImage.int.png" and it will no longer be placed in the external flash. This section PRAGMA is no longer added to the image, have a look at "generated/images/src/myImage.cpp"

#include <touchgfx/hal/Config.hpp>
 
KEEP extern const unsigned char myImage[]  =   // 240x320 RGB565 pixels.
{ ...

where as normally it will have the "LOCATION_PRAGMA" prefix and the "LOCATION_ATTRIBUTE" postfix

#include <touchgfx/hal/Config.hpp>
 
LOCATION_PRAGMA("ExtFlashSection")
KEEP extern const unsigned char myImage[] LOCATION_ATTRIBUTE("ExtFlashSection") =   // 240x320 RGB565 pixels.
{ ...

The exact section placement of assets can be found in the linker scripts for each compiler.

You can lower the pixel clock for the LTDC (and DSI, F769), this will give the TouchGFX engine a bit more time to render each frame. Start out by just lowering the refresh rate by a couple of Hz. Please note that lowering the framerate too much could cause the screen to display incorrect.

Finally, the STM32H750-Discovery is by default set to have all code and assets stored in external flash and then execute from there, since it only has 128kB of internal flash.

Also, here is an article which describes how to measure performance on an application using either mcu load or a logic analyser and looking at the vsync, render time, frame rate, and mcu_active

https://touchgfx.zendesk.com/hc/en-us/articles/205419361-Measuring-Performance

/Anders

Thanks for the info Anders. I had tried most of this and am still seeing that rotating multiple images on the ST is probably not the way to go. And when I asked about changing the frame rate, I was expecting to be able to change it by a lot more than than (like reducing it by 1/2). Is this possible or is it dependent on the display hardware itself?

Another question I have related to the texture mapper:

Is it possible to change the set the bitmap to another bitmap after it is setup? My application may require changing the image during the animation or at the very least after an animation is complete. I have been able to change the alpha value during animation, but the texturemapper doesn't appear to allow me to change the bitmap (using the setBitmap() method). The bitmap I am changing it to is the same size.

Is this possible or is it dependent on the display hardware itself? - Yes it is dependent on the display.

I've used the Animated TextureMapper Example from the designer and modified the MainView::animationEndedHandler(const AnimationTextureMapper& src) to update the image when the animation is done, the function is located in gui/src/main_screen/MainView.cpp.

Please have a look to see if this helps.

/Anders