In many cases, some tweaking will substantially increase performance. It is therefore strongly recommended to follow the hints in this chapter.
Optimizing DMA During TFT Controller Access
The single most important performance optimization to perform is to allow DMA transfers to take place while the TFT controller is updating the display. This is done by calling the following function in your TouchGFX initialization code:
HAL::getInstance()->lockDMAToFrontPorch(false); //DMA is now no longer tied to the TFT controller.
When doing this, the DMA will no longer be locked to the TFT controller and thereby allowing DMA transfers to begin immediately, instead of having to wait until the front porch is entered (TFT controller exits active area). In most cases this will decrease the rendering time by around 25%. This optimization requires that the MCU of your platform is able to correctly perform arbiting of simulataneous RAM access by DMA and TFT. If this is not the case you will immediately see rendering errors on the display when enabling this optimization, in which case it cannot be used on that platform.
The board configurations distributed with TouchGFX are configured to enable this optimization on the platforms where it is known to be supported. If you use a custom board configuration, or a board configuration from TouchGFX 4.1.1 or earlier, you must manually enable this optimization.
If using single buffering, this optimization can only be applied in cases where you do not use a regular TFT controller. It is applicable, for instance, when using 8080 or DSI mode displays in single buffering configuration.
Optimizing VSYNC Timing
The article Timing and TFT Controller Integration explains in detail how the TFT controller timing relates to the rendering of frames. As mentioned earlier in the porting guide, having a VSYNC interval of around 16-20 milliseconds is generally a good value, but if you are seeing performance problems on particularly complex screens in your application, it is most likely a good idea to tweak the VSYNC interval.
Touch Sample Method and Frequency
If your application is depending on a low MCU load at all times, it can be a good idea to reduce the frequency with which the Touch Controller is being sampled, through the function
HAL::setTouchSampleRate. In many cases it will be sufficient to sample touch approximately every three ticks instead of every tick or maybe even rarer. Most, if not all, capacitive touch controllers have an output pin to signal that touch data if available. By reading this pin, unnecessary polling of the touch controller can be avoided.