5.3. Multimedia System Debugging Guide

5.3.1. Control Nodes

5.3.1.1. tuning server

Function: Enable the tuning server.

Description:
After executing this command, cam-service will support the tuning service, allowing users to tune ISP parameters via vtuner.

Command:

echo 1 > /sys/kernel/debug/isp/tune

5.3.1.2. cam-service

Function: Control the log output level of cam-service.

Description:
This command controls the log output mask of cam-service, printing logs according to the specified mask. Bit0 represents the error level, bit1 the warning level, bit2 the info level, bit3 the debug level, and bit4 the verbose level. The three numbers respectively correspond to the log levels of the ISP adapter layer/3A, ISP auto control, and ISP upper API components within cam-service.

Command:

echo 31 31 31 > /sys/kernel/debug/isp/log

5.3.1.3. libcam/libvpf

Function: Control the log output level of libcam/libvpf.

Description:
This command allows separate control of the log output levels for libcam and libvpf. These two dynamic libraries have four log levels: err, warning, info, and debug, corresponding to 1, 2, 3, and 4 respectively. The default log level is warning. This command modifies the log level; when loglevel is set to 4, all logs are output.

Command:

export CAM_LOGLEVEL=4
export VPF_LOGLEVEL=4

5.3.2. Statistics Nodes

5.3.2.1. VPU Module Debug Information

VENC Encoding

When debugging the VPU module and retrieving information, first run the corresponding encoding or decoding sample program, then use cat /sys/kernel/debug/ to view the relevant codec module. Take /app/platform_samples/sample_codec as an example. The encoding configuration file is as follows:

[encode]
; Enable encoding, using bitwise operations
; 0x0 means encoding is disabled
; 0x01 means only venc_stream1 is enabled
; 0x02 means only venc_stream2 is enabled
; 0x04 means only venc_stream3 is enabled
; 0x08 means only venc_stream4 is enabled
; 0x10 means only venc_stream5 is enabled
; 0x03 means enabling the first two streams (venc_stream1 and venc_stream2), 0x07 enables the first three streams, 0x0f enables the first four streams, and so on
encode_streams = 0x1

[venc_stream1]
; Codec type (0: H264, 1: H265, 2: MJPEG, 3: JPEG)
codec_type = 0
width = 1920
height = 1080
frame_rate = 30
bit_rate = 8192
input = 1920x1080_NV12.yuv
output = 1920x1080_30fps.h264
frame_num = 100
external_buffer = 1
profile = h264_main@L4

[venc_stream2]
; Codec type (0: H264, 1: H265, 2: MJPEG, 3: JPEG)
codec_type = 1
width = 1280
height = 720
frame_rate = 25
bit_rate = 4096
input = 1280x720_NV12.yuv
output = 1280x720_25fps.h265
frame_num = 100
profile = h265_main@L4%high_tier

[venc_stream3]
; Codec type (0: H264, 1: H265, 2: MJPEG, 3: JPEG)
codec_type = 3
width = 1280
height = 720
frame_rate = 25
bit_rate = 4096
input = 1280x720_NV12.yuv
output = 1280x720.jpg
frame_num = 100

[venc_stream4]
; Codec type (0: H264, 1: H265, 2: MJPEG, 3: JPEG)
codec_type = 0
width = 640
height = 480
frame_rate = 30
bit_rate = 8192
input = 640x480_nv12.yuv
output = 640x480_30fps.h264
frame_num = 1000

Run encoding program:

Enable one H264 encoding stream by default: encode_streams = 0x1

root@buildroot:/app/platform_samples/sample_codec# ./sample_codec

Print output:

Config file: codec_config.ini
encode_streams: 0x1
decode_streams: 0x0
Encoding video...
Encode params...
 codec_type: 0, width: 1920, height: 1080, frame_rate: 30, bit_rate: 8192, input_file: 1920x1080_NV12.yuv, output_file: 1920x1080_30fps.h264, frame_num: 100, profile: h264_main@L4, external_buffer: 1 performance_test:0
encode_video_external_buffer...
Encode idx: 0, init successful
Encode idx: 0, start successful
dequeue input buffer. src_idx(0), user_ptr((nil))
Encode idx: 0, frame= 1
on_encode_input_buffer_consumed userdata((nil)), inputBuffer->user_ptr(0xffffb0024810)
dequeue input buffer. src_idx(1), user_ptr((nil))
Encode idx: 0, frame= 2
on_encode_input_buffer_consumed userdata((nil)), inputBuffer->user_ptr(0xffffb0024fc0)
dequeue input buffer. src_idx(2), user_ptr((nil))
Encode idx: 0, frame= 3
....

Command:

cat /sys/kernel/debug/vpu/venc

Function: Retrieve encoding debug information.

Example output:

----encode enc param----
enc_idx  enc_id     profile       level width height pix_fmt fbuf_count extern_buf_flag bsbuf_count bsbuf_size mirror rotate
      0    h264 unspecified unspecified  1920   1080       1          5               0           8    3110912      0      0

----encode h264cbr param----
enc_idx rc_mode intra_period intra_qp bit_rate frame_rate initial_rc_qp vbv_buffer_size mb_level_rc_enalbe min_qp_I max_qp_I min_qp_P max_qp_P min_qp_B max_qp_B hvs_qp_enable hvs_qp_scale qp_map_enable max_delta_qp
      0 h264cbr           30       30     8192         30            20              20                  1        8       50        8       50        8       50             1            2             0           10


----encode gop param----
enc_idx  enc_id gop_preset_idx custom_gop_size decoding_refresh_type
      0    h264              1               0                     2

----encode intra refresh----
enc_idx  enc_id intra_refresh_mode intra_refresh_arg
      0    h264                  0                 1

----encode longterm ref----
enc_idx  enc_id use_longterm longterm_pic_period longterm_pic_using_period
      0    h264            0                   0                         0

----encode roi_params----
enc_idx  enc_id roi_enable roi_map_array_count
      0    h264          0                   0

----encode h264 entropy params----
enc_idx  enc_id entropy_coding_mode
      0    h264               CABAC

----encode h264 slice params----
enc_idx  enc_id h264_slice_mode h264_slice_arg
      0    h264               0              0

----encode h264 deblk filter----
enc_idx  enc_id disable_deblocking_filter_idc slice_alpha_c0_offset_div2 slice_beta_offset_div2
      0    h264                             1                          0                      0

----encode h264 timing----
enc_idx  enc_id vui_num_units_in_tick vui_time_scale fixed_frame_rate_flag
      0    h264                  1000          60000                     0

----encode h264_intra_pred----
enc_idx  enc_id constrained_intra_pred_flag
      0    h264                           0

----encode h264_transform----
enc_idx  enc_id transform_8x8_enable chroma_cb_qp_offset chroma_cr_qp_offset user_scaling_list_enable
      0    h264                    1                   0                   0                        0

----encode h264 vui----
enc_idx  enc_id aspect_ratio_info_present_flag aspect_ratio_idc sar_width sar_height overscan_info_present_flag overscan_appropriate_flag video_signal_type_present_flag video_format video_full_range_flag colour_description_present_flag colour_primaries transfer_characteristics matrix_coefficients vui_timing_info_present_flag vui_num_units_in_tick vui_time_scale vui_fixed_frame_rate_flag bitstream_restriction_flag
      0    h264                              0                0         0          0                          0                         0                              1            0                     1                               0                0                        0                   0                            1                  1000          60000                         0                          0

----encode 3dnr----
enc_idx  enc_id nr_y_enable nr_cb_enable nr_cr_enable nr_est_enable nr_intra_weightY nr_intra_weightCb nr_intra_weightCr nr_inter_weightY nr_inter_weightCb nr_inter_weightCr nr_noise_sigmaY nr_noise_sigmaCb nr_noise_sigmaCr
      0    h264           0            0            0             0                0                 0                 0                0                 0                 0               0                0                0

----encode smart bg----
enc_idx  enc_id bg_detect_enable bg_threshold_diff bg_threshold_mean_diff bg_lambda_qp bg_delta_qp s2fme_disable
      0    h264                0                 0                      0            0           0             0

----encode status----
enc_idx  enc_id cur_input_buf_cnt cur_output_buf_cnt left_recv_frame left_enc_frame total_input_buf_cnt total_output_buf_cnt     fps
      0    h264                 0                  1               0              0               28985                28985      30

Parameter Explanation:

