Skip to content
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
# Waylandsink_Playback (GStreamer) — Runner Test

This directory contains the **Waylandsink_Playback** validation test for Qualcomm Linux Testkit runners.

It validates **Wayland display** using **GStreamer waylandsink** with:
- Weston/Wayland server connectivity checks
- DRM display connectivity validation
- Video playback using `waylandsink` element
- Uses `videotestsrc` to generate test patterns

The script is designed to be **CI/LAVA-friendly**:
- Writes **PASS/FAIL/SKIP** into `Waylandsink_Playback.res`
- Always **exits 0** (even on FAIL/SKIP)
- Comprehensive Weston/Wayland environment detection
- Automatic Weston startup if needed

---

## What this test does

1. Sources framework utilities (`functestlib.sh`, `lib_gstreamer.sh`, `lib_display.sh`)
2. **Display connectivity check**: Verifies connected DRM display via sysfs
3. **Weston/Wayland server check**:
- Discovers existing Wayland socket
- Attempts to start Weston if no socket found
- Validates Wayland connection
4. **waylandsink element check**: Verifies GStreamer waylandsink is available
5. **Playback test**: Runs videotestsrc → videoconvert → waylandsink pipeline
6. **Validation**: Checks playback duration and exit code

---

## PASS / FAIL / SKIP criteria

### PASS
- Playback completes successfully (exit code 0 or 143)
- Elapsed time ≥ (duration - 2) seconds

### FAIL
- Playback exits with error code (not 0 or 143)
- Playback exits too quickly (< duration - 2 seconds)

### SKIP
- Missing GStreamer tools (`gst-launch-1.0`, `gst-inspect-1.0`)
- No connected DRM display found
- No Wayland socket found (and cannot start Weston)
- Wayland connection test fails
- `waylandsink` element not available

---

## Dependencies

### Required
- `gst-launch-1.0`
- `gst-inspect-1.0`
- `videotestsrc` GStreamer plugin
- `videoconvert` GStreamer plugin
- `waylandsink` GStreamer plugin

### Display/Wayland
- Weston compositor (running or startable)
- Connected DRM display
- Wayland socket (`/run/user/*/wayland-*` or `/dev/socket/weston/wayland-*`)

---

## Usage

```bash
./run.sh [options]
```

### Options

- `--resolution <WIDTHxHEIGHT>` - Video resolution (e.g., 1920x1080, 3840x2160) (default: 1920x1080)
- `--duration <seconds>` - Playback duration (default: 30)
- `--pattern <smpte|snow|ball|etc>` - videotestsrc pattern (default: smpte)
- `--width <pixels>` - Video width (alternative to --resolution) (default: 1920)
- `--height <pixels>` - Video height (alternative to --resolution) (default: 1080)
- `--framerate <fps>` - Video framerate (default: 30)
- `--gst-debug <level>` - GStreamer debug level 1-9 (default: 2)

---

## Examples

```bash
# Run default test (1920x1080 SMPTE for 30s)
./run.sh

# Run with custom resolution using --resolution
./run.sh --resolution 3840x2160

# Run with custom resolution and duration
./run.sh --resolution 3840x2160 --duration 20

# Run with ball pattern
./run.sh --pattern ball

# Run with custom resolution using separate width/height
./run.sh --width 1280 --height 720

# Run with different framerate
./run.sh --framerate 60

# Run with higher debug level
./run.sh --gst-debug 5
```

---

## Pipeline

```
videotestsrc num-buffers=<N> pattern=<pattern>
! video/x-raw,width=<W>,height=<H>,framerate=<FPS>/1
! videoconvert
! waylandsink
```

---

## Logs

```
./Waylandsink_Playback.res
./logs/Waylandsink_Playback/
gst.log # GStreamer debug output
run.log # Pipeline execution log
```

---

## Troubleshooting

### "SKIP: No connected DRM display found"
- Check physical display connection
- Verify DRM drivers loaded: `ls -l /dev/dri/`

### "SKIP: No Wayland socket found"
- Check if Weston is running: `pgrep weston`
- Try starting Weston manually
- Check `XDG_RUNTIME_DIR` and `WAYLAND_DISPLAY` environment variables

### "SKIP: waylandsink element not available"
- Install GStreamer Wayland plugin
- Check: `gst-inspect-1.0 waylandsink`

