ffmpeg -hwaccel vulkan falls back to SW on mesa-panvk-bifrost-video — SYNC_FD external semaphore handle unsupported #1
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
mesa-panvk-bifrost-video(panvk-bifrost-video campaign, sibling of mesa-panvk-bifrost-r4) ships VK_KHR_video_decode_h264 byte-exact-correct on Mali Bifrost SBCs (verified 2026-05-21: 48/48 BBB display frames byte-identical to ffmpeg+libva-v4l2-request-fourier on the same hantro VPU). But ffmpeg's own Vulkan hwaccel falls back to software decode when wired against this driver — the decoded image can't cross the API boundary to ffmpeg's downstream code.Repro on ohm (PineTab2, RK3566, Mali-G52 r1 MC1)
Observed:
Diagnosis
The Vulkan device DOES advertise the external-sync extensions ffmpeg looks for:
So the gap isn't extension availability. It's the handle-type granularity inside the extensions: ffmpeg's
hwcontext_vulkan.crequestsVK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BITfor the post-decode cross-API handoff (sync_file / drm-prime), andvkGetPhysicalDeviceExternalSemaphorePropertieson panvk-bifrost reports it unsupported. HenceVK_ERROR_INVALID_EXTERNAL_HANDLEat semaphore-create time.panvk likely exposes
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT(the Mesa-side common minimum), but notSYNC_FD. The latter is what Linux drm-prime consumers want.What works vs what doesn't (same device, same driver)
vulkan-video-dec-simple-testffmpeg -hwaccel vulkan(h264)Probable fix
Add
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT(and likelyVK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT) to the supported handle types panvk reports in:panvk_GetPhysicalDeviceExternalSemaphoreProperties(currently advertises OPAQUE_FD only?)panvk_GetPhysicalDeviceExternalFencePropertiespan_kmod_*sync-import/export plumbing (kernel-side sync_file fd round-trip via DRM_IOCTL_SYNCOBJ_*)Most panvk paths already use drm-syncobj internally, so the kernel-side support is there — the gap is at the Vulkan API surface where panvk doesn't claim SYNC_FD as a supported handle type.
Scope note
This is panvk-wide, not video-specific. Any Vulkan consumer wanting cross-API drm-prime sync on panvk hits the same wall. Filing here under
marfrit/fourierbecause the immediate motivating consumer is the fourier HW-decode stack (ffmpeg-vulkan-h264 on Bifrost SBCs).References
~/src/panvk-bifrost-video/phase0_evidence/phase5_post_review_2026-05-21.tgz(the source delta that proves the decode path correct)Vulkan-Video-Samples/build/vk_video_decoder/test/vulkan-video-dec-simple-test(byte-exact validation 2026-05-21)[[panvk-bifrost-video-state]]covers the full campaign🤖 Filed by Claude Code on behalf of mfritsche