Debug Info Group Status Parameter Description
encode enc param Basic Encoding Parameters enc_idx: encoding instance value, enc_id: encoding type, profile: profile type, level: h265 level type, width: encoding width, height: encoding height, pix_fmt: input frame pixel format, fbuf_count: number of input FrameBuffers, extern_buf_flag: whether external input buffer is used, bsbuf_count: number of bitstreamBuffers, bsbuf_size: bitstreamBuffer size, mirror: whether mirroring is enabled, rotate: whether rotation is enabled
encode h265cbr param CBR Rate Control Parameters enc_idx: encoding instance value, rc_mode: rate control type, intra_period: I-frame interval, intra_qp: I-frame QP value, bit_rate: bitrate value, frame_rate: frame rate, initial_rc_qp: initial QP value, vbv_buffer_size: size of VBV buffer, ctu_level_rc_enable: whether rate control operates at CTU level, min_qp_I: minimum QP for I-frame, max_qp_I: maximum QP for I-frame, min_qp_P: minimum QP for P-frame, max_qp_P: maximum QP for P-frame, min_qp_B: minimum QP for B-frame, max_qp_B: maximum QP for B-frame, hvs_qp_enable: whether rate control operates at subCTU level, hvs_qp_scale: QP scaling factor, qp_map_enable: enable QP map for ROI encoding, max_delta_qp: maximum deviation range for HVS QP value
encode gop param GOP Parameters enc_idx: encoding instance value, enc_id: encoding type, gop_preset_idx: preset GOP structure selection, custom_gop_size: GOP size when custom, decoding_refresh_type: IDR frame type setting
encode intra refresh Intra Refresh Parameters enc_idx: encoding instance value, enc_id: encoding type, intra_refresh_mode: intra refresh mode, intra_refresh_arg: intra refresh argument
encode longterm ref Long-term Reference Frame Parameters enc_idx: encoding instance value, enc_id: encoding type, use_longterm: enable long-term reference frame, longterm_pic_period: long-term reference frame period, longterm_pic_using_period: period for using long-term reference frame
encode roi_params ROI Parameters enc_idx: encoding instance value, enc_id: encoding type, roi_enable: enable ROI encoding, roi_map_array_count: number of elements in ROI map
encode mode_decision 1 Block Encoding Mode Decision Parameters 1 Various mode selection parameters, including pu04_delta_rate, pu08_delta_rate, etc.
encode mode_decision 2 Block Encoding Mode Decision Parameters 2 Various mode selection parameters, including pu32_intra_planar_delta_rate, pu32_intra_dc_delta_rate, etc.
encode h265_transform Transform Parameters enc_idx: encoding instance value, enc_id: encoding type, chroma_cb_qp_offset: QP offset for cb component, chroma_cr_qp_offset: QP offset for cr component, user_scaling_list_enable: enable user-defined scaling list
encode h265_pred_unit Prediction Unit Parameters enc_idx: encoding instance value, enc_id: encoding type, intra_nxn_enable: enable intra NXN PUs, constrained_intra_pred_flag: whether intra prediction is constrained, strong_intra_smoothing_enabled_flag: whether bidirectional linear interpolation is used in filtering, max_num_merge: number of merge candidates
encode h265 timing Timing Parameters enc_idx: encoding instance value, enc_id: encoding type, vui_num_units_in_tick: number of time units, vui_time_scale: number of time units per second, vui_num_ticks_poc_diff_one_minus1: number of ticks corresponding to POC difference of 1
encode h265 slice params Slice Parameters enc_idx: encoding instance value, enc_id: encoding type, h265_independent_slice_mode: independent slice encoding mode, h265_independent_slice_arg: size of independent slice, h265_dependent_slice_mode: dependent slice encoding mode, h265_dependent_slice_arg: size of dependent slice
encode h265 deblk filter Deblocking Filter Parameters enc_idx: encoding instance value, enc_id: encoding type, slice_deblocking_filter_disabled_flag: whether intra-slice deblocking is disabled, slice_beta_offset_div2: β deblocking parameter offset for current slice, slice_tc_offset_div2: tC deblocking parameter offset for current slice, slice_loop_filter_across_slices_enabled_flag: whether boundary filtering is enabled
encode h265 sao param SAO Parameters enc_idx: encoding instance value, enc_id: encoding type, sample_adaptive_offset_enabled_flag: whether sample adaptive offset is applied to reconstructed image after deblocking
encode status Current Encoding Status Parameters enc_idx: encoding instance value, enc_id: encoding type, cur_input_buf_cnt: number of currently used input buffers, cur_output_buf_cnt: number of currently used output buffers, left_recv_frame: remaining frames to receive (valid when receive_frame_number is set), left_enc_frame: remaining frames to encode (valid when receive_frame_number is set), total_input_buf_cnt: total number of input buffers used, total_output_buf_cnt: total number of output buffers used, fps: current frame rate

Description:
The VPU (Video Processing Unit) is a dedicated visual processing module designed for efficient video content processing. It supports encoding of H.264/H.265 video formats and provides interfaces through Codec for users to obtain the encoded video stream.

VDEC Decoding

Take /app/platform_samples/sample_codec as an example. The decoding configuration file is as follows:

[decode]
; Enable decoding, using bitwise operations
; 0x0 means decoding is disabled
; 0x01 means only vdec_stream1 is enabled
; 0x02 means only vdec_stream2 is enabled
; 0x03 means enabling the first two streams (vdec_stream1 and vdec_stream2), 0x07 enables the first three streams, 0x0f enables the first four streams, and so on
decode_streams = 0x0

[vdec_stream1]
; Codec type (0: H264, 1: H265, 2: MJPEG, 3: JPEG)
codec_type = 0
width = 1920
height = 1080
input = 1920x1080_30fps.h264
output = 1920x1080_NV12.yuv

[vdec_stream2]
; Codec type (0: H264, 1: H265, 2: MJPEG, 3: JPEG)
codec_type = 1
width = 1280
height = 720
input = 1280x720_25fps.h265
output = 1280x720_NV12.yuv

[vdec_stream3]
; Codec type (0: H264, 1: H265, 2: MJPEG, 3: JPEG)
codec_type = 3
width = 1280
height = 720
input = 1280x720.jpg
output = 1280x720_NV12.yuv

[vdec_stream4]
; Codec type (0: H264, 1: H265, 2: MJPEG, 3: JPEG)
codec_type = 0
width = 640
height = 480
input = 640x480_30fps.h264
output = 640x480_nv12.yuv

Run decoding program:

Disable encoding, enable vdec_stream1 decoding

root@buildroot:/app/platform_samples/sample_codec# ./sample_codec -e 0 -d 0x1

Print output:

Config file: codec_config.ini
encode_streams: 0x0
decode_streams: 0x1
Decode params...
 codec_type: 0, width: 1920, height: 1080, input_file: 1920x1080_30fps.h264, output_file: 1920x1080_NV12.yuv
