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

Merge pull request #1743 from lvgl/dcache_cb

lv_disp: add `clean_dcache_cb` callback
This commit is contained in:
Gabor Kiss-Vamosi 2020-08-27 09:48:56 +02:00 committed by GitHub
commit 832000ad34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 4 deletions

View File

@ -9,6 +9,7 @@
- Add `lv_font_load()` function - Loads a `lv_font_t` object from a binary font file
- Add `lv_font_free()` function - Frees the memory allocated by the `lv_font_load()` function
- Add style caching to reduce acces time of properties with default value
- Add `clean_dcache_cb` and `lv_disp_clean_dcache` to enable users to use their own cache management function
### Bugfixes
- Fix color bleeding on border drawing

View File

@ -352,6 +352,21 @@ void lv_disp_trig_activity(lv_disp_t * disp)
disp->last_activity_time = lv_tick_get();
}
/**
* Clean any CPU cache that is related to the display.
* @param disp pointer to an display (NULL to use the default display)
*/
void lv_disp_clean_dcache(lv_disp_t * disp)
{
if(!disp) disp = lv_disp_get_default();
if(!disp) {
LV_LOG_WARN("lv_disp_clean_dcache: no display registered");
return;
}
if(disp->driver.clean_dcache_cb)
disp->driver.clean_dcache_cb(&disp->driver);
}
/**
* Get a pointer to the screen refresher task to

View File

@ -133,6 +133,12 @@ uint32_t lv_disp_get_inactive_time(const lv_disp_t * disp);
*/
void lv_disp_trig_activity(lv_disp_t * disp);
/**
* Clean any CPU cache that is related to the display.
* @param disp pointer to an display (NULL to use the default display)
*/
void lv_disp_clean_dcache(lv_disp_t * disp);
/**
* Get a pointer to the screen refresher task to
* modify its parameters with `lv_task_...` functions.

View File

@ -7,6 +7,7 @@
* INCLUDES
*********************/
#include "lv_gpu_stm32_dma2d.h"
#include "../lv_core/lv_disp.h"
#include "../lv_core/lv_refr.h"
#if LV_USE_GPU_STM32_DMA2D
@ -216,11 +217,10 @@ void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color
static void invalidate_cache(void)
{
#if __DCACHE_PRESENT
if(SCB->CCR & (uint32_t)SCB_CCR_DC_Msk) {
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();
}
#endif
}
static void dma2d_wait(void)

View File

@ -111,6 +111,9 @@ typedef struct _disp_drv_t {
* User can execute very simple tasks here or yield the task */
void (*wait_cb)(struct _disp_drv_t * disp_drv);
/** OPTIONAL: Called when lvgl needs any CPU cache that affects rendering to be cleaned */
void (*clean_dcache_cb)(struct _disp_drv_t * disp_drv);
#if LV_USE_GPU
/** OPTIONAL: Blend two memories using opacity (GPU only)*/
void (*gpu_blend_cb)(struct _disp_drv_t * disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length,