Backed out changeset c6d147ba37b5 (bug 1281259) for making windows vm mn-e10s permafail

This commit is contained in:
Wes Kocher 2016-07-20 16:08:55 -07:00
Родитель f4f658ae9a
Коммит afdaddcff4
8 изменённых файлов: 41 добавлений и 69 удалений

Просмотреть файл

@ -31,7 +31,6 @@
#include "nsServiceManagerUtils.h"
#include "gfxPlatform.h"
#include "mozilla/Snprintf.h"
#include "gfxConfig.h"
#ifdef MOZ_WIDGET_ANDROID
#include "AndroidBridge.h"
@ -82,7 +81,7 @@ IsWebMForced(DecoderDoctorDiagnostics* aDiagnostics)
bool mp4supported =
DecoderTraits::IsMP4TypeAndEnabled(NS_LITERAL_CSTRING("video/mp4"),
aDiagnostics);
bool hwsupported = gfx::gfxConfig::IsEnabled(gfx::Feature::HW_VIDEO_DECODING);
bool hwsupported = gfxPlatform::GetPlatform()->CanUseHardwareVideoDecoding();
return !mp4supported || !hwsupported || VP9Benchmark::IsVP9DecodeFast();
}

Просмотреть файл

@ -13,7 +13,6 @@
#include "MediaPrefs.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/Logging.h"
#include "gfxConfig.h"
namespace mozilla {
@ -53,7 +52,8 @@ AppleDecoderModule::Init()
sIsVTHWAvailable = AppleVTLinker::skPropEnableHWAccel != nullptr;
sCanUseHardwareVideoDecoder = loaded && gfxConfig::IsEnabled(gfx::Feature::HW_VIDEO_DECODING);
sCanUseHardwareVideoDecoder = loaded &&
gfxPlatform::GetPlatform()->CanUseHardwareVideoDecoding();
sInitialized = true;
}

Просмотреть файл

