From f756be87ff2ece677565e0f28d186ff09128b7ba Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 30 Aug 2024 16:31:58 -0500 Subject: [PATCH] Fix YUV444 hardware decoding on Windows systems without an Intel GPU present --- app/streaming/video/ffmpeg-renderers/d3d11va.cpp | 7 ++++++- app/streaming/video/ffmpeg-renderers/dxva2.cpp | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/streaming/video/ffmpeg-renderers/d3d11va.cpp b/app/streaming/video/ffmpeg-renderers/d3d11va.cpp index 22d2506e..d5f90f6d 100644 --- a/app/streaming/video/ffmpeg-renderers/d3d11va.cpp +++ b/app/streaming/video/ffmpeg-renderers/d3d11va.cpp @@ -1169,7 +1169,12 @@ IFFmpegRenderer::InitFailureReason D3D11VARenderer::getInitFailureReason() // NB2: We're also assuming that no GPU exists which lacks any D3D11 driver but has drivers // for non-DX APIs like Vulkan. I believe this is a Windows Logo requirement so it should be // safe to assume. - if (m_DevicesWithFL11Support != 0 && m_DevicesWithCodecSupport == 0) { + // + // NB3: Sigh, there *are* GPUs drivers with greater codec support available via Vulkan than + // D3D11VA even when both D3D11 and Vulkan APIs are supported. This is the case for HEVC RExt + // profiles that were not supported by Microsoft until the Windows 11 24H2 SDK. Don't report + // that hardware support is missing for YUV444 profiles since the Vulkan driver may support it. + if (m_DevicesWithFL11Support != 0 && m_DevicesWithCodecSupport == 0 && !(m_DecoderParams.videoFormat & VIDEO_FORMAT_MASK_YUV444)) { return InitFailureReason::NoHardwareSupport; } else { diff --git a/app/streaming/video/ffmpeg-renderers/dxva2.cpp b/app/streaming/video/ffmpeg-renderers/dxva2.cpp index 0b5ca90a..a3e538b0 100644 --- a/app/streaming/video/ffmpeg-renderers/dxva2.cpp +++ b/app/streaming/video/ffmpeg-renderers/dxva2.cpp @@ -717,6 +717,11 @@ bool DXVA2Renderer::initialize(PDECODER_PARAMETERS params) // the HDR colorspace and HDR display metadata required to enable HDR mode properly. return false; } + else if (params->videoFormat & VIDEO_FORMAT_MASK_YUV444) { + // It's theoretically possible to use YUV444 with D3D9, but probably not worth actually + // implementing because any YUV444-capable hardware supports D3D11 or Vulkan. + return false; + } #ifndef Q_PROCESSOR_X86 else if (qgetenv("DXVA2_ENABLED") != "1" && m_DecoderSelectionPass == 0) { SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,