GeezerVison is showing github.com — GPU spectrum deadlocks the GUI thread on Linux/Wayland (QWaylandWindow::waitForFrameSync) · Issue #4704 · aethersdr/AetherSDR
GPU spectrum deadlocks the GUI thread on Linux/Wayland (QWaylandWindow::waitForFrameSync) #4704DescriptionSummary
On Linux/Wayland the GPU spectrum path (AETHER_GPU_SPECTRUM=ON) intermittently deadlocks the GUI thread at startup. The spectrum and waterfall never update for the rest of the session; the rest of the UI is also frozen. It is a race — it does not reproduce on every launch, which makes single-run testing actively misleading.
Measured on a Raspberry Pi 5: 6 deadlocks in 15 launches (40%).
Environment
|
|
| Hardware |
Raspberry Pi 5 Model B Rev 1.1 |
| OS |
Raspberry Pi OS Trixie (Debian 13), glibc 2.41 |
| Compositor |
labwc (wlroots), native Wayland |
| GPU / driver |
Broadcom V3D 7.1.10.2, Mesa 25.0.7 |
| Qt |
6.8.2 (Debian) |
| Source |
main @ 590ae12, Release, AETHER_GPU_SPECTRUM=ON |
Diagnosis
The GUI thread parks in QWaylandWindow::waitForFrameSync() waiting on a compositor frame callback that never arrives. Backtrace from a frozen process (launched plainly, no instrumentation):
#3 pthread_cond_timedwait
#4 QWaitCondition::wait(QMutex*, QDeadlineTimer)
#5 QtWaylandClient::QWaylandWindow::waitForFrameSync(int)
#6 QtWaylandClient::QWaylandGLContext::swapBuffers(QPlatformSurface*)
#8 QRhi::endFrame(QRhiSwapChain*, QFlags<QRhi::EndFrameFlag>)
#10 QPlatformBackingStore::rhiFlush(QWindow*, double, QRegion const&, ...)
#11 QWidgetRepaintManager::flush(QWidget*, QRegion const&, QPlatformTextureList*)
#13 QWidgetRepaintManager::paintAndFlush()
The rhiFlush frame is the key one. A QRhiWidget without a native window promotes the entire top-level window to RHI compositing, so every frame — not just the panadapter — is presented through rhiFlush -> QRhi::endFrame -> QWaylandGLContext::swapBuffers. That is what drags the whole UI into the Wayland frame-callback handshake, and it is only reachable because the spectrum is a QRhiWidget. Builds with AETHER_GPU_SPECTRUM=OFF are unaffected.
Fix
Give the pan its own native surface on Linux/Wayland, so the top level stays on the raster backing store and rhiFlush is never reached:
setAttribute(Qt::WA_DontCreateNativeAncestors);
setAttribute(Qt::WA_NativeWindow);
This is the isolation policy the app already ships for macOS (applyNativeWindowIsolationPolicy(), #714/#4339). The helper existed but was only called from the Q_OS_MAC branch of the constructor.
Measured result
| Arm |
Healthy |
Deadlocked |
| unpatched |
9 |
6 |
| patched |
15 |
0 |
30 launches, Fisher exact p = 0.017 two-tailed. Oracle was thread-1 stack sampling for waitForFrameSync (position-independent), not screenshot comparison.
Confirmed the patched build is genuinely on native Wayland and the GPU, not an XWayland fallback: libqwayland-generic.so + libQt6WaylandEglClientHwIntegration loaded, libEGL_mesa mapped, /dev/dri/renderD128 open.
Related: QT_QPA_PLATFORM is forced, not preferred
Separate defect found alongside. src/main.cpp sets qputenv("QT_QPA_PLATFORM", "wayland") — a single value, which discards Qt's own fallback chain (its default on a Wayland session is already the list wayland;xcb). A host whose Qt lacks qt6-wayland, or whose plugin mismatches the compositor protocol, then gets a hard "Could not load the Qt platform plugin" abort instead of degrading to XWayland. That is the failure shape #1389 describes. Passing "wayland;xcb" keeps the #1233 preference and restores the fallback.
Release impact
.github/workflows/appimage.yml enabled AETHER_GPU_SPECTRUM=ON for aarch64 in #4670, so the next tagged release ships this path to Pi users for the first time. The workflow is tag-only and has never run, so no aarch64 AppImage exists yet and it is unverified whether the shipping artifact (Qt 6.8.3) reproduces this. Worth settling before a tag.
Not yet established
- Whether the native surface costs frame rate or CPU (the macOS comment warns of a per-present raster blend on the GUI thread) — measurement in progress.
- Whether this reproduces on desktop Linux GPUs (Intel/AMD/NVIDIA) or is specific to V3D. The fix is currently gated on
Q_OS_LINUX + Wayland, so it changes behaviour for all Linux users.
- Whether newer Qt (6.9+) fixes the underlying
waitForFrameSync behaviour upstream.
Activityaethersdr-agent commented on Aug 2, 2026 Thanks for reporting this, @ten9876. To help us track it down, could you share a few more details?
- Radio model and firmware version
- AetherSDR version
If you can attach logs (Help → Support → File an Issue), that would be especially helpful.
— AetherClaude (automated agent for AetherSDR)
🤖 aethersdr-agent · cost: $35.1645 · model: claude-opus-5 aethersdr-agent commented on Aug 2, 2026 Thanks for filing this. This issue involves CI/CD workflows, build infrastructure, or release packaging — that is outside what I can help with, as I am restricted to source code changes in src/ and docs/.
Jeremy will need to handle this one directly.
— AetherClaude (automated agent for AetherSDR)
🤖 aethersdr-agent · cost: $0.5373 · model: claude-opus-5 aethersdr-agent commented on Nov 19, 2026 Triage against main @ 47f5aff31. Please disregard my two earlier replies: the questions about radio and logs don't apply here, and the half of this issue that still needs work is in src/gui/, not CI.
Already fixed: QT_QPA_PLATFORM was forced to a single value
src/main.cpp:376-408 now sets an ordered list ("wayland;xcb", or "xcb;wayland" on an affirmatively headless session) and leaves it alone if the user set QT_QPA_PLATFORM or passed -platform. That came in with 30e2bd1 (#4692) and 8be0cc4 (#4755). Nothing more to do on that part.
Still open: the pan's native surface is macOS-only, and it is now opt-in there too
SpectrumWidget::applyNativeWindowIsolationPolicy() (src/gui/SpectrumWidget.cpp:2003-2017) is still compiled only under #if defined(AETHER_GPU_SPECTRUM) && defined(Q_OS_MACOS). The constructor calls it only in the Q_OS_MACOS branch (:2079). On Linux the pan is a plain QRhiWidget, so the whole top-level window still goes through rhiFlush → QRhi::endFrame → QWaylandGLContext::swapBuffers. That is the path in your backtrace.
- The project has also changed direction since this was filed. With perf(gui): reduce backing-store copies and batch window redraws #7231 (733eb62), shared top-level composition is the default on every platform, macOS included. Native child surfaces are now a diagnostic opt-in,
AETHER_PAN_NATIVE_WINDOW=1 (SpectrumWidget.h:186-188, docs/performance/backing-store-redraws.md:43).
- Shared windows also get the new display-paced
WindowRepaintScheduler. A native child turns that off: PanadapterRenderScheduler.cpp:39 sets paceWindow = !WA_NativeWindow, and such pans go back to the 16 ms timer. So a native surface on all of Linux, as proposed here, would now take Linux off the pacing path perf(gui): reduce backing-store copies and batch window redraws #7231 just added.
- The Qt floor is now 6.12 (
CMakeLists.txt:331-362), and the AppImage ships 6.12. The 6/15 vs 0/15 measurement was taken on Debian's Qt 6.8.2, which can no longer build main. Nobody has shown whether QWaylandWindow::waitForFrameSync still stalls on 6.12. The user docs (gpu-rendering.md, linux.md, installation.md) still list GPU spectrum deadlocks the GUI thread on Linux/Wayland (QWaylandWindow::waitForFrameSync) #4704 as a known issue.
Proposed fix (two steps; the second depends on a measurement)
- Cheap, no change to defaults: make the existing opt-in work on Linux/Wayland too. Drop
Q_OS_MACOS from the guard in applyNativeWindowIsolationPolicy() (keep AETHER_GPU_SPECTRUM). Call it from the non-mac constructor branch when QGuiApplication::platformName() starts with wayland. PanadapterStack.cpp:46 already calls it again after a reparent. Update the helper comment in SpectrumWidget.h:189-196 and the nativeWindow row in docs/automation-bridge.md:1606. This gives Pi users AETHER_PAN_NATIVE_WINDOW=1 as a documented workaround, and gives us the A/B switch for step 2.
- Default on Wayland only if 6.12 still deadlocks: if it does, make
nativeWindowPreferred() return true for Wayland when the env var is unset (with =0 as the opt-out). Measure frame rate/CPU against the paced shared path at the same time, since that was the open cost question in the report.
One caveat for whoever measures this: a native pan on Wayland is a wl_subsurface whose swapBuffers still runs on the GUI thread. The pan's own present can still call waitForFrameSync, though the rest of the UI no longer goes through rhiFlush. The 0/15 result suggests the subsurface callback arrives reliably, but it is worth sampling thread 1 for that frame in the patched arm as well.
Handoff
- Known: the root cause is still in the code (
rhiFlush on the top level, because no Linux pan is native). The platform-forcing half is fixed.
- Not known: whether Qt 6.12 on V3D/labwc still deadlocks. The reported fix also conflicts with the shared-composition and pacing direction perf(gui): reduce backing-store copies and batch window redraws #7231 set.
- Decision needed: authorize step 1 now (small,
src/gui/ + docs, defaults unchanged), and/or re-run the 15-launch thread-1 sampling on a Qt 6.12 build before choosing a Wayland default for step 2.
- Label:
priority: high, because when it hits, the whole UI freezes for the session.
🤖 aethersdr-agent · cost: $0.5422 · model: claude-opus-5-5
MetadataMetadataStatusShow more project fields
DevelopmentNo branches or pull requestsIssue actions
|