Skip to content

Add KMScube & WestonSimpleEGL Test for Graphics Public CI #52

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

Merged
merged 1 commit into from
Jun 3, 2025
Merged
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
82 changes: 82 additions & 0 deletions Runner/suites/Multimedia/Graphics/KMSCube/README_KMSCube.md
Original file line number Diff line number Diff line change
@@ -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 <this-repo>
cd <this-repo>
scp -r common Runner user@target_device_ip:<Path in device>
ssh user@target_device_ip
cd <Path in device>/Runner && ./run-test.sh KMSCube
```
#### Sample output:
```
sh-5.2# cd <Path in device>/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.
74 changes: 74 additions & 0 deletions Runner/suites/Multimedia/Graphics/KMSCube/run.sh
Original file line number Diff line number Diff line change
@@ -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
58 changes: 0 additions & 58 deletions Runner/suites/Multimedia/Graphics/run.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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 <this-repo>
cd <this-repo>
scp -r common Runner user@target_device_ip:<Path in device>
ssh user@target_device_ip
cd <Path in device>/Runner && ./run-test.sh weston-simple-egl
```

#### Sample output:
```
sh-5.2# cd <Path in device>/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.
Loading
Loading