Skip to content

Commit 782d3ef

Browse files
committed
Adding YAVTA Test Scripts for Camera RDI dump validation
- Introduced automated test scripts for validating camera RDI dumps using YAVTA and media-ctl - Compatible with Qualcomm Yocto-based Linux systems - Includes run.sh for test execution and README_Camera.md for usage instructions Signed-off-by: Bhargav Ram Pranav Mutyalapalli <[email protected]>
1 parent 7433bb9 commit 782d3ef

File tree

4 files changed

+234
-0
lines changed

4 files changed

+234
-0
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Camera RDI dump validation using YAVTA App Test Scripts for Qualcomm Linux based platform (Yocto)
2+
3+
## Overview
4+
5+
Camera scripts automates the Camera RDI dump validation using YAVTA App on the Qualcomm Linux based platform running a Yocto-based Linux system.It utilizes yavta and media-ctl binaries which is publicly available
6+
## Features
7+
8+
- Camera RDI dump validation using YAVTA App
9+
- Compatible with Yocto-based root filesystem
10+
11+
## Prerequisites
12+
13+
Ensure the following components are present in the target Yocto build:
14+
15+
- `yavta and media-ctl` (available in /usr/bin/)
16+
- To find the exact /dev/media node for our camss driver
17+
```
18+
media-ctl -p -d /dev/media 'y' | grep camss ['y' has to be replaced with media0 or media1 eg: /dev/media0, /dev/media1]
19+
20+
Output will be # driver qcom-camss [for probed media]
21+
```
22+
- To find list avaliable device files
23+
```
24+
v4l2-ctl --list-devices
25+
```
26+
Output will be # video0 video1 video2 ...
27+
- /dev/video# linking to RDI port is dynamic not fixed , user need to identify the correct video device file(by trail and error) to use in yavta RDI dump command
28+
29+
'y' has to be replaced eg: /dev/video0, /dev/video1 depending on RDI port configured..
30+
```
31+
yavta -B capture-mplane -c -I -n 5 -f SRGGB10P -s 4056x3040 -F /dev/video'y' --capture=5 --file='frame-#.bin'
32+
```
33+
- camera_node_finder function dynamically detects the active media node and the corresponding video node (e.g., /dev/mediaX and /dev/videoY) for the msm_vfe0_rdi0 entity, enabling automated and adaptable camera pipeline configuration.
34+
35+
## Directory Structure
36+
37+
```bash
38+
Runner/
39+
├── suites/
40+
│ ├── Multimedia/
41+
│ │ ├── Camera/
42+
│ │ │ ├── v4l2_camera_RDI_dump
43+
│ │ │ │ ├── run.sh
44+
│ │ │ ├── README_Camera.md
45+
│ │ │ │
46+
```
47+
48+
## Usage
49+
50+
1. Copy repo to Target Device: Use scp to transfer the scripts from the host to the target device. The scripts should be copied to any directory on the target device.
51+
52+
2. Verify Transfer: Ensure that the repo have been successfully copied to any directory on the target device.
53+
54+
3. Run Scripts: Navigate to the directory where these files are copied on the target device and execute the scripts as needed.
55+
56+
Run a specific test using:
57+
---
58+
Quick Example
59+
```
60+
git clone <this-repo>
61+
cd <this-repo>
62+
scp -r Runner user@target_device_ip:<Path in device>
63+
ssh user@target_device_ip
64+
cd <Path in device> && chmod +x run.sh && ./run.sh
65+
```
66+
Sample output:
67+
```
68+
sh-5.2# cd <Path in device>
69+
sh-5.2# ./run.sh
70+
[INFO] 2025-01-09 13:45:22 - -----------------------------------------------------------------------------------------
71+
[INFO] 2025-01-09 13:45:22 - -------------------Starting v4l2_camera_RDI_dump Testcase----------------------------
72+
[INFO] 2025-01-09 13:45:22 - === Test Initialization ===
73+
[INFO] 2025-01-09 13:45:22 - Checking if dependency binary is available
74+
[INFO] 2025-01-09 13:45:22 - -------------------Camera commands execution start----------------------------
75+
Device /dev/v4l-subdev0 opened.
76+
Control 0x009f0903 set to 0, is 0
77+
Device /dev/v4l-subdev0 opened.
78+
Control 0x009f0903 set to 9, is 9
79+
[PASS] 2025-01-09 13:45:23 - v4l2_camera_RDI_dump : Test Passed
80+
[INFO] 2025-01-09 13:45:23 - -------------------Completed v4l2_camera_RDI_dump Testcase----------------------------
81+
```
82+
3. Results will be available in the `Runner/suites/Multimedia/Camera/v4l2_camera_RDI_dump/` directory under each usecase folder.
83+
84+
## Notes
85+
86+
- The script does not take any arguments.
87+
- It validates the presence of required libraries before executing tests.
88+
- If any critical tool is missing, the script exits with an error message.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# media_topology.conf
2+
3+
# Device paths
4+
MEDIA_DEV="$MEDIA_NODE"
5+
SUBDEV="/dev/v4l-subdev0"
6+
VIDEO_DEV="$VIDEO_NODE"
7+
8+
# Format settings
9+
FORMAT="SRGGB10"
10+
RESOLUTION="1920x1080"
11+
FIELD="none"
12+
13+
# Control values
14+
STREAM_OFF=0
15+
STREAM_ON=9
16+
17+
# Command templates
18+
RESET_CMD='media-ctl -d "$MEDIA_DEV" --reset'
19+
20+
FORMAT_TPG='media-ctl -d "$MEDIA_DEV" -V "\"msm_tpg0\":0[fmt:$FORMAT/$RESOLUTION field:$FIELD]"'
21+
FORMAT_CSID='media-ctl -d "$MEDIA_DEV" -V "\"msm_csid0\":0[fmt:$FORMAT/$RESOLUTION field:$FIELD]"'
22+
FORMAT_VFE='media-ctl -d "$MEDIA_DEV" -V "\"msm_vfe0_rdi0\":0[fmt:$FORMAT/$RESOLUTION field:$FIELD]"'
23+
24+
LINK_TPG_CSID='media-ctl -d "$MEDIA_DEV" -l "\"msm_tpg0\":1->\"msm_csid0\":0[1]"'
25+
LINK_CSID_VFE='media-ctl -d "$MEDIA_DEV" -l "\"msm_csid0\":1->\"msm_vfe0_rdi0\":0[1]"'
26+
27+
DISABLE_STREAM='yavta --no-query -w "0x009f0903 $STREAM_OFF" "$SUBDEV"'
28+
ENABLE_STREAM='yavta --no-query -w "0x009f0903 $STREAM_ON" "$SUBDEV"'
29+
30+
CAPTURE_CMD='yavta -B capture-mplane -n 5 -f "${FORMAT}P" -s "$RESOLUTION" "$VIDEO_DEV" --capture=10 --file="frame-#.bin" >> "${test_path}/Camera_RDI_Test.txt"'
31+
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/sh
2+
3+
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
4+
# SPDX-License-Identifier: BSD-3-Clause-Clear
5+
6+
# --------- Robustly source init_env and functestlib.sh ----------
7+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
8+
INIT_ENV=""
9+
SEARCH="$SCRIPT_DIR"
10+
while [ "$SEARCH" != "/" ]; do
11+
if [ -f "$SEARCH/init_env" ]; then
12+
INIT_ENV="$SEARCH/init_env"
13+
break
14+
fi
15+
SEARCH=$(dirname "$SEARCH")
16+
done
17+
18+
if [ -z "$INIT_ENV" ]; then
19+
echo "[ERROR] Could not find init_env (starting at $SCRIPT_DIR)" >&2
20+
exit 1
21+
fi
22+
23+
if [ -z "$__INIT_ENV_LOADED" ]; then
24+
. "$INIT_ENV"
25+
fi
26+
. "$TOOLS/functestlib.sh"
27+
# ---------------------------------------------------------------
28+
29+
TESTNAME="v4l2_camera_RDI_dump"
30+
test_path=$(find_test_case_by_name "$TESTNAME")
31+
cd "$test_path" || exit 1
32+
33+
log_info "-----------------------------------------------------------------------------------------"
34+
log_info "-------------------Starting $TESTNAME Testcase----------------------------"
35+
log_info "=== Test Initialization ==="
36+
37+
log_info "Checking if dependency binary is available"
38+
check_dependencies yavta media-ctl
39+
40+
# To find the exact probed media and video nodes for camera
41+
camera_node_finder
42+
43+
log_info "-------------------Camera commands execution start----------------------------"
44+
45+
# Load configuration
46+
source ./media_topology.conf
47+
48+
49+
# Execute commands using variables
50+
eval $RESET_CMD
51+
eval $DISABLE_STREAM
52+
eval $FORMAT_TPG
53+
eval $FORMAT_CSID
54+
eval $FORMAT_VFE
55+
eval $LINK_TPG_CSID
56+
eval $LINK_CSID_VFE
57+
eval $ENABLE_STREAM
58+
59+
# Removing the previous execution logs
60+
rm -rf "${test_path}"/Camera_RDI_Test.txt
61+
rm -rf "${test_path}"/v4l2_camera_RDI_dump.res
62+
rm -rf "${test_path}"/*.bin
63+
64+
# Start capture using the dynamic video node
65+
eval $CAPTURE_CMD
66+
67+
if grep -q "Captured 10 frames" "${test_path}/Camera_RDI_Test.txt"; then
68+
log_pass "$TESTNAME : Test Passed"
69+
else
70+
log_fail "$TESTNAME : Test Failed"
71+
fi
72+
73+
log_info "-------------------Completed $TESTNAME Testcase----------------------------"

Runner/utils/functestlib.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,3 +391,45 @@ weston_start() {
391391
fi
392392
}
393393

394+
#Function to find the probed media and video node for camera
395+
camera_node_finder() {
396+
# Step 1: Find the media node with qcom-camss driver
397+
for media in /dev/media*; do
398+
if media-ctl -p -d "$media" 2>/dev/null | grep -q "driver[[:space:]]*qcom-camss"; then
399+
MEDIA_NODE="$media"
400+
break
401+
fi
402+
done
403+
404+
if [ -z "$MEDIA_NODE" ]; then
405+
echo "No media device with qcom-camss driver found."
406+
exit 1
407+
fi
408+
409+
export MEDIA_NODE
410+
411+
# Step 2: Get the entity number for msm_vfe0_video0
412+
ENTITY_LINE=$(media-ctl -p -d "$MEDIA_NODE" 2>/dev/null | grep -E 'entity [0-9]+: msm_vfe0_video0')
413+
ENTITY_NUM=$(echo "$ENTITY_LINE" | grep -oP 'entity \K[0-9]+')
414+
415+
if [ -z "$ENTITY_NUM" ]; then
416+
echo "Could not find entity for msm_vfe0_video0."
417+
exit 1
418+
fi
419+
420+
# Step 3: Extract the device node name from that entity
421+
VIDEO_NODE=$(media-ctl -p -d "$MEDIA_NODE" 2>/dev/null | \
422+
awk -v entity="entity $ENTITY_NUM:" '
423+
$0 ~ entity { found=1; next }
424+
found && /device node name/ {
425+
print $NF
426+
exit
427+
}')
428+
429+
if [ -n "$VIDEO_NODE" ]; then
430+
export VIDEO_NODE
431+
else
432+
echo "Could not find video node for msm_vfe0_video0."
433+
exit 1
434+
fi
435+
}

0 commit comments

Comments
 (0)