diff --git a/Runner/suites/Multimedia/Graphics/KMSCube/README_KMSCube.md b/Runner/suites/Multimedia/Graphics/KMSCube/README_KMSCube.md new file mode 100644 index 00000000..f033372f --- /dev/null +++ b/Runner/suites/Multimedia/Graphics/KMSCube/README_KMSCube.md @@ -0,0 +1,82 @@ +Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + +SPDX-License-Identifier: BSD-3-Clause-Clear +# KMSCube GraphicsTest Scripts for Qualcomm Linux based platform (Yocto) +# Overview + +Graphics scripts automates the validation of Graphics OpenGL ES 2.0 capabilities on the Qualcomm RB3 Gen2 platform running a Yocto-based Linux system. It utilizes kmscube test app which is publicly available at https://gitlab.freedesktop.org/mesa/kmscube + +## Features + +- Primarily uses OpenGL ES 2.0, but recent versions include headers for OpenGL ES 3.0 for compatibility +- Uses Kernel Mode Setting (KMS) and Direct Rendering Manager (DRM) to render directly to the screen without a display server +- Designed to be lightweight and minimal, making it ideal for embedded systems and validation environments. +- Can be used to measure GPU performance or validate rendering pipelines in embedded Linux systems + +## Prerequisites + +Ensure the following components are present in the target Yocto build: + +- kmscube (Binary Available in /usr/bin) - this test app can be compiled from https://gitlab.freedesktop.org/mesa/kmscube +- Weston should be killed while running KMSCube Test +- Write access to root filesystem (for environment setup) + +## Directory Structure + +``` +bash +Runner/ +├── suites/ +│ ├── Multimedia/ +│ │ ├── Graphics/ +│ │ │ ├── KMSCube/ +│ │ │ │ ├── run.sh +``` + +## Usage + +Instructions + +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 Graphics KMSCube test using: +--- +#### Quick Example +``` +git clone +cd +scp -r common Runner user@target_device_ip: +ssh user@target_device_ip +cd /Runner && ./run-test.sh KMSCube +``` +#### Sample output: +``` +sh-5.2# cd /Runner/ && ./run-test.sh KMSCube +[Executing test case: KMSCube] 2025-01-08 19:54:40 - +[INFO] 2025-01-08 19:54:40 - ------------------------------------------------------------------- +[INFO] 2025-01-08 19:54:40 - ------------------- Starting kmscube Testcase ------------------- +[INFO] 2025-01-08 19:54:40 - Stopping Weston... +[INFO] 2025-01-08 19:54:42 - Weston stopped. +[INFO] 2025-01-08 19:54:42 - Running kmscube test with --count=999... +[PASS] 2025-01-08 19:54:59 - kmscube : Test Passed +[INFO] 2025-01-08 19:55:02 - Weston started. +[INFO] 2025-01-08 19:55:02 - ------------------- Completed kmscube Testcase ------------------ +[PASS] 2025-01-08 19:55:02 - KMSCube passed + +[INFO] 2025-01-08 19:55:02 - ========== Test Summary ========== +PASSED: +KMSCube + +FAILED: + None +[INFO] 2025-01-08 19:55:02 - ================================== +sh-5.2# +``` +## Notes + +- It validates the graphics gles2 functionalities. +- If any critical tool is missing, the script exits with an error message. diff --git a/Runner/suites/Multimedia/Graphics/KMSCube/run.sh b/Runner/suites/Multimedia/Graphics/KMSCube/run.sh new file mode 100644 index 00000000..c83f9193 --- /dev/null +++ b/Runner/suites/Multimedia/Graphics/KMSCube/run.sh @@ -0,0 +1,74 @@ +#!/bin/sh +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause-Clear + +# KMSCube Validator Script (Yocto-Compatible) +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 + # shellcheck disable=SC1090 + . "$INIT_ENV" +fi + +# shellcheck disable=SC1090,SC1091 +. "$TOOLS/functestlib.sh" + +TESTNAME="kmscube" +FRAME_COUNT=999 +EXPECTED_FRAMES=$((FRAME_COUNT - 1)) +test_path=$(find_test_case_by_name "$TESTNAME") +cd "$test_path" || exit 1 +RES_FILE="./$TESTNAME.res" +LOG_FILE="./${TESTNAME}_run.log" +rm -f "$RES_FILE" "$LOG_FILE" + +log_info "-------------------------------------------------------------------" +log_info "------------------- Starting $TESTNAME Testcase -------------------" + +if check_dependencies "$TESTNAME"; then + log_fail "$TESTNAME : kmscube binary not found" + echo "$TESTNAME SKIP" > "$RES_FILE" + exit 1 +fi + +weston_was_running=0 +if weston_is_running; then + weston_stop + weston_was_running=1 +fi + +log_info "Running kmscube test with --count=$FRAME_COUNT..." +if kmscube --count="$FRAME_COUNT" > "$LOG_FILE" 2>&1; then + if grep -q "Rendered $EXPECTED_FRAMES frames" "$LOG_FILE"; then + log_pass "$TESTNAME : Test Passed" + echo "$TESTNAME PASS" > "$RES_FILE" + else + log_fail "$TESTNAME : Expected output not found (Rendered $EXPECTED_FRAMES frames)" + echo "$TESTNAME FAIL" > "$RES_FILE" + fi +else + log_fail "$TESTNAME : Execution failed (non-zero exit code)" + echo "$TESTNAME FAIL" > "$RES_FILE" +fi + +if [ "$weston_was_running" -eq 1 ]; then + log_info "weston realuching after $TESTNAME completion" + weston_start +fi + +log_info "------------------- Completed $TESTNAME Testcase ------------------" +exit 0 diff --git a/Runner/suites/Multimedia/Graphics/run.sh b/Runner/suites/Multimedia/Graphics/run.sh deleted file mode 100755 index 4e64b2e1..00000000 --- a/Runner/suites/Multimedia/Graphics/run.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh - -# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - -# Robustly find and source init_env -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 - -# Only source if not already loaded (idempotent) -if [ -z "$__INIT_ENV_LOADED" ]; then - # shellcheck disable=SC1090 - . "$INIT_ENV" -fi -# Always source functestlib.sh, using $TOOLS exported by init_env -# shellcheck disable=SC1090,SC1091 -. "$TOOLS/functestlib.sh" - -TESTNAME="Graphics" -test_path=$(find_test_case_by_name "$TESTNAME") -cd "$test_path" || exit 1 -# shellcheck disable=SC2034 -res_file="./$TESTNAME.res" - -log_info "-----------------------------------------------------------------------------------------" -log_info "-------------------Starting $TESTNAME Testcase----------------------------" -log_info "=== Test Initialization ===" - -log_info "Checking if dependency binary is available" -check_dependencies a660_sqe.fw a660_zap.mbn a660_gmu.bin - -# Clear dmesg logs -dmesg -c - -cat /dev/dri/card0 & -OUTPUT=$(dmesg) - -if echo "${OUTPUT}" | grep "Loaded GMU firmware"; then - log_pass "$TESTNAME : Test Passed" - echo "$TESTNAME PASS" > "$res_file" -else - log_fail "$TESTNAME : Test Failed" - echo "$TESTNAME FAIL" > "$res_file" -fi -log_info "-------------------Completed $TESTNAME Testcase----------------------------" diff --git a/Runner/suites/Multimedia/Graphics/weston-simple-egl/README_weston-simple-egl.md b/Runner/suites/Multimedia/Graphics/weston-simple-egl/README_weston-simple-egl.md new file mode 100644 index 00000000..f9d01098 --- /dev/null +++ b/Runner/suites/Multimedia/Graphics/weston-simple-egl/README_weston-simple-egl.md @@ -0,0 +1,109 @@ +Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + +SPDX-License-Identifier: BSD-3-Clause-Clear +# weston-simple-egl GraphicsTest Scripts for Qualcomm Linux based platform (Yocto) +# Overview + +Graphics scripts automates the validation of Graphics OpenGL ES 2.0 capabilities on the Qualcomm RB3 Gen2 platform running a Yocto-based Linux system. It utilizes Weston-Simple-EGL test app which is publicly available at https://github.com/krh/weston + +## Features + +- Wayland Client Integration , Uses wl_compositor, wl_shell, wl_seat, and wl_shm interfaces +- OpenGL ES 2.0 Rendering +- EGL Context Initialization + +## Prerequisites + +Ensure the following components are present in the target Yocto build: + +- `weston-simple-egl` (Binary Available in /usr/bin) be default +- Write access to root filesystem (for environment setup) + +## Directory Structure + +``` +bash +Runner/ +├── suites/ +│ ├── Multimedia/ +│ │ ├── Graphics/ +│ │ │ ├── weston-simple-egl/ +│ │ │ │ ├── run.sh +``` + +## Usage + +Instructions + +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 Graphics weston-simple-egl using: +--- +#### Quick Example +``` +git clone +cd +scp -r common Runner user@target_device_ip: +ssh user@target_device_ip +cd /Runner && ./run-test.sh weston-simple-egl +``` + +#### Sample output: +``` +sh-5.2# cd /Runner/ && ./run-test.sh weston-simple-egl +[Executing test case: weston-simple-egl] 2025-01-08 19:57:17 - +[INFO] 2025-01-08 19:57:17 - -------------------------------------------------------------------------- +[INFO] 2025-01-08 19:57:17 - ------------------- Starting weston-simple-egl Testcase -------------------------- +[INFO] 2025-01-08 19:57:17 - Weston already running. +[INFO] 2025-01-08 19:57:17 - Running weston-simple-egl for 30 seconds... +QUALCOMM build : 05b958b3c9, Ia7470d0c4c +Build Date : 03/27/25 +OpenGL ES Shader Compiler Version: +Local Branch : +Remote Branch : +Remote Branch : +Reconstruct Branch : + +Build Config : G ESX_C_COMPILER_OPT 3.3.0 AArch64 +Driver Path : /usr/lib/libGLESv2_adreno.so.2 +Driver Version : 0808.0.6 +Process Name : weston-simple-egl +PFP: 0x016dc112, ME: 0x00000000 +Pre-rotation disabled !!! + +EGL updater thread started + +MSM_GEM_NEW returned handle[1] for drm_fd=5 buffer flag=65536 buffer size=266240 +Get fd[7] from GEM HANDLE[1] +MSM_GEM_NEW returned handle[2] for drm_fd=5 buffer flag=65536 buffer size=266240 +Get fd[7] from GEM HANDLE[2] +MSM_GEM_NEW returned handle[3] for drm_fd=5 buffer flag=65536 buffer size=266240 +Get fd[7] from GEM HANDLE[3] +MSM_GEM_NEW returned handle[4] for drm_fd=5 buffer flag=65536 buffer size=266240 +Get fd[7] from GEM HANDLE[4] +303 frames in 5 seconds: 60.599998 fps +300 frames in 5 seconds: 60.000000 fps +298 frames in 5 seconds: 59.599998 fps +300 frames in 5 seconds: 60.000000 fps +299 frames in 5 seconds: 59.799999 fps +[PASS] 2025-01-08 19:57:49 - weston-simple-egl : Test Passed +[INFO] 2025-01-08 19:57:49 - ------------------- Completed weston-simple-egl Testcase ------------------------ +[PASS] 2025-01-08 19:57:49 - weston-simple-egl passed + +[INFO] 2025-01-08 19:57:49 - ========== Test Summary ========== +PASSED: +weston-simple-egl + +FAILED: + None +[INFO] 2025-01-08 19:57:49 - ================================== +sh-5.2# +``` +## Notes + +- It validates the graphics gles2 functionalities. +- If any critical tool is missing, the script exits with an error message. diff --git a/Runner/suites/Multimedia/Graphics/weston-simple-egl/run.sh b/Runner/suites/Multimedia/Graphics/weston-simple-egl/run.sh new file mode 100644 index 00000000..932b1375 --- /dev/null +++ b/Runner/suites/Multimedia/Graphics/weston-simple-egl/run.sh @@ -0,0 +1,78 @@ +#!/bin/sh +# SPDX-License-Identifier: BSD-3-Clause-Clear +# Description: Script to test the 'weston-simple-egl' Wayland client for 30 seconds and log the result. + +# Robustly find and source init_env +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 + +# Only source if not already loaded (idempotent) +if [ -z "$__INIT_ENV_LOADED" ]; then + # shellcheck disable=SC1090 + . "$INIT_ENV" +fi + +# Always source functestlib.sh, using $TOOLS exported by init_env +# shellcheck disable=SC1090,SC1091 +. "$TOOLS/functestlib.sh" + +TESTNAME="weston-simple-egl" + +test_path=$(find_test_case_by_name "$TESTNAME") +cd "$test_path" || exit 1 +RES_FILE="./$TESTNAME.res" +LOG_FILE="./${TESTNAME}_run.log" +rm -f "$RES_FILE" "$LOG_FILE" + +log_info "--------------------------------------------------------------------------" +log_info "------------------- Starting $TESTNAME Testcase --------------------------" + +# Only start if not already running +if ! weston_is_running; then + log_info "Weston not running. Attempting to start..." + weston_start +fi + +if check_dependencies weston-simple-egl; then + log_fail "$TESTNAME : weston-simple-egl binary not found" + echo "$TESTNAME SKIP" > "$RES_FILE" + exit 1 +fi + +XDG_RUNTIME_DIR="/dev/socket/weston" +WAYLAND_DISPLAY="wayland-1" +export XDG_RUNTIME_DIR WAYLAND_DISPLAY + +mkdir -p "$XDG_RUNTIME_DIR" +chmod 0700 "$XDG_RUNTIME_DIR" +log_info "Running weston-simple-egl for 30 seconds..." +script -q -c "weston-simple-egl" "$LOG_FILE" 2>/dev/null & +EGL_PID=$! +sleep 30 +kill "$EGL_PID" 2>/dev/null +wait "$EGL_PID" 2>/dev/null + +count=$(grep -i -o "5 seconds" "$LOG_FILE" | wc -l) +if [ "$count" -ge 5 ]; then + log_pass "$TESTNAME : Test Passed" + echo "$TESTNAME PASS" > "$RES_FILE" +else + log_fail "$TESTNAME : Test Failed" + echo "$TESTNAME FAIL" > "$RES_FILE" +fi + +log_info "------------------- Completed $TESTNAME Testcase ------------------------" +exit 0 diff --git a/Runner/utils/functestlib.sh b/Runner/utils/functestlib.sh index 8260b8d8..473b43f7 100755 --- a/Runner/utils/functestlib.sh +++ b/Runner/utils/functestlib.sh @@ -163,3 +163,58 @@ check_tar_file() { return 2 } +# Check if weston is running +weston_is_running() { + pgrep -x weston >/dev/null 2>&1 +} + +# Stop all Weston processes +weston_stop() { + if weston_is_running; then + log_info "Stopping Weston..." + pkill -x weston + for i in $(seq 1 10); do + log_info "Waiting for Weston to stop with $i attempt " + if ! weston_is_running; then + log_info "Weston stopped successfully" + return 0 + fi + sleep 1 + done + log_error "Failed to stop Weston after waiting." + return 1 + else + log_info "Weston is not running." + fi + return 0 +} + +# Start weston with correct env if not running +weston_start() { + export XDG_RUNTIME_DIR="/dev/socket/weston" + mkdir -p "$XDG_RUNTIME_DIR" + + # Remove stale Weston socket if it exists + if [ -S "$XDG_RUNTIME_DIR/weston" ]; then + log_info "Removing stale Weston socket." + rm -f "$XDG_RUNTIME_DIR/weston" + fi + + if weston_is_running; then + log_info "Weston already running." + return 0 + fi + # Clean up stale sockets for wayland-0 (optional) + [ -S "$XDG_RUNTIME_DIR/wayland-1" ] && rm -f "$XDG_RUNTIME_DIR/wayland-1" + nohup weston --continue-without-input --idle-time=0 > weston.log 2>&1 & + sleep 3 + + if weston_is_running; then + log_info "Weston started." + return 0 + else + log_error "Failed to start Weston." + return 1 + fi +} +