Skip to content

Support for Shikra added for Video - #569

Merged
Srikanth Muppandam (smuppand) merged 1 commit into
qualcomm-linux:mainfrom
vmadired2:Video_Shikra_01
Oct 30, 2026
Merged

Srikanth Muppandam (smuppand) merged 1 commit into
qualcomm-linux:mainfrom
vmadired2:Video_Shikra_01

Conversation

@vmadired2

Copy link
Copy Markdown
Contributor

Changes:

  • Aligned board detection with runtime device-tree based detection.
  • Restricted level override handling to intended encoder configurations.
  • Avoided modifying user/source configurations directly.

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.

Recommended scalable design

functestlib.sh
platform_runtime_identity()
platform_identity_matches()

lib_video.sh
video_policy_lookup(platform, mode, codec)
video_stage_control_override(config, control, value, output_dir)

run.sh
platform=$(...)
policy=$(...)
effective_config=$(...)
run repeats and retries with effective_config

With this design:

  • Adding a new SoC means adding policy data.
  • Platform detection remains shared across audio and video.
  • JSON staging has one implementation.
  • Normal runs and retries cannot diverge.
  • No-policy platforms use the original config unchanged.

Comment thread Runner/utils/lib_video.sh
# if no device-tree/platform data is available (callers should treat that
# as "no match" rather than falling back to a caller-name heuristic).
# -----------------------------------------------------------------------------
video_get_dt_identity() {

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.

video_get_dt_identity() duplicates both detect_platform() and the Shikra runtime identity logic merged in PR #544 as audio_platform_is_shikra(). A future SoC alias or DT-root correction would need to be updated independently in functestlib, audio, and video. Extract a generic runtime platform identity/match helper into functestlib.sh, including both DT roots, and make audio and video consume that shared contract.

Comment thread Runner/utils/lib_video.sh Outdated
# video_target_is_shikra -> 0/1
# video_apply_level_override_for_target <cfg_json_path>

: "${VIDEO_LEVEL_OVERRIDE:=4.0}"

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.

The policy model supports only one global target/value pair:

VIDEO_LEVEL_OVERRIDE=4.0
VIDEO_LEVEL_OVERRIDE_TARGET=shikra

It cannot express cases such as Shikra H.264=4.0, Shikra HEVC=4.1, and a future SoC HEVC=5.1 without adding branches or changing global state. Replace this with a policy lookup keyed by platform, mode, codec, control, and value. Adding another SoC should require one policy row, with no run.sh changes.

For example:

shikra|encode|h264|Level|4.0
shikra|encode|hevc|Level|4.0
new-soc|encode|hevc|Level|5.1

Comment thread Runner/utils/lib_video.sh Outdated
}

# Convenience wrapper for the "shikra" target specifically.
video_target_is_shikra() {

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.

video_target_is_shikra() has no callers and establishes a pattern that would lead to video_target_is_() helpers for every new target. Remove this wrapper. Use the shared platform identity plus the generic policy lookup.

if video_run_once "$cfg" "$logf" "$TIMEOUT" "$SUCCESS_RE" "$LOGLEVEL"; then
run_cfg="$cfg"
if [ "$mode" = "encode" ] && { [ "$codec" = "h264" ] || [ "$codec" = "hevc" ]; }; then
if command -v video_apply_level_override_for_target >/dev/null 2>&1; 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.

Configuration preparation is duplicated in the normal path and retry path at line 1262. Every future target policy would need to remain synchronized across both branches. Resolve and stage the effective configuration once per test case, before the repeat loop, then use the same path for normal
runs and retries. Preserve helper diagnostics instead of redirecting stderr.

Comment thread Runner/utils/lib_video.sh Outdated
BEGIN { in_level = 0 }
{
line = $0
if (line ~ /"Id"[ \t]*:[ \t]*"Level"/) {

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.

The transformation claims to be scoped to StaticControls, but it only finds "Id": "Level" and rewrites the next "Value" line. It does not track the enclosing JSON object. Make the generic staging helper structurally validate the intended object and verify that exactly one requested control changed. A malformed or ambiguous config must fail preparation rather than run with an uncertain result.

Comment thread Runner/utils/lib_video.sh Outdated
*"$tok_l"*)
return 0
;;
*)

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.

Remove the trailing whitespace. git diff --check currently fails here.

@vmadired2

Copy link
Copy Markdown
Contributor Author

Hi Srikanth Muppandam (@smuppand)
Addressed all review feedback by consolidating platform detection into shared utilities, removing target-specific video logic, and introducing a policy-based configuration override mechanism for better scalability. Updated Video_V4L2_Runner to stage effective configs once per test case, ensuring consistent behavior across normal runs and retries.

Comment thread Runner/utils/lib_video.sh

if printf '%s' "$s" | grep -Eq "$shikra_pat"; then
printf '%s\n' "shikra"
return 0

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.

Returning shikra here introduces a platform value that none of the stack helpers recognize.
With the default VIDEO_STACK=auto, stack detection returns unknown, selects upstream, and the runner exits at the hard stack gate before applying the Shikra configuration policy.

Please define Shikra’s stack contract across video_stack_status, validation, blacklist, and switching paths, or explicitly bypass legacy stack switching with an appropriate runtime readiness check.

Comment thread Runner/utils/lib_video.sh
return 0
}

