1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

DMA2D: invalidate cache only if enabled

This commit is contained in:
Gabor Kiss-Vamosi 2020-04-28 14:39:02 +02:00
parent 843fa5e304
commit a54d6a1752

View File

@ -41,6 +41,7 @@
/**********************
* STATIC PROTOTYPES
**********************/
static void invalidate_cache(void);
static void dma2d_wait(void);
/**********************
@ -67,9 +68,8 @@ static DMA2D_HandleTypeDef hdma2d;
*/
void lv_gpu_stm32_dma2d_fill(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, lv_coord_t fill_w, lv_coord_t fill_h)
{
#if __DCACHE_PRESENT
SCB_CleanInvalidateDCache();
#endif
invalidate_cache();
hdma2d.Instance = DMA2D;
hdma2d.Init.Mode = DMA2D_R2M;
hdma2d.Init.ColorMode = DMA2D_OUTPUT_FORMAT;
@ -98,9 +98,8 @@ void lv_gpu_stm32_dma2d_fill(lv_color_t * buf, lv_coord_t buf_w, lv_color_t colo
*/
void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, const lv_opa_t * mask, lv_opa_t opa, lv_coord_t fill_w, lv_coord_t fill_h)
{
#if __DCACHE_PRESENT
SCB_CleanInvalidateDCache();
#endif
invalidate_cache();
/* Configure the DMA2D Mode, Color Mode and line output offset */
hdma2d.Init.Mode = DMA2D_M2M_BLEND;
hdma2d.Init.ColorMode = DMA2D_OUTPUT_FORMAT;
@ -141,9 +140,8 @@ void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t
*/
void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h)
{
#if __DCACHE_PRESENT
SCB_CleanInvalidateDCache();
#endif
invalidate_cache();
hdma2d.Instance = DMA2D;
hdma2d.Init.Mode = DMA2D_M2M;
hdma2d.Init.ColorMode = DMA2D_OUTPUT_FORMAT;
@ -177,9 +175,8 @@ void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_
*/
void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_opa_t opa, lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h)
{
#if __DCACHE_PRESENT
SCB_CleanInvalidateDCache();
#endif
invalidate_cache();
hdma2d.Instance = DMA2D;
hdma2d.Init.Mode = DMA2D_M2M_BLEND;
hdma2d.Init.ColorMode = DMA2D_OUTPUT_FORMAT;
@ -210,6 +207,15 @@ void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color
* STATIC FUNCTIONS
**********************/
static void invalidate_cache(void)
{
#if __DCACHE_PRESENT
if(SCB->CCR & (uint32_t)SCB_CCR_DC_Msk) {
SCB_CleanInvalidateDCache();
}
#endif
}
static void dma2d_wait(void)
{
lv_disp_t * disp = lv_refr_get_disp_refreshing();