2023-03-10 03:07 AM
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
2023-03-10 03:16 AM
2023-03-10 03:37 AM
Hey @MM..1 Thank you for pointing that out. But I've already read this post. I can't find any solution to my question.
I already have this part solved of marking the dirty area for VNC by using the flushFrameBuffer callback. I need a function to copy actual pixels from framebuffer to another part of memory using DMA2D. However, since touchgfx already uses DMA2D, this is not so trivial.
So I'm mainly interested in whether function copyFrameBufferRegionToMemory or
copyFBRegionToMemory uses locking of DMA2D and if it waits for completition of transfer (blocking mode). That way I can use just one of these functions.
2023-03-10 04:18 AM
Why you dont send vnc pixels directly from FB. DMA2D is good for accel different format image transfers. Same formats is exactly line by line normal DMA. Then maybe you cn use mem to mem DMA here.
2023-03-12 04:05 AM
Thanks for the idea. I will give it a try.