зеркало из https://github.com/mozilla/gecko-dev.git
Use gfxConfig for D3D9 preferences. (bug 1270650, r=jrmuizel)
This commit is contained in:
Родитель
969594ea8c
Коммит
bfbc7d0ba3
|
@ -6,6 +6,7 @@
|
|||
#include "mozilla/Preferences.h"
|
||||
#include "prprf.h"
|
||||
#include "gfxFeature.h"
|
||||
#include "nsString.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
@ -60,9 +61,13 @@ FeatureState::SetDefaultFromPref(const char* aPrefName,
|
|||
if (Preferences::HasUserValue(aPrefName)) {
|
||||
bool userValue = Preferences::GetBool(aPrefName, aDefaultValue);
|
||||
if (userValue == aIsEnablePref) {
|
||||
UserEnable("Enabled by user preference");
|
||||
nsCString message("Enabled via ");
|
||||
message.AppendASCII(aPrefName);
|
||||
UserEnable(message.get());
|
||||
} else {
|
||||
UserDisable("Disabled by user preference");
|
||||
nsCString message("Disabled via ");
|
||||
message.AppendASCII(aPrefName);
|
||||
UserDisable(message.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace gfx {
|
|||
/* Name, Type, Description */ \
|
||||
_(HW_COMPOSITING, Feature, "Compositing") \
|
||||
_(D3D11_COMPOSITING, Feature, "Direct3D11 Compositing") \
|
||||
_(D3D9_COMPOSITING, Feature, "Direct3D9 Compositing") \
|
||||
_(DIRECT2D, Feature, "Direct2D") \
|
||||
/* Add new entries above this comment */
|
||||
|
||||
|
|
|
@ -42,8 +42,6 @@ CompositorD3D9::Initialize()
|
|||
{
|
||||
ScopedGfxFeatureReporter reporter("D3D9 Layers");
|
||||
|
||||
MOZ_ASSERT(gfxPlatform::CanUseDirect3D9());
|
||||
|
||||
mDeviceManager = gfxWindowsPlatform::GetPlatform()->GetD3D9DeviceManager();
|
||||
if (!mDeviceManager) {
|
||||
return false;
|
||||
|
|
|
@ -2055,7 +2055,6 @@ gfxPlatform::OptimalFormatForContent(gfxContentType aContent)
|
|||
* and remember the values. Changing these preferences during the run will
|
||||
* not have any effect until we restart.
|
||||
*/
|
||||
static bool sLayersSupportsD3D9 = false;
|
||||
bool gANGLESupportsD3D11 = false;
|
||||
static bool sLayersSupportsHardwareVideoDecoding = false;
|
||||
static bool sLayersHardwareVideoDecodingFailed = false;
|
||||
|
@ -2086,15 +2085,7 @@ gfxPlatform::InitAcceleration()
|
|||
nsCString discardFailureId;
|
||||
int32_t status;
|
||||
#ifdef XP_WIN
|
||||
if (gfxConfig::IsForcedOnByUser(Feature::HW_COMPOSITING)) {
|
||||
sLayersSupportsD3D9 = true;
|
||||
} else if (!gfxPrefs::LayersAccelerationDisabledDoNotUseDirectly() && gfxInfo) {
|
||||
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_9_LAYERS, discardFailureId, &status))) {
|
||||
if (status == nsIGfxInfo::FEATURE_STATUS_OK) {
|
||||
MOZ_ASSERT(!sPrefBrowserTabsRemoteAutostart || IsVistaOrLater());
|
||||
sLayersSupportsD3D9 = true;
|
||||
}
|
||||
}
|
||||
if (!gfxPrefs::LayersAccelerationDisabledDoNotUseDirectly() && gfxInfo) {
|
||||
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_11_ANGLE, discardFailureId, &status))) {
|
||||
if (status == nsIGfxInfo::FEATURE_STATUS_OK) {
|
||||
gANGLESupportsD3D11 = true;
|
||||
|
@ -2155,15 +2146,6 @@ gfxPlatform::InitCompositorAccelerationPrefs()
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
gfxPlatform::CanUseDirect3D9()
|
||||
{
|
||||
// this function is called from the compositor thread, so it is not
|
||||
// safe to init the prefs etc. from here.
|
||||
MOZ_ASSERT(sLayersAccelerationPrefsInitialized);
|
||||
return sLayersSupportsD3D9;
|
||||
}
|
||||
|
||||
bool
|
||||
gfxPlatform::CanUseHardwareVideoDecoding()
|
||||
{
|
||||
|
|
|
@ -449,7 +449,6 @@ public:
|
|||
|
||||
static bool OffMainThreadCompositingEnabled();
|
||||
|
||||
static bool CanUseDirect3D9();
|
||||
virtual bool CanUseHardwareVideoDecoding();
|
||||
virtual bool CanUseDirect3D11ANGLE() { return false; }
|
||||
|
||||
|
|
|
@ -1956,10 +1956,41 @@ gfxWindowsPlatform::InitializeConfig()
|
|||
return;
|
||||
}
|
||||
|
||||
InitializeD3D9Config();
|
||||
InitializeD3D11Config();
|
||||
InitializeD2DConfig();
|
||||
}
|
||||
|
||||
void
|
||||
gfxWindowsPlatform::InitializeD3D9Config()
|
||||
{
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
|
||||
FeatureState& d3d9 = gfxConfig::GetFeature(Feature::D3D9_COMPOSITING);
|
||||
|
||||
if (!IsVistaOrLater()) {
|
||||
d3d9.EnableByDefault();
|
||||
} else {
|
||||
d3d9.SetDefaultFromPref(
|
||||
gfxPrefs::GetLayersAllowD3D9FallbackPrefName(),
|
||||
true,
|
||||
gfxPrefs::GetLayersAllowD3D9FallbackPrefDefault());
|
||||
|
||||
if (!d3d9.IsEnabled() && gfxPrefs::LayersPreferD3D9()) {
|
||||
d3d9.UserEnable("Direct3D9 enabled via layers.prefer-d3d9");
|
||||
}
|
||||
}
|
||||
|
||||
nsCString message;
|
||||
if (!IsGfxInfoStatusOkay(nsIGfxInfo::FEATURE_DIRECT3D_9_LAYERS, &message)) {
|
||||
d3d9.Disable(FeatureStatus::Blacklisted, message.get());
|
||||
}
|
||||
|
||||
if (gfxConfig::IsForcedOnByUser(Feature::HW_COMPOSITING)) {
|
||||
d3d9.UserForceEnable("Hardware compositing is force-enabled");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gfxWindowsPlatform::InitializeD3D11Config()
|
||||
{
|
||||
|
@ -2889,23 +2920,18 @@ gfxWindowsPlatform::GetAcceleratedCompositorBackends(nsTArray<LayersBackend>& aB
|
|||
aBackends.AppendElement(LayersBackend::LAYERS_OPENGL);
|
||||
}
|
||||
|
||||
bool allowTryingD3D9 = false;
|
||||
if (!gfxPrefs::LayersPreferD3D9()) {
|
||||
if (mD3D11Device) {
|
||||
aBackends.AppendElement(LayersBackend::LAYERS_D3D11);
|
||||
} else {
|
||||
allowTryingD3D9 = gfxPrefs::LayersAllowD3D9Fallback();
|
||||
NS_WARNING("Direct3D 11-accelerated layers are not supported on this system.");
|
||||
}
|
||||
if (gfxConfig::IsEnabled(Feature::D3D9_COMPOSITING) && gfxPrefs::LayersPreferD3D9()) {
|
||||
aBackends.AppendElement(LayersBackend::LAYERS_D3D9);
|
||||
}
|
||||
|
||||
if (gfxPrefs::LayersPreferD3D9() || !IsVistaOrLater() || allowTryingD3D9) {
|
||||
// We don't want D3D9 except on Windows XP, unless we failed to get D3D11
|
||||
if (gfxPlatform::CanUseDirect3D9()) {
|
||||
aBackends.AppendElement(LayersBackend::LAYERS_D3D9);
|
||||
} else {
|
||||
NS_WARNING("Direct3D 9-accelerated layers are not supported on this system.");
|
||||
}
|
||||
if (mD3D11Device) {
|
||||
aBackends.AppendElement(LayersBackend::LAYERS_D3D11);
|
||||
} else {
|
||||
NS_WARNING("Direct3D 11-accelerated layers are not supported on this system.");
|
||||
}
|
||||
|
||||
if (gfxConfig::IsEnabled(Feature::D3D9_COMPOSITING) && !gfxPrefs::LayersPreferD3D9()) {
|
||||
aBackends.AppendElement(LayersBackend::LAYERS_D3D9);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -290,6 +290,7 @@ private:
|
|||
void DisableD2D(mozilla::gfx::FeatureStatus aStatus, const char* aMessage);
|
||||
|
||||
void InitializeConfig();
|
||||
void InitializeD3D9Config();
|
||||
void InitializeD3D11Config();
|
||||
void InitializeD2DConfig();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче