Disable Advanced Layers when the sanity test fails. (bug 1377866 part 3, r=mchang)

This commit is contained in:
David Anderson 2017-07-10 19:30:52 -07:00
Родитель 211a8becfd
Коммит dd94534a4f
6 изменённых файлов: 31 добавлений и 7 удалений

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

@ -4241,7 +4241,7 @@ nsDOMWindowUtils::TriggerDeviceReset()
GPUProcessManager* pm = GPUProcessManager::Get();
if (pm) {
pm->TriggerDeviceResetForTesting();
pm->SimulateDeviceReset();
}
return NS_OK;
}

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

@ -5432,7 +5432,7 @@ ContentParent::RecvDeviceReset()
{
GPUProcessManager* pm = GPUProcessManager::Get();
if (pm) {
pm->TriggerDeviceResetForTesting();
pm->SimulateDeviceReset();
}
return IPC_OK();

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

@ -397,8 +397,11 @@ ShouldLimitDeviceResets(uint32_t count, int32_t deltaMilliseconds)
}
void
GPUProcessManager::TriggerDeviceResetForTesting()
GPUProcessManager::SimulateDeviceReset()
{
// Make sure we rebuild environment and configuration for accelerated features.
gfxPlatform::GetPlatform()->CompositorUpdated();
if (mProcess) {
OnRemoteProcessDeviceReset(mProcess);
} else {

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

@ -144,7 +144,7 @@ public:
void OnProcessLaunchComplete(GPUProcessHost* aHost) override;
void OnProcessUnexpectedShutdown(GPUProcessHost* aHost) override;
void TriggerDeviceResetForTesting();
void SimulateDeviceReset();
void OnInProcessDeviceReset();
void OnRemoteProcessDeviceReset(GPUProcessHost* aHost) override;
void NotifyListenersOnCompositeDeviceReset();

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

@ -1419,6 +1419,11 @@ gfxWindowsPlatform::InitializeAdvancedLayersConfig()
nsCString message, failureId;
if (!IsGfxInfoStatusOkay(nsIGfxInfo::FEATURE_ADVANCED_LAYERS, &message, failureId)) {
al.Disable(FeatureStatus::Blacklisted, message.get(), failureId);
} else if (Preferences::GetBool("layers.mlgpu.sanity-test-failed", false)) {
al.Disable(
FeatureStatus::Broken,
"Failed to render sanity test",
NS_LITERAL_CSTRING("FEATURE_FAILURE_FAILED_TO_RENDER"));
}
}

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

@ -18,10 +18,14 @@ const PAGE_HEIGHT = 166;
const DRIVER_PREF = "sanity-test.driver-version";
const DEVICE_PREF = "sanity-test.device-id";
const VERSION_PREF = "sanity-test.version";
const ADVANCED_LAYERS_PREF = "sanity-test.advanced-layers";
const DISABLE_VIDEO_PREF = "media.hardware-video-decoding.failed";
const RUNNING_PREF = "sanity-test.running";
const TIMEOUT_SEC = 20;
const AL_ENABLED_PREF = "layers.mlgpu.dev-enabled";
const AL_TEST_FAILED_PREF = "layers.mlgpu.sanity-test-failed";
// GRAPHICS_SANITY_TEST histogram enumeration values
const TEST_PASSED = 0;
const TEST_FAILED_RENDER = 1;
@ -34,6 +38,7 @@ const REASON_FIRST_RUN = 0;
const REASON_FIREFOX_CHANGED = 1;
const REASON_DEVICE_CHANGED = 2;
const REASON_DRIVER_CHANGED = 3;
const REASON_AL_CONFIG_CHANGED = 4;
// GRAPHICS_SANITY_TEST_OS_SNAPSHOT histogram enumeration values
const SNAPSHOT_VIDEO_OK = 0;
@ -120,7 +125,7 @@ function verifyLayersRendering(ctx) {
return testPixel(ctx, 18, 18, 255, 0, 0, 255, 64);
}
function testCompositor(win, ctx) {
function testCompositor(test, win, ctx) {
takeWindowSnapshot(win, ctx);
var testPassed = true;
@ -131,8 +136,16 @@ function testCompositor(win, ctx) {
}
if (!verifyLayersRendering(ctx)) {
// Try disabling advanced layers if it was enabled. Also trgiger
// a device reset so the screen redraws.
if (Preferences.get(AL_ENABLED_PREF, false)) {
Preferences.set(AL_TEST_FAILED_PREF, true);
test.utils.triggerDeviceReset();
}
reportResult(TEST_FAILED_RENDER);
testPassed = false;
} else {
Preferences.set(AL_TEST_FAILED_PREF, false);
}
if (testPassed) {
@ -174,7 +187,7 @@ var listener = {
// Perform the compositor backbuffer test, which currently we use for
// actually deciding whether to enable hardware media decoding.
testCompositor(this.win, this.ctx);
testCompositor(this, this.win, this.ctx);
this.endTest();
},
@ -246,6 +259,7 @@ SanityTest.prototype = {
// gpu or drivers.
var buildId = Services.appinfo.platformBuildID;
var gfxinfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo);
var hasAL = Preferences.get(AL_ENABLED_PREF, false);
if (Preferences.get(RUNNING_PREF, false)) {
Preferences.set(DISABLE_VIDEO_PREF, true);
@ -269,7 +283,8 @@ SanityTest.prototype = {
// TODO: Handle dual GPU setups
if (checkPref(DRIVER_PREF, gfxinfo.adapterDriverVersion, REASON_DRIVER_CHANGED) &&
checkPref(DEVICE_PREF, gfxinfo.adapterDeviceID, REASON_DEVICE_CHANGED) &&
checkPref(VERSION_PREF, buildId, REASON_FIREFOX_CHANGED)) {
checkPref(VERSION_PREF, buildId, REASON_FIREFOX_CHANGED) &&
checkPref(ADVANCED_LAYERS_PREF, hasAL, REASON_AL_CONFIG_CHANGED)) {
return false;
}
@ -279,6 +294,7 @@ SanityTest.prototype = {
Preferences.set(DRIVER_PREF, gfxinfo.adapterDriverVersion);
Preferences.set(DEVICE_PREF, gfxinfo.adapterDeviceID);
Preferences.set(VERSION_PREF, buildId);
Preferences.set(ADVANCED_LAYERS_PREF, hasAL);
// Update the prefs so that this test doesn't run again until the next update.
Preferences.set(RUNNING_PREF, true);