feat(nuttx_image_cache): add configuration to use image cache heap for default heap (#7653)
This commit is contained in:
5
Kconfig
5
Kconfig
@@ -1832,6 +1832,11 @@ menu "LVGL configuration"
|
|||||||
depends on LV_USE_NUTTX
|
depends on LV_USE_NUTTX
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
config LV_NUTTX_DEFAULT_DRAW_BUF_USE_INDEPENDENT_IMAGE_HEAP
|
||||||
|
bool "Use independent image heap for default draw buffer"
|
||||||
|
depends on LV_USE_NUTTX_INDEPENDENT_IMAGE_HEAP
|
||||||
|
default n
|
||||||
|
|
||||||
config LV_USE_NUTTX_LIBUV
|
config LV_USE_NUTTX_LIBUV
|
||||||
bool "Use uv loop to replace default timer loop and other fb/indev timers"
|
bool "Use uv loop to replace default timer loop and other fb/indev timers"
|
||||||
depends on LV_USE_NUTTX && LIBUV
|
depends on LV_USE_NUTTX && LIBUV
|
||||||
|
|||||||
@@ -1155,6 +1155,9 @@
|
|||||||
#if LV_USE_NUTTX
|
#if LV_USE_NUTTX
|
||||||
#define LV_USE_NUTTX_INDEPENDENT_IMAGE_HEAP 0
|
#define LV_USE_NUTTX_INDEPENDENT_IMAGE_HEAP 0
|
||||||
|
|
||||||
|
/** Use independent image heap for default draw buffer */
|
||||||
|
#define LV_NUTTX_DEFAULT_DRAW_BUF_USE_INDEPENDENT_IMAGE_HEAP 0
|
||||||
|
|
||||||
#define LV_USE_NUTTX_LIBUV 0
|
#define LV_USE_NUTTX_LIBUV 0
|
||||||
|
|
||||||
/** Use Nuttx custom init API to open window and handle touchscreen */
|
/** Use Nuttx custom init API to open window and handle touchscreen */
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ typedef struct {
|
|||||||
|
|
||||||
lv_draw_buf_malloc_cb malloc_cb;
|
lv_draw_buf_malloc_cb malloc_cb;
|
||||||
lv_draw_buf_free_cb free_cb;
|
lv_draw_buf_free_cb free_cb;
|
||||||
|
|
||||||
|
#if LV_NUTTX_DEFAULT_DRAW_BUF_USE_INDEPENDENT_IMAGE_HEAP
|
||||||
|
lv_draw_buf_malloc_cb malloc_cb_default;
|
||||||
|
lv_draw_buf_free_cb free_cb_default;
|
||||||
|
#endif
|
||||||
} lv_nuttx_ctx_image_cache_t;
|
} lv_nuttx_ctx_image_cache_t;
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC PROTOTYPES
|
* STATIC PROTOTYPES
|
||||||
@@ -77,6 +82,15 @@ void lv_nuttx_image_cache_init(bool use_independent_image_heap)
|
|||||||
handlers->buf_malloc_cb = malloc_cb;
|
handlers->buf_malloc_cb = malloc_cb;
|
||||||
handlers->buf_free_cb = free_cb;
|
handlers->buf_free_cb = free_cb;
|
||||||
|
|
||||||
|
#if LV_NUTTX_DEFAULT_DRAW_BUF_USE_INDEPENDENT_IMAGE_HEAP
|
||||||
|
handlers = lv_draw_buf_get_handlers();
|
||||||
|
ctx->malloc_cb_default = handlers->buf_malloc_cb;
|
||||||
|
ctx->free_cb_default = handlers->buf_free_cb;
|
||||||
|
|
||||||
|
handlers->buf_malloc_cb = malloc_cb;
|
||||||
|
handlers->buf_free_cb = free_cb;
|
||||||
|
#endif
|
||||||
|
|
||||||
ctx->initialized = false;
|
ctx->initialized = false;
|
||||||
ctx->independent_image_heap = use_independent_image_heap;
|
ctx->independent_image_heap = use_independent_image_heap;
|
||||||
}
|
}
|
||||||
@@ -93,6 +107,13 @@ FREE_CONTEXT:
|
|||||||
lv_draw_buf_handlers_t * handlers = image_cache_draw_buf_handlers;
|
lv_draw_buf_handlers_t * handlers = image_cache_draw_buf_handlers;
|
||||||
handlers->buf_malloc_cb = ctx->malloc_cb;
|
handlers->buf_malloc_cb = ctx->malloc_cb;
|
||||||
handlers->buf_free_cb = ctx->free_cb;
|
handlers->buf_free_cb = ctx->free_cb;
|
||||||
|
|
||||||
|
#if LV_NUTTX_DEFAULT_DRAW_BUF_USE_INDEPENDENT_IMAGE_HEAP
|
||||||
|
handlers = lv_draw_buf_get_handlers();
|
||||||
|
handlers->buf_malloc_cb = ctx->malloc_cb_default;
|
||||||
|
handlers->buf_free_cb = ctx->free_cb_default;
|
||||||
|
#endif
|
||||||
|
|
||||||
lv_free(ctx);
|
lv_free(ctx);
|
||||||
|
|
||||||
ctx = NULL;
|
ctx = NULL;
|
||||||
|
|||||||
@@ -3730,6 +3730,15 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/** Use independent image heap for default draw buffer */
|
||||||
|
#ifndef LV_NUTTX_DEFAULT_DRAW_BUF_USE_INDEPENDENT_IMAGE_HEAP
|
||||||
|
#ifdef CONFIG_LV_NUTTX_DEFAULT_DRAW_BUF_USE_INDEPENDENT_IMAGE_HEAP
|
||||||
|
#define LV_NUTTX_DEFAULT_DRAW_BUF_USE_INDEPENDENT_IMAGE_HEAP CONFIG_LV_NUTTX_DEFAULT_DRAW_BUF_USE_INDEPENDENT_IMAGE_HEAP
|
||||||
|
#else
|
||||||
|
#define LV_NUTTX_DEFAULT_DRAW_BUF_USE_INDEPENDENT_IMAGE_HEAP 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef LV_USE_NUTTX_LIBUV
|
#ifndef LV_USE_NUTTX_LIBUV
|
||||||
#ifdef CONFIG_LV_USE_NUTTX_LIBUV
|
#ifdef CONFIG_LV_USE_NUTTX_LIBUV
|
||||||
#define LV_USE_NUTTX_LIBUV CONFIG_LV_USE_NUTTX_LIBUV
|
#define LV_USE_NUTTX_LIBUV CONFIG_LV_USE_NUTTX_LIBUV
|
||||||
|
|||||||
Reference in New Issue
Block a user