Skip to content

Adding Camera RDI validation using YAVTA Test Scripts #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions Runner/suites/Multimedia/Camera/README_Camera.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
# SPDX-License-Identifier: BSD-3-Clause-Clear
Copy link
Contributor

@smuppand smuppand Jun 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove comments for the Copyright. Also move this file under v4l2_camera_RDI_dump folder.


# Camera RDI dump validation using YAVTA App Test Scripts for Qualcomm Linux based platform (Yocto)

## Overview

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
## Features

- Camera RDI dump validation using YAVTA App
- Compatible with Yocto-based root filesystem

## Prerequisites

Ensure the following components are present in the target Yocto build:

- `yavta and media-ctl` (available in /usr/bin/)
- To find the exact /dev/media node for our camss driver
```
media-ctl -p -d /dev/media 'y' | grep camss ['y' has to be replaced with media0 or media1 eg: /dev/media0, /dev/media1]
Output will be # driver qcom-camss [for probed media]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not coming properly in Markdown language. Can you check this once

```
- To find list avaliable device files
```
v4l2-ctl --list-devices
```
Output will be # video0 video1 video2 ...
- /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

'y' has to be replaced eg: /dev/video0, /dev/video1 depending on RDI port configured..
```
yavta -B capture-mplane -c -I -n 5 -f SRGGB10P -s 4056x3040 -F /dev/video'y' --capture=5 --file='frame-#.bin'
```
- Write access to root filesystem (for environment setup)
```
mount -o rw,remount /
mount -o rw,remount /usr
```

## Directory Structure

```bash
Runner/
├── suites/
│ ├── Multimedia/
│ │ ├── Camera/
│ │ │ ├── v4l2_camera_RDI_dump
│ │ │ │ ├── run.sh
│ │ │ ├── README_Camera.md
│ │ │ │
```

## Usage

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.

2. Verify Transfer: Ensure that the repo have been successfully copied to any directory on the target device.

3. Run Scripts: Navigate to the directory where these files are copied on the target device and execute the scripts as needed.

Run a specific test using:
---
Quick Example
```
git clone <this-repo>
cd <this-repo>
scp -r Runner user@target_device_ip:<Path in device>
ssh user@target_device_ip
cd <Path in device> --> /var/Runner/suites/Multimedia/Camera/v4l2_camera_RDI_dump/ && chmod +x run.sh && ./run.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not to use /var in the documentation. In place of /var use like #69 line. <path in device

```
Sample output:
```
sh-5.2# cd /var/Runner/suites/Multimedia/Camera/v4l2_camera_RDI_dump/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here also.. you can refactor this line

sh-5.2# ./run.sh
[INFO] 2025-01-09 13:45:22 - -----------------------------------------------------------------------------------------
[INFO] 2025-01-09 13:45:22 - -------------------Starting v4l2_camera_RDI_dump Testcase----------------------------
[INFO] 2025-01-09 13:45:22 - === Test Initialization ===
[INFO] 2025-01-09 13:45:22 - Checking if dependency binary is available
[INFO] 2025-01-09 13:45:22 - -------------------Camera commands execution start----------------------------
Device /dev/v4l-subdev0 opened.
Control 0x009f0903 set to 0, is 0
Device /dev/v4l-subdev0 opened.
Control 0x009f0903 set to 9, is 9
[PASS] 2025-01-09 13:45:23 - v4l2_camera_RDI_dump : Test Passed
[INFO] 2025-01-09 13:45:23 - -------------------Completed v4l2_camera_RDI_dump Testcase----------------------------
```
3. Results will be available in the `Runner/suites/Multimedia/Camera/v4l2_camera_RDI_dump/` directory under each usecase folder.

## Notes

- The script does not take any arguments.
- It validates the presence of required libraries before executing tests.
- If any critical tool is missing, the script exits with an error message.
67 changes: 67 additions & 0 deletions Runner/suites/Multimedia/Camera/v4l2_camera_RDI_dump/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/sh

# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
# SPDX-License-Identifier: BSD-3-Clause-Clear

# --------- Robustly source init_env and functestlib.sh ----------
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
INIT_ENV=""
SEARCH="$SCRIPT_DIR"
while [ "$SEARCH" != "/" ]; do
if [ -f "$SEARCH/init_env" ]; then
INIT_ENV="$SEARCH/init_env"
break
fi
SEARCH=$(dirname "$SEARCH")
done

if [ -z "$INIT_ENV" ]; then
echo "[ERROR] Could not find init_env (starting at $SCRIPT_DIR)" >&2
exit 1
fi

if [ -z "$__INIT_ENV_LOADED" ]; then
. "$INIT_ENV"
fi
. "$TOOLS/functestlib.sh"
# ---------------------------------------------------------------

TESTNAME="v4l2_camera_RDI_dump"
test_path=$(find_test_case_by_name "$TESTNAME")
cd "$test_path" || exit 1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

res_file is not used anywhere in the script

log_info "-----------------------------------------------------------------------------------------"
log_info "-------------------Starting $TESTNAME Testcase----------------------------"
log_info "=== Test Initialization ==="

log_info "Checking if dependency binary is available"
check_dependencies yavta media-ctl

log_info "-------------------Camera commands execution start----------------------------"
# Run the test
mount -o rw,remount /
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by default it will be rw. any reason why remount is required?

mount -o rw,remount /usr/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't see any operations are being performed under /usr. Why do we require /usr remount?

media-ctl -d /dev/media0 --reset
yavta --no-query -w '0x009f0903 0' /dev/v4l-subdev0
media-ctl -d /dev/media0 -V '"msm_tpg0":0[fmt:SRGGB10/1920x1080 field:none]'
media-ctl -d /dev/media0 -V '"msm_csid0":0[fmt:SRGGB10/1920x1080 field:none]'
media-ctl -d /dev/media0 -V '"msm_vfe0_rdi0":0[fmt:SRGGB10/1920x1080 field:none]'
media-ctl -d /dev/media0 -l '"msm_tpg0":1->"msm_csid0":0[1]'
media-ctl -d /dev/media0 -l '"msm_csid0":1->"msm_vfe0_rdi0":0[1]'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it is /dev/media0 is common across the devices? if not, its better to make a robust to get the right dev node.


#Removing previous logs in the device
rm -rf "${test_path}"/Camera_RDI_Test.txt
rm -rf "${test_path}"/v4l2_camera_RDI_dump.res
rm -rf "${test_path}"/*.bin

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this working.
IMO it should be - rm -rf "$test_path"/*.bin

yavta --no-query -w '0x009f0903 9' /dev/v4l-subdev0
yavta -B capture-mplane -n 5 -f SRGGB10P -s 1920x1080 /dev/video1 --capture=10 --file='frame-#.bin' >> "${test_path}/Camera_RDI_Test.txt"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/dev/video1 will be consistent across the devices as DT might be changing per device?



if grep -q "Captured 10 frames" "${test_path}/Camera_RDI_Test.txt"; then
log_pass "$TESTNAME : Test Passed"
else
log_fail "$TESTNAME : Test Failed"
fi

log_info "-------------------Completed $TESTNAME Testcase----------------------------"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure run.sh have executable permission (chmod 755 )

Loading