Decode idx: 0, init successful
Init video decode instance 0 successful
Decode idx: 0, start successful
Decoding video...
Decoding output video...
[h264 @ 0xffff68000d50] Stream #0: not enough frames to estimate rate; consider increasing probesize
p_param->frame_num: 98
decode output continue
No more valid data available for decoding, avpacket.size: 0. Decoder will exit due to timeout after fetching decoded output.
decode output continue
Decode idx: 0, hb_mm_mc_dequeue_output_buffer timed out (possibly normal exit due to lack of data)
decode output continue
Decode idx: 0, stop successful
Decode idx: 0, deinit successful
deinit video decode instance 0 successful
....

Command:

cat /sys/kernel/debug/vpu/vdec

Function: Retrieve VDEC decoding debug information.

Example output:

----decode param----
dec_idx  dec_id feed_mode pix_fmt bitstream_buf_size bitstream_buf_count frame_buf_count
      0    h264         1       1            3110912                   3               3
----h264 decode param----
dec_idx  dec_id reorder_enable skip_mode bandwidth_Opt
      0    h264              1         0             1

----decode frameinfo----
dec_idx  dec_id display_width display_height
      0    h264          1920           1080
----decode status----
dec_idx  dec_id cur_input_buf_cnt cur_output_buf_cnt total_input_buf_cnt total_output_buf_cnt     fps
      0    h264                 0                  1                  66                   62      12

Parameter Explanation:

Debug Info Group Status Parameter Description
decode param Basic Decoding Parameters dec_idx: decoding instance value, dec_id: decoding type, feed_mode: data feeding mode, pix_fmt: output pixel format, bitstream_buf_size: input bitstream buffer size, bitstream_buf_count: number of input bitstream buffers, frame_buf_count: number of output framebuffer buffers
h264 decode param H264 Basic Decoding Parameters dec_idx: decoding instance value, dec_id: decoding type, reorder_enable: enable decoder to output frames in display order, skip_mode: enable frame skip mode, bandwidth_Opt: enable bandwidth-saving mode
decode frameinfo Decoded Frame Output Info dec_idx: decoding instance value, dec_id: decoding type, display_width: display width, display_height: display height
decode status Current Decoding Status Parameters dec_idx: decoding instance value, dec_id: decoding type, cur_input_buf_cnt: number of currently used input buffers, cur_output_buf_cnt: number of currently used output buffers, total_input_buf_cnt: total number of input buffers used, total_output_buf_cnt: total number of output buffers used, fps: current frame rate

Description:
The VPU (Video Processing Unit) is a dedicated visual processing module designed for efficient video content processing. It supports decoding of H.264/H.265 video formats and provides interfaces through Codec for users to obtain the decoded video stream.

5.3.2.2. JPU Module Debug Information

JENC Encoding

Take /app/platform_samples/sample_codec as an example. Run the following command:

Enable vdec_stream3 for JPEG encoding

root@buildroot:/app/platform_samples/sample_codec# ./sample_codec -e 0x4

Print output:

root@buildroot:/app/platform_samples/sample_codec# ./sample_codec -e 0x4
Config file: codec_config.ini
encode_streams: 0x4
decode_streams: 0x0
Encoding video...
Encode params...
 codec_type: 3, width: 1280, height: 720, frame_rate: 25, bit_rate: 4096, input_file: 1280x720_NV12.yuv, output_file: 1280x720.jpg, frame_num: 100, profile: , external_buffer: 0 performance_test:0
encode_video...
Encode idx: 0, init successful
Encode idx: 0, start successful
Encode idx: 0, frame= 1
Encode idx: 0, frame= 2
....
Encode idx: 0, frame= 100

Command:

cat /sys/kernel/debug/jpu/jenc

Function: Retrieve JPEG encoding debug information.

Example output:

----encode param----
enc_idx  enc_id width height pix_fmt fbuf_count extern_buf_flag bsbuf_count bsbuf_size mirror rotate
      0    jpeg  1280    720       1          3               0           3    1384448      0      0

----encode rc param----
enc_idx   rc_mode frame_rate quality_factor
      0 noratecontrol          0             50


----encode status----
enc_idx  enc_id cur_input_buf_cnt cur_output_buf_cnt left_recv_frame left_enc_frame total_input_buf_cnt total_output_buf_cnt     fps
      0    jpeg                 0                  1               0              0                  40                   40      28

Parameter Explanation:

Debug Info Group Status Parameter Description
encode param Basic Encoding Parameters enc_idx: encoding instance, enc_id: encoding type, width: image width, height: image height, pix_fmt: pixel format, fbuf_count: number of input framebuffer buffers, extern_buf_flag: whether user-allocated input buffer is used, bsbuf_count: number of output bitstream buffers, bsbuf_size: size of output bitstream, mirror: whether mirroring is enabled, rotate: whether rotation is enabled
encode rc param mjpeg Rate Control Parameters enc_idx: encoding instance value, rc_mode: rate control mode, frame_rate: target frame rate, quality_factor: quantization factor
encode status Current Encoding Status enc_idx: encoding instance value, enc_id: encoding type, cur_input_buf_cnt: number of currently used input buffers, cur_output_buf_cnt: number of currently used output buffers, left_recv_frame: remaining frames to receive (valid when receive_frame_number is set), left_enc_frame: remaining frames to encode (valid when receive_frame_number is set), total_input_buf_cnt: total number of input buffers used, total_output_buf_cnt: total number of output buffers used, fps: current frame rate

