Skip to content

[Bug]: Linux hybrid GPU (AMD + NVIDIA): MP4 export aborts the app — "Unable to load get_memory_fd_khr" in create_exportable_staging #1622

Closed

Description

@DariusDev16

Search existing issues

  • I have searched the existing issues

Describe the bug

On a hybrid-GPU Linux laptop (AMD iGPU + NVIDIA dGPU), clicking Export (MP4) aborts the whole app. Only an empty .openscreen-mp4-<pid>-0.partial.mp4 is left in the output folder.

wgpu picks the NVIDIA adapter (PowerPreference::HighPerformance), but that device is opened without the dmabuf export extensions:

[d3d] adaptateur Vulkan : NVIDIA GeForce RTX 3050 Laptop GPU (DiscreteGpu, Vulkan) -> backend Hardware, export dmabuf indisponible

VaapiEncoder::open still succeeds, because it opens the hard-coded /dev/dri/renderD128, which is the AMD iGPU here. So run_multi_inner calls create_exportable_staging, which calls vkGetMemoryFdKHR even though the extension was never loaded. ash panics inside a non-unwinding context and the process aborts:

thread '<unnamed>' panicked at .../ash-0.38.0+1.3.281/src/extensions_generated.rs:12032:29:
Unable to load get_memory_fd_khr
thread '<unnamed>' panicked at .../core/src/panicking.rs:225:5:
panic in a function that cannot unwind
  10: <ash::extensions_generated::khr::external_memory_fd::DeviceFn>::load_erased::get_memory_fd_khr
  11: <openscreen_compositor::compositor_linux::Compositor>::create_exportable_staging
  12: openscreen_compositor::pipeline_linux::run_multi_inner
  13: openscreen_compositor::pipeline_linux::run_composited_multi_cancellable
  14: napi::async_work::execute::<compositor_view::ExportMultiTask>
thread caused non-unwinding panic. aborting.

The doc comment on create_exportable_staging says it returns None when the device was opened without the external-memory extensions. In practice nothing checks that. The dmabuf_export flag from create_async is only logged and never stored on Gpu.

Expected behavior

Export completes. When the device has no dmabuf export, create_exportable_staging should return None, so the export falls back to the software encoder (libopenh264) instead of crashing.

To Reproduce

  1. Linux laptop with AMD iGPU (renderD128) + NVIDIA dGPU (renderD129), proprietary NVIDIA driver, X11.
  2. Record any clip (screen only, no audio).
  3. Click Export → MP4 → choose a path.
  4. The app closes immediately.

Workarounds that confirm the diagnosis:

  • VK_DRIVER_FILES=/usr/share/vulkan/icd.d/radeon_icd.json (wgpu on AMD): export works, log shows export dmabuf actif and encodeur video : h264_vaapi (materiel, dmabuf).
  • OPENSCREEN_EXPORT_ENCODER=libopenh264 skips the VAAPI path.

Suggested fix

Store the flag on Gpu and guard the call. The patch below is against v2.3.0 (still applies to main). I have not compiled it:

--- a/crates/compositor/src/d3d_linux.rs
+++ b/crates/compositor/src/d3d_linux.rs
@@ pub struct Gpu {
     pub feature_level: u64,
+    /// True when the device was opened with VK_KHR_external_memory_fd +
+    /// VK_EXT_external_memory_dma_buf.
+    pub dmabuf_export: bool,
 }
@@ async fn create_async
         backend: got,
         feature_level: 0,
+        dmabuf_export,
     })
--- a/crates/compositor/src/compositor_linux.rs
+++ b/crates/compositor/src/compositor_linux.rs
@@ pub fn new_sized
             feature_level: gpu.feature_level,
+            dmabuf_export: gpu.dmabuf_export,
         };
@@ pub fn create_exportable_staging
         use ash::vk;
+        // Without the extensions `get_memory_fd` is not loaded: ash panics
+        // ("Unable to load get_memory_fd_khr") and the whole process aborts.
+        if !self.gpu.dmabuf_export {
+            return None;
+        }

A more complete fix could also open VAAPI on the render node that belongs to the wgpu adapter (match the PCI vendor/device), instead of hard-coding renderD128.

OS

Linux

OS Version

Debian 13 (kernel 6.12), X11, OpenScreen 2.3.0 AppImage

Device Type

Laptop: AMD Radeon (Renoir/Barcelo, RADV) + NVIDIA GeForce RTX 3050 Laptop GPU (proprietary driver)

Activity

  1. added 2 commits that reference this issue on Nov 19, 2026
    450cc9d
    d68ee54
  2. added
    status: fixed in mainWork is merged into main but may not be in a downloadable release yet.
    status: pending releaseMerged change is waiting for a packaged desktop release.
    on Nov 19, 2026
  3. added this to the Next Release milestone on Nov 19, 2026
  4. github-actions commented on Nov 19, 2026

    @github-actions
    Contributor

    Fixed by #1624 and merged into main.

    This change is assigned to the Next Release release milestone and is not necessarily available in the latest downloadable desktop release yet. It is currently marked as status: pending release until a packaged release containing it is published.

  5. added a commit that references this issue on Nov 19, 2026
    0c8a43c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: fixed in mainWork is merged into main but may not be in a downloadable release yet.status: pending releaseMerged change is waiting for a packaged desktop release.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions