Bug 1689064 - Disable optimized shaders on Mali-T6xx. r=aosmond

Webrender's pre-optimized shaders result in completely broken
rendering on a Huawei MediaPad M2 (Mali-T628). As a precaution,
disable optimized shaders on all Mali-T6xx devices.

Differential Revision: https://phabricator.services.mozilla.com/D104752
This commit is contained in:
Jamie Nicol 2021-02-10 23:09:19 +00:00
parent 597ed615c5
commit 6bd22ad430
7 changed files with 59 additions and 22 deletions

View File

@ -38,6 +38,8 @@ void gfxConfigManager::Init() {
StaticPrefs::layers_gpu_process_allow_software_AtStartup();
mWrPartialPresent =
StaticPrefs::gfx_webrender_max_partial_present_rects_AtStartup() > 0;
mWrOptimizedShaders =
StaticPrefs::gfx_webrender_use_optimized_shaders_AtStartup();
#ifdef XP_WIN
mWrForceAngle = StaticPrefs::gfx_webrender_force_angle_AtStartup();
mWrForceAngleNoGPUProcess = StaticPrefs::
@ -76,6 +78,8 @@ void gfxConfigManager::Init() {
mFeatureWrAngle = &gfxConfig::GetFeature(Feature::WEBRENDER_ANGLE);
mFeatureWrDComp = &gfxConfig::GetFeature(Feature::WEBRENDER_DCOMP_PRESENT);
mFeatureWrPartial = &gfxConfig::GetFeature(Feature::WEBRENDER_PARTIAL);
mFeatureWrOptimizedShaders =
&gfxConfig::GetFeature(Feature::WEBRENDER_OPTIMIZED_SHADERS);
mFeatureWrSoftware = &gfxConfig::GetFeature(Feature::WEBRENDER_SOFTWARE);
mFeatureHwCompositing = &gfxConfig::GetFeature(Feature::HW_COMPOSITING);
@ -403,6 +407,14 @@ void gfxConfigManager::ConfigureWebRender() {
}
}
}
mFeatureWrOptimizedShaders->EnableByDefault();
if (!mWrOptimizedShaders) {
mFeatureWrOptimizedShaders->UserDisable("User disabled via pref",
"FEATURE_FAILURE_PREF_DISABLED"_ns);
}
ConfigureFromBlocklist(nsIGfxInfo::FEATURE_WEBRENDER_OPTIMIZED_SHADERS,
mFeatureWrOptimizedShaders);
}
} // namespace gfx

View File