Description:
The JPU (JPEG Processing Unit) is primarily used to perform JPEG/MJPEG encoding. Users can input YUV data to be encoded via the CODEC interface, and obtain the encoded JPEG/MJPEG images after processing by the JPU.

JDEC Decoding

Take /app/platform_samples/sample_codec as an example. Run the following command:

Enable vdec_stream3 for JPEG decoding

root@buildroot:/app/platform_samples/sample_codec# ./sample_codec -e 0 -d 0x4

Print output:

Config file: codec_config.ini
encode_streams: 0x4
decode_streams: 0x0
Encoding video...
Encode params...
 codec_type: 3, width: 1280, height: 720, frame_rate: 25, bit_rate: 4096, input_file: 1280x720_NV12.yuv, output_file: 1280x720.jpg, frame_num: 100, profile: , external_buffer: 0 performance_test:0
encode_video...
Encode idx: 0, init successful
Encode idx: 0, start successful
Encode idx: 0, frame= 1
Encode idx: 0, frame= 2
....
Encode idx: 0, frame= 100

Command:

cat /sys/kernel/debug/jpu/jdec

Function: Retrieve JDEC decoding debug information.

Example output:

----decode param----
dec_idx  dec_id feed_mode pix_fmt bitstream_buf_size bitstream_buf_count frame_buf_count mirror rotate
      0    jpeg         1       1            1382400                   3               3      0      0

----decode frameinfo----
dec_idx  dec_id display_width display_height
      0    jpeg             0              0

----decode status----
dec_idx  dec_id cur_input_buf_cnt cur_output_buf_cnt total_input_buf_cnt total_output_buf_cnt     fps
      0    jpeg                 0                  0                   0                    0       0

Parameter Explanation:

Debug Info Group Status Parameter Description
decode param Basic Decoding Parameters dec_idx: decoding instance, dec_id: decoding type, feed_mode: data feeding mode, pix_fmt: image pixel format, bitstream_buf_size: input bitstream buffer size, bitstream_buf_count: number of input bitstream buffers, frame_buf_count: number of output framebuffer buffers, mirror: whether mirroring is enabled, rotate: whether rotation is enabled
decode frameinfo Decoded Frame Output Info dec_idx: decoding instance value, dec_id: decoding type, display_width: display width, display_height: display height
decode status Current Encoding Status Parameters dec_idx: decoding instance value, dec_id: decoding type, cur_input_buf_cnt: number of currently used input buffers, cur_output_buf_cnt: number of currently used output buffers, total_input_buf_cnt: total number of input buffers used, total_output_buf_cnt: total number of output buffers used, fps: current frame rate

Description:
The JPU (JPEG Processing Unit) is primarily used to perform JPEG/MJPEG decoding. Users can input JPEG images to be decoded via the CODEC interface, and obtain the decoded YUV data after processing by the JPU.

5.3.2.3. Interrupt Statistics

Function: Output interrupt counts for each module.

Command:

watch -n 1 'grep -E "sif|isp|vse|gdc" /proc/interrupts'

Example Output:

/proc/interrupts:40: 62:          0          0          0          0          0          0          0          0     GICv3  69 Level     sif
/proc/interrupts:41: 63:          0          0          0          0          0          0          0          0     GICv3  70 Level     sif
/proc/interrupts:42: 64:      54451          0          0          0          0          0          0          0     GICv3  71 Level     sif
/proc/interrupts:43: 65:          0          0          0          0          0          0          0          0     GICv3  72 Level     sif
/proc/interrupts:48: 70:     134309          0          0          0          0          0          0          0     GICv3  75 Level     isp
/proc/interrupts:52: 74:      54342          0          0          0          0          0          0          0     GICv3  82 Level     vse
/proc/interrupts:53: 75:          0          0          0          0          0          0          0          0     GICv3  80 Level     gdc

Explanation:
Prints the number of interrupts generated by each module during current video stream operation. When an error occurs in the complete pipeline, the module causing the anomaly can be identified based on interrupt counts.

5.3.2.4. Frame Rate Information

Function: Output frame rate

Command:

cat /sys/devices/virtual/vps/flow/fps

Output Example:

-------------------------------------------------------------------
                              Flow0 FPS
-------------------------------------------------------------------
  vin3 ctx 0: | ich0   0 | och0   0 | och3   0 | och4   0 |
  isp0 ctx 0: | ich0   0 | och0  30 |
-------------------------------------------------------------------
                              Flow1 FPS
-------------------------------------------------------------------
  vin2 ctx 0: | ich0   0 | och0   0 | och3   0 | och4   0 |
  isp0 ctx 1: | ich0   0 | och0  30 |
-------------------------------------------------------------------
                              Flow2 FPS
-------------------------------------------------------------------
  vin0 ctx 0: | ich0   0 | och0   0 | och3   0 | och4   0 |
  isp0 ctx 2: | ich0   0 | och0  30 |
