-
Notifications
You must be signed in to change notification settings - Fork 7.6k
video: introduction of STM32 VENC driver for H264 hardware video compression #92884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
57454b2
b085c77
35bce9d
51ca23b
4cea4fa
4a1cde0
20d30f5
25ecf94
4419a21
ef412ab
58daa7c
a0908b1
75284f7
9465d39
5ffa36c
2878753
a32b1da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -58,6 +58,20 @@ config VIDEO_I2C_RETRY_NUM | |||||||||||||||||||||||
The default is to not retry. Board configuration files or user project can then | ||||||||||||||||||||||||
use the number of retries that matches their situation. | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
config VIDEO_BUFFER_USE_MEM_ATTR_HEAP | ||||||||||||||||||||||||
bool "Use mem attr api for video buffer" | ||||||||||||||||||||||||
default n | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
config VIDEO_BUFFER_MEM_SW_ATTRIBUTE | ||||||||||||||||||||||||
int "Mem SW attribute for video buffer" | ||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||
depends on VIDEO_BUFFER_USE_MEM_ATTR_HEAP | ||||||||||||||||||||||||
default 1 | ||||||||||||||||||||||||
help | ||||||||||||||||||||||||
Mem SW attribute for video buffer: | ||||||||||||||||||||||||
1: ATTR_SW_ALLOC_CACHE | ||||||||||||||||||||||||
2: ATTR_SW_ALLOC_NON_CACHE | ||||||||||||||||||||||||
4: ATTR_SW_ALLOC_DMA | ||||||||||||||||||||||||
Comment on lines
+70
to
+73
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be best to avoid duplicating information from the header.
Suggested change
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
source "drivers/video/Kconfig.esp32_dvp" | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
source "drivers/video/Kconfig.mcux_csi" | ||||||||||||||||||||||||
|
@@ -76,6 +90,8 @@ source "drivers/video/Kconfig.ov2640" | |||||||||||||||||||||||
|
||||||||||||||||||||||||
source "drivers/video/Kconfig.stm32_dcmi" | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
source "drivers/video/Kconfig.stm32_venc" | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
source "drivers/video/Kconfig.ov5640" | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
source "drivers/video/Kconfig.ov7670" | ||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# STM32 VENC driver configuration options | ||
|
||
# Copyright (c) 2025 Hugues Fruchet <hugues.fruchet@foss.st.com> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config VIDEO_STM32_VENC | ||
bool "STM32 video encoder (VENC) driver" | ||
default y | ||
depends on DT_HAS_ST_STM32_VENC_ENABLED | ||
select HAS_STM32LIB | ||
select USE_STM32_LL_VENC | ||
select USE_STM32_HAL_RIF if SOC_SERIES_STM32N6X | ||
help | ||
Enable driver for STM32 video encoder peripheral. |
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -26,6 +26,14 @@ LOG_MODULE_REGISTER(video_common, CONFIG_VIDEO_LOG_LEVEL); | |||||||||||||
#define VIDEO_COMMON_HEAP_ALLOC(align, size, timeout) \ | ||||||||||||||
shared_multi_heap_aligned_alloc(CONFIG_VIDEO_BUFFER_SMH_ATTRIBUTE, align, size) | ||||||||||||||
#define VIDEO_COMMON_FREE(block) shared_multi_heap_free(block) | ||||||||||||||
#elif defined(CONFIG_VIDEO_BUFFER_USE_MEM_ATTR_HEAP) | ||||||||||||||
#include <zephyr/mem_mgmt/mem_attr_heap.h> | ||||||||||||||
#include <zephyr/dt-bindings/memory-attr/memory-attr.h> | ||||||||||||||
|
||||||||||||||
#define VIDEO_COMMON_HEAP_ALLOC(align, size, timeout) \ | ||||||||||||||
mem_attr_heap_aligned_alloc((CONFIG_VIDEO_BUFFER_MEM_SW_ATTRIBUTE << \ | ||||||||||||||
DT_MEM_SW_ATTR_SHIFT), align, size) | ||||||||||||||
Comment on lines
+33
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
#define VIDEO_COMMON_FREE(block) mem_attr_heap_free(block) | ||||||||||||||
#else | ||||||||||||||
K_HEAP_DEFINE(video_buffer_pool, CONFIG_VIDEO_BUFFER_POOL_SZ_MAX*CONFIG_VIDEO_BUFFER_POOL_NUM_MAX); | ||||||||||||||
#define VIDEO_COMMON_HEAP_ALLOC(align, size, timeout) \ | ||||||||||||||
|
@@ -47,6 +55,9 @@ struct video_buffer *video_buffer_aligned_alloc(size_t size, size_t align, k_tim | |||||||||||||
struct mem_block *block; | ||||||||||||||
int i; | ||||||||||||||
|
||||||||||||||
#if defined(CONFIG_VIDEO_BUFFER_USE_MEM_ATTR_HEAP) | ||||||||||||||
mem_attr_heap_pool_init(); | ||||||||||||||
#endif | ||||||||||||||
Comment on lines
+58
to
+60
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: should check that return value is |
||||||||||||||
/* find available video buffer */ | ||||||||||||||
for (i = 0; i < ARRAY_SIZE(video_buf); i++) { | ||||||||||||||
if (video_buf[i].buffer == NULL) { | ||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+ maybe this should
depends on MEM_ATTR_HEAP