Commit Graph
6 Commits
Author SHA1 Message Date
Raphael Derosso Pereira 60ea5b7c57 test(linux): cover the render-node open failure and record the fake's fd
ClosesRenderNodeDescriptorWhenDeviceCreationFails no longer predicts the
descriptor with a probe open()/close(): open_fake_render_node() records
the descriptor it returned, and the test checks that one, so another
thread claiming the number between the calls cannot make it flaky or
check the wrong fd.

DoesNotCreateDeviceWhenRenderNodeFailsToOpen covers the early return in
gbm_device_t::init(): with open_render_node returning -1, create_device
is never called (counted by the fake accessors), and the owner stays
empty (no device, fd() == -1, nothing destroyed).
2026-10-09 09:56:06 -04:00
Raphael Derosso Pereira 8ca9dbfcd3 fix(linux): close the DRM render-node fd owned by wl::dmabuf_t
`dmabuf_t::init_gbm()` opens the render node and hands the descriptor to
`gbm_create_device()`; the destructor destroys the GBM device but never
closes the descriptor, on the assumption that GBM owns it. It does not:
libgbm leaves the fd to the caller (`gbm_device_destroy()` does not close
it).

Every capture (re)initialisation constructs a new `dmabuf_t` -- one per
streaming session start, plus one per output mode change and per encoder
validation pass that reaches a real capture -- so the process keeps one
open `/dev/dri/renderD*` descriptor per (re)init for its lifetime.
Measured on a long-running host (Hyprland, `capture = wlr`, `encoder =
nvenc`, NVIDIA 610.57.04, v2026.516.143833; unchanged on master):
`/dev/dri` descriptors went 4 -> 8 across three Moonlight connect /
disconnect cycles and only a restart of Sunshine returned them.

Own the descriptor together with the device in a small RAII type,
`wl::gbm_device_t`, whose `reset()` destroys the device and then closes
the descriptor (and which closes it when device creation fails); open it
with `O_CLOEXEC` so prep/do commands do not inherit it. The open/create/
destroy calls are injectable (`gbm_device_accessors_t`, same shape as
`gbm_bo_accessors_t`) so the lifecycle is covered by unit tests that need
no GPU: the descriptor is closed on reset, on the failure path and on
destruction.

Signed-off-by: Raphael Derosso Pereira <raphael@insignis.com.br>
2026-10-09 09:56:06 -04:00
Dave Lane fb925302d0 fix(linux): export all Wayland DMA-BUF planes (#5699) 2026-09-13 09:31:45 -04:00
Dave Lane 2ebaae37d2 fix(linux): handle NVENC in builds without CUDA (#5698) 2026-09-12 16:30:01 -04:00
dasepmochandReenigneArcher 3841ac593c fix: iterator/stat utility edge cases and add tests (#5308)
Co-authored-by: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
2026-09-02 08:57:41 -04:00
Zach DentonandReenigneArcher 3dfbfe0906 fix(wayland): use the current wl_output mode (#5150)
Signed-off-by: Zach Denton <z@chdenton.com>
Co-authored-by: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
2026-08-20 23:00:50 -04:00