@ -25,7 +25,6 @@
#include "prsystem.h"
#include "mozilla/Maybe.h"
#include "mozilla/StaticMutex.h"
#include "gfxConfig.h"
namespace mozilla {
@ -48,7 +47,7 @@ WMFDecoderModule::~WMFDecoderModule()
void
WMFDecoderModule::Init()
{
sDXVAEnabled = gfx::gfxConfig::IsEnabled(gfx::Feature::HW_VIDEO_DECODING);
sDXVAEnabled = gfxPlatform::GetPlatform()->CanUseHardwareVideoDecoding();
}
/* static */

Просмотреть файл

@ -22,9 +22,8 @@ namespace gfx {
_(D3D9_COMPOSITING, Feature, "Direct3D9 Compositing") \
_(OPENGL_COMPOSITING, Feature, "OpenGL Compositing") \
_(DIRECT2D, Feature, "Direct2D") \
_(D3D11_HW_ANGLE, Feature, "Direct3D11 hardware ANGLE") \
_(D3D11_HW_ANGLE, Feature, "Direct3D11 hardware ANGLE") \
_(GPU_PROCESS, Feature, "GPU Process") \
_(HW_VIDEO_DECODING, Feature, "Hardware Video Decoding") \
/* Add new entries above this comment */
enum class Feature : uint32_t {

Просмотреть файл

@ -992,21 +992,6 @@ void SourceSurfaceDestroyed(void *aData)
delete static_cast<DependentSourceSurfaceUserData*>(aData);
}
/**
* Used to update (enable or disable) hw video decode feature based on pref
* Dummy parameters are used to work with existing RegisterCallback func
*/
static void
UpdateHWDecBasedOnPref(const char* aPref, void* aClosure)
{
FeatureState& hwVideoDecFeature = gfxConfig::GetFeature(Feature::HW_VIDEO_DECODING);
if (!Preferences::GetBool("media.hardware-video-decoding.failed", false))
{
hwVideoDecFeature.UserDisable("Hardware video decoding disabled by user preference.", NS_LITERAL_CSTRING("FEATURE_FAILURE_HW_VIDEO_DEC_DISABLED_BY_PREF"));
}
}
void
gfxPlatform::ClearSourceSurfaceForSurface(gfxASurface *aSurface)
{
@ -2085,6 +2070,8 @@ gfxPlatform::OptimalFormatForContent(gfxContentType aContent)
* and remember the values. Changing these preferences during the run will
* not have any effect until we restart.
*/
static mozilla::Atomic<bool> sLayersSupportsHardwareVideoDecoding(false);
static bool sLayersHardwareVideoDecodingFailed = false;
static bool sBufferRotationCheckPref = true;
static bool sPrefBrowserTabsRemoteAutostart = false;
@ -2110,37 +2097,22 @@ gfxPlatform::InitAcceleration()
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
nsCString discardFailureId;
int32_t status;
FeatureState& hwVideoDecFeature = gfxConfig::GetFeature(Feature::HW_VIDEO_DECODING);
// feature prefs on
if (Preferences::GetBool("media.hardware-video-decoding.enabled", false)
if (Preferences::GetBool("media.hardware-video-decoding.enabled", false) &&
#ifdef XP_WIN
&& Preferences::GetBool("media.windows-media-foundation.use-dxva", true)
Preferences::GetBool("media.windows-media-foundation.use-dxva", true) &&
#endif
) {
hwVideoDecFeature.EnableByDefault();
}
// not forced on and prefs not set
else {
hwVideoDecFeature.DisableByDefault(FeatureStatus::Disabled, "HW video decode pref not set.", NS_LITERAL_CSTRING("FEATURE_FAILURE_HW_VIDEO_DEC_DISABLED"));
NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING,
discardFailureId, &status))) {
if (status == nsIGfxInfo::FEATURE_STATUS_OK || gfxPrefs::HardwareVideoDecodingForceEnabled()) {
sLayersSupportsHardwareVideoDecoding = true;
}
}
// force enabled feature
if (gfxPrefs::HardwareVideoDecodingForceEnabled()) {
hwVideoDecFeature.UserForceEnable("User force-enabled video decoding.");
}
gPlatform->InitHWVideoDecodingConfig(hwVideoDecFeature);
//blocklist
nsCString message;
nsCString failureId;
if (!IsGfxInfoStatusOkay(nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING, &message, failureId)) {
hwVideoDecFeature.Disable(FeatureStatus::Blacklisted, message.get(), failureId);
}
Preferences::RegisterCallback(UpdateHWDecBasedOnPref, "media.hardware-video-decoding.failed", NULL, Preferences::ExactMatch);
Preferences::AddBoolVarCache(&sLayersHardwareVideoDecodingFailed,
"media.hardware-video-decoding.failed",
false);
if (XRE_IsParentProcess()) {
if (gfxPrefs::GPUProcessDevEnabled()) {
@ -2199,6 +2171,15 @@ gfxPlatform::InitCompositorAccelerationPrefs()
}
}
bool
gfxPlatform::CanUseHardwareVideoDecoding()
{
// this function is called from the compositor thread, so it is not
// safe to init the prefs etc. from here.
MOZ_ASSERT(sLayersAccelerationPrefsInitialized);
return sLayersSupportsHardwareVideoDecoding && !sLayersHardwareVideoDecodingFailed;
}
bool
gfxPlatform::AccelerateLayersByDefault()
{

Просмотреть файл

@ -52,7 +52,6 @@ class ScaledFont;
class DrawEventRecorder;
class VsyncSource;
class DeviceInitData;
class FeatureState;
inline uint32_t
BackendTypeBit(BackendType b)
@ -174,8 +173,6 @@ public:
static void InitLayersIPC();
static void ShutdownLayersIPC();
virtual void InitHWVideoDecodingConfig(mozilla::gfx::FeatureState& hwVideoDecFeature){};
/**
* Initialize ScrollMetadata statics. Does not depend on gfxPlatform.
*/
@ -455,6 +452,8 @@ public:
static bool OffMainThreadCompositingEnabled();
virtual bool CanUseHardwareVideoDecoding();
// Returns a prioritized list of all available compositor backends.
void GetCompositorBackends(bool useAcceleration, nsTArray<mozilla::layers::LayersBackend>& aBackends);

Просмотреть файл

@ -401,6 +401,15 @@ gfxWindowsPlatform::InitAcceleration()
UpdateRenderMode();
}
bool
gfxWindowsPlatform::CanUseHardwareVideoDecoding()
{
if (!gfxPrefs::LayersPreferD3D9() && !mCompositorD3D11TextureSharingWorks) {
return false;
}
return !IsWARP() && gfxPlatform::CanUseHardwareVideoDecoding();
}
bool
gfxWindowsPlatform::InitDWriteSupport()
{
@ -1922,17 +1931,6 @@ InitializeANGLEConfig()
}
void
gfxWindowsPlatform::InitHWVideoDecoodingConfig(FeatureState& hwVideoDecFeature)
{
if (!gfxPrefs::LayersPreferD3D9() && !CompositorD3D11TextureSharingWorks()) {
hwVideoDecFeature.UserDisable("D3d9 not used, and d3d11 texture sharing not working", NS_LITERAL_CSTRING("FEATURE_FAILURE_HW_VIDEO_DEC_D3D_NOT_WORKING"));
}
else if (!IsWARP()) {
hwVideoDecFeature.UserDisable("WARP is disabled.", NS_LITERAL_CSTRING("FEATURE_FAILURE_HW_VIDEO_DEC_NO_WARP"));
}
}
void
gfxWindowsPlatform::InitializeConfig()
{

Просмотреть файл

@ -160,11 +160,6 @@ public:
*/
void VerifyD2DDevice(bool aAttemptForce);
/**
* Check to see that hw video decoding can be enabled, if not disable the feature
*/
void InitHWVideoDecoodingConfig(mozilla::gfx::FeatureState& hwVideoDecFeature);
virtual void GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
Script aRunScript,
nsTArray<const char*>& aFontList) override;
@ -176,6 +171,8 @@ public:
gfxUserFontSet *aUserFontSet,
gfxFloat aDevToCssSize) override;
virtual bool CanUseHardwareVideoDecoding() override;
/**
* Check whether format is supported on a platform or not (if unclear, returns true)
*/