зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1365772 - Allow component alpha to be managed by blocklists. r=kats
MozReview-Commit-ID: 5iEuUtmfkLl --HG-- extra : rebase_source : 5c39798c464d790cd76254dedba4c76470dc2126
This commit is contained in:
Родитель
e22f5d26c6
Коммит
5c589ff480
|
@ -26,6 +26,7 @@ namespace gfx {
|
|||
_(GPU_PROCESS, Feature, "GPU Process") \
|
||||
_(WEBRENDER, Feature, "WebRender") \
|
||||
_(OMTP, Feature, "Off Main Thread Painting") \
|
||||
_(COMPONENT_ALPHA, Feature, "Component Alpha") \
|
||||
/* Add new entries above this comment */
|
||||
|
||||
enum class Feature : uint32_t {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "gfxEnv.h"
|
||||
#include "gfxPlatform.h" // for gfxPlatform
|
||||
#include "gfxPrefs.h"
|
||||
#include "gfxConfig.h"
|
||||
#include "gfxUtils.h" // for gfxUtils, etc
|
||||
#include "gfx2DGlue.h"
|
||||
#include "mozilla/DebugOnly.h" // for DebugOnly
|
||||
|
@ -167,7 +168,7 @@ LayerManager::CreateImageContainer(ImageContainer::Mode flag)
|
|||
bool
|
||||
LayerManager::AreComponentAlphaLayersEnabled()
|
||||
{
|
||||
return gfxPrefs::ComponentAlphaEnabled();
|
||||
return gfxConfig::IsEnabled(Feature::COMPONENT_ALPHA);
|
||||
}
|
||||
|
||||
/*static*/ void
|
||||
|
|
|
@ -917,7 +917,7 @@ CompositorD3D11::DrawGeometry(const Geometry& aGeometry,
|
|||
break;
|
||||
case EffectTypes::COMPONENT_ALPHA:
|
||||
{
|
||||
MOZ_ASSERT(gfxPrefs::ComponentAlphaEnabled());
|
||||
MOZ_ASSERT(gfxConfig::IsEnabled(Feature::COMPONENT_ALPHA));
|
||||
MOZ_ASSERT(mAttachments->mComponentBlendState);
|
||||
EffectComponentAlpha* effectComponentAlpha =
|
||||
static_cast<EffectComponentAlpha*>(aEffectChain.mPrimaryEffect.get());
|
||||
|
|
|
@ -176,7 +176,7 @@ DeviceAttachmentsD3D11::Initialize()
|
|||
return false;
|
||||
}
|
||||
|
||||
if (gfxPrefs::ComponentAlphaEnabled()) {
|
||||
if (gfxConfig::IsEnabled(Feature::COMPONENT_ALPHA)) {
|
||||
D3D11_RENDER_TARGET_BLEND_DESC rtBlendComponent = {
|
||||
TRUE,
|
||||
D3D11_BLEND_ONE,
|
||||
|
@ -294,7 +294,7 @@ DeviceAttachmentsD3D11::CreateShaders()
|
|||
InitPixelShader(sYCbCrShaderMask, mYCbCrShader, MaskType::Mask);
|
||||
InitPixelShader(sNV12Shader, mNV12Shader, MaskType::MaskNone);
|
||||
InitPixelShader(sNV12ShaderMask, mNV12Shader, MaskType::Mask);
|
||||
if (gfxPrefs::ComponentAlphaEnabled()) {
|
||||
if (gfxConfig::IsEnabled(Feature::COMPONENT_ALPHA)) {
|
||||
InitPixelShader(sComponentAlphaShader, mComponentAlphaShader, MaskType::MaskNone);
|
||||
InitPixelShader(sComponentAlphaShaderMask, mComponentAlphaShader, MaskType::Mask);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "gfxEnv.h" // for gfxEnv
|
||||
#include "gfxPlatform.h" // for gfxPlatform
|
||||
#include "gfxPrefs.h" // for gfxPrefs
|
||||
#include "gfxConfig.h"
|
||||
#include "gfxRect.h" // for gfxRect
|
||||
#include "gfxUtils.h" // for gfxUtils, etc
|
||||
#include "mozilla/ArrayUtils.h" // for ArrayLength
|
||||
|
@ -1414,7 +1415,7 @@ CompositorOGL::DrawGeometry(const Geometry& aGeometry,
|
|||
}
|
||||
break;
|
||||
case EffectTypes::COMPONENT_ALPHA: {
|
||||
MOZ_ASSERT(gfxPrefs::ComponentAlphaEnabled());
|
||||
MOZ_ASSERT(gfxConfig::IsEnabled(Feature::COMPONENT_ALPHA));
|
||||
MOZ_ASSERT(blendMode == gfx::CompositionOp::OP_OVER, "Can't support blend modes with component alpha!");
|
||||
EffectComponentAlpha* effectComponentAlpha =
|
||||
static_cast<EffectComponentAlpha*>(aEffectChain.mPrimaryEffect.get());
|
||||
|
|
|
@ -696,6 +696,7 @@ gfxPlatform::Init()
|
|||
gPlatform->InitAcceleration();
|
||||
gPlatform->InitWebRenderConfig();
|
||||
gPlatform->InitOMTPConfig();
|
||||
gPlatform->InitComponentAlphaPrefs();
|
||||
|
||||
if (gfxConfig::IsEnabled(Feature::GPU_PROCESS)) {
|
||||
GPUProcessManager* gpu = GPUProcessManager::Get();
|
||||
|
@ -2450,6 +2451,34 @@ gfxPlatform::InitOMTPConfig()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
gfxPlatform::InitComponentAlphaPrefs()
|
||||
{
|
||||
FeatureState& componentAlpha = gfxConfig::GetFeature(Feature::COMPONENT_ALPHA);
|
||||
|
||||
// First check the about:config value
|
||||
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
|
||||
// If MOZ_GFX_OPTIMIZE_MOBILE is defined, we force component alpha off
|
||||
// and ignore the preference.
|
||||
componentAlpha.DisableByDefault(
|
||||
FeatureStatus::Unavailable,
|
||||
"Component alpha not available on mobile",
|
||||
NS_LITERAL_CSTRING("FEATURE_FAILURE_MOBILE"));
|
||||
#else
|
||||
componentAlpha.SetDefaultFromPref(
|
||||
gfxPrefs::GetComponentAlphaEnabledDoNotUseDirectlyPrefName(),
|
||||
true,
|
||||
gfxPrefs::GetComponentAlphaEnabledDoNotUseDirectlyPrefDefault());
|
||||
#endif
|
||||
|
||||
// Then check the blocklist value
|
||||
nsCString message;
|
||||
nsCString failureId;
|
||||
if (!IsGfxInfoStatusOkay(nsIGfxInfo::FEATURE_COMPONENT_ALPHA, &message, failureId)) {
|
||||
componentAlpha.Disable(FeatureStatus::Blacklisted, message.get(), failureId);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
gfxPlatform::CanUseHardwareVideoDecoding()
|
||||
{
|
||||
|
|
|
@ -828,6 +828,7 @@ private:
|
|||
void InitGPUProcessPrefs();
|
||||
void InitWebRenderConfig();
|
||||
void InitOMTPConfig();
|
||||
void InitComponentAlphaPrefs();
|
||||
|
||||
static bool IsDXInterop2Blocked();
|
||||
|
||||
|
|
|
@ -517,15 +517,7 @@ private:
|
|||
DECL_GFX_PREF(Live, "layers.bench.enabled", LayersBenchEnabled, bool, false);
|
||||
DECL_GFX_PREF(Once, "layers.bufferrotation.enabled", BufferRotationEnabled, bool, true);
|
||||
DECL_GFX_PREF(Live, "layers.child-process-shutdown", ChildProcessShutdown, bool, true);
|
||||
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
|
||||
// If MOZ_GFX_OPTIMIZE_MOBILE is defined, we force component alpha off
|
||||
// and ignore the preference.
|
||||
DECL_GFX_PREF(Skip, "layers.componentalpha.enabled", ComponentAlphaEnabled, bool, false);
|
||||
#else
|
||||
// If MOZ_GFX_OPTIMIZE_MOBILE is not defined, we actually take the
|
||||
// preference value, defaulting to true.
|
||||
DECL_GFX_PREF(Once, "layers.componentalpha.enabled", ComponentAlphaEnabled, bool, true);
|
||||
#endif
|
||||
DECL_GFX_PREF(Once, "layers.componentalpha.enabled", ComponentAlphaEnabledDoNotUseDirectly, bool, true);
|
||||
DECL_GFX_PREF(Live, "layers.composer2d.enabled", Composer2DCompositionEnabled, bool, false);
|
||||
DECL_GFX_PREF(Once, "layers.d3d11.force-warp", LayersD3D11ForceWARP, bool, false);
|
||||
DECL_GFX_PREF(Live, "layers.deaa.enabled", LayersDEAAEnabled, bool, false);
|
||||
|
|
|
@ -28,5 +28,18 @@
|
|||
<driverVersion> 8.52.322.2202 </driverVersion>
|
||||
<driverVersionComparator> LESS_THAN </driverVersionComparator>
|
||||
</gfxBlacklistEntry>
|
||||
<gfxBlacklistEntry>
|
||||
<os>Darwin 13</os>
|
||||
<vendor>0xabcd</vendor>
|
||||
<devices>
|
||||
<device>0x2783</device>
|
||||
<device>0x1234</device>
|
||||
<device>0x2782</device>
|
||||
</devices>
|
||||
<feature> COMPONENT_ALPHA </feature>
|
||||
<featureStatus> BLOCKED_DRIVER_VERSION </featureStatus>
|
||||
<driverVersion> 8.52.322.2202 </driverVersion>
|
||||
<driverVersionComparator> LESS_THAN </driverVersionComparator>
|
||||
</gfxBlacklistEntry>
|
||||
</gfxItems>
|
||||
</blocklist>
|
||||
|
|
|
@ -79,6 +79,9 @@ function run_test() {
|
|||
} else if (get_platform() == "Darwin") {
|
||||
status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_OPENGL_LAYERS);
|
||||
do_check_eq(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION);
|
||||
|
||||
status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_COMPONENT_ALPHA);
|
||||
do_check_eq(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION);
|
||||
}
|
||||
|
||||
gTestserver.stop(do_test_finished);
|
||||
|
|
|
@ -135,6 +135,9 @@ function run_test() {
|
|||
status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DX_INTEROP2, failureId);
|
||||
do_check_eq(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK);
|
||||
|
||||
status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_COMPONENT_ALPHA, failureId);
|
||||
do_check_eq(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK);
|
||||
|
||||
gTestserver.stop(do_test_finished);
|
||||
}
|
||||
|
||||
|
|
|
@ -170,6 +170,9 @@ GetPrefNameForFeature(int32_t aFeature)
|
|||
case nsIGfxInfo::FEATURE_WEBGL2:
|
||||
name = BLACKLIST_PREF_BRANCH "webgl2";
|
||||
break;
|
||||
case nsIGfxInfo::FEATURE_COMPONENT_ALPHA:
|
||||
name = BLACKLIST_PREF_BRANCH "layers.componentalpha";
|
||||
break;
|
||||
case nsIGfxInfo::FEATURE_VP8_HW_DECODE:
|
||||
case nsIGfxInfo::FEATURE_VP9_HW_DECODE:
|
||||
case nsIGfxInfo::FEATURE_DX_INTEROP2:
|
||||
|
@ -350,6 +353,8 @@ BlacklistFeatureToGfxFeature(const nsAString& aFeature)
|
|||
return nsIGfxInfo::FEATURE_CANVAS2D_ACCELERATION;
|
||||
else if (aFeature.EqualsLiteral("WEBGL2"))
|
||||
return nsIGfxInfo::FEATURE_WEBGL2;
|
||||
else if (aFeature.EqualsLiteral("COMPONENT_ALPHA"))
|
||||
return nsIGfxInfo::FEATURE_COMPONENT_ALPHA;
|
||||
|
||||
// If we don't recognize the feature, it may be new, and something
|
||||
// this version doesn't understand. So, nothing to do. This is
|
||||
|
@ -980,6 +985,7 @@ GfxInfoBase::EvaluateDownloadedBlacklist(nsTArray<GfxDriverInfo>& aDriverInfo)
|
|||
nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION,
|
||||
nsIGfxInfo::FEATURE_CANVAS2D_ACCELERATION,
|
||||
nsIGfxInfo::FEATURE_WEBGL2,
|
||||
nsIGfxInfo::FEATURE_COMPONENT_ALPHA,
|
||||
0
|
||||
};
|
||||
|
||||
|
|
|
@ -124,8 +124,10 @@ interface nsIGfxInfo : nsISupports
|
|||
const long FEATURE_GPU_PROCESS = 20;
|
||||
/* Whether the WebGL2 is supported, starting in 54 */
|
||||
const long FEATURE_WEBGL2 = 21;
|
||||
/* Whether per-color-component alpha (for sub-pixel-AA) is supported, starting in 56. */
|
||||
const long FEATURE_COMPONENT_ALPHA = 22;
|
||||
/* the maximum feature value. */
|
||||
const long FEATURE_MAX_VALUE = FEATURE_WEBGL2;
|
||||
const long FEATURE_MAX_VALUE = FEATURE_COMPONENT_ALPHA;
|
||||
|
||||
/*
|
||||
* A set of return values from GetFeatureStatus
|
||||
|
|
Загрузка…
Ссылка в новой задаче