K230 system control API reference#
Overview#
Overview#
Based on the characteristics of the k230 chip, the system control completes the reset and basic initialization of various hardware components. It is also responsible for completing the initialization and de-initialization of MPP (Media Process Platform) system memory management, log management, binding management and other modules.
Functional Description#
Video cache pool#
The video buffer pool is a set of buffers (rather than one), mainly provided for use by multimedia hardware devices, and transferred between multimedia hardware devices. The cache pool is divided into public cache pool and private cache pool. The public cache pool is mainly for VI. Before use, you must determine the size of the cache block according to the image parameters of the VI, and then apply for a certain number of cache blocks to form a cache pool. Generally speaking, for the original picture input by the VI, the size of one frame corresponds to the size of one cache block. Multiple cache blocks are equivalent to providing a multi-frame caching mechanism for the VI. At the same time, these public cache blocks can also be used by VO or VENC. Private buffer pools often represent that the data stored in memory is closely related to the multimedia device itself. For example, the encoded code stream data is still very different from the actual video stream composed of image pixels. These code streams are only available to codecs, and VB provides dedicated buffer pools for these devices. The figure below shows the process of virtual VI and virtual VO using VB to transfer cache blocks.

System binding#
System binding is to establish an association between the two by binding the data receiver to the data source (only the data receiver is allowed to bind the data source). After binding, the data generated by the data source is automatically sent to the recipient. K230’s voice and video processing is mainly divided into several major modules as follows:
Voice: Voice input (Audio Input, referred to as AI), speech encoding (Audio Encoder, referred to as AENC), speech decoding (Audio Decoder, referred to as ADEC), speech output (Audio Output, referred to as AO)
Image: Video Input (VI for short), Video Encoder (VENC for short), image rotation (completed by GSDMA, DMA for short), Depth Process Unit (DPU for short), Image Decoder (VDEC for short), Video Output (VO for short), Virtual Video Input (VVI for short), Virtual Video Output (Virtual Video Output, referred to as VVO)
The binding relationships supported by K230 are as follows:
Table 11
Data source |
Data Recipient |
illustrate |
|---|---|---|
VI (video input) |
GSDMA |
VI data can be sent to GSDMA for rotation processing |
VO |
VI data can be sent directly to VO for display |
|
DPU |
VI data can be sent directly to the DPU for processing |
|
VENC |
VI data can be sent directly to VENC for processing |
|
GSDMA (image rotation) |
VO |
The data processed by GSDMA can be directly sent to VO for display. |
DPU |
The data processed by GSDMA can be directly sent to the DPU for processing. |
|
VENC |
The data processed by GSDMA can be directly sent to VENC for encoding. |
|
VDEC (video decoding) |
GSDMA |
VDEC data will eventually be played locally and may need to be rotated before playing. |
VO |
VDEC data will eventually be played locally |
|
DPU (Depth Processing Unit) |
None |
DPU is the end point of video data and does not support binding relationships. |
VENC (video encoding) |
None |
Binding relationships are not supported |
VO (video display) |
None |
VO is the end point of video data and does not support binding relationships. |
AI (audio input) |
AREC |
The data processed by AI can be directly sent to the speech recognition module for recognition. |
AENC |
The data processed by AI can be directly sent to the speech coding module for encoding. |
|
AO |
The data processed by AI can be played directly |
|
ADEC (speech decoding) |
AO |
The data processed by ADEC can be played directly |
AENC (speech coding) |
None |
Binding relationships are not supported |
AO (audio output) |
None |
AO is the end point of audio data and does not support binding relationships. |
API Reference#
Multimedia memory management#
This function module provides the following APIs:
kd_mpi_sys_mmz_alloc#
Description
Apply for MMZ memory in user space
Syntax
k_s32 kd_mpi_sys_mmz_alloc(k_u64* phy_addr, void** virt_addr, const k_char* mmb, const k_char* zone, k_u32 len);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
phy_addr |
Physical address pointer. |
Output |
virt_addr |
Pointer to a virtual address pointer. |
Output |
mmb |
String pointer to Mmb name. |
Input |
zone |
String pointer to the MMZ zone name. |
Input |
len |
Memory block size. |
Input |
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None.
Requirements
Header File: mpi_sys_api.h
Library File: libsys.a
Notes
MMZ consists of multiple zones, and each zone has multiple MMBs. You can call this MPI to allocate a memory block of size len*mmb in the MMZ of *zone. In this case, pointers to the physical address and user-mode virtual address are returned. If an anonymous zone exists in the MMZ, set *zone to null. If *mmb is set to null, the created MMB is named null.
Example
None
Related Topics
None
kd_mpi_sys_mmz_alloc_cached#
Description
Apply for MMZ memory with cache in user space
Syntax
k_s32 kd_mpi_sys_mmz_alloc_cached(k_u64* phy_addr, void** virt_addr, const k_char* mmb, const k_char* zone, k_u32 len);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
phy_addr |
Physical address pointer. |
Output |
virt_addr |
Pointer to a virtual address pointer. |
Output |
mmb |
String pointer to Mmb name. |
Input |
zone |
String pointer to the MMZ zone name. |
Input |
len |
Memory block size. |
Input |
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None
Requirements
Header File: mpi_sys_api.h
Library File: libsys.a
Notes
The difference between kd_mpi_sys_mmz_alloc_cached and kd_mpi_sys_mmz_alloc: The memory allocated by calling kd_mpi_sys_mmz_alloc_cached supports caching. If the memory to be allocated will be used frequently, it is recommended to use kd_mpi_sys_mmz_alloc_cached. This can improve CPU read/write efficiency and system performance.
When the CPU accesses the memory allocated by this interface, the data in the memory will be placed in the cache. If the hardware device can only access physical memory and not cache, in this case kd_mpi_sys_mmz_flush_cache needs to be called to synchronize the data.
Example
None
Related Topics
None
kd_mpi_sys_mmap#
Description
memory storage mapping interface.
Syntax
void *kd_mpi_sys_mmap(k_u64 phy_addr, k_u32 size);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
phy_addr |
The starting address of the memory unit to be mapped |
Input |
size |
Number of bytes mapped |
Input |
Return Value
Return Value |
describe |
|---|---|
0 |
Invalid address |
non-0 |
valid address |
Chip differences
None
Requirements
Header File: mpi_sys_api.h
Library File: libsys.a
Notes
Only physical addresses obtained through MMZ application can be mapped using this API.
If the address range belongs to a VB, then the size of the mapping needs to be smaller than the size of the VB pool
Example
None
Related Topics
kd_mpi_sys_mmap_cached#
Description
memory storage mapping interface with cache.
Syntax
void *kd_mpi_sys_mmap_cached(k_u64 phy_addr, k_u32 size);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
phy_addr |
The starting address of the memory unit to be mapped |
Input |
size |
Number of bytes mapped |
Input |
Return Value
Return Value |
describe |
|---|---|
0 |
Invalid address |
non-0 |
valid address |
Chip differences
None
Requirements
Header File: mpi_sys_api.h
Library File: libsys.a
Notes
Only physical addresses obtained through MMZ application can be mapped using this API.
If the address range belongs to a VB, then the size of the mapping needs to be smaller than the size of the VB pool
Example
None
Related Topics
None
kd_mpi_sys_munmap#
Description
memory storage mapping de-interface.
Syntax
void *kd_mpi_sys_munmap(void *virt_addr, k_u32 size);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
virt_addr |
virtual address returned by mmap |
Input |
size |
Number of bytes mapped |
Input |
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
fail |
Chip differences
None
Requirements
Header File: mpi_sys_api.h
Library File: libsys.a
Notes
None
Example
None
Related Topics
kd_mpi_sys_mmz_flush_cache#
Description
Flush the contents of the cache to memory and invalidate the contents of the cache.
Syntax
k_s32 kd_mpi_sys_mmz_flush_cache(k_u64 phy_addr, void* virt_addr, k_u32 size);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
phy_addr |
The starting physical address of the data to be operated on. |
Input |
virt_addr |
The starting virtual address pointer of the data to be operated on. Cannot pass NULL |
Input |
size |
The size of the data to be operated on |
Input |
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None
Requirements
Header File: mpi_sys_api.h
Library File: libsys.a
Notes
If the data in the cache is the latest data, you need to call this MPI to synchronize the data to memory. This ensures that hardware that does not have direct access to the cache can get the correct data. .
You must first call kd_mpi_sys_mmz_alloc_cached and then use this MPI
If phy_addr is set to 0, it means operating the entire cache area. (not supported yet)
You need to ensure that the parameters passed are valid
Make sure not to call kd_mpi_sys_mmz_free to release the refreshed memory when performing a refresh operation. Otherwise, unpredictable exceptions may occur.
Example
None
Related Topics
kd_mpi_sys_mmz_free#
Description
Release MMZ memory in user mode.
Syntax
k_s32 kd_mpi_sys_mmz_free(k_u64 phy_addr, void* virt_addr);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
phy_addr |
physical address. |
Input |
virt_addr |
Virtual address pointer. |
Input |
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None
Requirements
Header File: mpi_sys_api.h
Library File: libsys.a
Notes
The entered address must be a valid physical address, and the virtual address pointer can be set to NULL.
Memory that is undergoing a flush operation cannot be released, otherwise an unpredictable exception will occur.
Example
None
Related Topics
kd_mpi_sys_get_virmem_info#
Description
Obtain the corresponding memory information based on the virtual address, including physical address and cached attribute
Syntax
k_s32 kd_mpi_sys_get_virmem_info(const void* virt_addr, k_sys_virmem_info* mem_info);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
virt_addr |
Virtual address pointer. |
Input |
mem_info |
Memory information corresponding to the virtual address, including physical address, cached attributes and other information. |
Output |
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None
Requirements
Header File: mpi_sys_api.h k_mmz_comm.h
Library File: libsys.a
Notes
The input must be a user-space virtual address.
Cross-process use is not supported.
Example
None
Related Topics
kd_mpi_vb_set_config#
Description
Set MPP video buffer pool properties.
Syntax
k_s32 kd_mpi_vb_set_config(const k_vb_config *config);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
config |
Video cache pool attribute pointer. |
Input |
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None
Requirements
Header File: mpi_vb_api.h k_vb_comm.h
Library File: libvb.a
Notes
The cache pool properties can only be set when the system is in an uninitialized state, otherwise failure will be returned.
The size of each cache block in the common cache pool should vary based on the current image pixel format and whether the image is compressed. For the specific allocation size, please refer to the description in the k_vb_config structure.
Example
None
Related Topics
kd_mpi_vb_get_config#
Description
Get MPP video buffer pool properties.
Syntax
k_s32 kd_mpi_vb_get_config(const k_vb_config *config);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
config |
Video cache pool attribute pointer. |
Output |
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None
Requirements
Header File: mpi_vb_api.h k_vb_comm.h
Library File: libvb.a
Notes
You must first call kd_mpi_vb_set_config to set the MPP video cache pool properties, and then get the properties.
Example
None
Related Topics
kd_mpi_vb_init#
Description
Initialize the MPP video buffer pool. .
Syntax
k_s32 kd_mpi_vb_init(void);
Parameters
None
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None
Requirements
Header File: mpi_vb_api.h k_vb_comm.h
Library File: libvb.a
Notes
You must first call kd_mpi_vb_set_config to set the MPP video cache pool properties and then initialize the cache pool, otherwise it will fail.
Can be initialized repeatedly without returning failure.
Example
None
Related Topics
kd_mpi_vb_exit#
Description
De-initialize the MPP video buffer pool.
Syntax
k_s32 kd_mpi_vb_exit(void);
Parameters
None
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None
Requirements
Header File: mpi_vb_api.h k_vb_comm.h
Library File: libvb.a
Notes
Deinitialization does not clear the previous configuration of the cache pool.
Can be deinitialized repeatedly without returning failure.
Before exiting the VB pool, please make sure that no VB in the VB pool is occupied, otherwise you cannot exit.
Example
None
Related Topics
kd_mpi_vb_create_pool#
Description
Create a video cache pool
Syntax
k_s32 kd_mpi_vb_create_pool(k_vb_pool_config *config);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
config |
Cache pool configuration property parameter pointer |
Input |
Return Value
Return Value |
describe |
|---|---|
Not VB_INVALID_POOLID |
A valid cache pool ID number |
VB_INVALID_POOLID |
The cache pool creation failed, possibly because the parameters are illegal or the reserved memory is insufficient. |
Chip differences
None
Requirements
Header File: mpi_vb_api.h k_vb_comm.h
Library File: libvb.a
Notes
None
Example
None
Related Topics
kd_mpi_vb_destory_pool#
Description
Destroy a video buffer pool.
Syntax
k_s32 kd_mpi_vb_destory_pool(k_u32 pool_id);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
pool_id |
Cache pool ID number. Value range: [0, VB_MAX_POOLS). |
Input |
Return Value
Return Value |
describe |
|---|---|
0 |
success. |
Not 0 |
Failure, see error code for its value. |
Chip differences
None
Requirements
Header File: mpi_vb_api.h k_vb_comm.h
Library File: libvb.a
Notes
Destroying a non-existent cache pool will return K_ERR_VB_UNEXIST
Only cache pools created by kd_mpi_vb_create_pool can be destroyed
Example
None
Related Topics
kd_mpi_vb_get_block#
Description
User mode gets a cache block
Syntax
k_vb_blk_handle kd_mpi_vb_get_block(k_u32 pool_id, k_u64 blk_size, const k_char *mmz_name);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
pool_id |
Cache pool ID number. Value range: [0, VB_MAX_POOLS). |
Input |
blk_size |
Cache block size. Value range: the full range of the data type, in byte. |
Input |
mmz_name |
The name of the DDR where the cache pool is located. |
Input |
Return Value
Return Value |
describe |
|---|---|
Not VB_INVALID_HANDLE |
A valid cache block handle |
VB_INVALID_HANDLE |
Failed to get cache block |
Chip differences
None
Requirements
Header File: mpi_vb_api.h k_vb_comm.h
Library File: libvb.a
Notes
After creating a cache pool, the user can call this interface to obtain a cache block from the cache pool; that is, set the first parameter Pool to the created cache pool ID; when obtaining a cache block from the specified cache pool, the parameter mmz_name is invalid
If the user needs to obtain a cache block of a specified size from any public cache pool, the first parameter Pool can be set to an invalid ID number (VB_INVALID_POOLID), the second parameter blk_size can be set to the required cache block size, and the cache block can be obtained from the public cache pool on which DDR. If there is no public cache pool on the specified DDR, the cache block will not be obtained. If mmz_name equals NULL, it means that the cache block is obtained from the public cache pool on the anonymous DDR.
Example
None
Related Topics
kd_mpi_vb_release_block#
Description
User mode releases a cache block
Syntax
k_s32 kd_mpi_vb_release_block(k_vb_blk_handle block);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
block |
vb block handle |
Input |
Return Value
Return Value |
describe |
|---|---|
0 |
success. |
Not 0 |
Failure, see error code for its value. |
Chip differences
None
Requirements
Header File: mpi_vb_api.h k_vb_comm.h
Library File: libvb.a
Notes
After the obtained cache block is used up, this interface should be called to release the cache block.
Example
None
Related Topics
kd_mpi_vb_phyaddr_to_handle#
Description
User mode obtains the handle of the cache block through its physical address.
Syntax
k_vb_blk_handle kd_mpi_vb_phyaddr_to_handle(k_u64 phys_addr);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
phys_addr |
physical address |
Input |
Return Value
Return Value |
describe |
|---|---|
Not VB_INVALID_HANDLE |
A valid cache block handle |
VB_INVALID_HANDLE |
Failed to obtain cache cache handle |
Chip differences
None
Requirements
Header File: mpi_vb_api.h k_vb_comm.h
Library File: libvb.a
Notes
The physical address should be the address of a valid cache block obtained from the MPP video cache pool.
Example
None
Related Topics
None
kd_mpi_vb_handle_to_phyaddr#
Description
User mode obtains the physical address of a cache block
Syntax
k_u64 kd_mpi_vb_handle_to_phyaddr(k_vb_blk_handle block);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
block |
vb block handle |
Input |
Return Value
Return Value |
describe |
|---|---|
0 |
Invalid return value, illegal cache block handle. |
Not 0 |
Valid physical address. |
Chip differences
None
Requirements
Header File: mpi_vb_api.h k_vb_comm.h
Library File: libvb.a
Notes
The specified cache block should be a valid cache block obtained from the MPP video cache pool.
Example
None
Related Topics
None
kd_mpi_vb_handle_to_pool_id#
Description
User mode obtains the ID of the buffer pool where a frame buffer block is located.
Syntax
k_s32 kd_mpi_vb_handle_to_pool_id(k_vb_blk_handle block);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
block |
vb block handle |
Input |
Return Value
Return Value |
describe |
|---|---|
Not VB_INVALID_POOLID |
A valid cache pool ID number |
VB_INVALID_POOLID |
Failed to obtain cache pool ID. |
Chip differences
None
Requirements
Header File: mpi_vb_api.h k_vb_comm.h
Library File: libvb.a
Notes
The specified cache block should be a valid cache block obtained from the MPP video cache pool.
Example
None
Related Topics
None
kd_mpi_vb_inquire_user_cnt#
Description
Query cache block usage count information.
Syntax
k_s32 kd_mpi_vb_inquire_user_cnt(k_vb_blk_handle block);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
block |
vb block handle |
Input |
Return Value
Return Value |
describe |
|---|---|
K_FAILED |
Query failed |
other values |
Cache block usage count value. |
Chip differences
None
Requirements
Header File: mpi_vb_api.h k_vb_comm.h
Library File: libvb.a
Notes
None.
Example
None
Related Topics
None
kd_mpi_vb_get_supplement_attr#
Description
Get auxiliary information for VB Block memory.
Syntax
k_s32 kd_mpi_vb_get_supplement_attr(k_vb_blk_handle block, k_video_supplement *supplement);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
block |
vb block handle |
Input |
supplement |
Auxiliary information of vb block memory. Such as ISP information, DCF information, etc. |
Output |
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None
Requirements
Header File: mpi_vb_api.h k_vb_comm.h
Library File: libvb.a
Notes
The virtual address information of DCF and ISP saved in Supplement is the kernel state virtual address.
Example
None
Related Topics
None
kd_mpi_vb_set_supplement_config#
Description
Sets additional information for VB memory.
Description
Some information needs to be appended to the VB memory. For example, DCF information, ISP statistical information, some real-time parameters of ISP, etc. These additional information can be transferred to each module of MPP along with VB memory. User mode can obtain VB memory and also obtain this information.
Syntax
k_s32 kd_mpi_vb_get_supplement_config(k_vb_supplement_config *supplement_config);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
supplement_config |
VB memory additional information control structure. Allocate memory for additional information. |
Input |
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None
Requirements
Header File: mpi_vb_api.h k_vb_comm.h
Library File: libvb.a
Notes
Currently, 2 types of VB memory additional information are supported, namely:
DCF information, corresponding to structure k_jpeg_dcf. The corresponding MASK is VB_SUPPLEMENT_JPEG_MASK.
ISP information, the corresponding result is k_isp_frame_info. The corresponding MASK is VB_SUPPLEMENT_ISPINFO_MASK.
This interface needs to be called before kd_mpi_vb_init for the auxiliary information to take effect.
Example
None
Related Topics
kd_mpi_vb_get_supplement_config#
Description
Get additional information about VB memory.
Syntax
k_s32 kd_mpi_vb_set_supplement_config(const k_vb_supplement_config *supplement_config);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
supplement_config |
VB memory additional information control structure. Allocate memory for additional information. |
Output |
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None
Requirements
Header File: mpi_vb_api.h k_vb_comm.h
Library File: libvb.a
Notes
None
Example
None
Related Topics
kd_mpi_vb_set_supplement_config
kd_mpi_vb_set_mod_pool_config#
Description
Set module public video buffer pool properties.
Syntax
k_s32 kd_mpi_vb_set_mod_pool_config(k_vb_uid vb_uid, const k_vb_config *config);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
vb_uid |
Use the module ID of the module’s public video pool. |
Input |
config |
Video cache pool attribute pointer. |
Input |
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None
Requirements
Header File: mpi_vb_api.h k_vb_comm.h
Library File: libvb.a
Notes
The configuration of the module’s public video buffer should be configured according to actual needs, otherwise it will cause a waste of memory.
If the module VB has been created, configuring it again will return the error code KD_ERR_VB_BUSY
Example
None
Related Topics
kd_mpi_vb_get_mod_pool_config#
Description
Get the module public video buffer pool properties.
Syntax
k_s32 kd_mpi_vb_get_mod_pool_config(k_vb_uid vb_uid, k_vb_config *config);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
vb_uid |
Use the module ID of the module’s public video buffer pool |
Input |
config |
Video cache pool attribute pointer. |
Output |
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None
Requirements
Header File: mpi_vb_api.h k_vb_comm.h
Library File: libvb.a
Notes
You must first call kd_mpi_vb_set_mod_pool_config to set the module public video cache pool attributes, and then obtain the attributes.
sex.
Example
None
Related Topics
kd_mpi_vb_init_mod_common_pool#
Description
Initialize module public video buffer pool.
Syntax
k_s32 kd_mpi_vb_init_mod_common_pool(k_vb_uid vb_uid);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
vb_uid |
Use the module ID of the module’s public video pool. |
Input |
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None
Requirements
Header File: mpi_vb_api.h k_vb_comm.h
Library File: libvb.a
Notes
kd_mpi_vb_init must be called first to initialize the public video buffer pool.
You must first call kd_mpi_vb_set_mod_pool_config to configure the cache pool properties and then initialize the cache pool, otherwise it will fail.
Can be initialized repeatedly without returning failure.
Example
None
Related Topics
kd_mpi_vb_exit_mod_common_pool#
Description
Exit the module public video buffer pool.
Syntax
k_s32 kd_mpi_vb_exit_mod_common_pool(k_vb_uid vb_uid);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
vb_uid |
Use the module ID of the module’s public video pool. |
Input |
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None
Requirements
Header File: mpi_vb_api.h k_vb_comm.h
Library File: libvb.a
Notes
This interface must be called before calling kd_mpi_vb_exit, otherwise failure will be returned.
After exiting, the previous configuration of the module’s public video cache pool will be cleared.
Can exit repeatedly without returning failure.
Before exiting the VB pool, please make sure that no VB in the VB pool is occupied, otherwise you cannot exit.
Example
None
Related Topics
System binding#
This function module provides the following APIs:
kd_mpi_sys_bind#
Description
Data source to data receiver binding interface
Syntax
k_s32 kd_mpi_sys_bind(k_mpp_chn *src_chn, k_mpp_chn *dest_chn);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
src_chn |
Source channel pointer. |
Input |
dest_chn |
Destination channel pointer. |
Input |
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None
Requirements
Header File: mpi_sys_api.h k_module.h
Library File: libsys.a
Notes
For the binding relationships currently supported by the system, see Table 1-1.
The same data receiver can only be bound to one data source.
Binding refers to the establishment of an association between a data source and a data receiver. After binding, the data generated by the data source will automatically send to recipient
Example
None/xx.
Related Topics
kd_mpi_sys_unbind#
Description
Data source to data receiver unbinding interface.
Syntax
k_s32 kd_mpi_sys_unbind(k_mpp_chn *src_chn, k_mpp_chn *dest_chn);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
src_chn |
Source channel pointer. |
Input |
dest_chn |
Destination channel pointer. |
Input |
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None
Requirements
Header File: mpi_sys_api.h k_module.h
Library File: libsys.a
Notes
pstDestChn If the bound source channel cannot be found, success will be returned directly. If the bound source channel is found, However, if the bound source channel does not match pstSrcChn, failure will be returned.
Example
None/xx.
Related Topics
kd_mpi_sys_get_bind_by_dest#
Description
Get information about the source channel bound on this channel.
Syntax
k_s32 kd_mpi_sys_get_bind_by_dest(k_mpp_chn *dest_chn, k_mpp_chn *src_chn);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
src_chn |
Source channel pointer. |
Output |
dest_chn |
Destination channel pointer. |
Input |
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None
Requirements
Header File: mpi_sys_api.h k_module.h
Library File: libsys.a
Notes
None
Example
None/xx.
Related Topics
Log management#
This function module provides the following APIs:
kd_mpi_log_set_level_conf#
Description
Set the log level.
Syntax
k_s32 kd_mpi_log_set_level_conf(const k_log_level_conf *conf);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
conf |
Log level information structure. |
Input |
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None
Requirements
Header File: mpi_sys_api.h k_module.h k_log_comm.h
Library File: libsys.a
Notes
When the member mod_name in conf is set to the string “all”, the log level of all modules will be set. No Then, only set the log level of the module specified by mod_id
Example
None
Related Topics
kd_mpi_log_get_level_conf#
Description
Set the log level.
Syntax
k_s32 kd_mpi_log_get_level_conf(k_log_level_conf *conf);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
conf->mod_id |
The module ID of the log level needs to be obtained. |
Input |
conf->level |
Obtained log level |
Output |
conf->mod_name |
module name |
Output |
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None
Requirements
Header File: mpi_sys_api.h k_module.h k_log_comm.h
Library File: libsys.a
Notes
None
Example
None
Related Topics
kd_mpi_log_set_wait_flag#
Description
Sets the wait flag while reading the log.
Syntax
k_s32 kd_mpi_log_set_wait_flag(k_bool is_wait);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
is_wait |
Flag whether to wait when reading the log. |
Input |
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None
Requirements
Header File: mpi_sys_api.h k_module.h k_log_comm.h
Library File: libsys.a
Notes
None
Example
None
Related Topics
None
kd_mpi_log_read#
Description
Read the log.
Syntax
k_s32 kd_mpi_log_read(k_char *buf, k_u32 size);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
buf |
Memory pointer used to store logs. |
Output |
size |
The size of the read log. |
Input |
Return Value
Return Value |
describe |
|---|---|
Greater than or equal to 0 |
The size of the log successfully read. |
Chip differences
None
Requirements
Header File: mpi_sys_api.h k_module.h k_log_comm.h
Library File: libsys.a
Notes
None
Example
None
Related Topics
None
kd_mpi_log_close#
Description
Close the log file.
Syntax
void kd_mpi_log_close(void);
Parameters
None
Return Value
None
Chip differences
None
Requirements
Header File: mpi_sys_api.h k_module.h k_log_comm.h
Library File: libsys.a
Notes
None
Example
None
Related Topics
None
kd_mpi_log_set_console#
Description
Configure whether logs are printed directly through the console.
Syntax
k_s32 kd_mpi_log_get_console(k_bool *is_console);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
is_console |
Whether to print via the console |
Input |
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None
Requirements
Header File: mpi_sys_api.h k_module.h k_log_comm.h
Library File: libsys.a
Notes
None
Example
None
Related Topics
kd_mpi_log_get_console#
Description
Get whether the log is printed directly through the console.
Syntax
k_s32 kd_mpi_log_set_console(k_bool is_console);
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
is_console |
Whether to print via the console |
Output |
Return Value
Return Value |
describe |
|---|---|
0 |
Success |
non-0 |
Failure, see error code for its value |
Chip differences
None
Requirements
Header File: mpi_sys_api.h k_module.h k_log_comm.h
Library File: libsys.a
Notes
None
Example
None
Related Topics
data type#
public data type#
This module has the following data types
k_mod_id#
Description
Defines the module ID enumeration type.
definition
typedef enum {
K_ID_CMPI = 0, /*< common module platform interface */
K_ID_LOG = 1, /*< mpi device log */
K_ID_MMZ = 2, /*< media memory zone */
K_ID_MMZ_USER_DEV = 3, /*< media memory zone user used */
K_ID_VB = 4, /*< video buffer device */
K_ID_SYS = 5, /*< system contrl device */
K_ID_VI = 6, /*< video in device */
K_ID_VPROC = 7, /*< video proc device */
K_ID_VREC = 8, /*< video recognize device */
K_ID_VENC = 9, /*< video encoding device */
K_ID_VDEC = 10, /*< video decoding device */
K_ID_VO = 11, /*< video output device */
K_ID_AI = 12, /*< audio input device */
K_ID_AREC = 13, /*< audio recognize device */
K_ID_AENC = 14, /*< audio encoding device */
K_ID_ADEC = 15, /*< audio decoding device */
K_ID_AO = 16, /*< audio output device */
K_ID_DPU = 17, /*< depth Process Unit */
K_ID_V_VI, /*< virtual video input device */
K_ID_V_VO, /*< virtual video output device */
K_ID_DMA, /*< dma device */
K_ID_BUTT, /*< Invalid */
} k_mod_id;
Notes
None
Related Data Types and Interfaces
None
k_mpp_chn#
Description
Defines the module ID enumeration type.
definition
typedef struct {
k_mod_id mod_id; /*< Module ID */
k_s32 dev_id; /*< Device ID */
k_s32 chn_id; /*< Channel ID */
} k_mpp_chn;
member
Member name |
describe |
|---|---|
mod_id |
module number |
dev_id |
Device number |
chn_id |
Channel number |
Notes
None
Related Data Types and Interfaces
Multimedia memory management#
This module has the following data types
VB_MAX_POOLS#
Description
Maximum number of video cache pools
definition
#define VB_SINGLE_MAX_BLKS 256
Notes
None
Related Data Types and Interfaces
None
k_vb_uid#
Description
Defines the module ID enumeration type.
definition
typedef enum {
VB_UID_VI = 0,
VB_UID_VPROC = 1,
VB_UID_VREC = 2,
VB_UID_VENC = 3,
VB_UID_VDEC = 4,
VB_UID_VO = 5,
VB_UID_USER = 6,
VB_UID_AI = 7,
VB_UID_AREC = 8,
VB_UID_AENC = 9,
VB_UID_ADEC = 10,
VB_UID_AO = 11,
VB_UID_V_VI = 12,
VB_UID_V_VO = 13,
VB_UID_DMA = 14,
VB_UID_BUTT = 15,
}k_vb_uid;
Notes
None
Related Data Types and Interfaces
None
k_vb_config#
Description
Define the video cache pool attribute structure.
definition
typedef struct {
k_u32 max_pool_cnt;
k_vb_pool_config comm_pool[VB_MAX_COMM_POOLS];
} k_vb_config;
member
Member name |
describe |
|---|---|
max_pool_cnt |
The number of cache pools that can be accommodated in the entire system. Value range: (0, VB_MAX_POOLS] |
comm_pool |
Public cache pool attribute structure. static properties |
Notes
If blk_size is equal to 0 or blk_cnt is equal to 0, the corresponding buffer pool will not be created.
It is recommended to memset the entire structure to 0 first and then assign values as needed.
Related Data Types and Interfaces
kd_mpi_vb_get_config
k_vb_pool_config#
Description
Define the video cache pool attribute structure.
definition
typedef struct
{
k_u64 blk_size; /*< Size of each VB block*/
k_u32 blk_cnt; /*< Number of blocks*/
k_vb_remap_mode mode; /*< Mapping mode of the kernel mode virtual addresses of the VB*/
char mmz_name[MAX_MMZ_NAME_LEN];/*< Name of the MMZ that allocates the memory for the current VB pool*/
}k_vb_pool_config;
member
Member name |
describe |
|---|---|
blk_size |
Cache block size, in Byte bits. |
blk_cnt |
The number of cache blocks per cache pool. 0 ~ VB_SINGLE_MAX_BLKS |
mode |
VB’s kernel-mode virtual address mapping mode |
mmz_name |
The MMZ area from which the current cache pool allocates memory. |
Notes
The size u64BlkSize of each cache block should be calculated based on the current image width and height, pixel format, data bit width, whether to be compressed, etc.
The cache pool is allocated from free MMZ memory, and a cache pool contains several cache blocks of the same size. If the size of the cache pool exceeds the free space in reserved memory, creating the cache pool fails.
The user needs to ensure that the entered DDR name already exists. If the entered DDR name does not exist, the component will not be stored in the memory. If the array mmz_name is memset to 0 it means creating a buffer pool in an unnamed DDR.
Related Data Types and Interfaces
k_vb_remap_mode#
Description
Define VB kernel mode virtual address mapping mode.
definition
typedef enum {
VB_REMAP_MODE_NONE = 0, /*< no remap */
VB_REMAP_MODE_NOCACHE = 1, /*< no cache remap */
VB_REMAP_MODE_CACHED = 2, /*< cache remap, if you use this mode, you should flush cache by yourself */
VB_REMAP_MODE_BUTT
} k_vb_remap_mode;
member
Member name |
describe |
|---|---|
VB_REMAP_MODE_NONE |
Not mapped. |
VB_REMAP_MODE_NOCACHE |
mapped to nocache |
VB_REMAP_MODE_CACHED |
map to cache |
Notes
None
Related Data Types and Interfaces
None
k_vb_supplement_config#
Description
Define VB additional information structure.
definition
typedef struct
{
k_u32 supplement_config; /*<Control of the auxiliary information*/
}k_vb_supplement_config;
member
Member name |
describe |
|---|---|
supplement_config |
Additional information control |
Notes
Currently, 2 types of additional information are supported. For details, please refer to the description of interface kd_mpi_vb_set_supplement_config.
Related Data Types and Interfaces
Video public data type#
This module has the following data types
k_video_frame_info#
Description
Define video image frame information structure
definition
typedef struct {
k_video_frame v_frame; /*< Video picture frame */
k_u32 pool_id; /*< VB pool ID */
k_mod_id mod_id; /*< Logical unit for generating video frames */
} k_video_frame_info;
member
Member name |
describe |
|---|---|
v_frame |
Video image frames. |
pool_id |
Video cache pool ID. |
mod_id |
Which hardware logic module writes the current frame data. |
Notes
Currently, 2 types of additional information are supported. For details, please refer to the description of interface kd_mpi_vb_set_supplement_config.
Related Data Types and Interfaces
k_video_frame#
Description
Define video image frame information structure
definition
typedef struct {
k_u32 width; /*< Picture width */
k_u32 height; /*< Picture height */
k_video_field field; /*< video frame filed*/
k_pixel_format pixel_format; /*< Pixel format of a picture */
k_video_format video_format;
k_dynamic_range dynamic_range;
k_compress_mode compress_mode;
k_color_gamut color_gamut;
k_u32 header_stride;
k_u32 stride;
k_u64 header_phys_addr;
k_u64 header_virt_addr;
k_u64 phys_addr;
k_u64 virt_addr;
k_s16 offset_top; /* top offset of show area */
k_s16 offset_bottom; /* bottom offset of show area */
k_s16 offset_left; /* left offset of show area */
k_s16 offset_right; /* right offset of show area */
k_u32 time_ref;
k_u64 pts;
k_u64 priv_data;
k_video_supplement supplement; /*< Supplementary information about images */
} k_video_frame;
member
Member name |
describe |
|---|---|
width |
image width |
height |
image height |
filed |
Frame field mode. |
pixel_format |
Video image pixel format. |
video_format |
Video image format. |
dynamic_range |
dynamic range. |
compress_mode |
Video compression mode. |
color_gamut |
Color gamut range. |
header_stride |
Image compression header span. |
stride |
Image data span. |
header_phys_addr |
Compression header physical address |
header_virt_addr |
Compression header virtual address (kernel mode virtual address) |
phys_addr |
Image data physical address |
virt_addr |
Image data virtual address (kernel state virtual address) |
offset_top |
Image top crop width. |
offset_bottom |
Image bottom crop width. |
offset_left |
Image left crop width |
offset_right |
Image right crop width |
time_ref |
Image frame sequence number |
pts |
Image timestamp |
priv_data |
private data |
supplement |
Supplementary information for the image |
Notes
None
Related Data Types and Interfaces
None
k_video_supplement#
Description
Define video image frame supplementary information.
definition
typedef struct {
k_u64 jpeg_dcf_phy_addr;
k_u64 isp_info_phy_addr;
void jpeg_dcf_kvirt_addr; /*< jpeg_dcf, used in JPEG DCF */
void isp_info_kvirt_addr; /*< isp_frame_info, used in ISP debug, when get raw and send raw */
} k_video_supplement;
member
Member name |
describe |
|---|---|
jpeg_dcf_phy_addr |
The physical address of the Jpeg DCF message. |
isp_info_phy_addr |
Physical address of ISP auxiliary information. |
jpeg_dcf_kvirt_addr |
Virtual address of Jpeg DCF information (kernel state virtual address) |
isp_info_kvirt_addr |
Virtual address for ISP auxiliary information. (Kernel state virtual address) |
Notes
None
Related Data Types and Interfaces
k_isp_frame_info#
Description
Real-time information from ISPs.
definition
typedef struct {
k_u32 iso; /*< ISP internal ISO : again\*dgain\*is_pgain */
k_u32 exposure_time; /*< exposure time (reciprocal of shutter speed),unit is us */
k_u32 isp_dgain;
k_u32 again;
k_u32 dgain;
k_u32 ratio;
k_u32 isp_nr_strength;
k_u32 f_number; /*< the actual F-number (F-stop) of lens when the image was taken */
k_u32 sensor_id; /*< which sensor is used */
k_u32 sensor_mode;
k_u32 hmax_times; /*< sensor hmax_times,unit is ns */
k_u32 vmax; /*< sensor vmax,unit is line */
k_u32 vc_num; /*< when dump wdr frame, which is long or short exposure frame. */
} k_isp_frame_info;
member
Member name |
describe |
|---|---|
iso |
Current sensor analog gain*sensor digital gain*ISP digital gain*100. |
exposure_time |
Exposure time, unit is microsecond (us). |
isp_dgain |
ISP digital gain. |
again |
Sensor’s analog gain. |
dgain |
Sensor’s digital gain. |
ratio |
Multi-frame synthesis WDR default exposure ratio of two adjacent frames. |
isp_nr_strength |
NR intensity of ISP. Currently not supported, default value is 0. |
f_number |
The F number of the currently used lens. |
sensor_id |
The currently used sensorID. |
sensor_mode |
The seneor sequence mode currently in use. |
hmax_times |
The currently used sensor corresponds to the time it takes to read out a line, and the unit is nanoseconds (ns). |
vmax |
Number of lines in a frame |
vc_num |
The sequence number of the currently collected frame. |
Notes
None
Related Data Types and Interfaces
None
k_jpeg_dcf#
Description
DCF information used by JPEG images.
definition
typedef struct {
k_u8 capture_time [DCF_CAPTURE_TIME_LENGTH]; /*< the date and time when the picture data was generated*/
k_u32 flash; /*< whether the picture is captured when a flash lamp is on*/
k_u32 digital_zoom_ratio; /*< indicates the digital zoom ratio when the image was shot.*
*if the numerator of the recorded value is 0, this indicates that digital zoom was not used.*/
k_isp_dcf_info isp_dcf_info;
} k_jpeg_dcf;
member
Member name |
describe |
|---|---|
capture_time |
Jpeg picture shooting time |
flash |
Is there a flash when taking Jpeg photos? |
digital_zoom_ratio |
Digital zoom factor when taking Jpeg photos |
isp_dcf_info |
DCF other information |
Notes
None
Related Data Types and Interfaces
None
k_isp_dcf_info#
The details of this data type will not be updated in the current version.
k_isp_dcf_update_info#
The details of this data type will not be updated in the current version.
k_isp_dcf_const_info#
The details of this data type will not be updated in the current version.
k_compress_mode#
Description
Define video compression data format structure
definition
typedef enum
{
COMPRESS_MODE_NONE = 0, /* no compress */
COMPRESS_MODE_SEG, /* compress unit is 256x1 bytes as a segment.*/
COMPRESS_MODE_TILE, /* compress unit is a tile.*/
COMPRESS_MODE_LINE, /* compress unit is the whole line. raw for VI */
COMPRESS_MODE_FRAME, /* compress unit is the whole frame. YUV for VI), RGB for VO(read) */
COMPRESS_MODE_BUTT
} k_compress_mode;
member
Member name |
describe |
|---|---|
COMPRESS_MODE_NONE |
Uncompressed video format. |
COMPRESS_MODE_SEG |
Segment compressed video format |
COMPRESS_MODE_TILE |
Tile compressed video format, compressed into one segment according to Tile. |
COMPRESS_MODE_LINE |
Line-compressed video format, compressing one line per line. |
COMPRESS_MODE_FRAME |
Frame compressed video format, compressed in units of one frame. |
Notes
None
Related Data Types and Interfaces
None
k_color_gamut#
Description
Defines the color gamut range enumeration.
definition
typedef enum {
COLOR_GAMUT_BT601 = 0,
COLOR_GAMUT_BT709,
COLOR_GAMUT_BT2020,
COLOR_GAMUT_USER,
COLOR_GAMUT_BUTT
} k_color_gamut;
member
Member name |
describe |
|---|---|
COLOR_GAMUT_BT601 |
BT601 color gamut range |
COLOR_GAMUT_BT709 |
BT709 color gamut range |
COLOR_GAMUT_BT2020 |
BT2020 color gamut range |
COLOR_GAMUT_USER |
User-defined color gamut, non-standard color gamut |
Notes
The coordinates of the blue, green, red, and white points in each color gamut range are as follows:
ColorGamut |
Primary |
|||
|---|---|---|---|---|
Green |
Blue |
Red |
White |
|
BT601 |
(0.29, 0.60) |
(0.15, 0.06) |
(0.64, 0.33) |
(0.3127, 0.3290) |
BT709 |
(0.300, 0.600) |
(0.150, 0.060) |
(0.640, 0.330) |
(0.3127, 0.3290) |
BT2020 |
(0.170, 0.797) |
(0.131, 0.046) |
(0.708, 0.292) |
(0.3127, 0.3290) |
Related Data Types and Interfaces
None
k_dynamic_range#
Description
Define dynamically scoped enumerations.
definition
typedef enum {
DYNAMIC_RANGE_SDR8 = 0,
DYNAMIC_RANGE_SDR10,
DYNAMIC_RANGE_HDR10,
DYNAMIC_RANGE_HLG,
DYNAMIC_RANGE_SLF,
DYNAMIC_RANGE_XDR,
DYNAMIC_RANGE_BUTT
} k_dynamic_range;
member
Member name |
describe |
|---|---|
DYNAMIC_RANGE_SDR8 |
Standard dynamic range of 8bit data. |
DYNAMIC_RANGE_SDR10 |
Standard dynamic range of 10bit data. |
DYNAMIC_RANGE_HDR10 |
High dynamic range of 10bit data. |
DYNAMIC_RANGE_HLG |
High dynamic range of 10bit data. |
DYNAMIC_RANGE_SLF |
invalid |
DYNAMIC_RANGE_XDR |
invalid |
Notes
The curves corresponding to each dynamic range are as follows:
Dynamic Range |
Transfer Characteristic |
|---|---|
SDR8/ SDR10 |
V = α * Lc0.45 - (α - 1) for 1 >= Lc >= β V = 4.500 * Lcfor β > Lc >= 0 |
HDR10 |
V = ( ( c1 + c2 * Lc n ) ÷ ( 1 + c3 * Lc n ) )m for all values of Lc c1 = c3 - c2 + 1 = 3424 ÷ 4096 = 0.8359375 c2 = 32 * 2413 ÷ 4096 = 18.8515625 c3 = 32 * 2392 ÷ 4096 = 18.6875 m = 128 * 2523 ÷ 4096 = 78.84375 n = 0.25 * 2610 ÷ 4096 = 0.1593017578125 for which Lc equal to 1 for peak white is ordinarily intended to correspond to a reference output luminance level of 10000 candelas per square metre |
HLG |
V = a * Ln( 12 * Lc - b ) + c for 1 >= Lc > 1 ÷ 12 V = Sqrt( 3 ) * Lc0.5 for 1 ÷ 12 >= Lc >= 0 a = 0.17883277, b = 0.28466892, c = 0.55991073 |
Related Data Types and Interfaces
None
k_video_format#
Description
Define the video format structure.
definition
typedef enum
{
VIDEO_FORMAT_LINEAR = 0, /* nature video line */
VIDEO_FORMAT_TILE_64x16, /* tile cell: 64pixel x 16line */
VIDEO_FORMAT_TILE_16x8, /* tile cell: 16pixel x 8line */
VIDEO_FORMAT_LINEAR_DISCRETE, /* The data bits are aligned in bytes */
VIDEO_FORMAT_BUTT
} k_video_format;
member
Member name |
describe |
|---|---|
VIDEO_FORMAT_LINEAR |
Linear storage video format. |
VIDEO_FORMAT_TILE_64x16 |
A video format stored in the TILE format where the block size of the tile is 64 pixels wide and 16 rows of pixels high. |
VIDEO_FORMAT_TILE_16x8 |
A video format stored in the TILE format where the block size of the tile is 16 pixels wide and 8 rows of pixels high, also known as the small TILE format. |
VIDEO_FORMAT_LINEAR_DISCRETE |
Linear discrete natural row storage data format, the data bit width is byte-aligned, the low bit is valid and the high bit is invalid. |
Notes
None
Related Data Types and Interfaces
None
k_video_field#
Description
Defines the video image frame field type.
definition
typedef enum
{
VIDEO_FIELD_TOP = 0x1, /* even field */
VIDEO_FIELD_BOTTOM = 0x2, /* odd field */
VIDEO_FIELD_INTERLACED = 0x3, /* two interlaced fields */
VIDEO_FIELD_FRAME = 0x4, /* frame */
VIDEO_FIELD_BUTT
} k_video_field;
member
Member name |
describe |
|---|---|
VIDEO_FIELD_TOP |
top field type |
VIDEO_FIELD_BOTTOM |
Bottom field type |
VIDEO_FIELD_INTERLACED |
Interpolation type between two fields |
VIDEO_FIELD_FRAME |
Frame type |
Notes
None
Related Data Types and Interfaces
k_pixel_format#
Description
Defines the pixel format type.
definition
typedef enum {
PIXEL_FORMAT_RGB_444 = 0,
PIXEL_FORMAT_RGB_555,
PIXEL_FORMAT_RGB_565,
PIXEL_FORMAT_RGB_888,
PIXEL_FORMAT_BGR_444,
PIXEL_FORMAT_BGR_555,
PIXEL_FORMAT_BGR_565,
PIXEL_FORMAT_BGR_888,
PIXEL_FORMAT_ARGB_1555,
PIXEL_FORMAT_ARGB_4444,
PIXEL_FORMAT_ARGB_8565,
PIXEL_FORMAT_ARGB_8888,
PIXEL_FORMAT_ARGB_2BPP,
PIXEL_FORMAT_ABGR_1555,
PIXEL_FORMAT_ABGR_4444,
PIXEL_FORMAT_ABGR_8565,
PIXEL_FORMAT_ABGR_8888,
PIXEL_FORMAT_RGB_MONOCHROME_8BPP,
PIXEL_FORMAT_RGB_BAYER_8BPP,
PIXEL_FORMAT_RGB_BAYER_10BPP,
PIXEL_FORMAT_RGB_BAYER_12BPP,
PIXEL_FORMAT_RGB_BAYER_14BPP,
PIXEL_FORMAT_RGB_BAYER_16BPP,
PIXEL_FORMAT_YVU_PLANAR_422,
PIXEL_FORMAT_YVU_PLANAR_420,
PIXEL_FORMAT_YVU_PLANAR_444,
PIXEL_FORMAT_YVU_SEMIPLANAR_422,
PIXEL_FORMAT_YVU_SEMIPLANAR_420,
PIXEL_FORMAT_YVU_SEMIPLANAR_444,
PIXEL_FORMAT_YUV_SEMIPLANAR_422,
PIXEL_FORMAT_YUV_SEMIPLANAR_420,
PIXEL_FORMAT_YUV_SEMIPLANAR_444,
PIXEL_FORMAT_YUYV_PACKAGE_422,
PIXEL_FORMAT_YVYU_PACKAGE_422,
PIXEL_FORMAT_UYVY_PACKAGE_422,
PIXEL_FORMAT_VYUY_PACKAGE_422,
PIXEL_FORMAT_YYUV_PACKAGE_422,
PIXEL_FORMAT_YYVU_PACKAGE_422,
PIXEL_FORMAT_UVYY_PACKAGE_422,
PIXEL_FORMAT_VUYY_PACKAGE_422,
PIXEL_FORMAT_VY1UY0_PACKAGE_422,
PIXEL_FORMAT_YUV_400,
PIXEL_FORMAT_UV_420,
/* SVP data format */
PIXEL_FORMAT_BGR_888_PLANAR,
PIXEL_FORMAT_HSV_888_PACKAGE,
PIXEL_FORMAT_HSV_888_PLANAR,
PIXEL_FORMAT_LAB_888_PACKAGE,
PIXEL_FORMAT_LAB_888_PLANAR,
PIXEL_FORMAT_S8C1,
PIXEL_FORMAT_S8C2_PACKAGE,
PIXEL_FORMAT_S8C2_PLANAR,
PIXEL_FORMAT_S8C3_PLANAR,
PIXEL_FORMAT_S16C1,
PIXEL_FORMAT_U8C1,
PIXEL_FORMAT_U16C1,
PIXEL_FORMAT_S32C1,
PIXEL_FORMAT_U32C1,
PIXEL_FORMAT_U64C1,
PIXEL_FORMAT_S64C1,
PIXEL_FORMAT_BUTT
} k_pixel_format;
member
None
Notes
None
Related Data Types and Interfaces
slightly
Multimedia log management#
This module has the following data structure
k_log_level_conf#
Description
Define the log level information structure.
definition
typedef struct {
k_mod_id mod_id;
k_s32 level;
k_char mod_name[16];
} k_log_level_conf;
member
Member name |
describe |
|---|---|
mod_id |
Module ID |
level |
Log level |
mod_name |
module name |
Notes
None
Related Data Types and Interfaces
error code#
Multimedia memory management error code#
Video cache pool error code#
Table 41
Error code |
Macro Definition |
describe |
|---|---|---|
0xa0048006 |
K_ERR_VB_NULL_PTR |
Parameter null pointer error |
0xa004800c |
K_ERR_VB_NOMEM |
Failed to allocate memory |
0xa004800d |
K_ERR_VB_NOBUF |
Failed to allocate cache |
0xa0048005 |
K_ERR_VB_UNEXIST |
Video cache does not exist |
0xa0048003 |
K_ERR_VB_ILLEGAL_PARAM |
Parameter setting is invalid |
0xa0048010 |
K_ERR_VB_NOTREADY |
The cache pool is not ready yet |
0xa0048012 |
K_ERR_VB_BUSY |
System is busy |
0xa0048009 |
K_ERR_VB_NOT_PERM |
Operation not allowed |
0xa0048040 |
K_ERR_VB_2MPOOLS |
Too many cache pools created |
Multimedia memory zone error code#
Table 42
Error code |
Macro Definition |
describe |
|---|---|---|
0xa0038003 |
K_ERR_MMZ_USERDEV_ILLEGAL_PARAM |
Parameter settings are tiny |
0xa0038006 |
K_ERR_MMZ_USERDEV_NULL_PTR |
Parameter null pointer error |
0xa0038008 |
K_ERR_MMZ_USERDEV_NOT_SUPPORT |
Unsupported operation |
0xa0038009 |
K_ERR_MMZ_USERDEV_NOT_PERM |
Operation not allowed |
0xa003800c |
K_ERR_MMZ_USERDEV_NOMEM |
Failed to allocate memory |
0xa0038010 |
K_ERR_MMZ_USERDEV_NOTREADY |
System is not ready |
0xa0038011 |
K_ERR_MMZ_USERDEV_BADADDR |
wrong address |
0xa0038012 |
K_ERR_MMZ_USERDEV_BUSY |
System is busy |
System binding error code#
Table 43
Error code |
Macro Definition |
describe |
|---|---|---|
0xa0058003 |
K_ERR_SYS_ILLEGAL_PARAM |
Parameter error |
0xa0058006 |
K_ERR_SYS_NULL_PTR |
Null pointer error |
0xa0058008 |
K_ERR_SYS_NOT_SUPPORT |
Unsupported features |
0xa0058009 |
K_ERR_SYS_NOT_PERM |
Operation not allowed |
0xa0058010 |
K_ERR_SYS_NOTREADY |
System control properties are not configured |
0xa0058011 |
K_ERR_SYS_BADADDR |
wrong address |
0xa005800c |
K_ERR_SYS_NOMEM |
Failed to allocate memory, such as insufficient system memory |
Log management error code#
Table 44
Error code |
Macro Definition |
describe |
|---|---|---|
0xa0018003 |
K_ERR_LOG_ILLEGAL_PARAM |
Parameter error |
0xa0018006 |
K_ERR_LOG_NULL_PTR |
Null pointer error |
0xa0018009 |
K_ERR_LOG_NOT_PERM |
Operation not allowed |
0xa0018010 |
K_ERR_LOG_NOTREADY |
Log device not ready |
0xa001800c |
K_ERR_LOG_NOMEM |
Failed to allocate memory, such as insufficient system memory |
debugging information#
Overview#
The debugging information uses the proc file system, which can reflect the current running status of the system in real time. The recorded information can be used for problem location and analysis.
File directory
/proc/
Document list
File name |
describe |
|---|---|
umap/sysbind |
Record the current system binding situation |
umap/vb |
Record the buffer usage of the current VB module. |
mem-media |
Record current multimedia memory usage |
Multimedia memory management#
Video cache pool debugging information#
debugging information
-----VB PUB CONFIG--------------------------------------------------------------
MaxPoolCnt
10
-----VB SUPPLEMENT ATTR---------------------------------------------------------
Config Size VbCnt
1 204 21
-----COMMON POOL CONFIG---------------------------------------------------------
PoolConfId BlkSize Count RemapMode
0 8294400 5 CACHED
1 8192 3 NONE
2 4096 5 NOCACHE
-----MODULE COMMON MOD POOL CONFIG of [2]---------------------------------------
PoolConfId BlkSize Count RemapMode
0 4096 5 CACHED
1 8192 3 NONE
-------------------------------------------------------------------------------------
PoolId PhysAddr VirtAddr IsComm Owner BlkSz BlkCnt Free MinFree
0 0x18001000 0xc00d1000 1 -1 8294400 5 2 2
BLK VI VENC VDEC VO USER AI AREC AENC ADEC AO V_VI V_VO DMA DPU
0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
1 0 0 0 0 1 0 0 0 0 0 0 0 0 0
2 0 0 0 0 1 0 0 0 0 0 0 0 0 0
Sum 0 0 0 0 3 0 0 0 0 0 0 0 0 0
-------------------------------------------------------------------------------------
PoolId PhysAddr VirtAddr IsComm Owner BlkSz BlkCnt Free MinFree
1 0x1a78f000 0x0 1 -1 8192 3 3 3
-------------------------------------------------------------------------------------
PoolId PhysAddr VirtAddr IsComm Owner BlkSz BlkCnt Free MinFree
2 0x1a796000 0xc2860000 1 -1 4096 5 5 5
-------------------------------------------------------------------------------------
PoolId PhysAddr VirtAddr IsComm Owner BlkSz BlkCnt Free MinFree
3 0x1a79c000 0xc2866000 1 2 4096 5 5 5
-------------------------------------------------------------------------------------
PoolId PhysAddr VirtAddr IsComm Owner BlkSz BlkCnt Free MinFree
4 0x1a7a2000 0x0 1 2 8192 3 3 3
Debugging information analysis
Record the block usage of the current VB module
Parameter description
parameter |
describe |
|
|---|---|---|
VB PUB CONFIG |
MaxPoolCnt |
The maximum number of cache pools. |
VB SUPPLEMENT ATTR |
Config |
Video frame supplementary information configuration. |
Size |
Video frame supplementary information occupies memory space. |
|
VbCnt |
The total number of VB blocks contained in all VB pools (public, private). |
|
COMMON POOL CONFIG |
PoolId |
Handle to the public cache pool. |
Size |
The size of the blocks within the cache pool. |
|
Count |
The number of blocks in the cache pool. |
|
MODULE COMMON POOL CONFIG of VB_UID (module assigned common VB) |
PoolId |
Handle to the public cache pool. |
Size |
The size of the blocks within the cache pool. |
|
Count |
The number of blocks in the cache pool. |
|
NULL (table empty, anonymous DDR) |
PoolId |
Handle to the public/private buffer pool. |
PhysAddr |
The starting physical address of the public/private cache pool. |
|
VirtAddr |
The starting virtual address of the public/private cache pool. |
|
IsComm |
Whether the cache pool is public. Value: {0, 1}. |
|
Owner |
The owner of the cache pool. -2: Private pool. -1: Public pool. ≥0: module VB. |
|
BlkSz |
The size of cache blocks within the cache pool. |
|
BlkCnt |
The number of cache blocks in the cache pool. |
|
Free |
The number of free cache blocks in the cache pool. |
|
MinFree |
MinFree The minimum remaining number of free cache blocks since the program is running. If the count is 0, there may be frames dropped due to insufficient cache blocks. |
|
BLK |
Handle to the cache block within the cache pool. |
|
VI/VPROC/VREC/VENC /VDEC/VO/USER/AI/AREC /AENC/ADEC/AO/V_VI/ V_VO/DMA |
The corresponding number below the module name indicates how many places the current module occupies this cache block in the cache pool. 0: Not occupied. Non-0: Number of occupancies |
Multimedia memory zone debugging information#
debugging information
msh /bin\>cat /proc/media-mem
+---ZONE: PHYS(0x18000000, 0x1FEFFFFF), GFP=0, nBYTES=130048KB, NAME="anonymous"
|-MMB: phys(0x18000000, 0x18000FFF), kvirt=0xC00D0000, flags=0x00000001, length=4KB, name="sup_nc"
|-MMB: phys(0x18001000, 0x1A78DFFF), kvirt=0xC00D1000, flags=0x00000003, length=40500KB, name="vb_pool"
|-MMB: phys(0x1A78E000, 0x1A78EFFF), kvirt=0xC285E000, flags=0x00000001, length=4KB, name="sup_nc"
|-MMB: phys(0x1A78F000, 0x1A794FFF), kvirt=0x00000000, flags=0x00000000, length=24KB, name="vb_pool"
|-MMB: phys(0x1A795000, 0x1A795FFF), kvirt=0xC285F000, flags=0x00000001, length=4KB, name="sup_nc"
|-MMB: phys(0x1A796000, 0x1A79AFFF), kvirt=0xC2860000, flags=0x00000001, length=20KB, name="vb_pool"
|-MMB: phys(0x1A79B000, 0x1A79BFFF), kvirt=0xC2865000, flags=0x00000001, length=4KB, name="sup_nc"
|-MMB: phys(0x1A79C000, 0x1A7A0FFF), kvirt=0xC2866000, flags=0x00000003, length=20KB, name="vb_mod_pool"
|-MMB: phys(0x1A7A1000, 0x1A7A1FFF), kvirt=0xC286B000, flags=0x00000001, length=4KB, name="sup_nc"
|-MMB: phys(0x1A7A2000, 0x1A7A7FFF), kvirt=0x00000000, flags=0x00000000, length=24KB, name="vb_mod_pool"
---MMZ_USE_INFO:
total size=130048KB(127MB),used=40608KB(39MB + 672KB),remain=89440KB(87MB + 352KB),zone_number=1,block_number=10
Debugging information analysis
Record current multimedia memory usage
Parameter description
None
System binding#
System binding debugging information#
debugging information
msh /bin\>cat /proc/umap/sysbind
\-----BIND RELATION TABLE--------------------------------------------------------
FirMod FirDev FirChn SecMod SecDev SecChn TirMod TirDev TirChn SendCnt rstCnt
vvi 0 0 vvo 0 0 null 0 0 42 0
vvi 0 0 vvo 1 1 null 0 0 42 0
Debugging information analysis
Record the current system binding situation
Parameter description
parameter |
describe |
|---|---|
FirMod |
The module number of the data source |
FirDev |
The device number of the data source |
FirChn |
Channel number of data source |
SecMod |
The module number of the second module (bound to the data source) |
SecDev |
The device number of the second module (bound to the data source) |
SecChn |
The channel number of the second module (bound to the data source) |
ThrMod |
The module number of the third module (bound to the second module) |
ThrDev |
The device number of the third module (bound to the second module) |
ThrChn |
The channel number of the third module (bound to the second module) |
Sendcnt |
Number of times data is sent |
Rstcnt |
Number of resets |
