I was trying to build a GUI using the emWin library on the iMXRT1052 microcontroller and I encountered a performance problem. As far as I know, the LCD and GUI buffers should be placed in a non-cacheable region of SDRAM. This actually works fine, however I experience significant performance drop during moving actions of the GUI elements. I tried to enable the D cache for the whole SDRAM, however in this case the image on the display is broken (the first line on the display is shifted because of some missing pixels and whole image has an offset).
And here comes my question. What causes this problem and why the D cache needs to be disabled for the LCD buffers? Is there any way to clean and flush the cache just before displaying the image frame? Maybe this would help with the performance. Is there anything else that could help to achieve fast GUI without lagging elements?
I have already enabled two display buffers and also tried with the emwin MEMDEV flags. My working memory region configuration looks like this:
|MPU->RBAR = ARM_MPU_RBAR(8, 0x81000000U);|
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_16MB);
chainging it to:
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 1, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_16MB);
also doesn't work, but I guess this setting also should disable the cache.
EDIT: I also tried other cache configurations (including shareable with write through), but I am still having the same problem. It only works with the memory region configured as the Device type.