fix(draw): remove LV_LAYER_MAX_MEMORY_USAGE (#4809)

Signed-off-by: YanXiaowei <yanxiaowei@xiaomi.com>
Co-authored-by: YanXiaowei <yanxiaowei@xiaomi.com>
This commit is contained in:
bjsylvia
2023-11-25 03:17:10 +08:00
committed by GitHub
parent 0447443029
commit 990fbc8cdf
6 changed files with 13 additions and 47 deletions
-3
View File
@@ -80,9 +80,6 @@
/*Align the start address of draw_buf addresses to this bytes*/
#define LV_DRAW_BUF_ALIGN 4
/* Max. memory to be used for layers */
#define LV_LAYER_MAX_MEMORY_USAGE 150 /*[kB]*/
#define LV_USE_DRAW_SW 1
#if LV_USE_DRAW_SW == 1
/* Set the number of draw unit.
-6
View File
@@ -174,12 +174,6 @@ menu "LVGL configuration"
help
Align the start address of draw_buf addresses to this bytes.
config LV_LAYER_MAX_MEMORY_USAGE
int "Max layer memory usage(kB)"
default 150
help
Max. memory to be used for layers.
config LV_USE_OS
int "Default operating system to use"
default 0
-3
View File
@@ -79,9 +79,6 @@
/*Align the start address of draw_buf addresses to this bytes*/
#define LV_DRAW_BUF_ALIGN 4
/* Max. memory to be used for layers */
#define LV_LAYER_MAX_MEMORY_USAGE 150 /*[kB]*/
#define LV_USE_DRAW_SW 1
#if LV_USE_DRAW_SW == 1
/* Set the number of draw unit.
+13 -25
View File
@@ -27,6 +27,10 @@
**********************/
static bool is_independent(lv_layer_t * layer, lv_draw_task_t * t_check);
static inline uint32_t get_layer_size_kb(uint32_t size_byte)
{
return size_byte < 1024 ? 1 : size_byte >> 10;
}
/**********************
* STATIC VARIABLES
**********************/
@@ -155,7 +159,6 @@ void lv_draw_dispatch(void)
render_running = true;
layer = layer->next;
}
if(!render_running) {
lv_draw_dispatch_request();
}
@@ -185,7 +188,7 @@ bool lv_draw_dispatch_layer(struct _lv_display_t * disp, lv_layer_t * layer)
int32_t w = lv_area_get_width(&layer_drawn->buf_area);
uint32_t layer_size_byte = h * lv_draw_buf_width_to_stride(w, layer_drawn->color_format);
_draw_info.used_memory_for_layers_kb -= layer_size_byte < 1024 ? 1 : layer_size_byte >> 10;
_draw_info.used_memory_for_layers_kb -= get_layer_size_kb(layer_size_byte);
LV_LOG_INFO("Layer memory used: %" LV_PRIu32 " kB\n", _draw_info.used_memory_for_layers_kb);
lv_draw_buf_free(layer_drawn->buf_unaligned);
}
@@ -242,27 +245,13 @@ bool lv_draw_dispatch_layer(struct _lv_display_t * disp, lv_layer_t * layer)
}
/*Assign draw tasks to the draw_units*/
else {
bool layer_ok = true;
if(layer->buf == NULL) {
int32_t h = lv_area_get_height(&layer->buf_area);
int32_t w = lv_area_get_width(&layer->buf_area);
uint32_t layer_size_byte = h * lv_draw_buf_width_to_stride(w, layer->color_format);
uint32_t kb = layer_size_byte < 1024 ? 1 : layer_size_byte >> 10;
if(_draw_info.used_memory_for_layers_kb + kb > LV_LAYER_MAX_MEMORY_USAGE) {
layer_ok = false;
}
}
if(layer_ok) {
/*Find a draw unit which is not busy and can take at least one task*/
/*Let all draw units to pick draw tasks*/
lv_draw_unit_t * u = _draw_info.unit_head;
while(u) {
int32_t taken_cnt = u->dispatch_cb(u, layer);
if(taken_cnt >= 0) render_running = true;
u = u->next;
}
/*Find a draw unit which is not busy and can take at least one task*/
/*Let all draw units to pick draw tasks*/
lv_draw_unit_t * u = _draw_info.unit_head;
while(u) {
int32_t taken_cnt = u->dispatch_cb(u, layer);
if(taken_cnt >= 0) render_running = true;
u = u->next;
}
}
@@ -363,8 +352,7 @@ void * lv_draw_layer_alloc_buf(lv_layer_t * layer)
layer->buf = lv_draw_buf_align(layer->buf_unaligned, layer->color_format);
uint32_t kb = layer_size_byte < 1024 ? 1 : layer_size_byte >> 10;
_draw_info.used_memory_for_layers_kb += kb;
_draw_info.used_memory_for_layers_kb += get_layer_size_kb(layer_size_byte);
LV_LOG_INFO("Layer memory used: %" LV_PRIu32 " kB\n", _draw_info.used_memory_for_layers_kb);
if(lv_color_format_has_alpha(layer->color_format)) {
-9
View File
@@ -199,15 +199,6 @@
#endif
#endif
/* Max. memory to be used for layers */
#ifndef LV_LAYER_MAX_MEMORY_USAGE
#ifdef CONFIG_LV_LAYER_MAX_MEMORY_USAGE
#define LV_LAYER_MAX_MEMORY_USAGE CONFIG_LV_LAYER_MAX_MEMORY_USAGE
#else
#define LV_LAYER_MAX_MEMORY_USAGE 150 /*[kB]*/
#endif
#endif
#ifndef LV_USE_DRAW_SW
#ifdef _LV_KCONFIG_PRESENT
#ifdef CONFIG_LV_USE_DRAW_SW
-1
View File
@@ -1,5 +1,4 @@
#define LV_MEM_SIZE (32 * 1024 * 1024)
#define LV_LAYER_MAX_MEMORY_USAGE (4 * 1024)
#define LV_SHADOW_CACHE_SIZE (8 * 1024)
#define LV_IMAGE_CACHE_DEF_SIZE 32
#define LV_USE_LOG 1