[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 <maranbr@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/64
Co-authored-by: SDK-Chan <sdkchan@eden-emu.dev>
Co-committed-by: SDK-Chan <sdkchan@eden-emu.dev>
This commit is contained in:
SDK-Chan 2025-07-14 22:30:07 +02:00 committed by crueter
parent 2e092010e6
commit a8564a09b7
No known key found for this signature in database
GPG key ID: 425ACD2D4830EBC6

View file

@ -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,
};