Portal + VAAPI: streaming fails, encoder loops with EGL_BAD_PARAMETER
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 42/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- C++
- Stelle
- 43k
- Fork
- 2.4k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di LizardByte/Sunshine
-
Linux keyboard backend has no mapping for VK_ABNT_C1 (ABNT2 dedicated `/ ?` key) — key is silently droppedForse già presa @NestorBrasileiro l’ha presa 3 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
LizardByte/Sunshine#6051 · 2 commenti ·
-
PIN pairing fails with "Missing CSRF token" - web UI never fetches/attaches the tokenForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
LizardByte/Sunshine#5467 · 2 commenti ·
-
LizardByte/Sunshine#6230 · 5 commenti ·
-
Virtual HID Driver License notifications appearing even though Enable Gamepad Input is uncheckedAperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
LizardByte/Sunshine#6222 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 47/100
LizardByte/Sunshine#6208 ·
Tutte le issue di LizardByte/Sunshine
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
I maintainer di solito rispondono entro 2 giorni
-
bug data-types
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
ClickHouse/clickhouse-cpp#645 ·
I maintainer di solito rispondono entro 1 giorno
-
bug compatibility difficulty:easy prio:normal
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
NatronGitHub/openfx-misc#524 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation enhancement help wanted P0
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Awesome-Embedded-Learning-Studio/Tutorial_AwesomeModernCPP#359 ·
I maintainer di solito rispondono entro 1 giorno
-
Type: Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
openscad/openscad#7360 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno