Bug 1552126 - Convert layers.componentalpha.enabled to a non-Skip pref. r=mattwoodrow

Differential Revision: https://phabricator.services.mozilla.com/D37372

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicholas Nethercote 2019-07-10 22:32:43 +00:00
Родитель 059ebab5c9
Коммит fb9371f1b2
6 изменённых файлов: 34 добавлений и 20 удалений

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

@ -138,8 +138,18 @@ already_AddRefed<ImageContainer> LayerManager::CreateImageContainer(
return container.forget();
}
bool LayerManager::LayersComponentAlphaEnabled() {
// If MOZ_GFX_OPTIMIZE_MOBILE is defined, we force component alpha off
// and ignore the preference.
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
return false;
#else
return StaticPrefs::layers_componentalpha_enabled_do_not_use_directly();
#endif
}
bool LayerManager::AreComponentAlphaLayersEnabled() {
return StaticPrefs::layers_componentalpha_enabled();
return LayerManager::LayersComponentAlphaEnabled();
}
/*static*/

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

@ -388,6 +388,12 @@ class LayerManager : public FrameRecorder {
const nsTArray<nsIWidget::Configuration>& aConfigurations) {}
bool IsSnappingEffectiveTransforms() { return mSnapEffectiveTransforms; }
/**
* Returns true if the underlying platform can properly support layers with
* SurfaceMode::SURFACE_COMPONENT_ALPHA.
*/
static bool LayersComponentAlphaEnabled();
/**
* Returns true if this LayerManager can properly support layers with
* SurfaceMode::SURFACE_COMPONENT_ALPHA. LayerManagers that can't will use

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

@ -10,6 +10,7 @@
#include "gfxWindowsPlatform.h"
#include "nsIWidget.h"
#include "Layers.h"
#include "mozilla/gfx/D3D11Checks.h"
#include "mozilla/gfx/DeviceManagerDx.h"
#include "mozilla/gfx/GPUParent.h"
@ -1050,7 +1051,7 @@ void CompositorD3D11::DrawGeometry(const Geometry& aGeometry,
mContext->PSSetShaderResources(TexSlot::Y, 3, srViews);
} break;
case EffectTypes::COMPONENT_ALPHA: {
MOZ_ASSERT(StaticPrefs::layers_componentalpha_enabled());
MOZ_ASSERT(LayerManager::LayersComponentAlphaEnabled());
MOZ_ASSERT(mAttachments->mComponentBlendState);
EffectComponentAlpha* effectComponentAlpha =
static_cast<EffectComponentAlpha*>(aEffectChain.mPrimaryEffect.get());

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

@ -9,6 +9,7 @@
#include "mozilla/Telemetry.h"
#include "mozilla/layers/Compositor.h"
#include "CompositorD3D11Shaders.h"
#include "Layers.h"
#include "ShaderDefinitionsD3D11.h"
namespace mozilla {
@ -179,7 +180,7 @@ bool DeviceAttachmentsD3D11::Initialize() {
return false;
}
if (StaticPrefs::layers_componentalpha_enabled()) {
if (LayerManager::LayersComponentAlphaEnabled()) {
D3D11_RENDER_TARGET_BLEND_DESC rtBlendComponent = {
TRUE,
D3D11_BLEND_ONE,
@ -275,7 +276,7 @@ bool DeviceAttachmentsD3D11::CreateShaders() {
InitPixelShader(sYCbCrShaderMask, mYCbCrShader, MaskType::Mask);
InitPixelShader(sNV12Shader, mNV12Shader, MaskType::MaskNone);
InitPixelShader(sNV12ShaderMask, mNV12Shader, MaskType::Mask);
if (StaticPrefs::layers_componentalpha_enabled()) {
if (LayerManager::LayersComponentAlphaEnabled()) {
InitPixelShader(sComponentAlphaShader, mComponentAlphaShader,
MaskType::MaskNone);
InitPixelShader(sComponentAlphaShaderMask, mComponentAlphaShader,

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

@ -1550,7 +1550,7 @@ void CompositorOGL::DrawGeometry(const Geometry& aGeometry,
BindAndDrawGeometry(program, aGeometry);
} break;
case EffectTypes::COMPONENT_ALPHA: {
MOZ_ASSERT(StaticPrefs::layers_componentalpha_enabled());
MOZ_ASSERT(LayerManager::LayersComponentAlphaEnabled());
MOZ_ASSERT(blendMode == gfx::CompositionOp::OP_OVER,
"Can't support blend modes with component alpha!");
EffectComponentAlpha* effectComponentAlpha =

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

@ -4009,25 +4009,21 @@ VARCACHE_PREF(
RelaxedAtomicBool, true
)
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
// If MOZ_GFX_OPTIMIZE_MOBILE is defined, we force component alpha off
// and ignore the preference.
VARCACHE_PREF(
Skip,
"layers.componentalpha.enabled",
layers_componentalpha_enabled,
bool, false
)
#else
// If MOZ_GFX_OPTIMIZE_MOBILE is not defined, we actually take the
// preference value, defaulting to true.
VARCACHE_PREF(
Once,
"layers.componentalpha.enabled",
layers_componentalpha_enabled,
bool, true
)
layers_componentalpha_enabled_do_not_use_directly,
bool,
// Nb: we ignore this pref if MOZ_GFX_OPTIMIZE_MOBILE is defined, as if this
// pref was always false. But we go to the effort of setting it to false so
// that telemetry's reporting of the pref value is more likely to reflect
// what the code is doing.
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
false
#else
true
#endif
)
VARCACHE_PREF(
Once,