From a8564a09b7b2aac98a0319d40f8e5bc6984f8f1d Mon Sep 17 00:00:00 2001 From: SDK-Chan Date: Mon, 14 Jul 2025 22:30:07 +0200 Subject: [PATCH] [host1x] FreeBSD: Fix random crashes due to CUDA/VAAPI check sideeffects (#64) FreeBSD doesn't support NVDEC, CUDA, and partially supports VAAPI (mostly for firefox). Implementing VAAPI for other use cases would be a little bit complicated so, I chose to switch it off for FreeBSD. This PR ensures that FFmpeg will always default to software decoding on FreeBSD, but should remain the same functionalities for other OS's. The results are slight CPU increases while decoding in software mode, but still neglectable and they don't really harm performance. Co-authored-by: MaranBr Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/64 Co-authored-by: SDK-Chan Co-committed-by: SDK-Chan --- src/video_core/host1x/ffmpeg/ffmpeg.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/video_core/host1x/ffmpeg/ffmpeg.cpp b/src/video_core/host1x/ffmpeg/ffmpeg.cpp index 9b718f2591..5321c8c98c 100644 --- a/src/video_core/host1x/ffmpeg/ffmpeg.cpp +++ b/src/video_core/host1x/ffmpeg/ffmpeg.cpp @@ -26,13 +26,14 @@ namespace { constexpr AVPixelFormat PreferredGpuFormat = AV_PIX_FMT_NV12; constexpr AVPixelFormat PreferredCpuFormat = AV_PIX_FMT_YUV420P; constexpr std::array PreferredGpuDecoders = { - AV_HWDEVICE_TYPE_CUDA, #ifdef _WIN32 + AV_HWDEVICE_TYPE_CUDA, AV_HWDEVICE_TYPE_D3D11VA, AV_HWDEVICE_TYPE_DXVA2, +#elif defined(__FreeBSD__) + AV_HWDEVICE_TYPE_VDPAU, #elif defined(__unix__) AV_HWDEVICE_TYPE_VAAPI, - AV_HWDEVICE_TYPE_VDPAU, #endif AV_HWDEVICE_TYPE_VULKAN, };