Compositor crashes when an auxiliary buffer can't be allocated (NVIDIA GBM: gbm_bo_create failed: Invalid argument)

Aperta
#3,149 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp

Direzione di ricerca

Start by reviewing the attached patch and the allocation call sites in src/view/view-3d.cpp, plugins/blur/blur-base.cpp, plugins/blur/blur.cpp, src/view/view.cpp, and the listed workspace, grid, and cube files. Build Wayfire with the proposed transformer changes, then verify that allocation failure skips the affected frame without crashing the session; the remaining callers should either handle failure similarly or be explicitly assessed.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

When wf::auxilliary_buffer_t::allocate() fails, several callers ignore the FAILED result and render into the empty buffer anyway. Wayfire then crashes and the whole session ends (every client loses its connection).

On my machine this happens with the NVIDIA card as the primary renderer. The GBM allocation fails now and then, for ordinary window-sized buffers:

EE [render/allocator/gbm.c:89] gbm_bo_create failed: Invalid argument
EE [render/allocator/gbm.c:89] gbm_bo_create failed: Invalid argument
EE [src/render.cpp:465] Failed to allocate auxilliary buffer! Size 876x448 format 875713089
(EE) failed to read Wayland events: Broken pipe

I had four crashes in about an hour, and three of them logged the failed allocation. Two of those failed on a view's transformer buffer (876x448, 960x494) and one on the blur during Alt+Tab (1920x1080). During at least two crashes, an Electron app (GitHub Desktop, Flatpak) was in a loop: its GPU process kept failing eglCreateImage (0x3009) on imported dmabufs and restarting. That may be what pushed the NVIDIA driver into refusing allocations. With the integrated GPU as the primary renderer (WLR_DRM_DEVICES=/dev/dri/card0:/dev/dri/card1), I have had no crashes since.

System
Wayfire 0.12.0 master (d181484, Sep 26 2026), wlroots 0.20.2
ASUS TUF A15: Ryzen 7 7735HS (Radeon 680M, amdgpu) and RTX 4060 Laptop (NVIDIA proprietary 615.71.09, nvidia_drm.modeset=1)
MUX in dGPU mode, so wlroots picks the NVIDIA card (card1) by default
Two outputs: eDP-1 1920x1080@144 and HDMI-A-1 1920x1080@180
Plugins: blur, animate, pixdecor, a transformer-based plugin (rounded corners)
Where the result is ignored

allocate() returns buffer_reallocation_result_t::FAILED, but these callers continue as if it succeeded:

transformer_base_node_t::get_updated_contents() (src/view/view-3d.cpp): runs a render pass into inner_content and returns texture_t::from_aux(). This path is used by every transformer (2D/3D views, blur, plugins).
plugins/blur/blur-base.cpp: render_iteration() (out.allocate) and copy_region() (result.allocate)
plugins/blur/blur.cpp: saved_pixels->pixels.allocate(target.get_size())
src/view/view.cpp: take_snapshot()
plugins/common/workspace-wall.cpp, plugins/grid/.../crossfade.hpp, plugins/cube/cube.cpp
Proposed fix (attached patch)

The patch covers the transformer path, which caused most of the crashes:

get_updated_contents() returns nullptr when the allocation fails. It keeps the damage, so the next frame redraws everything.
transformer_render_instance_t::get_texture() passes the nullptr on.
Its callers in view-3d.cpp (2D and 3D, GLES and Vulkan) and blur.cpp skip drawing for that frame.

A window then misses a frame instead of taking down the session. The blur passes and the other callers listed above could follow the same pattern: check the result, then skip or degrade. I'm happy to extend the patch if this approach is acceptable.

The patch is against d181484. I wrote it while debugging and haven't built Wayfire with it yet.

Patch:
wayfire-skip-frame-on-buffer-failure.patch

Lingua principale
C++
Stelle
3.1k
Fork
249
Merge medio
7g 13h
PR unite (30g)
5

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di WayfireWM/wayfire

Tutte le issue di WayfireWM/wayfire

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.