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
Родитель 597ed615c5
Коммит 6bd22ad430
7 изменённых файлов: 59 добавлений и 22 удалений

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

@ -38,6 +38,8 @@ void gfxConfigManager::Init() {
StaticPrefs::layers_gpu_process_allow_software_AtStartup(); StaticPrefs::layers_gpu_process_allow_software_AtStartup();
mWrPartialPresent = mWrPartialPresent =
StaticPrefs::gfx_webrender_max_partial_present_rects_AtStartup() > 0; StaticPrefs::gfx_webrender_max_partial_present_rects_AtStartup() > 0;
mWrOptimizedShaders =
StaticPrefs::gfx_webrender_use_optimized_shaders_AtStartup();
#ifdef XP_WIN #ifdef XP_WIN
mWrForceAngle = StaticPrefs::gfx_webrender_force_angle_AtStartup(); mWrForceAngle = StaticPrefs::gfx_webrender_force_angle_AtStartup();
mWrForceAngleNoGPUProcess = StaticPrefs:: mWrForceAngleNoGPUProcess = StaticPrefs::
@ -76,6 +78,8 @@ void gfxConfigManager::Init() {
mFeatureWrAngle = &gfxConfig::GetFeature(Feature::WEBRENDER_ANGLE); mFeatureWrAngle = &gfxConfig::GetFeature(Feature::WEBRENDER_ANGLE);
mFeatureWrDComp = &gfxConfig::GetFeature(Feature::WEBRENDER_DCOMP_PRESENT); mFeatureWrDComp = &gfxConfig::GetFeature(Feature::WEBRENDER_DCOMP_PRESENT);
mFeatureWrPartial = &gfxConfig::GetFeature(Feature::WEBRENDER_PARTIAL); mFeatureWrPartial = &gfxConfig::GetFeature(Feature::WEBRENDER_PARTIAL);
mFeatureWrOptimizedShaders =
&gfxConfig::GetFeature(Feature::WEBRENDER_OPTIMIZED_SHADERS);
mFeatureWrSoftware = &gfxConfig::GetFeature(Feature::WEBRENDER_SOFTWARE); mFeatureWrSoftware = &gfxConfig::GetFeature(Feature::WEBRENDER_SOFTWARE);
mFeatureHwCompositing = &gfxConfig::GetFeature(Feature::HW_COMPOSITING); 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 } // namespace gfx

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

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

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

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

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

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

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

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

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

@ -653,6 +653,22 @@ nsresult GfxInfo::GetFeatureStatusImpl(
} }
return NS_OK; 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( return GfxInfoBase::GetFeatureStatusImpl(

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

@ -171,8 +171,10 @@ interface nsIGfxInfo : nsISupports
const long FEATURE_THREADSAFE_GL = 31; const long FEATURE_THREADSAFE_GL = 31;
/* Support running WebRender using the software backend, starting in 84. */ /* Support running WebRender using the software backend, starting in 84. */
const long FEATURE_WEBRENDER_SOFTWARE = 32; 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. */ /* 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 * A set of return values from GetFeatureStatus