Couldn't import dmabuf as vulkan device memory. vkAllocateMemory: VK_ERROR_INVALID_EXTERNAL_HANDLE
Hi. I'm building my app on arm64 with vulkan on rpi4 raspbian trixie.
Linux scubaru 6.12.47+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.12.47-1+rpt1 (2025-09-16) aarch64 GNU/Linux
I'm building using the following command:
flutterpi_tool build --release --arch=arm64 --cpu=pi4
My flutter env setup is:
Flutter 3.38.5 • channel [user-branch] • unknown source
Framework • revision f6ff1529fd (4 weeks ago) • 2025-12-11 11:50:07 -0500
Engine • hash c108a94d7a8273e112339e6c6833daa06e723a54 (revision 1527ae0ec5) (24 days ago) • 2025-12-11 15:04:31.000Z
Tools • Dart 3.10.4 • DevTools 2.51.1
This is a stable release from source tag.
The app builds fine in both flutter-pi and flutter. It runs fine on x64 and arm64 without Vulkan. When I run it on arm64 with Vulkan enabled (compiled on arm64) I get the following:
/usr/local/bin/flutter-pi --vulkan --videomode=1920x1080@60 --release .
vk_gbm_render_surface.c: Couldn't import dmabuf as vulkan device memory. vkAllocateMemory: VK_ERROR_INVALID_EXTERNAL_HANDLE
vk_gbm_render_surface.c: Could not initialize vulkan GBM framebuffer.
window.c: Couldn't create Vulkan GBM rendering surface.
compositor_ng.c: Couldn't create render surface for flutter to render into.
[ERROR:flutter/shell/platform/embedder/embedder.cc(1393)] Could not create the embedder backing store.
From what I understand of the flutter-pi source code, this is quite late on in the process, after the memory has been allocated for DMA. I have the DRM modules installed in config.txt. No overclocking or gpu mem specified.
Any advice would be gratefully received.
I have found this forum post on the Nvidia website which may point to the cause of the issue.
I've confirmed it's not my code as I can also reproduce this behaviour with the default Flutter app, as per by flutter create <myApp> on both x64 and arm64 platforms.
I recompiled flutter-pi with debug options enabled to try to get a bit more info. As follows:
sudo flutter-pi --vulkan --release --videomode 1920x1080 -d "531,299" .
==============Locale==============
Flutter locale:
default: en
locales: en en.UTF-8 en_GB en.UTF-8 en.UTF-8 en_GB en.UTF-8
===================================
modesetting.c: Could not set DRM client universal planes capable. drmSetClientCap: Operation not supported
flutter-pi.c: Could not create drmdev from device at "/dev/dri/card1". Continuing.
===================================
Vulkan Info:
enabled layers:
enabled instance extensions:
enabled device extensions: VK_KHR_external_memory, VK_KHR_external_memory_fd, VK_KHR_external_semaphore, VK_KHR_external_semaphore_fd, VK_EXT_external_memory_dma_buf, VK_KHR_image_format_list, VK_EXT_image_drm_format_modifier
===================================
display mode:
resolution: 1920 x 1080
refresh rate: 60.000000Hz
physical size: 531mm x 299mm
flutter device pixel ratio: 0.951531
pixel format: (any)
pluginregistry.c: Initialized plugins: services, text input, raw keyboard plugin,
vk_gbm_render_surface.c: Couldn't import dmabuf as vulkan device memory. vkAllocateMemory: VK_ERROR_INVALID_EXTERNAL_HANDLE
vk_gbm_render_surface.c: Could not initialize vulkan GBM framebuffer.
window.c: Couldn't create Vulkan GBM rendering surface.
compositor_ng.c: Couldn't create render surface for flutter to render into.
[ERROR:flutter/shell/platform/embedder/embedder.cc(1393)] Could not create the embedder backing store.
flutter-pi: compositor_ng.c:398: on_flutter_present_layers: Assertion `layers != NULL' failed.
Aborted
Hey, I'm going to close this. For anyone else coming along, follow the instructions in the wiki!
Hey, good that you got it working. And interesting that it's broken on trixie, I would've thought it should be working there by now.