-------------------------------------------------------------------
                              Flow3 FPS
-------------------------------------------------------------------
  vin1 ctx 0: | ich0   0 | och0   0 | och3   0 | och4   0 |
  isp0 ctx 3: | ich0   0 | och0  30 |

Description: This command outputs the frame rate information for each current video channel (Flow). Taking get_isp_data as an example, after running the relevant sample programme, executing this command displays the frame rate data for different video input streams (vin) and image signal processor contexts (isp). Each line in the output represents the frame rate information for the corresponding device or channel.

Command:

cat /sys/devices/virtual/vps/flow/fps_stats

Output Example:

flowid mod    c_id   chn     fcnt   avg_fps   cur_fps
0      vin2   0
                     0       0     0.000     0.000
                     8       0     0.000     0.000
                     11      0     0.000     0.000
                     12      0     0.000     0.000

0      isp0   0
                     0       0     0.000     0.000
                     8      95    10.070     0.000

0      vse0   0
                     0       0     0.000     0.000
                     8      95    10.074     0.000
                     9       0     0.000     0.000
                     10      0     0.000     0.000
                     11      0     0.000     0.000
                     12      0     0.000     0.000
                     13      0     0.000     0.000

0      gdc0   0
                     0      95    10.074     0.000
                     8      95    10.079     0.000

Explanation:
Displays FPS for all running modules. This FPS refers to the frame rate at which a module outputs data to DDR, excluding frames marked as dropped by software. When a module is online to a downstream module, this information will not be available. If frame drops occur, the statistical value will be lower than the expected sensor FPS. Note that to use this node, the timestamp function of SIF must be enabled. The corresponding JSON configuration can refer to the following:

	"function": {
		"enable_frame_id": 1,
		"set_init_frame_id": 1,
		"time_stamp_en": 1,
		"time_stamp_mode": 3,
		"ts_trigger_source": 1,
		"pps_trigger_source": 6
	}

5.3.2.5. Timestamp Information

Function: Output timestamps of the most recent 5 frames.

Command:

cat /sys/devices/virtual/vps/flow/vio_delay

Output Example:

------------------------------- pipe 0 vio info -------------------------------
frameid  module FS              FE              QB              DQ
00000515 sif    00000184.562367 00000184.595320 00000184.592899 00000184.592901
00000516 sif    00000184.595700 00000184.628653 00000184.626232 00000184.626235
00000517 sif    00000184.629033 00000184.661986 00000184.659558 00000184.659560
00000518 sif    00000184.662366 00000000.000000 00000000.000000 00000000.000000
00000514 sif    00000184.529033 00000184.561986 00000184.559557 00000184.559560

00000515 isp    00000184.593734 00000184.596138 00000184.596186 00000000.000000
00000516 isp    00000184.627070 00000184.629533 00000184.629521 00000000.000000
00000517 isp    00000184.660506 00000184.662958 00000184.662946 00000000.000000
00000513 isp    00000184.527066 00000184.529460 00000184.529506 00000000.000000
00000514 isp    00000184.560459 00000184.562863 00000184.562910 00000000.000000

00000000 vse    00000000.000000 00000184.599267 00000184.599266 00000184.596168
00000000 vse    00000000.000000 00000184.632600 00000184.632600 00000184.629503
00000000 vse    00000000.000000 00000184.666027 00000184.666026 00000184.662929
00000000 vse    00000000.000000 00000184.532586 00000184.532585 00000184.529489
00000000 vse    00000000.000000 00000184.565982 00000184.565981 00000184.562894

00000000 gdc    00000000.000000 00000000.000000 00000000.000000 00000000.000000
00000000 gdc    00000000.000000 00000000.000000 00000000.000000 00000000.000000
00000000 gdc    00000000.000000 00000000.000000 00000000.000000 00000000.000000
00000000 gdc    00000000.000000 00000000.000000 00000000.000000 00000000.000000
00000000 gdc    00000000.000000 00000000.000000 00000000.000000 00000000.000000

00000000 n2d    00000000.000000 00000000.000000 00000000.000000 00000000.000000
00000000 n2d    00000000.000000 00000000.000000 00000000.000000 00000000.000000
00000000 n2d    00000000.000000 00000000.000000 00000000.000000 00000000.000000
00000000 n2d    00000000.000000 00000000.000000 00000000.000000 00000000.000000
00000000 n2d    00000000.000000 00000000.000000 00000000.000000 00000000.000000

Explanation:
Prints timestamps (in seconds) corresponding to specific actions (Frame Start / Frame End / Queue Buffer / Dequeue Buffer) for all active modules. This statistic shows timestamps for the most recent 5 frames. If a frame’s data is 0, it means the event has not yet occurred. The driver performs Queue/Dequeue operations after Frame End, so these three timestamps are close and occur after Frame End. The VSE module lacks Frame Start interrupts due to hardware limitations, so its Frame Start timestamp is empty. The frameid used is the one from Frame Start; if Frame Start is missing, the frameid is blank.

5.3.2.6. Latency Information

Function: Output processing latency for each module per frame.

Command:

cat /sys/devices/virtual/vps/flow/delay_stats

Output Example:

---------------------------------------------------------------------------------------
flowid    module    ctx_id    chn   cur_delay_ms min_delay_ms avg_delay_ms max_delay_ms
---------------------------------------------------------------------------------------
0         vin0      0
                              ich0             0            0            0            0
                              och0            30           30           30           30
                              och3             0            0            0            0
                              och4             0            0            0            0

0         isp0      0
                              ich0             0            0            0            0
                              och0            33           33           33           34

0         vse0      0
                              ich0             0            0            0            0
                              och0            36           36           36           37
                              och1            36           36           36           37
                              och2            36           36           36           37
                              och3            36           36           36           37
                              och4            36           36           36           37
                              och5            36           36           36           37

Explanation:
At Frame Start, SIF acquires the current timestamp in kernel space, which propagates along with the image through the VIO pipeline. This command prints, for each active module, the time difference (in milliseconds) between the current timestamp when the module completes processing (framedone) and the initial SIF timestamp — representing the total delay from when SIF received the frame to when the module finished processing it. This node depends on framedone events in offline mode; modules that do not save data to DDR cannot display this information. If a module lacks framedone information (e.g., application fails to retrieve the buffer), the driver treats it as a software frame drop, and the corresponding node will not update, retaining the last recorded value.

5.3.2.7. Frame Drop Information

Function: Output frame drop information for modules.

Command:

cat /sys/devices/virtual/vps/flow/drop_info
cat /sys/devices/virtual/vps/flow/drop_stats

Explanation:
The first command prints the frame IDs of recently dropped frames for all active modules. The second command prints statistical frame drop rates for all running modules. Software frame drops occur at framedone time — if a module does not save data to DDR, software frame drops will not be recorded. These two features are currently unsupported.

5.3.2.8. Driver Buffer Status

Function: Output buffer status.

Command:

cat /sys/devices/virtual/vps/flow/fmgr_stats

Output Example:

------------------------------------------------------------------------------
flowid    module    ctx_id    chn    FREE   REQUEST   PROCESS  COMPLETE  USED
------------------------------------------------------------------------------
0         vin0      0
                              ich0     16         0         0         0     0
                              och0      0         5         1         0     0

0         isp0      0
                              ich0     10         0         0         0     6
                              och0      0         6         0         0     0

0         vse0      0
                              ich0     10         0         0         0     6
                              och0      0         4         0         0     0
                              och1      0         4         0         0     0
                              och2      0         4         0         0     0
                              och3      0         4         0         0     0
                              och4      0         4         0         0     0
                              och5      0         4         0         0     0

Explanation:
Description: Print the number of buffers for each state of the input and output channels for all running modules.

5.3.2.9. VIO Path Information

Function: Output pipeline status.

Command:

cat /sys/devices/virtual/vps/flow/path_stat

Output Example:

(active)[S0] vin0_C0*(dma)-m2m-isp0_C0-m2m-vse0_C0

Explanation:
Prints connection information between IPs in all active video pipelines. S[number] indicates the flowid of the current pipeline. The number following the module name represents the hardware ID (hw_id). C[number] denotes the software context ID (ctx_id). “dma” indicates output to DDR, “m2m” means offline connection to a downstream module, and “otf” stands for direct (real-time) connection to a downstream module.

5.3.2.10. MIPI Interrupts

Function: View MIPI interrupt counts.

Command:

cat /proc/interrupts |grep mipi_host

Output Example:

 66:          0          0          0          0          0          0          0          0     GICv3  76 Level     3d060000.mipi_host
 67:          0          0          0          0          0          0          0          0     GICv3  78 Level     3d070000.mipi_host
 68:          0          0          0          0          0          0          0          0     GICv3  77 Level     3d080000.mipi_host
 69:          0          0          0          0          0          0          0          0     GICv3  79 Level     3d090000.mipi_host

Explanation:
During normal MIPI module operation, no interrupts should be triggered. Interrupts only occur when errors happen. The above command displays the total interrupt count since the module was loaded.

5.3.2.11. MIPI Status Registers

Function: View MIPI status registers.

Command:

cat /sys/class/vps/mipi_host0/status/regs

Output Example:

