Skip to content
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
64 changes: 64 additions & 0 deletions Runner/suites/Multimedia/Display/igt-gpu-tools/dmabuf/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# dmabuf Test

## Overview
The dmabuf test is an IGT (Intel GPU Tools) test that validates DMA-BUF (Direct Memory Access Buffer) functionality in the display subsystem. This test verifies the kernel's ability to handle DMA-BUF operations for graphics memory sharing.

## Test Description
This test validates:
- DMA-BUF allocation and management
- Memory sharing between different subsystems
- Buffer import/export operations
- Kernel selftests for DMA-BUF functionality

## Prerequisites
- IGT GPU tools must be installed on the target device
- Display hardware must be available
- Weston compositor will be stopped during test execution

## Usage

### Basic Usage (Default)
```bash
./run-test.sh dmabuf
```
The test will automatically use the binary at `/usr/libexec/igt-gpu-tools/dmabuf`

### With Custom Binary Path
```bash
./run-test.sh dmabuf --dmabuf-path /custom/path/to/dmabuf
```

Or:
```bash
./run-test.sh dmabuf /custom/path/to/dmabuf
```

### Help
```bash
cd Runner/suites/Multimedia/Display/igt-gpu-tools/dmabuf
./run.sh --help
```

## Test Results
The test generates:
- **Result file**: `dmabuf.res` - Contains PASS/FAIL/SKIP status
- **Log file**: `dmabuf_log.txt` - Contains detailed test output

## Expected Behavior
- **PASS**: All subtests succeed or some subtests succeed with others skipped
- **SKIP**: All subtests are skipped (e.g., when kernel selftests are not available)
- **FAIL**: One or more subtests fail or the test exits with a non-zero code

## Common Issues
1. **Test Skipped**: If the test shows "SKIP", it typically means the required kernel selftests are not available on the system. This is not necessarily an error - it indicates the test requirements are not met.

2. **Binary Not Found**: Ensure IGT GPU tools are installed:
```bash
# Check if binary exists
ls -l /usr/libexec/igt-gpu-tools/dmabuf
```

## Notes
- The test automatically stops Weston before execution
- Exit code 77 indicates a SKIP condition (standard IGT behavior)
- Test output is parsed for SUCCESS, FAIL, and SKIP counts
144 changes: 144 additions & 0 deletions Runner/suites/Multimedia/Display/igt-gpu-tools/dmabuf/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
#!/bin/sh
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
# SPDX-License-Identifier: BSD-3-Clause-Clear

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"

# ---- Source init_env & tools ----
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="dmabuf"
result_file="./${TESTNAME}.res"
# Default IGT test binary location
DEFAULT_IGT_PATH="/usr/libexec/igt-gpu-tools"
DMABUF_CMD="$DEFAULT_IGT_PATH/$TESTNAME"

test_path="$(find_test_case_by_name "$TESTNAME" 2>/dev/null)"
if [ -z "$test_path" ] || [ ! -d "$test_path" ]; then
test_path="$SCRIPT_DIR"
fi

if [ ! -w "$test_path" ]; then
log_error "Cannot write to test directory: $test_path"
echo "$TESTNAME FAIL" >"$result_file"
exit 1
fi

while [ $# -gt 0 ]; do
case "$1" in
--dmabuf-path)
shift
if [ -n "${1:-}" ]; then
DMABUF_CMD="$1"
else
log_error "Missing value for --dmabuf-path parameter"
echo "$TESTNAME FAIL" >"$result_file"
exit 1
fi
;;
--help|-h)
log_info "Usage: $0 [--dmabuf-path BINARY_PATH] | [BINARY_PATH]"
log_info "Default binary path: $DEFAULT_IGT_PATH/$TESTNAME"
exit 0
;;
-*)
log_warn "Unknown argument: $1"
;;
*)
DMABUF_CMD="$1"
;;
esac
shift
done

if ! cd "$test_path"; then
log_error "cd failed: $test_path"
echo "$TESTNAME FAIL" >"$result_file"
exit 1
fi

log_info "-------------------Starting $TESTNAME Testcase-----------------------------"

# Check if the binary exists and is executable
if [ ! -x "$DMABUF_CMD" ]; then
log_error "FAIL: dmabuf binary not found or not executable at: $DMABUF_CMD"
log_error "Please ensure IGT GPU tools are installed or specify the binary path with --dmabuf-path"
echo "$TESTNAME FAIL" > "$result_file"
exit 1
fi

log_info "Using dmabuf binary at: $DMABUF_CMD"

if ! weston_stop; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All four wrappers stop Weston but never restart it on PASS, FAIL, or SKIP.

Follow core_auth/run.sh: source lib_display.sh, track weston_stopped_by_test, and call weston_restore_runtime on every exit path, including signals. The equivalent locations are kms_setmode:90, kms_sysfs_edid_timing:90, and kms_vblank:104.

log_error "Failed to stop Weston"
echo "$TESTNAME FAIL" > "$result_file"
exit 1
fi

log_file="$test_path/${TESTNAME}_log.txt"
"$DMABUF_CMD" > "$log_file" 2>&1
RC="$?"

log_info "Logs written to: $log_file"

success_count=$(grep -c "SUCCESS" "$log_file" 2>/dev/null || echo "0")
fail_count=$(grep -c "FAIL" "$log_file" 2>/dev/null || echo "0")
skip_count=$(grep -c "SKIP" "$log_file" 2>/dev/null || echo "0")

success_count=${success_count:-0}
fail_count=${fail_count:-0}
skip_count=${skip_count:-0}

case "$success_count" in ''|*[!0-9]*) success_count=0 ;; esac
case "$fail_count" in ''|*[!0-9]*) fail_count=0 ;; esac
case "$skip_count" in ''|*[!0-9]*) skip_count=0 ;; esac

total_subtests=$((success_count + fail_count + skip_count))

log_info "Subtest Results: SUCCESS=$success_count, FAIL=$fail_count, SKIP=$skip_count, TOTAL=$total_subtests"
log_info "results will be written to \"$result_file\""
log_info "-------------------Completed $TESTNAME Testcase----------------------------"

if [ "$RC" -ne 0 ]; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Any nonzero return code is classified as FAIL before skip handling. IGT uses exit code 77 for skipped tests, as the README itself states.

Handle RC=77 before the general nonzero branch. Apply the same correction at kms_setmode:120, kms_sysfs_edid_timing:120, and kms_vblank:135.

log_fail "$TESTNAME : Test Failed (exit code: $RC)"
echo "$TESTNAME FAIL" > "$result_file"
exit 1
elif [ "$fail_count" -gt 0 ]; then
log_fail "$TESTNAME : Test Failed - $fail_count subtest(s) failed out of $total_subtests"
echo "$TESTNAME FAIL" > "$result_file"
exit 1
elif [ "$skip_count" -gt 0 ] && [ "$success_count" -eq 0 ]; then
log_skip "$TESTNAME : Test Skipped - All $skip_count subtest(s) were skipped"
echo "$TESTNAME SKIP" > "$result_file"
exit 0
else
if [ "$success_count" -gt 0 ]; then
if [ "$skip_count" -gt 0 ]; then
log_pass "$TESTNAME : Test Passed - $success_count subtest(s) succeeded, $skip_count skipped"
else
log_pass "$TESTNAME : Test Passed - All $success_count subtest(s) succeeded"
fi
else
log_pass "$TESTNAME : Test Passed (return code $RC)"
fi
echo "$TESTNAME PASS" > "$result_file"
exit 0
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# kms_setmode Test

## Overview
The kms_setmode test is an IGT (Intel GPU Tools) test that validates mode setting functionality in the KMS (Kernel Mode Setting) display subsystem. This test verifies the kernel's ability to set and switch between different display modes.

## Test Description
This test validates:
- Display mode setting operations
- Mode switching between different resolutions and refresh rates
- Multi-monitor mode configuration
- Display pipeline configuration
- CRTC (Cathode Ray Tube Controller) and connector management
- Mode validation and compatibility checking

## Prerequisites
- IGT GPU tools must be installed on the target device
- Display hardware must be available and connected
- Weston compositor will be stopped during test execution

## Usage

### Basic Usage (Default)
```bash
./run-test.sh kms_setmode
```
The test will automatically use the binary at `/usr/libexec/igt-gpu-tools/kms_setmode`

### With Custom Binary Path
```bash
./run-test.sh kms_setmode --kms-setmode-path /custom/path/to/kms_setmode
```

Or:
```bash
./run-test.sh kms_setmode /custom/path/to/kms_setmode
```

### Help
```bash
cd Runner/suites/Multimedia/Display/igt-gpu-tools/kms_setmode
./run.sh --help
```

## Test Results
The test generates:
- **Result file**: `kms_setmode.res` - Contains PASS/FAIL/SKIP status
- **Log file**: `kms_setmode_log.txt` - Contains detailed test output

## Expected Behavior
- **PASS**: All subtests succeed or some subtests succeed with others skipped
- **SKIP**: All subtests are skipped (e.g., when display hardware is not available)
- **FAIL**: One or more subtests fail or the test exits with a non-zero code

## Common Issues
1. **No Display Connected**: The test requires an active display connection. Ensure a monitor is connected.

2. **Mode Not Supported**: Some display modes may not be supported by the hardware or monitor. This will result in test skips for those specific modes.

3. **Display Flicker**: During mode switching tests, you may observe brief display flicker or blanking. This is expected behavior.

4. **Binary Not Found**: Ensure IGT GPU tools are installed:
```bash
# Check if binary exists
ls -l /usr/libexec/igt-gpu-tools/kms_setmode
```

## Test Coverage
The test typically covers:
- Single display mode setting
- Multiple display configurations
- Mode switching sequences
- Invalid mode rejection
- Display pipeline state validation

## Notes
- The test automatically stops Weston before execution
- Mode setting tests may cause brief display disruptions
- Test output is parsed for SUCCESS, FAIL, and SKIP counts
- The test validates both successful mode sets and proper error handling for invalid modes
- Results may vary based on display hardware capabilities and connected monitors
Loading
Loading