Add VP9 Hardware Decoding with DXVA (Non-MFT), Vista+

Thanks to Maggie (imjustsomeoneiguess) on discord for helping with a lot of this VP9 media code.
This is the first browser so far to support VP9 Non MFT
This commit is contained in:
EAZYBLACK 2026-09-15 18:34:43 +03:00
commit 1414824320
18 changed files with 1747 additions and 34 deletions

View file

@ -30,9 +30,11 @@
#ifdef MOZ_FMP4
#include "MP4Decoder.h"
#endif
#include "WMFDecoderModule.h"
#if defined(XP_WIN) && defined(MOZ_WMF)
#include "MediaPrefs.h"
#include "WMFDecoderModule.h"
#include "mozilla/gfx/gfxVars.h"
#endif
#include "CubebUtils.h"
#include "nsIScrollableFrame.h"
@ -2379,17 +2381,26 @@ nsDOMWindowUtils::GetSupportsHardwareVP9Decoding(JS::MutableHandle<JS::Value> aP
}
#if defined(XP_WIN) && defined(MOZ_WMF)
nsCOMPtr<nsIWidget> widget = GetWidget();
LayerManager* layerManager = widget ? widget->GetLayerManager() : nullptr;
if (!MediaPrefs::PDMWMFVP9DecoderEnabled()) {
promise->MaybeResolve(NS_LITERAL_STRING("No; media.wmf.vp9.enabled is false"));
promise->MaybeResolve(NS_LITERAL_STRING(
"No; media.wmf.vp9.enabled is false"));
} else if (!gfx::gfxVars::CanUseHardwareVideoDecoding()) {
promise->MaybeResolve(NS_LITERAL_STRING("No; hardware video decoding disabled"));
} else if (WMFDecoderModule::HasVP9()) {
promise->MaybeResolve(NS_LITERAL_STRING("Yes"));
promise->MaybeResolve(NS_LITERAL_STRING(
"No; hardware video decoding disabled"));
} else if (WMFDecoderModule::HasVP9MFT()) {
promise->MaybeResolve(NS_LITERAL_STRING("Yes; using MFT"));
} else if (layerManager && WMFDecoderModule::HasVP9DXVA2(
layerManager->AsShadowForwarder())) {
promise->MaybeResolve(NS_LITERAL_STRING("Yes; using DXVA2"));
} else {
promise->MaybeResolve(NS_LITERAL_STRING("No; MFT unavailable"));
promise->MaybeResolve(NS_LITERAL_STRING(
"No; no VP9 hardware decoder available"));
}
#else
promise->MaybeResolve(NS_LITERAL_STRING("No; not supported on this platform"));
promise->MaybeResolve(NS_LITERAL_STRING(
"No; not supported on this platform"));
#endif
aPromise.setObject(*promise->PromiseObj());