root@buildroot:/userdata/gmsl# cat /sys/class/vps/mipi_host0/status/regs
0x000: 0x30313534       - VERSION
0x004: 0x3      - N_LANES
0x008: 0x0      - CSI2_RESETN
0x040: 0x0      - PHY_SHUTDOWNZ
0x044: 0x0      - DPHY_RSTZ
0x048: 0x10000  - PHY_RX
0x04c: 0x0      - PHY_STOPSTATE
0x0cc: 0x0      - PHY_CAL
0x0a0: 0x1111   - IPI_SOFTRSTN
0x010: 0x0      - DATA_IDS_1
0x014: 0x0      - DATA_IDS_2
0x018: 0x0      - PHY_CFG
0x01c: 0x0      - PHY_MODE
0x030: 0x0      - DATA_IDS_VC1
0x034: 0x0      - DATA_IDS_VC2
0x00c: 0x0      - INT_ST_MAIN
0x0e0: 0x0      - INT_ST_PHY_FATAL
0x0f0: 0x0      - INT_ST_PKT_FATAL
0x110: 0x0      - INT_ST_PHY
0x130: 0x0      - INT_ST_LINE
0x140: 0x0      - INT_ST_IPI
0x150: 0x0      - INT_ST_IPI2
0x160: 0x0      - INT_ST_IPI3
0x170: 0x0      - INT_ST_IPI4
0x280: 0x0      - INT_ST_BNDRY_FRAME_FATAL
0x290: 0x0      - INT_ST_SEQ_FRAME_FATAL
0x2a0: 0x0      - INT_ST_CRC_FRAME_FATAL
0x2b0: 0x0      - INT_ST_PLD_CRC_FATAL
0x2c0: 0x0      - INT_ST_DATA_ID
0x2d0: 0x0      - INT_ST_ECC_CORRECT
0x0e4: 0x0      - INT_MSK_PHY_FATAL
0x0f4: 0x0      - INT_MSK_PKT_FATAL
0x114: 0x0      - INT_MSK_PHY
0x134: 0x0      - INT_MSK_LINE
0x144: 0x0      - INT_MSK_IPI
0x154: 0x0      - INT_MSK_IPI2
0x164: 0x0      - INT_MSK_IPI3
0x174: 0x0      - INT_MSK_IPI4
0x284: 0x0      - INT_MSK_BNDRY_FRAME_FATAL
0x294: 0x0      - INT_MSK_SEQ_FRAME_FATAL
0x2a4: 0x0      - INT_MSK_CRC_FRAME_FATAL
0x2b4: 0x0      - INT_MSK_PLD_CRC_FATAL
0x2c4: 0x0      - INT_MSK_DATA_ID
0x2d4: 0x0      - INT_MSK_ECC_CORRECT
0x080: 0x1010000        - IPI_MODE
0x084: 0x0      - IPI_VCID
0x088: 0x1e     - IPI_DATA_TYPE
0x08c: 0x100    - IPI_MEM_FLUSH
0x090: 0x4      - IPI_HSA_TIME
0x094: 0x4      - IPI_HBP_TIME
0x098: 0x1a     - IPI_HSD_TIME
0x09c: 0x0      - IPI_HLINE_TIME
0x0ac: 0x1030000        - IPI_ADV_FEATURES
0x0b0: 0x0      - IPI_VSA_LINES
0x0b4: 0x0      - IPI_VBP_LINES
0x0b8: 0x0      - IPI_VFP_LINES
0x0bc: 0x0      - IPI_VACTIVE_LINES
0x200: 0x1010000        - IPI2_MODE
0x204: 0x1      - IPI2_VCID
0x208: 0x1e     - IPI2_DATA_TYPE
0x20c: 0x100    - IPI2_MEM_FLUSH
0x210: 0x4      - IPI2_HSA_TIME
0x214: 0x4      - IPI2_HBP_TIME
0x218: 0x1a     - IPI2_HSD_TIME
0x21c: 0x1030000        - IPI2_ADV_FEATURES

Explanation:
Below are key MIPI error status registers:

  • INT_ST_PHY_FATAL

    • [7:0]: 0xff phy_errsotsynchs_7..0

      • Error: SOT error (sync not received) on corresponding data lane.

      • Troubleshooting: Check configuration file correctness.

    • [8]: 0x100 err_deskew

      • Error: Skew between lanes exceeds 2 rxwordhs, leading to data loss.

  • INT_ST_SEQ_FRAME_FATAL

    • [31:0]: 0xFFFFFFFF err_f_seq_vc31..0

      • Error: Frame numbers on corresponding VC are discontinuous, indicating frame drops.

      • Troubleshooting: Check bandwidth sufficiency, SerDes status, and hardware signals.

  • INT_ST_CRC_FRAME_FATAL

    • [31:0]: 0XFFFFFFFF err_frame_data_vc31..0

      • Error: At least one CRC error in frames on the corresponding VC.

      • Troubleshooting: Check SerDes status and hardware signals.

  • INT_ST_PHY

    • [7:0]: 0x0000FF phy_errsoths_7..0

      • Error: SOT error (sync not received) on corresponding data lane.

      • Troubleshooting: Verify correct mipiclk and settle settings in configuration.

    • [23:16]: 0xFF0000 phy_errsoths_7..0

      • Error: SOT error (sync not received) on corresponding data lane.

      • Troubleshooting: Verify correct mipiclk and settle settings in configuration.

5.3.2.12. MIPI Interrupt Logging

Function: View current logging limits and remove restrictions on MIPI module error message printing.

Command:

# View current limit:
cat /sys/class/vps/mipi_host0/param/irq_cnt

Command:

# Set no limit (for debug use):
echo 0xffffffff > /sys/class/vps/mipi_host0/param/irq_cnt

Output Example:

root@buildroot:/userdata/gmsl# cat /sys/class/vps/mipi_host0/param/irq_cnt
10

Explanation:
If MIPI stops printing error messages after only about ten lines, this does not mean the errors have ceased — it may indicate that interrupt logging is limited. By writing to the irq_cnt parameter, the number of log lines can be increased to obtain more detailed error information.