Skip to content

fix(linux/vaapi): validate quality configuration, add Intel quirk - #5797

Closed
psyke83 wants to merge 4 commits into
LizardByte:masterfrom
psyke83:validate_vaapi_quality
Closed

psyke83 wants to merge 4 commits into
LizardByte:masterfrom
psyke83:validate_vaapi_quality

Conversation

@psyke83

@psyke83 psyke83 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

  • Validate quality levels against driver before committing value to ctx->compression_level.
  • Add quirk for intermediate quality value on Intel cards (balanced should be 4, not 3).

Screenshot

Issues Fixed or Closed

Roadmap Issues

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Unit tests have been added or updated for any new or modified functionality

AI Usage

See our AI usage policy.

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

@psyke83
psyke83 force-pushed the validate_vaapi_quality branch from 3a4cec2 to e94376b Compare September 24, 2026 21:34
@psyke83
psyke83 marked this pull request as ready for review September 24, 2026 21:34
@psyke83
psyke83 force-pushed the validate_vaapi_quality branch from e94376b to 33423f7 Compare September 24, 2026 21:35
@psyke83 psyke83 mentioned this pull request Sep 24, 2026
6 of 21 tasks
@psyke83
psyke83 force-pushed the validate_vaapi_quality branch 5 times, most recently from 5ed7241 to 8bf924d Compare September 24, 2026 23:39
@psyke83

psyke83 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

Ready for review, but please don't merge until users with Intel GPUs validate that the "auto" case (attempting to set value 0) is also resolved in the linked report. My AMD card behaves differently so I can't be certain.

@ReenigneArcher ReenigneArcher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One doxygen error:

/home/docs/checkouts/readthedocs.org/user_builds/sunshinestream/checkouts/5797/src/platform/linux/vaapi.cpp:284: error: parameters of member va::va_t::set_quality_level are not documented

* Validate quality levels against driver before committing
  to AVOptions dict.
* Add quirk for intermediate quality value on Intel cards.
@ReenigneArcher

Copy link
Copy Markdown
Member

Ready for review, but please don't merge until users with Intel GPUs validate that the "auto" case (attempting to set value 0) is also resolved in the linked report. My AMD card behaves differently so I can't be certain.

I'm running CI to make it easier for people to test. Please ping me once it's ready to merge.

@codecov

codecov Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Last Updated 2026-09-26 01:26:10 UTC
Source Run CI Run #5792
Commit f92302532c4ae646ff8f055c0961be503f201d6b

Screenshot Comparison

PR #5797 screenshots vs screenshots baseline.

Matrix: AppImage-aarch64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: AppImage-x86_64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: Windows-AMD64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: Windows-ARM64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: macOS-arm64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: macOS-x86_64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

@codecov

codecov Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.35%. Comparing base (e1e6700) to head (f923025).
⚠️ Report is 26 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/platform/linux/vaapi.cpp 0.00% 29 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5797      +/-   ##
==========================================
- Coverage   38.36%   38.35%   -0.02%     
==========================================
  Files         113      113              
  Lines       26099    26112      +13     
  Branches    11562    11561       -1     
==========================================
  Hits        10014    10014              
- Misses      14405    14435      +30     
+ Partials     1680     1663      -17     
Flag Coverage Δ
Alpine-aarch64 22.98% <0.00%> (-0.02%) ⬇️
Alpine-x86_64 23.10% <0.00%> (-0.02%) ⬇️
Archlinux 21.76% <0.00%> (-0.02%) ⬇️
Homebrew-macos-15 37.74% <ø> (ø)
Homebrew-macos-26 38.07% <ø> (ø)
Homebrew-ubuntu-24.04 24.64% <0.00%> (-0.02%) ⬇️
Linux-AppImage-aarch64 25.82% <0.00%> (-0.03%) ⬇️
Linux-AppImage-x86_64 26.01% <0.00%> (-0.03%) ⬇️
PowerShell 100.00% <ø> (ø)
Web-UI 85.00% <ø> (ø)
Windows-AMD64 30.83% <ø> (ø)
Windows-ARM64 25.86% <ø> (+<0.01%) ⬆️
macOS-arm64 31.30% <ø> (ø)
macOS-x86_64 31.91% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/platform/linux/vaapi.cpp 2.38% <0.00%> (-0.12%) ⬇️

... and 10 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e1e6700...f923025. Read the comment docs.

@dsvarela

dsvarela commented Oct 1, 2026

Copy link
Copy Markdown

The proposed vaCreateConfig probe gives the wrong answer on Comet Lake (UHD [8086:9bca], iHD 26.1.2). The CI build hasn't been run, but running the PR's check as standalone shows that auto would still not work.

Probe Results vs. Actual Encode

On this GPU, HEVC encodes only at quality levels 1, 4, and 7. Levels 0, 2, 3, 5, and 6 fail at the second frame's vaEndPicture with error 24 (verified via plain ffmpeg; H.264 accepts all eight).

However, running the PR's check (vaCreateConfig with VAConfigAttribEncQualityRange set to the level) for each level returns success only for 0 and 7, and rejects 1 through 6.

This results in the following matrix with the PR as written:

vaapi_quality level PR Probe Actual Encode Expected with PR
auto 0 Accepts Fails Still aborts
speed 7 Accepts Works Works
balanced 4 Rejects Would work Falls back to driver default
quality 1 Rejects Would work Falls back to driver default

vaCreateConfig cannot reliably identify working levels on iHD.

Proposed Fix for auto

For auto, leave compression_level at -1 so FFmpeg sends no quality buffer. Without a quality buffer, HEVC encodes normally on this GPU. This matches Sunshine 2026.516 behavior prior to #5388.

Related FFmpeg Abort

The resulting abort is an FFmpeg bug I filed at: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/24838

@psyke83

psyke83 commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

@dsvarela

If that's the case, trying to probe quality is not a good idea. Please try the simplified resolution at #5847.

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.

VAAPI "auto" quality sends compression_level 0 to the driver; Intel HD 620 rejects it for HEVC and every stream aborts

3 participants