# -----------------------------------------------------------------------------

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.

WK status 1 conflates an already-correct value with a target control whose object has no valid Value. The latter is documented as malformed but is returned as success, allowing Shikra to run the original unsupported level.

Please distinguish “Value found and already correct” from “target Id found without a valid Value”, and fail configuration preparation for the malformed case.

@vmadired2
vmadired2 force-pushed the Video_Shikra_01 branch 3 times, most recently from 8a7da66 to c9ae0a4 Compare September 8, 2026 05:36
@vmadired2

Copy link
Copy Markdown
Contributor Author

Hi Srikanth Muppandam (@smuppand)
Added complete Shikra stack handling across all video stack helper functions, ensuring VIDEO_STACK=auto correctly resolves to the upstream qcom_iris driver and validates successfully on Shikra. (For video, Shikra is upstream-only — no downstream support.)

Improved video_stage_control_override error handling by distinguishing three cases through dedicated awk return codes: valid no-op (value already correct), malformed configuration (Id found but no Value in the object), and ambiguous update (multiple changes).

Malformed control configurations now fail preparation instead of being silently ignored, preventing test execution with unsupported settings.

Comment thread Runner/utils/lib_video.sh
[ -z "$vsc_val" ] && return 1

# Quick check: does this file have the target control at all?
if ! grep -q "\"Id\"[[:space:]]*:[[:space:]]*\"${vsc_ctrl}\"" "$vsc_cfg" 2>/dev/null; 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.

The Shikra policy declares Level=4.0 as required, but a config without that control returns success here. The runner then executes the original config, silently bypassing the platform policy and potentially running an unsupported driver default.

Return a distinct “required control absent” error when a matching policy row is applied, and fail config preparation rather than treating it as a no-op.

