diff --git a/src/lv_gpu/lv_gpu_stm32_dma2d.c b/src/lv_gpu/lv_gpu_stm32_dma2d.c index 205b3d645..f11c4c6a4 100644 --- a/src/lv_gpu/lv_gpu_stm32_dma2d.c +++ b/src/lv_gpu/lv_gpu_stm32_dma2d.c @@ -42,6 +42,7 @@ /********************** * STATIC PROTOTYPES **********************/ +static void invalidate_cache(void); static void dma2d_wait(void); /********************** @@ -82,7 +83,7 @@ void lv_gpu_stm32_dma2d_init(void) */ 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) { - lv_disp_clean_dcache(_lv_refr_get_disp_refreshing()); + invalidate_cache(); DMA2D->CR = 0x30000; DMA2D->OMAR = (uint32_t)buf; @@ -112,7 +113,7 @@ void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t lv_opa_t opa, lv_coord_t fill_w, lv_coord_t fill_h) { #if 0 - lv_disp_clean_dcache(_lv_refr_get_disp_refreshing()); + invalidate_cache(); /* Configure the DMA2D Mode, Color Mode and line output offset */ hdma2d.Init.Mode = DMA2D_M2M_BLEND; @@ -156,7 +157,7 @@ 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) { - lv_disp_clean_dcache(_lv_refr_get_disp_refreshing()); + invalidate_cache(); DMA2D->CR = 0; /* copy output colour mode, this register controls both input and output colour format */ @@ -186,7 +187,7 @@ 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) { - lv_disp_clean_dcache(_lv_refr_get_disp_refreshing()); + invalidate_cache(); DMA2D->CR = 0x20000; DMA2D->BGPFCCR = LV_DMA2D_COLOR_FORMAT; @@ -214,6 +215,14 @@ 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) +{ + lv_disp_t * disp = _lv_refr_get_disp_refreshing(); + if(disp->driver.clean_dcache_cb) disp->driver.clean_dcache_cb(&disp->driver); + else + SCB_CleanInvalidateDCache(); +} + static void dma2d_wait(void) { lv_disp_t * disp = _lv_refr_get_disp_refreshing();