@ -24,6 +24,7 @@ class gfxConfigManager {
mFeatureWrAngle(nullptr),
mFeatureWrDComp(nullptr),
mFeatureWrPartial(nullptr),
mFeatureWrOptimizedShaders(nullptr),
mFeatureWrSoftware(nullptr),
mFeatureHwCompositing(nullptr),
mFeatureD3D11HwAngle(nullptr),
@ -37,6 +38,7 @@ class gfxConfigManager {
mWrDCompWinEnabled(false),
mWrCompositorDCompRequired(false),
mWrPartialPresent(false),
mWrOptimizedShaders(false),
mGPUProcessAllowSoftware(false),
mXRenderEnabled(false),
mWrEnvForceEnabled(false),
@ -65,6 +67,7 @@ class gfxConfigManager {
FeatureState* mFeatureWrAngle;
FeatureState* mFeatureWrDComp;
FeatureState* mFeatureWrPartial;
FeatureState* mFeatureWrOptimizedShaders;
FeatureState* mFeatureWrSoftware;
FeatureState* mFeatureHwCompositing;
@ -84,6 +87,7 @@ class gfxConfigManager {
bool mWrDCompWinEnabled;
bool mWrCompositorDCompRequired;
bool mWrPartialPresent;
bool mWrOptimizedShaders;
bool mGPUProcessAllowSoftware;
bool mXRenderEnabled;

View File

@ -16,24 +16,25 @@
namespace mozilla {
namespace gfx {
#define GFX_FEATURE_MAP(_) \
/* Name, Type, Description */ \
_(HW_COMPOSITING, Feature, "Compositing") \
_(D3D11_COMPOSITING, Feature, "Direct3D11 Compositing") \
_(OPENGL_COMPOSITING, Feature, "OpenGL Compositing") \
_(DIRECT2D, Feature, "Direct2D") \
_(D3D11_HW_ANGLE, Feature, "Direct3D11 hardware ANGLE") \
_(DIRECT_DRAW, Feature, "DirectDraw") \
_(GPU_PROCESS, Feature, "GPU Process") \
_(WEBRENDER, Feature, "WebRender") \
_(WEBRENDER_QUALIFIED, Feature, "WebRender qualified") \
_(WEBRENDER_COMPOSITOR, Feature, "WebRender native compositor") \
_(WEBRENDER_PARTIAL, Feature, "WebRender partial present") \
_(WEBRENDER_ANGLE, Feature, "WebRender ANGLE") \
_(WEBRENDER_DCOMP_PRESENT, Feature, "WebRender DirectComposition") \
_(WEBRENDER_SOFTWARE, Feature, "WebRender software fallback") \
_(OMTP, Feature, "Off Main Thread Painting") \
_(WEBGPU, Feature, "WebGPU") \
#define GFX_FEATURE_MAP(_) \
/* Name, Type, Description */ \
_(HW_COMPOSITING, Feature, "Compositing") \
_(D3D11_COMPOSITING, Feature, "Direct3D11 Compositing") \
_(OPENGL_COMPOSITING, Feature, "OpenGL Compositing") \
_(DIRECT2D, Feature, "Direct2D") \
_(D3D11_HW_ANGLE, Feature, "Direct3D11 hardware ANGLE") \
_(DIRECT_DRAW, Feature, "DirectDraw") \
_(GPU_PROCESS, Feature, "GPU Process") \
_(WEBRENDER, Feature, "WebRender") \
_(WEBRENDER_QUALIFIED, Feature, "WebRender qualified") \
_(WEBRENDER_COMPOSITOR, Feature, "WebRender native compositor") \
_(WEBRENDER_PARTIAL, Feature, "WebRender partial present") \
_(WEBRENDER_OPTIMIZED_SHADERS, Feature, "WebRender optimized shaders") \
_(WEBRENDER_ANGLE, Feature, "WebRender ANGLE") \
_(WEBRENDER_DCOMP_PRESENT, Feature, "WebRender DirectComposition") \
_(WEBRENDER_SOFTWARE, Feature, "WebRender software fallback") \
_(OMTP, Feature, "Off Main Thread Painting") \
_(WEBGPU, Feature, "WebGPU") \
/* Add new entries above this comment */
enum class Feature : uint32_t {

View File

@ -2733,9 +2733,8 @@ void gfxPlatform::InitWebRenderConfig() {
gfxVars::SetUseWebRenderProgramBinaryDisk(hasWebRender);
}
if (StaticPrefs::gfx_webrender_use_optimized_shaders_AtStartup()) {
gfxVars::SetUseWebRenderOptimizedShaders(hasWebRender);
}
gfxVars::SetUseWebRenderOptimizedShaders(
gfxConfig::IsEnabled(Feature::WEBRENDER_OPTIMIZED_SHADERS));
gfxVars::SetUseSoftwareWebRender(!hasHardware && hasSoftware);

View File

@ -228,6 +228,9 @@ static const char* GetPrefNameForFeature(int32_t aFeature) {
case nsIGfxInfo::FEATURE_WEBRENDER_SOFTWARE:
name = BLOCKLIST_PREF_BRANCH "webrender.software";
break;
case nsIGfxInfo::FEATURE_WEBRENDER_OPTIMIZED_SHADERS:
name = BLOCKLIST_PREF_BRANCH "webrender.optimized-shaders";
break;
default:
MOZ_ASSERT_UNREACHABLE("Unexpected nsIGfxInfo feature?!");
break;

View File

@ -653,6 +653,22 @@ nsresult GfxInfo::GetFeatureStatusImpl(
}
return NS_OK;
}
if (aFeature == FEATURE_WEBRENDER_OPTIMIZED_SHADERS) {
// Optimized shaders result in completely broken rendering in at least one
// Mali-T6xx device. Disable on all T6xx as a precaution until we know
// more specifically which devices are affected. See bug 1689064 for
// details.
const bool isMaliT6xx =
mGLStrings->Renderer().Find("Mali-T6", /*ignoreCase*/ true) >= 0;
if (isMaliT6xx) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
aFailureId = "FEATURE_FAILURE_BUG_1689064";
} else {
*aStatus = nsIGfxInfo::FEATURE_STATUS_OK;
}
return NS_OK;
}
}
return GfxInfoBase::GetFeatureStatusImpl(

View File

@ -171,8 +171,10 @@ interface nsIGfxInfo : nsISupports
const long FEATURE_THREADSAFE_GL = 31;
/* Support running WebRender using the software backend, starting in 84. */
const long FEATURE_WEBRENDER_SOFTWARE = 32;
/* Whether webrender uses pre-optimized shaders, starting in 87. */
const long FEATURE_WEBRENDER_OPTIMIZED_SHADERS = 33;
/* the maximum feature value. */
const long FEATURE_MAX_VALUE = FEATURE_WEBRENDER_SOFTWARE;
const long FEATURE_MAX_VALUE = FEATURE_WEBRENDER_OPTIMIZED_SHADERS;
/*
* A set of return values from GetFeatureStatus