Comment thread Runner/utils/lib_video.sh Outdated
END {
# Id found but no Value found in the object — malformed config.
if (found_id > 0 && found_val == 0) exit 2
# Value found but already at the desired setting — valid no-op.

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.

found_id is incremented but never used to enforce uniqueness. Two Level objects with already-correct values return the valid-no-op status, and a mixed pair can produce one rewrite and still succeed. That contradicts the helper contract that exactly one control object must match.

Fail when found_id != 1 or found_val != 1, independently of the number of value changes.

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.

Duplicate Value fields within one control still pass this check. For {"StaticControls":[{"Id":"Level","Value":"5.0","Value":"5.1"}]}, requesting Level=4.0 returns success with the first Value changed to 4.0 and the second left at 5.1. Count Value members inside the matched object in video_stage_control_override() and reject anything other than exactly one before staging, otherwise the application can still read the unchanged value.

Comment thread Runner/utils/functestlib.sh Outdated
# platform vars (PLATFORM_MACHINE, PLATFORM_TARGET, PLATFORM_SOC_MACHINE,
# PLATFORM_DT_MODEL, PLATFORM_DT_COMPAT).
#
# This is the SINGLE shared source of truth for "what board am I running on",

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.

This says the helper is the shared source of truth “consumed by both audio and video,” but audio_common.sh still has its own audio_platform_is_shikra() DT scan.

Rework audio to consume platform_identity_matches shikra, then remove the duplicate scan. Otherwise future DT-root or identity changes will still diverge across audio and video.

Comment thread Runner/utils/functestlib.sh Outdated
# device-tree/platform data is available. Callers should treat an empty
# result as "no match" rather than falling back to a hostname heuristic.
# -----------------------------------------------------------------------------
platform_runtime_identity() {

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.

detect_platform() already provides platform DT fields. The new shared identity helper is a reasonable extension, but its intended reuse is incomplete because audio still maintains a parallel implementation.

@vmadired2

Copy link
Copy Markdown
Contributor Author

Hi Srikanth Muppandam (@smuppand) ,
addressed the above comments , pls review it.
video_stage_control_override now returns a distinct error code (2) when the required control is absent from the config — run.sh treats this as a preparation failure rather than a no-op, preventing the runner from executing the original config with an unsupported driver default.

The awk END block now enforces found_id == 1 and found_val == 1 independently: found_id > 1 exits 2 (ambiguous), found_val > 1 exits 2 (ambiguous), and found_id > 0 && found_val == 0 exits 2 (malformed) — a mixed pair or two already-correct objects can no longer silently succeed.

audio_platform_is_shikra() in audio_common.sh now delegates to platform_identity_matches("shikra") from functestlib.sh when available, with the existing inline DT scan retained as a fallback. Audio and video now consume the same shared board-identity contract — the parallel implementation is removed.

Comment thread Runner/utils/audio_common.sh Outdated
return
fi

# Inline fallback — identical logic to platform_runtime_identity() + match.

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 repository callers source functestlib.sh before audio_common.sh, including the child user-session paths. This fallback therefore preserves a parallel DT scanner unnecessarily.

Remove the duplicate implementation and use platform_identity_matches shikra as the single contract. If standalone sourcing is required, source the shared helper explicitly.

Comment thread Runner/utils/lib_video.sh Outdated
if (line ~ ("\"Id\"[[:space:]]*:[[:space:]]*\"" ctrl "\"")) {
found_id++
# Compact layout: Id and Value on the same line.
if (line ~ /"Value"[[:space:]]*:/) {

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.

This accepts every Value field but only rewrites quoted string values. For "Value": 1, found_val increments, substitution changes nothing, and the helper returns successful no-op even though the override was not applied. It also never proves the matching Id belongs to StaticControls.

Parse the intended StaticControls object, support or explicitly reject non-string values, and verify the staged output contains exactly the requested value.

Comment thread Runner/utils/lib_video.sh Outdated

shikra)
# Shikra is upstream-only; qcom_iris is the sole driver.
if video_has_module_loaded qcom_iris; 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.

Shikra readiness is based only on lsmod, so a built-in qcom_iris driver with bound runtime devices is incorrectly reported missing.

Combine actual driver-binding evidence with module state so built-in and modular drivers are handled equivalently.

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.

[P2] The new fallback still does not prove a device is bound

At 3ad644e, find "$vqia_drv" -maxdepth 1 -type l accepts metadata links such as module, not just bound platform-device links. With no lsmod evidence and a fixture containing only that metadata link, video_qcom_iris_active returns 0. The modular fast path likewise accepts a loaded module without checking binding. This can report the stack as ready after a failed probe.

Require an actual platform device whose driver backlink resolves to the selected driver, excluding metadata links. Apply that readiness check to both modular and built-in cases so module registration is not confused with usable hardware.

@smuppand Srikanth Muppandam (smuppand) Oct 22, 2026 •

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.

Rechecked at c6424cf, this remains reproducible. With no loaded-module evidence and only the standard subsystem symlink in the driver directory, video_qcom_iris_active returns success. This link exists without a bound device, so a failed/deferred probe can be reported as Iris ready, followed by SKIP when no video nodes are found.

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.

The sysfs check now excludes metadata-only links, but the early lsmod return still accepts qcom_iris without a bound device. After a failed probe, that reports the Shikra stack ready and the runner can SKIP because /dev/video* is missing. Require a bound device for both modular and built-in drivers, using platform_device_driver_name() from functestlib.sh to check its driver backlink.

@smuppand Srikanth Muppandam (smuppand) Oct 30, 2026 •

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.

This PR adds Shikra support, but it also changes shared platform detection, audio detection and video stack handling used by existing platforms. Please preserve the working LeMans, Monaco and Kodiak paths and validate the affected auto/upstream/downstream modes, built-in and modular drivers, and custom configs across Yocto, Debian, Ubuntu and CentOS where supported. Shikra-only test results do not establish that these existing paths still work.

One remaining gap is that Shikra --stack auto can report SKIP after driver preparation fails, while explicit upstream reports FAIL. This auto-mode gate gap predates this PR, so it is not evidence of a newly introduced legacy regression. Resolve the effective requested stack using video_auto_preference_from_blacklist() and apply the existing video_validate_upstream_loaded() check before testcase discovery. Keep the existing platforms' stack-selection policies and legitimate optional-device SKIPs intact, and cover both healthy binding and failed-probe cases.

@vmadired2
vmadired2 force-pushed the Video_Shikra_01 branch 3 times, most recently from 000f2db to 6b694be Compare September 21, 2026 06:51
@vmadired2

Copy link
Copy Markdown
Contributor Author

Hi Srikanth Muppandam (@smuppand) ,
Removed the duplicate inline DT scanner fallback in audio_common.sh; all callers already source functestlib.sh first, so platform_identity_matches shikra is now the single contract for Shikra platform detection. The AWK-based StaticControls value override in lib_video.sh has been hardened to scope matching strictly to the StaticControls object, reject non-string values explicitly, and verify the staged output contains the requested value before returning success. Shikra driver-readiness detection in lib_video.sh now combines /sys/bus/platform/drivers/qcom_iris/ binding evidence with lsmod state so that a built-in (non-modular) qcom_iris driver with bound runtime devices is correctly reported as present, making built-in and modular driver paths equivalent.

@smuppand

Copy link
Copy Markdown
Contributor

sign-off is missing

@vmadired2

Copy link
Copy Markdown
Contributor Author

Hi Srikanth Muppandam (@smuppand) ,
"I've added the sign-off. Please review it.

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.

The single commit mixes:

  1. Shared platform-identity/audio behavior.
  2. Shikra video support.
  3. Hamoa video support.
  4. JSON policy transformation.

Recommended structure:

  • utils: add shared runtime platform identity helpers
  • video: add Shikra V4L2 support
  • Move Hamoa support to a separate PR unless it is part of the same independently validated rollout.

return 1
;;
esac
platform_identity_matches "shikra"

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.

platform_identity_matches is not defined in functestlib.sh or anywhere else at this PR head. Add the shared platform identity helpers to functestlib.sh in this PR and test both matching and non-matching platforms, or retain the previous working runtime-DT implementation.

Comment thread Runner/utils/lib_video.sh Outdated
if (line ~ /"Value"[[:space:]]*:/) {
if (line ~ /"Value"[[:space:]]*:[[:space:]]*"[^"]*"/) {
orig = line
sub(/"Value"[[:space:]]*:[[:space:]]*"[^"]*"/, \

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.

This substitution does not safely handle compact JSON. When base_h264Encoder.json is collapsed onto one valid JSON line, the helper returns success but changes Profile's Value to 4.0 while leaving Level at 5.0, because sub() replaces the first Value on the line.

The runner then executes a silently corrupted configuration while reporting that the Level policy was applied. Use an object-scoped JSON transformation that binds Value to the matching Id, and add regression fixtures for compact and pretty-printed JSON.

Comment thread Runner/utils/lib_video.sh

{
printf '%s\n' \
"shikra|encode|h264|Level|4.0" \

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.

This policy silently overwrites Level in every user-supplied Shikra H.264 or HEVC encode configuration, not only the bundled fixtures. That changes the workload requested through --config and prevents users from validating other supported levels.

Restrict the automatic rewrite to the intended bundled fixtures, or make the override explicit and document the authoritative platform contract that requires Level 4.0.

Comment thread Runner/utils/lib_video.sh
# shikra|encode|h264|Level|4.0
# shikra|encode|hevc|Level|4.0
#
# Extend at runtime via VIDEO_POLICY_EXTRA (same pipe-separated format,

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.

The new Shikra/Hamoa platform behavior and VIDEO_POLICY_EXTRA interface are not reflected in run.sh --help, README_Video.md, or the YAML description.

@vmadired2
vmadired2 force-pushed the Video_Shikra_01 branch 4 times, most recently from a0036da to 2654d84 Compare September 28, 2026 10:08
@vmadired2
vmadired2 force-pushed the Video_Shikra_01 branch 2 times, most recently from f1fed66 to 4a275dc Compare October 22, 2026 10:32
@vmadired2

Copy link
Copy Markdown
Contributor Author

Hi Srikanth Muppandam (@smuppand) ,
The AWK program now uses character-level depth tracking (static_depth) to find the exact StaticControls array boundary, including when it closes mid-line in compact JSON. For compact JSON, only the content between the [ and matching ] of StaticControls is extracted and processed — sibling arrays like DynamicControls are ignored. The END block now exits 2 when found_id == 0 so a control found only outside StaticControls is correctly rejected. Validated on Shikra EVK: {"StaticControls":[{"Id":"Profile","Value":"MAIN"}],"DynamicControls":[{"Id":"Level","Value":"5.0"}]} returns exit 2 (Level absent from StaticControls); {"StaticControls":[{"Id":"Level","Value":"5.0"}],"DynamicControls":[...]} returns exit 0 (Level found and staged to 4.0.

@smuppand

Copy link
Copy Markdown
Contributor

vmadired2 Regarding your validation, the cases with StaticControls first work. When DynamicControls comes first, the helper still returns success after changing the dynamic Level to 4.0, leaving the static Level at 5.0:

{"DynamicControls":[{"Id":"Level","Value":"5.1"}],"StaticControls":[{"Id":"Level","Value":"5.0"}]}

Please start the array scan after the matched StaticControls key and validate both key orders. The scan currently starts at the beginning of the line and selects the first array.

@vmadired2

Copy link
Copy Markdown
Contributor Author

Hi Srikanth Muppandam (@smuppand) ,
The array scan now starts from the position of the "StaticControls" key on the line using sc_key_pos = index(line, ""StaticControls"") and sc_scan_start = (sc_key_pos > 0) ? sc_key_pos : 1. This means any [ appearing before "StaticControls" on the same line (e.g. the DynamicControls array when it precedes StaticControls in compact JSON) is skipped. Both key orders are now handled correctly: {"StaticControls":[...],"DynamicControls":[...]} and {"DynamicControls":[...],"StaticControls":[...]} both select only the StaticControls array.

Comment thread Runner/utils/lib_video.sh Outdated
# Pretty-printed JSON: the ] is on its own line.
# All objects were already processed line by line above.
if (obj_buf != "") {
process_obj_buf()

@smuppand Srikanth Muppandam (smuppand) Oct 26, 2026 •

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.

When a multi-line control object ends on the same line as the array's closing ], this branch processes the buffer without appending the current line. For the input below, the helper returns success after changing Level, but drops the Profile value and closing brackets, producing invalid JSON. Fix the existing video_stage_control_override() in lib_video.sh to include the current line up to the array boundary before processing the object, preserve the remaining closing syntax, and validate the staged output before returning success.

{
  "StaticControls": [
    {"Id":"Level","Value":"5.0"},
    {"Id":"Profile",
     "Value":"MAIN"}]
}

@vmadired2

Copy link
Copy Markdown
Contributor Author

Hi Srikanth Muppandam (@smuppand) ,
When the closing ] of the StaticControls array appears on the same line as the tail of a buffered object (e.g. "Value":"MAIN"}]), the branch now splits the line at sc_close_pos into line_before_close (content before ]) and line_after_close (the ] and beyond). line_before_close is appended to obj_buf before process_obj_buf() is called, so the object is complete before processing. The output is then obj_buf line_after_close, preserving the ] and any trailing syntax. For the reviewer's test case, Level is correctly staged to 4.0, Profile is left unchanged, and the output is valid JSON. Validated on Shikra EVK: 10/10 PASS.

Comment thread Runner/utils/lib_video.sh Resolved
@vmadired2

Copy link
Copy Markdown
Contributor Author

Hi Srikanth Muppandam (@smuppand) ,
The brace-depth counter now uses brace_src = substr(line, sc_open_pos + 1) when the StaticControls array opening [ is on the current line, so only braces appearing after the [ are counted. The root { before "StaticControls" is excluded and no longer mistaken for the start of a control object. For {"StaticControls": [\n {"Id":"Level","Value":"5.0"}\n]}, Level is correctly staged to 4.0.

@vmadired2

Copy link
Copy Markdown
Contributor Author

Hi Srikanth Muppandam (@smuppand) ,
When sc_open_pos > 0, the code now prints substr(line, 1, sc_open_pos) (the prefix including [) as-is and buffers only substr(line, sc_open_pos + 1) (content after [). DynamicControls is never included in obj_buf. Validated on device: {"DynamicControls":[...],"StaticControls":[{"Id":"Level",\n"Value":"5.0"}]} returns Level=4.0 staged with exit code 0.

@vmadired2
vmadired2 force-pushed the Video_Shikra_01 branch 2 times, most recently from 322d581 to 1cd2fd6 Compare October 29, 2026 17:13
@vmadired2

Copy link
Copy Markdown
Contributor Author

Hi Srikanth Muppandam (@smuppand) ,
Driver-readiness — early lsmod return removed; both modular and built-in now require a bound device symlink resolving to /sys/devices/*.
Test: video_qcom_iris_active && echo "qcom_iris active YES"
Output: qcom_iris active YES

gate_stack="$(video_auto_preference_from_blacklist "$plat")"
# If the blacklist gives no preference, Shikra and unknown platforms
# default to upstream (the only valid stack on Shikra).
if [ "$gate_stack" = "unknown" ]; 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.

This fallback rejects working downstream setups on LeMans, Monaco and Kodiak. With no persistent blacklist and iris_vpu already active, video_ensure_stack() selects the current downstream stack and returns success, but this gate selects upstream and fails before running any tests. Reuse the complete selection order already in video_ensure_stack(): blacklist preference, then video_stack_status(), then upstream. Extract that selection into a shared helper and resolve the desired stack once before preparation so preparation and validation cannot disagree. Preserve the Shikra failed-probe FAIL behavior and cover the existing downstream auto-mode case.

Address all reviewer comments on the Shikra V4L2 support:

utils/functestlib.sh
- Add platform_runtime_identity() and platform_identity_matches() as the
  single source of truth for board identity shared by audio, video, and
  future callers.

utils/lib_video.sh
- Add Shikra platform detection and upstream-only stack support.
- Add video_qcom_iris_active() combining lsmod and sysfs binding evidence
  to handle both modular and built-in qcom_iris drivers.
- Fix video_stage_control_override() AWK compact-JSON scoping: use a
  placeholder-based split so sub() applies only to the portion of the
  line after the matched Id.
- Add video_policy_lookup() with Level-4.0 cap for Shikra H.264/HEVC
  encode; restrict automatic rewrite to bundled fixtures by default.
- Remove Hamoa from video_detect_platform() (separate PR).

suites/Multimedia/Video/Video_V4L2_Runner/run.sh
- Add Shikra post-stack module validation.
- Add bundled-fixture guard before video_policy_lookup.
- Document --platform shikra, VIDEO_POLICY_SCOPE, and VIDEO_POLICY_EXTRA
  in --help.

suites/Multimedia/Video/Video_V4L2_Runner/README_Video.md
- Add Shikra Platform Support section.

suites/Multimedia/Video/Video_V4L2_Runner/Video_V4L2_Runner.yaml
- Add VIDEO_STACK and VIDEO_POLICY_SCOPE params; wire --stack into run.

Signed-off-by: Vaishnavi Madireddy <vmadired@qti.qualcomm.com>
@vmadired2

Copy link
Copy Markdown
Contributor Author

Hi Srikanth Muppandam (@smuppand) ,
The gate now resolves VIDEO_STACK=auto using the same three-step selection order as video_ensure_stack():

  1. video_auto_preference_from_blacklist() — if a persistent blacklist prefers downstream (LeMans/Monaco/Kodiak), use downstream;
  2. video_stack_status() — if no blacklist but downstream is already active (iris_vpu loaded), use downstream;
  3. default to upstream. This correctly handles downstream setups on LeMans/Monaco/Kodiak and preserves the Shikra failed-probe FAIL behavior. Validated on Shikra EVK: --stack auto → 10/10 PASS; --stack upstream → 10/10 PASS; --stack downstream → FAIL immediately (upstream-only).

@smuppand

Copy link
Copy Markdown
Contributor

The code looks good. Before we merge, please share the complete stdout from running the current PR snapshot on Shikra and one legacy target (LeMans, Monaco or Kodiak). Include the testkit commit SHA, distro/kernel version and launch commands. Please cover Shikra with --stack auto and --stack upstream, and the legacy target with --stack auto on an active downstream setup without a persistent blacklist, to confirm the existing path still works.

@vmadired2

Copy link
Copy Markdown
Contributor Author

Hi Srikanth Muppandam (@smuppand) ,
pls review the stdout , tested on shikra and lemans
lemans_stdout.txt
lemans_upstream.txt
shikra_stdout.txt

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.

LGTM

@smuppand
Srikanth Muppandam (smuppand) merged commit e54d4ea into qualcomm-linux:main Oct 30, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants