Portal + VAAPI: streaming fails, encoder loops with EGL_BAD_PARAMETER
まだ誰も着手していません。
評価
調査の方向性
Start with build_format_parameter() and make_avcodec_encode_device() in the capture and encoder negotiation paths, then trace how the portal stream reports its negotiated buffer type to the encode thread. The report identifies an empty modifier list, shared memory negotiation, and repeated VAAPI import failures; check those paths against the attached logs and probe notes. Done means portal capture with VAAPI streams frames whether DMA-BUF is negotiated or memory buffers are used.
索引モデルが issue の本文から書いたものです。
説明
Is there an existing issue for this?
- I have searched the existing issues
Is your issue described in the documentation?
- I have read the documentation
Is your issue present in the latest beta/pre-release?
This issue is present in the latest pre-release
Describe the Bug
I can't stream on this machine when both capture = portal and encoder = vaapi
are set. The client connects, but not a single frame arrives, and the log keeps
printing the same four lines while the connection is up:
[21:31:24.502] [pipewire] using memory buffers
[21:31:24.515] Creating encoder [hevc_vaapi]
[21:31:24.537] Error: Couldn't import RGB Image: 0000300C
[21:31:24.537] Error: Could not convert image
0000300C is EGL_BAD_PARAMETER, roughly once per frame.
| Configuration | Result |
|---|---|
capture = portal, encoder = software (libx264) |
works |
capture = kms, encoder = vaapi, kernel 7.3.4 |
works |
capture = portal, encoder = vaapi |
fails |
So the capture path and the encoder each work on their own; only this pairing
fails.
The failure comes from five steps chained together. Each step only holds under its
own precondition, and each one only accounts for the change that precondition
brings.
First, this machine reports no modifiers. I ran eglQueryDmaBufModifiersEXT for
AR24/XR24 on every real GPU path: the Wayland platform, the card1 EGL device, GBM
on renderD128, and GBM on card1. All returned 0. Only the software EGL device
reports LINEAR. That is not a fault in itself; it just means there is no layout
label to announce, and the CPU copy path still works. Conversely, if the system
did report modifiers, this step and the following ones would not apply.
Second, with an empty list the modifier property never goes out at all. When
Sunshine builds the request, build_format_parameter() only writes the
SPA_FORMAT_VIDEO_modifier field if n_modifiers > 0; with an empty list that
whole branch is skipped. So the request that reaches the compositor has no
modifier entry in it whatsoever. Still nothing broken at this point.
Third, when that property is missing, KWin 6.8 only offers shared memory. Its
onStreamParamChanged() clears the DMA-BUF state when it cannot find the field. I
did not verify other compositors. This is where the problem starts: "not
specified" is read as "not needed", so the stream falls back to shared memory. On
its own this step is only a downgrade, slower but not broken.
Fourth, the encoder is chosen without looking at the negotiation result.
make_avcodec_encode_device() picks the vram path from n_dmabuf_infos > 0, and
that number counts formats, not modifiers. It stays above zero even after the
stream negotiated memory buffers. This is where it actually breaks: the encoder
assumes DMA-BUF while the frames have no fd behind them, so every import throws
EGL_BAD_PARAMETER. If the stream had been on DMA-BUF all along, this step alone
would be harmless.
Fifth, nothing degrades after a failed import. convert() returns an error, the
encode thread exits, the session restarts, and the same choice is made again. A
single failed import is enough to take the whole stream down for good, and the
client never gets a frame.
Expected Behavior
capture = portal with encoder = vaapi should produce video. Either path is
fine: DMA-BUF if the compositor offers it, memory copy otherwise. If an import
does fail, the stream should fall back to the memory copy instead of exiting the
encode thread and rebuilding the session.
Additional Context
Full logs, the EGL probe programs I used, and the notes from this investigation
are in one place, one directory per date:
https://github.com/aningQwQ/backup/tree/main/sunshine/2026-11-16
There's also a branch where I tried a fix, mostly so you can see what I mean:
https://github.com/aningQwQ/Sunshine/tree/2026-11-16
Built from that, the same machine logs using DMA-BUF buffers and no import
failures over an 8 minute session.
That fix came out of an AI-assisted session and I can't review the code myself,
so I'm not opening a PR.
One more thing I noticed while looking at this: a pw-dump taken during streaming
shows KWin announcing two formats, one with a modifier and one without. Since the
client request carries no modifier property, the negotiation lands on the second
one.
Host Operating System
Linux
Operating System Version
Linux xuyingjun-cachyos 7.3.4-1-cachyos #1 SMP PREEMPT_DYNAMIC Fri, 13 Nov 2026 19:45:18 +0000 x86_64 GNU/Linux
Architecture
amd64/x86_64
Package
Linux - AUR (Third Party)
GPU Type
AMD
GPU Model
Radeon RX 590 GME (Polaris 10)
GPU Driver/Mesa Version
GPU Driver/Mesa Version: Mesa 26.2.6-arch3.1, LLVM 23
Capture Method
XDG Portal Grab (FreeBSD/Linux)
Apps
Log output
https://github.com/aningQwQ/backup/tree/main/sunshine/2026-11-16
Online logs
https://github.com/aningQwQ/backup/tree/main/sunshine/2026-11-16
- 主要言語
- C++
- スター
- 43k
- フォーク
- 2.4k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
LizardByte/Sunshine のほかの issue
-
Linux keyboard backend has no mapping for VK_ABNT_C1 (ABNT2 dedicated `/ ?` key) — key is silently dropped対応中かも @NestorBrasileiro が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
LizardByte/Sunshine#6051 · コメント 2 件 ·
-
PIN pairing fails with "Missing CSRF token" - web UI never fetches/attaches the token再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
LizardByte/Sunshine#5467 · コメント 2 件 ·
-
LizardByte/Sunshine#6230 · コメント 5 件 ·
-
Virtual HID Driver License notifications appearing even though Enable Gamepad Input is uncheckedオープン
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
LizardByte/Sunshine#6222 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 47/100
LizardByte/Sunshine#6208 ·
LizardByte/Sunshine の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
メンテナーはふだん 2 日以内に返信
-
bug data-types
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
ClickHouse/clickhouse-cpp#645 ·
メンテナーはふだん 1 日以内に返信
-
bug compatibility difficulty:easy prio:normal
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
NatronGitHub/openfx-misc#524 ·
メンテナーはふだん 1 日以内に返信
-
documentation enhancement help wanted P0
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Awesome-Embedded-Learning-Studio/Tutorial_AwesomeModernCPP#359 ·
メンテナーはふだん 1 日以内に返信
-
Type: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
openscad/openscad#7360 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信