### "FAIL: Playback failed"
- Check logs in `logs/Waylandsink_Playback/`
- Increase debug level: `./run.sh --gst-debug 5`
- Verify Weston is running properly

---

## LAVA Environment Variables

The test supports these environment variables (can be set in LAVA job definition):

- `VIDEO_DURATION` - Playback duration in seconds (default: 30)
- `RUNTIMESEC` - Alternative to VIDEO_DURATION
- `VIDEO_PATTERN` - videotestsrc pattern (default: smpte)
- `VIDEO_WIDTH` - Video width (default: 1920)
- `VIDEO_HEIGHT` - Video height (default: 1080)
- `VIDEO_FRAMERATE` - Video framerate (default: 30)
- `VIDEO_GST_DEBUG` - GStreamer debug level (default: 2)
- `GST_DEBUG_LEVEL` - Alternative to VIDEO_GST_DEBUG

**Priority order for duration**: `VIDEO_DURATION` > `RUNTIMESEC` > default (30)
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
metadata:
name: gstreamer-waylandsink-playback
format: "Lava-Test Test Definition 1.0"
description: >
GStreamer waylandsink playback validation with Weston/Wayland server checks
on Qualcomm Linux platforms. Uses videotestsrc to generate test patterns
and displays them via waylandsink. Validates display connectivity and
Wayland compositor functionality.
os:
- linux
scope:
- functional

params:
# Playback duration in seconds (default: 30)
# Priority: VIDEO_DURATION > RUNTIMESEC
VIDEO_DURATION: "30"
RUNTIMESEC: "" # if set, used as fallback

# Test pattern for videotestsrc (default: smpte)
VIDEO_PATTERN: "smpte" # smpte|snow|black|white|red|green|blue|checkers-1|checkers-2|ball

# Video width in pixels (default: 1920)
VIDEO_WIDTH: "1920"

# Video height in pixels (default: 1080)
VIDEO_HEIGHT: "1080"

# Frame rate (default: 30)
VIDEO_FRAMERATE: "30"

# GStreamer debug level (default: 2)
# Priority: VIDEO_GST_DEBUG > GST_DEBUG_LEVEL
VIDEO_GST_DEBUG: "2" # 1-9
GST_DEBUG_LEVEL: "" # if set, used as fallback

run:
steps:
- REPO_PATH="$PWD"

# Navigate to test directory
- cd Runner/suites/Multimedia/GSTreamer/Display/Waylandsink_Playback/

# Export environment variables (script reads these directly)
- export VIDEO_DURATION="${VIDEO_DURATION}"
- export RUNTIMESEC="${RUNTIMESEC}"
- export VIDEO_PATTERN="${VIDEO_PATTERN}"
- export VIDEO_WIDTH="${VIDEO_WIDTH}"
- export VIDEO_HEIGHT="${VIDEO_HEIGHT}"
- export VIDEO_FRAMERATE="${VIDEO_FRAMERATE}"
- export VIDEO_GST_DEBUG="${VIDEO_GST_DEBUG}"
- export GST_DEBUG_LEVEL="${GST_DEBUG_LEVEL}"

# Build CLI args for overrides (optional - can also rely on env vars)
- |
CMD="./run.sh"

# Use CLI args to override defaults if needed
# Note: Script reads env vars by default, CLI args override env vars
[ -n "${VIDEO_WIDTH}" ] && [ -n "${VIDEO_HEIGHT}" ] && CMD="${CMD} --resolution ${VIDEO_WIDTH}x${VIDEO_HEIGHT}"
[ -n "${VIDEO_PATTERN}" ] && CMD="${CMD} --pattern ${VIDEO_PATTERN}"
[ -n "${VIDEO_DURATION}" ] && CMD="${CMD} --duration ${VIDEO_DURATION}"
[ -n "${VIDEO_FRAMERATE}" ] && CMD="${CMD} --framerate ${VIDEO_FRAMERATE}"
[ -n "${VIDEO_GST_DEBUG}" ] && CMD="${CMD} --gst-debug ${VIDEO_GST_DEBUG}"

echo "[LAVA] Running: ${CMD}"
sh -c "${CMD}" || true

# Send result to LAVA
- "${REPO_PATH}/Runner/utils/send-to-lava.sh Waylandsink_Playback.res || true"
Loading
Loading