TouchGFX + emVNC : How to copy area of current TFT framebuffer using DMA2D to a destination in blocking mode?
Hi,
I'm currently implementing SEGGER emVNC Server to work with touchgfx.
In fact, I already have a working solution. But I came up with an idea on how to speed up VNC with DMA2D.
To explain a bit in detail, emVNC has a callback which is called for retrieving a rectangle of pixels from the current TFT framebuffer. These rectangles are size of max 16x16 pixels (Hextile encoding).
Here is a callback function declaration:
/*********************************************************************
* readRect()
* x0: Pixel start coordinate
* y0: Pixel start coordinate
* x1: Pixel end coordinate
* y1: Pixel end coordinate
* pixelBuffer: Pointer to a buffer to store the pixel data (pixel index only, no color conversion)
*/
readRect(unsigned x0, unsigned y0, unsigned x1, unsigned y1, U32 * pixelBuffer);Currently I do that by looping through the framebuffer and retrieving pixel by pixel. This works quite well. But I was thinking that I could probably speed things up even more and reduce CPU usage by using DMA.
Given that the touchgfx task already uses DMA2D, I can't use it in the VNC task without locking it.
I wonder if I could use functions available in touchgfx for that:
HAL::lcd().copyFrameBufferRegionToMemory
or
HAL::getInstance()->copyFBRegionToMemory
Do these functions use locking of DMA2D and do they return when the DMA copy is complete ?
I would appreciate any feedback and ideas.
@Romain DIELEMAN