mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
ed0b673484
- Bug 1149343 - Part2: Add HW decode blacklisting support on mac. r=mattwoodrow (bd3d67e2e) - missing bit of Bug 1149343 - Part 1: Unify prefs/blacklist for hardware acceleration (551804df4) - Bug 1174055 - Load WMF DLLs in MFStartup(), never unload them. r=jya (f2eb84146) - Bug 1153123 - Don't upload in the ImageBridge thread if A8 texture sharing is broken. r=Bas (40d4a057f) - logical extension of ug 1149343 - Part 1: Unify prefs/blacklist for hardware acceleration (57adc4003) - Fix a startup crash when attempting to test D3D11 texture sharing. (bug 1170211, r=jmuizelaar, a=KWierso) (0a8fdc55f) - Bug 1175366 - Don't use DXVA if D3D11 texture sharing is broken. r=jrmuizel (968b04384) - Bug 1156135 - Add live pref for disabling DXVA when it fails to render correctly. r=ajones (1aed3e54d) - Bug 1171094. Disallow D3D11 ANGLE with old DisplayLink drivers. r=Bas (c7e91c2bd) - Bug 1173972. Improve logging in gfxWindowPlatform. r=milan (870aefb7b) - Bug 1176506 - Don't test texture sharing on WARP devices since it never works and can be detected as a driver reset. r=Bas (5d8baec76) - Bug 1180246 - Part 1 - remove dependencies on gfxD2DSurface. r=bas (6d20a0c23) - Bug 1180246 - Part 2 - kill gfxD2DSurface with fire. r=bas (107da3dd1) - Bug 1159751 - Use a more explicit order of destruction in gfxWindowsPlatform. r=bas (903a29b36) - Bug 1180246 - Part 3 - remove usage of cairo_d2d_device. r=bas (b9c66f7d4) - Bug 1180246 - Part 4 - reduce Cairo dependencies where safe in TextureClientD3D9. r=bas (07a18c32b) - Bug 1170390 - Make gfxPlatform::CreateOffscreenSurface use explicit format rather than guess. r=jrmuizel (491a790ed) - Bug 1109718. Log when RenderTargetView's need to be recreated. r=mwoodrow (fdaa1199d) - Bug 1184130. Report mismatches of adapter description and vendor id that we get from the registry. r=bas (ffee48afb) - Split gfxWindowsPlatform::UpdateRenderMode() into multiple functions. (bug 1179051 part 1, r=bas) (270caa1e5) - Bug 1170143 - Disable texture sharing if we've blacklisted direct2d. r=Bas (bfb85c2b3) - Bug 1170143 - Disable alpha texture sharing for intel driver version 8.15.10.2086 since it crashes. r=jrmuizel (cffedeb74) - Bug 1173719 - Prevent crashes when passing touch events across the PBrowser interface with APZ disabled. r=botond (6585f60bf) - Bug 1173983 - Use R8 textures for d3d11 alpha textures since it appears to be better supported. r=Bas (946c1e36c) - missing bit of Bug 1150124. Move WARP reporter closer to actually testing WARP. (7ebc11c2f) - Bug 1175104 - Enable multithread support on our d3d11 content device. r=Bas (32844aba1) - Fix regression where WARP could be used as a fallback on Windows 7. (bug 1179051 part 2.1, r=jrmuizel) (89e1f5c3d) - bug 1171113 - Add widget/uikit. r=roc (NPOTB) (dc79563ae) - Move compositor backend decisions into gfxPlatform. (bug 1179051 part 3, r=mattwoodrow) (b1b8e10c6) - Move more compositor backend checks into gfxPlatform. (bug 1179051 part 4, r=mattwoodrow) (6c9d820a0) - Bug 1176052 - Introduce gfxCriticalNote. r=jmuizelaar (1cc2a0c90)
186 lines
5.5 KiB
C++
186 lines
5.5 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "WMF.h"
|
|
#include "WMFDecoderModule.h"
|
|
#include "WMFVideoMFTManager.h"
|
|
#include "WMFAudioMFTManager.h"
|
|
#include "mozilla/Preferences.h"
|
|
#include "mozilla/DebugOnly.h"
|
|
#include "mozilla/Services.h"
|
|
#include "WMFMediaDataDecoder.h"
|
|
#include "nsIWindowsRegKey.h"
|
|
#include "nsComponentManagerUtils.h"
|
|
#include "nsServiceManagerUtils.h"
|
|
#include "nsIGfxInfo.h"
|
|
#include "GfxDriverInfo.h"
|
|
#include "nsServiceManagerUtils.h" // for do_GetService
|
|
#include "MediaInfo.h"
|
|
#include "gfxPlatform.h"
|
|
|
|
namespace mozilla {
|
|
|
|
static bool sIsWMFEnabled = false;
|
|
static bool sDXVAEnabled = false;
|
|
|
|
WMFDecoderModule::WMFDecoderModule()
|
|
: mWMFInitialized(false)
|
|
{
|
|
}
|
|
|
|
WMFDecoderModule::~WMFDecoderModule()
|
|
{
|
|
if (mWMFInitialized) {
|
|
DebugOnly<HRESULT> hr = wmf::MFShutdown();
|
|
NS_ASSERTION(SUCCEEDED(hr), "MFShutdown failed");
|
|
}
|
|
}
|
|
|
|
void
|
|
WMFDecoderModule::DisableHardwareAcceleration()
|
|
{
|
|
sDXVAEnabled = false;
|
|
}
|
|
|
|
/* static */
|
|
void
|
|
WMFDecoderModule::Init()
|
|
{
|
|
MOZ_ASSERT(NS_IsMainThread(), "Must be on main thread.");
|
|
sIsWMFEnabled = Preferences::GetBool("media.windows-media-foundation.enabled", false);
|
|
sDXVAEnabled = gfxPlatform::GetPlatform()->CanUseHardwareVideoDecoding();
|
|
}
|
|
|
|
nsresult
|
|
WMFDecoderModule::Startup()
|
|
{
|
|
if (sIsWMFEnabled) {
|
|
mWMFInitialized = SUCCEEDED(wmf::MFStartup());
|
|
}
|
|
return mWMFInitialized ? NS_OK : NS_ERROR_FAILURE;
|
|
}
|
|
|
|
already_AddRefed<MediaDataDecoder>
|
|
WMFDecoderModule::CreateVideoDecoder(const VideoInfo& aConfig,
|
|
layers::LayersBackend aLayersBackend,
|
|
layers::ImageContainer* aImageContainer,
|
|
FlushableMediaTaskQueue* aVideoTaskQueue,
|
|
MediaDataDecoderCallback* aCallback)
|
|
{
|
|
nsRefPtr<MediaDataDecoder> decoder =
|
|
new WMFMediaDataDecoder(new WMFVideoMFTManager(aConfig,
|
|
aLayersBackend,
|
|
aImageContainer,
|
|
sDXVAEnabled && ShouldUseDXVA(aConfig)),
|
|
aVideoTaskQueue,
|
|
aCallback);
|
|
return decoder.forget();
|
|
}
|
|
|
|
already_AddRefed<MediaDataDecoder>
|
|
WMFDecoderModule::CreateAudioDecoder(const AudioInfo& aConfig,
|
|
FlushableMediaTaskQueue* aAudioTaskQueue,
|
|
MediaDataDecoderCallback* aCallback)
|
|
{
|
|
nsRefPtr<MediaDataDecoder> decoder =
|
|
new WMFMediaDataDecoder(new WMFAudioMFTManager(aConfig),
|
|
aAudioTaskQueue,
|
|
aCallback);
|
|
return decoder.forget();
|
|
}
|
|
|
|
bool
|
|
WMFDecoderModule::ShouldUseDXVA(const VideoInfo& aConfig) const
|
|
{
|
|
static bool isAMD = false;
|
|
static bool initialized = false;
|
|
if (!initialized) {
|
|
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
|
|
nsAutoString vendor;
|
|
gfxInfo->GetAdapterVendorID(vendor);
|
|
isAMD = vendor.Equals(widget::GfxDriverInfo::GetDeviceVendor(widget::VendorAMD), nsCaseInsensitiveStringComparator()) ||
|
|
vendor.Equals(widget::GfxDriverInfo::GetDeviceVendor(widget::VendorATI), nsCaseInsensitiveStringComparator());
|
|
initialized = true;
|
|
}
|
|
if (!isAMD) {
|
|
return true;
|
|
}
|
|
// Don't use DXVA for 4k videos or above, since it seems to perform poorly.
|
|
return aConfig.mDisplay.width <= 1920 && aConfig.mDisplay.height <= 1200;
|
|
}
|
|
|
|
bool
|
|
WMFDecoderModule::SupportsSharedDecoders(const VideoInfo& aConfig) const
|
|
{
|
|
// If DXVA is enabled, but we're not going to use it for this specific config, then
|
|
// we can't use the shared decoder.
|
|
return !sDXVAEnabled || ShouldUseDXVA(aConfig);
|
|
}
|
|
|
|
bool
|
|
WMFDecoderModule::SupportsMimeType(const nsACString& aMimeType)
|
|
{
|
|
return aMimeType.EqualsLiteral("video/mp4") ||
|
|
aMimeType.EqualsLiteral("video/avc") ||
|
|
aMimeType.EqualsLiteral("video/webm; codecs=vp8") ||
|
|
aMimeType.EqualsLiteral("video/webm; codecs=vp9") ||
|
|
aMimeType.EqualsLiteral("audio/mp4a-latm") ||
|
|
aMimeType.EqualsLiteral("audio/mpeg");
|
|
}
|
|
|
|
PlatformDecoderModule::ConversionRequired
|
|
WMFDecoderModule::DecoderNeedsConversion(const TrackInfo& aConfig) const
|
|
{
|
|
if (aConfig.IsVideo() &&
|
|
(aConfig.mMimeType.EqualsLiteral("video/avc") ||
|
|
aConfig.mMimeType.EqualsLiteral("video/mp4"))) {
|
|
return kNeedAnnexB;
|
|
} else {
|
|
return kNeedNone;
|
|
}
|
|
}
|
|
|
|
static bool
|
|
ClassesRootRegKeyExists(const nsAString& aRegKeyPath)
|
|
{
|
|
nsresult rv;
|
|
|
|
nsCOMPtr<nsIWindowsRegKey> regKey =
|
|
do_CreateInstance("@mozilla.org/windows-registry-key;1", &rv);
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
return false;
|
|
}
|
|
|
|
rv = regKey->Open(nsIWindowsRegKey::ROOT_KEY_CLASSES_ROOT,
|
|
aRegKeyPath,
|
|
nsIWindowsRegKey::ACCESS_READ);
|
|
if (NS_FAILED(rv)) {
|
|
return false;
|
|
}
|
|
|
|
regKey->Close();
|
|
|
|
return true;
|
|
}
|
|
|
|
/* static */ bool
|
|
WMFDecoderModule::HasH264()
|
|
{
|
|
// CLSID_CMSH264DecoderMFT
|
|
return ClassesRootRegKeyExists(
|
|
NS_LITERAL_STRING("CLSID\\{32D186A7-218F-4C75-8876-DD77273A8999}"));
|
|
}
|
|
|
|
/* static */ bool
|
|
WMFDecoderModule::HasAAC()
|
|
{
|
|
// CLSID_CMSAACDecMFT
|
|
return ClassesRootRegKeyExists(
|
|
NS_LITERAL_STRING("CLSID\\{62CE7E72-4C71-4D20-B15D-452831A87D9D}"));
|
|
}
|
|
|
|
} // namespace mozilla
|