Skip to content

Commit 42f9345

Browse files
author
Alain Volmat
committed
drivers: video: add VIDEO_BUFFER_ZEPHYR_REGION for pool section
Add a Kconfig option in order to indicate in which Zephyr memory-region the video buffer pool should be stored. Signed-off-by: Alain Volmat <[email protected]>
1 parent 6a03018 commit 42f9345

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

drivers/video/Kconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ config VIDEO_BUFFER_POOL_ALIGN
3535
int "Alignment of the video pool’s buffer"
3636
default 64
3737

38+
config VIDEO_BUFFER_ZEPHYR_REGION
39+
bool "Place video pool in a Zephyr memory-region"
40+
help
41+
Place the video pool in a section, automatically
42+
creating from a 'zephyr,memory-region' compatible node,
43+
whose name is specified in VIDEO_BUFFER_ZEPHYR_REGION_NAME.
44+
45+
config VIDEO_BUFFER_ZEPHYR_REGION_NAME
46+
string "Name of the zephyr memory-region for video pool"
47+
depends on VIDEO_BUFFER_ZEPHYR_REGION
48+
help
49+
Name of the Zephyr memory-region where video pool is placed.
50+
3851
config VIDEO_BUFFER_USE_SHARED_MULTI_HEAP
3952
bool "Use shared multi heap for video buffer"
4053
default n

drivers/video/video_common.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,14 @@ LOG_MODULE_REGISTER(video_common, CONFIG_VIDEO_LOG_LEVEL);
2727
shared_multi_heap_aligned_alloc(CONFIG_VIDEO_BUFFER_SMH_ATTRIBUTE, align, size)
2828
#define VIDEO_COMMON_FREE(block) shared_multi_heap_free(block)
2929
#else
30+
#if defined(CONFIG_VIDEO_BUFFER_ZEPHYR_REGION)
31+
Z_HEAP_DEFINE_IN_SECT(video_buffer_pool,
32+
CONFIG_VIDEO_BUFFER_POOL_SZ_MAX * CONFIG_VIDEO_BUFFER_POOL_NUM_MAX,
33+
Z_GENERIC_SECTION(CONFIG_VIDEO_BUFFER_ZEPHYR_REGION_NAME));
34+
#else
3035
K_HEAP_DEFINE(video_buffer_pool,
31-
CONFIG_VIDEO_BUFFER_POOL_SZ_MAX * CONFIG_VIDEO_BUFFER_POOL_NUM_MAX);
36+
CONFIG_VIDEO_BUFFER_POOL_SZ_MAX * CONFIG_VIDEO_BUFFER_POOL_NUM_MAX);
37+
#endif
3238
#define VIDEO_COMMON_HEAP_ALLOC(align, size, timeout) \
3339
k_heap_aligned_alloc(&video_buffer_pool, align, size, timeout);
3440
#define VIDEO_COMMON_FREE(block) k_heap_free(&video_buffer_pool, block)

0 commit comments

Comments
 (0)