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

オープン
#3,149 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
52/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
cpp

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
C++
スター
3.1k
フォーク
249
平均マージ
7日 13時間
マージ済み PR(30日)
5

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

WayfireWM/wayfire のほかの issue

WayfireWM/wayfire の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。