diff --git a/gfx/tests/gtest/TestConfigManager.cpp b/gfx/tests/gtest/TestConfigManager.cpp index 1a1257400eb3..cb4e1c7b2970 100644 --- a/gfx/tests/gtest/TestConfigManager.cpp +++ b/gfx/tests/gtest/TestConfigManager.cpp @@ -121,6 +121,17 @@ class MockGfxInfo final : public nsIGfxInfo { } // The following methods we don't need for testing gfxConfigManager. + NS_IMETHOD GetFeatureStatusStr(const nsAString& aFeature, + nsACString& aFailureId, + nsAString& _retval) override { + return NS_ERROR_NOT_IMPLEMENTED; + } + + NS_IMETHOD GetFeatureSuggestedDriverVersionStr(const nsAString& aFeature, + nsAString& _retval) override { + return NS_ERROR_NOT_IMPLEMENTED; + } + NS_IMETHOD GetFeatureSuggestedDriverVersion(int32_t aFeature, nsAString& _retval) override { return NS_ERROR_NOT_IMPLEMENTED; diff --git a/toolkit/modules/Troubleshoot.sys.mjs b/toolkit/modules/Troubleshoot.sys.mjs index e00fcf1da1d0..35c60f6e6637 100644 --- a/toolkit/modules/Troubleshoot.sys.mjs +++ b/toolkit/modules/Troubleshoot.sys.mjs @@ -575,26 +575,26 @@ var dataProviders = { // a string in some cases and an object in others, return an object always. let msg = { key: "" }; try { - var status = gfxInfo.getFeatureStatus(feature); + var status = gfxInfo.getFeatureStatusStr(feature); } catch (e) {} switch (status) { - case Ci.nsIGfxInfo.FEATURE_BLOCKED_DEVICE: - case Ci.nsIGfxInfo.FEATURE_DISCOURAGED: + case "BLOCKED_DEVICE": + case "DISCOURAGED": msg = { key: "blocked-gfx-card" }; break; - case Ci.nsIGfxInfo.FEATURE_BLOCKED_OS_VERSION: + case "BLOCKED_OS_VERSION": msg = { key: "blocked-os-version" }; break; - case Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION: + case "BLOCKED_DRIVER_VERSION": try { var driverVersion = - gfxInfo.getFeatureSuggestedDriverVersion(feature); + gfxInfo.getFeatureSuggestedDriverVersionStr(feature); } catch (e) {} msg = driverVersion ? { key: "try-newer-driver", args: { driverVersion } } : { key: "blocked-driver" }; break; - case Ci.nsIGfxInfo.FEATURE_BLOCKED_MISMATCHED_VERSION: + case "BLOCKED_MISMATCHED_VERSION": msg = { key: "blocked-mismatched-version" }; break; } @@ -646,9 +646,7 @@ var dataProviders = { if (!data.numAcceleratedWindows && gfxInfo) { let win = AppConstants.platform == "win"; - let feature = win - ? gfxInfo.FEATURE_DIRECT3D_9_LAYERS - : gfxInfo.FEATURE_OPENGL_LAYERS; + let feature = win ? "DIRECT3D_9_LAYERS" : "OPENGL_LAYERS"; data.numAcceleratedWindowsMessage = statusMsgForFeature(feature); } @@ -695,9 +693,7 @@ var dataProviders = { } if ("direct2DEnabled" in data && !data.direct2DEnabled) { - data.direct2DEnabledMessage = statusMsgForFeature( - Ci.nsIGfxInfo.FEATURE_DIRECT2D - ); + data.direct2DEnabledMessage = statusMsgForFeature("DIRECT2D"); } } diff --git a/toolkit/mozapps/extensions/test/xpcshell/data/test_gfxBlacklist.json b/toolkit/mozapps/extensions/test/xpcshell/data/test_gfxBlocklist.json similarity index 100% rename from toolkit/mozapps/extensions/test/xpcshell/data/test_gfxBlacklist.json rename to toolkit/mozapps/extensions/test/xpcshell/data/test_gfxBlocklist.json diff --git a/toolkit/mozapps/extensions/test/xpcshell/data/test_gfxBlacklist_AllOS.json b/toolkit/mozapps/extensions/test/xpcshell/data/test_gfxBlocklist_AllOS.json similarity index 100% rename from toolkit/mozapps/extensions/test/xpcshell/data/test_gfxBlacklist_AllOS.json rename to toolkit/mozapps/extensions/test/xpcshell/data/test_gfxBlocklist_AllOS.json diff --git a/toolkit/mozapps/extensions/test/xpcshell/data/test_gfxBlacklist_OSVersion.json b/toolkit/mozapps/extensions/test/xpcshell/data/test_gfxBlocklist_OSVersion.json similarity index 100% rename from toolkit/mozapps/extensions/test/xpcshell/data/test_gfxBlacklist_OSVersion.json rename to toolkit/mozapps/extensions/test/xpcshell/data/test_gfxBlocklist_OSVersion.json diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_DriverNew.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_DriverNew.js deleted file mode 100644 index a6a1dc143584..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_DriverNew.js +++ /dev/null @@ -1,112 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// Test whether a machine which is newer than the equal -// blacklist entry is allowed. -// Uses test_gfxBlacklist.json - -// Performs the initial setup -async function run_test() { - var gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo); - - // We can't do anything if we can't spoof the stuff we need. - if (!(gfxInfo instanceof Ci.nsIGfxInfoDebug)) { - do_test_finished(); - return; - } - - gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug); - - // Set the vendor/device ID, etc, to match the test file. - switch (Services.appinfo.OS) { - case "WINNT": - gfxInfo.spoofVendorID("0xdcdc"); - gfxInfo.spoofDeviceID("0x1234"); - // test_gfxBlacklist.json has several entries targeting "os": "All" - // ("All" meaning "All Windows"), with several combinations of - // "driverVersion" / "driverVersionMax" / "driverVersionComparator". - gfxInfo.spoofDriverVersion("8.52.322.1112"); - // Windows 7 - gfxInfo.spoofOSVersion(0x60001); - break; - case "Linux": - // We don't support driver versions on Linux. - // XXX don't we? Seems like we do since bug 1294232 with the change in - // https://hg.mozilla.org/mozilla-central/diff/8962b8d9b7a6/widget/GfxInfoBase.cpp - // To update this test, we'd have to update test_gfxBlacklist.json in a - // way similar to how bug 1714673 was resolved for Android. - do_test_finished(); - return; - case "Darwin": - // We don't support driver versions on OS X. - do_test_finished(); - return; - case "Android": - gfxInfo.spoofVendorID("dcdc"); - gfxInfo.spoofDeviceID("uiop"); - gfxInfo.spoofDriverVersion("6"); - break; - } - - do_test_pending(); - - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "15.0", "8"); - await promiseStartupManager(); - - function checkBlacklist() { - var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); - - // Make sure unrelated features aren't affected - status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT3D_9_LAYERS); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); - - status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT3D_11_LAYERS); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); - - status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_OPENGL_LAYERS); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); - - status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT3D_11_ANGLE); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION); - - status = gfxInfo.getFeatureStatus( - Ci.nsIGfxInfo.FEATURE_HARDWARE_VIDEO_DECODING - ); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION); - - status = gfxInfo.getFeatureStatus( - Ci.nsIGfxInfo.FEATURE_WEBRTC_HW_ACCELERATION_H264 - ); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION); - - status = gfxInfo.getFeatureStatus( - Ci.nsIGfxInfo.FEATURE_WEBRTC_HW_ACCELERATION_DECODE - ); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION); - - status = gfxInfo.getFeatureStatus( - Ci.nsIGfxInfo.FEATURE_WEBRTC_HW_ACCELERATION_ENCODE - ); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION); - - status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_WEBGL_ANGLE); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); - - status = gfxInfo.getFeatureStatus( - Ci.nsIGfxInfo.FEATURE_CANVAS2D_ACCELERATION - ); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION); - - do_test_finished(); - } - - Services.obs.addObserver(function () { - // If we wait until after we go through the event loop, gfxInfo is sure to - // have processed the gfxItems event. - executeSoon(checkBlacklist); - }, "blocklist-data-gfxItems"); - - mockGfxBlocklistItemsFromDisk("../data/test_gfxBlacklist.json"); -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Version.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Version.js deleted file mode 100644 index cbd1699d536c..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Version.js +++ /dev/null @@ -1,190 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// Test whether a machine which exactly matches the blocklist entry is -// successfully blocked. -// Uses test_gfxBlacklist_AllOS.json - -// Performs the initial setup -async function run_test() { - var gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo); - - // We can't do anything if we can't spoof the stuff we need. - if (!(gfxInfo instanceof Ci.nsIGfxInfoDebug)) { - do_test_finished(); - return; - } - - gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug); - - // Save OS in variable since createAppInfo below will change it to "xpcshell". - const OS = Services.appinfo.OS; - // Set the vendor/device ID, etc, to match the test file. - switch (OS) { - case "WINNT": - gfxInfo.spoofVendorID("0xabcd"); - gfxInfo.spoofDeviceID("0x1234"); - gfxInfo.spoofDriverVersion("8.52.322.2201"); - // Windows 7 - gfxInfo.spoofOSVersion(0x60001); - break; - case "Linux": - gfxInfo.spoofVendorID("0xabcd"); - gfxInfo.spoofDeviceID("0x1234"); - break; - case "Darwin": - gfxInfo.spoofVendorID("0xabcd"); - gfxInfo.spoofDeviceID("0x1234"); - gfxInfo.spoofOSVersion(0xa0900); - break; - case "Android": - gfxInfo.spoofVendorID("0xabcd"); - gfxInfo.spoofDeviceID("0x1234"); - gfxInfo.spoofDriverVersion("5"); - break; - } - - do_test_pending(); - - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "15.0", "8"); - await promiseStartupManager(); - - function checkBlocklist() { - var failureId = {}; - var status; - - status = gfxInfo.getFeatureStatus( - Ci.nsIGfxInfo.FEATURE_DIRECT2D, - failureId - ); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION); - Assert.equal(failureId.value, "FEATURE_FAILURE_DL_BLOCKLIST_g1"); - - status = gfxInfo.getFeatureStatus( - Ci.nsIGfxInfo.FEATURE_DIRECT3D_9_LAYERS, - failureId - ); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION); - Assert.equal(failureId.value, "FEATURE_FAILURE_DL_BLOCKLIST_g2"); - - status = gfxInfo.getFeatureStatus( - Ci.nsIGfxInfo.FEATURE_DIRECT3D_10_LAYERS, - failureId - ); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); - Assert.equal(failureId.value, ""); - - status = gfxInfo.getFeatureStatus( - Ci.nsIGfxInfo.FEATURE_DIRECT3D_10_1_LAYERS, - failureId - ); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); - Assert.equal(failureId.value, ""); - - status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_OPENGL_LAYERS); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION); - - status = gfxInfo.getFeatureStatus( - Ci.nsIGfxInfo.FEATURE_WEBGL_OPENGL, - failureId - ); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION); - Assert.equal(failureId.value, "FEATURE_FAILURE_DL_BLOCKLIST_g11"); - - status = gfxInfo.getFeatureStatus( - Ci.nsIGfxInfo.FEATURE_WEBGL_ANGLE, - failureId - ); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION); - Assert.equal(failureId.value, "FEATURE_FAILURE_DL_BLOCKLIST_NO_ID"); - - status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_WEBGL2, failureId); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION); - Assert.equal(failureId.value, "FEATURE_FAILURE_DL_BLOCKLIST_NO_ID"); - - status = gfxInfo.getFeatureStatus( - Ci.nsIGfxInfo.FEATURE_STAGEFRIGHT, - failureId - ); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); - - status = gfxInfo.getFeatureStatus( - Ci.nsIGfxInfo.FEATURE_WEBRTC_HW_ACCELERATION_H264, - failureId - ); - if (OS == "Android" && status != Ci.nsIGfxInfo.FEATURE_STATUS_OK) { - // Hardware acceleration for H.264 varies by device. - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DEVICE); - Assert.equal(failureId.value, "FEATURE_FAILURE_WEBRTC_H264"); - } else { - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); - } - - status = gfxInfo.getFeatureStatus( - Ci.nsIGfxInfo.FEATURE_WEBRTC_HW_ACCELERATION_ENCODE, - failureId - ); - if (OS == "Android" && status != Ci.nsIGfxInfo.FEATURE_STATUS_OK) { - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DEVICE); - Assert.equal(failureId.value, "FEATURE_FAILURE_WEBRTC_ENCODE"); - } else { - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); - } - - status = gfxInfo.getFeatureStatus( - Ci.nsIGfxInfo.FEATURE_WEBRTC_HW_ACCELERATION_DECODE, - failureId - ); - if (OS == "Android" && status != Ci.nsIGfxInfo.FEATURE_STATUS_OK) { - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DEVICE); - Assert.equal(failureId.value, "FEATURE_FAILURE_WEBRTC_DECODE"); - } else { - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); - } - - status = gfxInfo.getFeatureStatus( - Ci.nsIGfxInfo.FEATURE_DIRECT3D_11_LAYERS, - failureId - ); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); - - status = gfxInfo.getFeatureStatus( - Ci.nsIGfxInfo.FEATURE_HARDWARE_VIDEO_DECODING, - failureId - ); - if (OS == "Linux" && status != Ci.nsIGfxInfo.FEATURE_STATUS_OK) { - // Linux test suite is running on SW OpenGL backend and we disable - // HW video decoding there. - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_PLATFORM_TEST); - Assert.equal( - failureId.value, - "FEATURE_FAILURE_VIDEO_DECODING_TEST_FAILED" - ); - } else { - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); - } - - status = gfxInfo.getFeatureStatus( - Ci.nsIGfxInfo.FEATURE_DIRECT3D_11_ANGLE, - failureId - ); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); - - status = gfxInfo.getFeatureStatus( - Ci.nsIGfxInfo.FEATURE_DX_INTEROP2, - failureId - ); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); - - do_test_finished(); - } - - Services.obs.addObserver(function () { - // If we wait until after we go through the event loop, gfxInfo is sure to - // have processed the gfxItems event. - executeSoon(checkBlocklist); - }, "blocklist-data-gfxItems"); - - mockGfxBlocklistItemsFromDisk("../data/test_gfxBlacklist_AllOS.json"); -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Device.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_Device.js similarity index 71% rename from toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Device.js rename to toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_Device.js index 68c935735600..0a4820786005 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Device.js +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_Device.js @@ -3,8 +3,8 @@ */ // Test whether a machine which differs only on device ID, but otherwise -// exactly matches the blacklist entry, is not blocked. -// Uses test_gfxBlacklist.json +// exactly matches the blocklist entry, is not blocked. +// Uses test_gfxBlocklist.json // Performs the initial setup async function run_test() { @@ -48,17 +48,15 @@ async function run_test() { createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8"); await promiseStartupManager(); - function checkBlacklist() { - var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + function checkBlocklist() { + var status = gfxInfo.getFeatureStatusStr("DIRECT2D"); + Assert.equal(status, "STATUS_OK"); - status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT3D_9_LAYERS); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + status = gfxInfo.getFeatureStatusStr("DIRECT3D_9_LAYERS"); + Assert.equal(status, "STATUS_OK"); - status = gfxInfo.getFeatureStatus( - Ci.nsIGfxInfo.FEATURE_CANVAS2D_ACCELERATION - ); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + status = gfxInfo.getFeatureStatusStr("CANVAS2D_ACCELERATION"); + Assert.equal(status, "STATUS_OK"); do_test_finished(); } @@ -66,8 +64,8 @@ async function run_test() { Services.obs.addObserver(function () { // If we wait until after we go through the event loop, gfxInfo is sure to // have processed the gfxItems event. - executeSoon(checkBlacklist); + executeSoon(checkBlocklist); }, "blocklist-data-gfxItems"); - mockGfxBlocklistItemsFromDisk("../data/test_gfxBlacklist.json"); + mockGfxBlocklistItemsFromDisk("../data/test_gfxBlocklist.json"); } diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_DriverNew.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_DriverNew.js similarity index 73% rename from toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_DriverNew.js rename to toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_DriverNew.js index fa274bde2dfa..d9caa0ffe96b 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_DriverNew.js +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_DriverNew.js @@ -2,9 +2,9 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -// Test whether a new-enough driver bypasses the blacklist, even if the rest of -// the attributes match the blacklist entry. -// Uses test_gfxBlacklist.json +// Test whether a new-enough driver bypasses the blocklist, even if the rest of +// the attributes match the blocklist entry. +// Uses test_gfxBlocklist.json // Performs the initial setup async function run_test() { @@ -47,12 +47,12 @@ async function run_test() { createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8"); await promiseStartupManager(); - function checkBlacklist() { - var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + function checkBlocklist() { + var status = gfxInfo.getFeatureStatusStr("DIRECT2D"); + Assert.equal(status, "STATUS_OK"); - status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT3D_9_LAYERS); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + status = gfxInfo.getFeatureStatusStr("DIRECT3D_9_LAYERS"); + Assert.equal(status, "STATUS_OK"); do_test_finished(); } @@ -60,8 +60,8 @@ async function run_test() { Services.obs.addObserver(function () { // If we wait until after we go through the event loop, gfxInfo is sure to // have processed the gfxItems event. - executeSoon(checkBlacklist); + executeSoon(checkBlocklist); }, "blocklist-data-gfxItems"); - mockGfxBlocklistItemsFromDisk("../data/test_gfxBlacklist.json"); + mockGfxBlocklistItemsFromDisk("../data/test_gfxBlocklist.json"); } diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_Equal_DriverNew.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_Equal_DriverNew.js new file mode 100644 index 000000000000..ffecc23a2295 --- /dev/null +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_Equal_DriverNew.js @@ -0,0 +1,102 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +// Test whether a machine which is newer than the equal +// blocklist entry is allowed. +// Uses test_gfxBlocklist.json + +// Performs the initial setup +async function run_test() { + var gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo); + + // We can't do anything if we can't spoof the stuff we need. + if (!(gfxInfo instanceof Ci.nsIGfxInfoDebug)) { + do_test_finished(); + return; + } + + gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug); + + // Set the vendor/device ID, etc, to match the test file. + switch (Services.appinfo.OS) { + case "WINNT": + gfxInfo.spoofVendorID("0xdcdc"); + gfxInfo.spoofDeviceID("0x1234"); + // test_gfxBlocklist.json has several entries targeting "os": "All" + // ("All" meaning "All Windows"), with several combinations of + // "driverVersion" / "driverVersionMax" / "driverVersionComparator". + gfxInfo.spoofDriverVersion("8.52.322.1112"); + // Windows 7 + gfxInfo.spoofOSVersion(0x60001); + break; + case "Linux": + // We don't support driver versions on Linux. + // XXX don't we? Seems like we do since bug 1294232 with the change in + // https://hg.mozilla.org/mozilla-central/diff/8962b8d9b7a6/widget/GfxInfoBase.cpp + // To update this test, we'd have to update test_gfxBlocklist.json in a + // way similar to how bug 1714673 was resolved for Android. + do_test_finished(); + return; + case "Darwin": + // We don't support driver versions on OS X. + do_test_finished(); + return; + case "Android": + gfxInfo.spoofVendorID("dcdc"); + gfxInfo.spoofDeviceID("uiop"); + gfxInfo.spoofDriverVersion("6"); + break; + } + + do_test_pending(); + + createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "15.0", "8"); + await promiseStartupManager(); + + function checkBlocklist() { + var status = gfxInfo.getFeatureStatusStr("DIRECT2D"); + Assert.equal(status, "STATUS_OK"); + + // Make sure unrelated features aren't affected + status = gfxInfo.getFeatureStatusStr("DIRECT3D_9_LAYERS"); + Assert.equal(status, "STATUS_OK"); + + status = gfxInfo.getFeatureStatusStr("DIRECT3D_11_LAYERS"); + Assert.equal(status, "STATUS_OK"); + + status = gfxInfo.getFeatureStatusStr("OPENGL_LAYERS"); + Assert.equal(status, "STATUS_OK"); + + status = gfxInfo.getFeatureStatusStr("DIRECT3D_11_ANGLE"); + Assert.equal(status, "BLOCKED_DRIVER_VERSION"); + + status = gfxInfo.getFeatureStatusStr("HARDWARE_VIDEO_DECODING"); + Assert.equal(status, "BLOCKED_DRIVER_VERSION"); + + status = gfxInfo.getFeatureStatusStr("WEBRTC_HW_ACCELERATION_H264"); + Assert.equal(status, "BLOCKED_DRIVER_VERSION"); + + status = gfxInfo.getFeatureStatusStr("WEBRTC_HW_ACCELERATION_DECODE"); + Assert.equal(status, "BLOCKED_DRIVER_VERSION"); + + status = gfxInfo.getFeatureStatusStr("WEBRTC_HW_ACCELERATION_ENCODE"); + Assert.equal(status, "BLOCKED_DRIVER_VERSION"); + + status = gfxInfo.getFeatureStatusStr("WEBGL_ANGLE"); + Assert.equal(status, "STATUS_OK"); + + status = gfxInfo.getFeatureStatusStr("CANVAS2D_ACCELERATION"); + Assert.equal(status, "BLOCKED_DRIVER_VERSION"); + + do_test_finished(); + } + + Services.obs.addObserver(function () { + // If we wait until after we go through the event loop, gfxInfo is sure to + // have processed the gfxItems event. + executeSoon(checkBlocklist); + }, "blocklist-data-gfxItems"); + + mockGfxBlocklistItemsFromDisk("../data/test_gfxBlocklist.json"); +} diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_DriverOld.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_Equal_DriverOld.js similarity index 77% rename from toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_DriverOld.js rename to toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_Equal_DriverOld.js index 93ca432c6dd2..f3d1332a1d44 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_DriverOld.js +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_Equal_DriverOld.js @@ -3,8 +3,8 @@ */ // Test whether a machine which is older than the equal -// blacklist entry is correctly allowed. -// Uses test_gfxBlacklist.json +// blocklist entry is correctly allowed. +// Uses test_gfxBlocklist.json // Performs the initial setup async function run_test() { @@ -47,13 +47,13 @@ async function run_test() { createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8"); await promiseStartupManager(); - function checkBlacklist() { - var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + function checkBlocklist() { + var status = gfxInfo.getFeatureStatusStr("DIRECT2D"); + Assert.equal(status, "STATUS_OK"); // Make sure unrelated features aren't affected - status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT3D_9_LAYERS); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + status = gfxInfo.getFeatureStatusStr("DIRECT3D_9_LAYERS"); + Assert.equal(status, "STATUS_OK"); do_test_finished(); } @@ -61,8 +61,8 @@ async function run_test() { Services.obs.addObserver(function () { // If we wait until after we go through the event loop, gfxInfo is sure to // have processed the gfxItems event. - executeSoon(checkBlacklist); + executeSoon(checkBlocklist); }, "blocklist-data-gfxItems"); - mockGfxBlocklistItemsFromDisk("../data/test_gfxBlacklist.json"); + mockGfxBlocklistItemsFromDisk("../data/test_gfxBlocklist.json"); } diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_OK.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_Equal_OK.js similarity index 76% rename from toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_OK.js rename to toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_Equal_OK.js index 4be921516124..fd8a4a4491aa 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_OK.js +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_Equal_OK.js @@ -3,8 +3,8 @@ */ // Test whether a machine which exactly matches the equal -// blacklist entry is successfully blocked. -// Uses test_gfxBlacklist.json +// blocklist entry is successfully blocked. +// Uses test_gfxBlocklist.json // Performs the initial setup async function run_test() { @@ -47,13 +47,13 @@ async function run_test() { createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8"); await promiseStartupManager(); - function checkBlacklist() { - var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION); + function checkBlocklist() { + var status = gfxInfo.getFeatureStatusStr("DIRECT2D"); + Assert.equal(status, "BLOCKED_DRIVER_VERSION"); // Make sure unrelated features aren't affected - status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT3D_9_LAYERS); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + status = gfxInfo.getFeatureStatusStr("DIRECT3D_9_LAYERS"); + Assert.equal(status, "STATUS_OK"); do_test_finished(); } @@ -61,8 +61,8 @@ async function run_test() { Services.obs.addObserver(function () { // If we wait until after we go through the event loop, gfxInfo is sure to // have processed the gfxItems event. - executeSoon(checkBlacklist); + executeSoon(checkBlocklist); }, "blocklist-data-gfxItems"); - mockGfxBlocklistItemsFromDisk("../data/test_gfxBlacklist.json"); + mockGfxBlocklistItemsFromDisk("../data/test_gfxBlocklist.json"); } diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_GTE_DriverOld.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_GTE_DriverOld.js similarity index 77% rename from toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_GTE_DriverOld.js rename to toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_GTE_DriverOld.js index d8b082bedca9..9185ae0c0b1a 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_GTE_DriverOld.js +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_GTE_DriverOld.js @@ -3,8 +3,8 @@ */ // Test whether a machine which is lower than the greater-than-or-equal -// blacklist entry is allowed. -// Uses test_gfxBlacklist.json +// blocklist entry is allowed. +// Uses test_gfxBlocklist.json // Performs the initial setup async function run_test() { @@ -47,13 +47,13 @@ async function run_test() { createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8"); await promiseStartupManager(); - function checkBlacklist() { - var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + function checkBlocklist() { + var status = gfxInfo.getFeatureStatusStr("DIRECT2D"); + Assert.equal(status, "STATUS_OK"); // Make sure unrelated features aren't affected - status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT3D_9_LAYERS); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + status = gfxInfo.getFeatureStatusStr("DIRECT3D_9_LAYERS"); + Assert.equal(status, "STATUS_OK"); do_test_finished(); } @@ -61,8 +61,8 @@ async function run_test() { Services.obs.addObserver(function () { // If we wait until after we go through the event loop, gfxInfo is sure to // have processed the gfxItems event. - executeSoon(checkBlacklist); + executeSoon(checkBlocklist); }, "blocklist-data-gfxItems"); - mockGfxBlocklistItemsFromDisk("../data/test_gfxBlacklist.json"); + mockGfxBlocklistItemsFromDisk("../data/test_gfxBlocklist.json"); } diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_GTE_OK.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_GTE_OK.js similarity index 78% rename from toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_GTE_OK.js rename to toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_GTE_OK.js index 0e419ec76135..9dc9ee7c3dfb 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_GTE_OK.js +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_GTE_OK.js @@ -3,8 +3,8 @@ */ // Test whether a machine which exactly matches the greater-than-or-equal -// blacklist entry is successfully blocked. -// Uses test_gfxBlacklist.json +// blocklist entry is successfully blocked. +// Uses test_gfxBlocklist.json // Performs the initial setup async function run_test() { @@ -49,13 +49,13 @@ async function run_test() { createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8"); await promiseStartupManager(); - function checkBlacklist() { - var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION); + function checkBlocklist() { + var status = gfxInfo.getFeatureStatusStr("DIRECT2D"); + Assert.equal(status, "BLOCKED_DRIVER_VERSION"); // Make sure unrelated features aren't affected - status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT3D_9_LAYERS); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + status = gfxInfo.getFeatureStatusStr("DIRECT3D_9_LAYERS"); + Assert.equal(status, "STATUS_OK"); do_test_finished(); } @@ -63,8 +63,8 @@ async function run_test() { Services.obs.addObserver(function () { // If we wait until after we go through the event loop, gfxInfo is sure to // have processed the gfxItems event. - executeSoon(checkBlacklist); + executeSoon(checkBlocklist); }, "blocklist-data-gfxItems"); - mockGfxBlocklistItemsFromDisk("../data/test_gfxBlacklist.json"); + mockGfxBlocklistItemsFromDisk("../data/test_gfxBlocklist.json"); } diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_No_Comparison.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_No_Comparison.js similarity index 67% rename from toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_No_Comparison.js rename to toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_No_Comparison.js index 4d457cff14c6..a1a25c55a1b4 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_No_Comparison.js +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_No_Comparison.js @@ -2,9 +2,9 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -// Test whether a machine which exactly matches the blacklist entry is +// Test whether a machine which exactly matches the blocklist entry is // successfully blocked. -// Uses test_gfxBlacklist.json +// Uses test_gfxBlocklist.json // Performs the initial setup async function run_test() { @@ -41,20 +41,18 @@ async function run_test() { createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8"); await promiseStartupManager(); - function checkBlacklist() { + function checkBlocklist() { var driverVersion = gfxInfo.adapterDriverVersion; if (driverVersion) { - var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DEVICE); + var status = gfxInfo.getFeatureStatusStr("DIRECT2D"); + Assert.equal(status, "BLOCKED_DEVICE"); - status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_WEBRENDER); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DEVICE); + status = gfxInfo.getFeatureStatusStr("WEBRENDER"); + Assert.equal(status, "BLOCKED_DEVICE"); // Make sure unrelated features aren't affected - status = gfxInfo.getFeatureStatus( - Ci.nsIGfxInfo.FEATURE_DIRECT3D_9_LAYERS - ); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + status = gfxInfo.getFeatureStatusStr("DIRECT3D_9_LAYERS"); + Assert.equal(status, "STATUS_OK"); } do_test_finished(); } @@ -62,8 +60,8 @@ async function run_test() { Services.obs.addObserver(function () { // If we wait until after we go through the event loop, gfxInfo is sure to // have processed the gfxItems event. - executeSoon(checkBlacklist); + executeSoon(checkBlocklist); }, "blocklist-data-gfxItems"); - mockGfxBlocklistItemsFromDisk("../data/test_gfxBlacklist.json"); + mockGfxBlocklistItemsFromDisk("../data/test_gfxBlocklist.json"); } diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OK.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_OK.js similarity index 75% rename from toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OK.js rename to toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_OK.js index 991bfa8a967e..3ae9ac32ac66 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OK.js +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_OK.js @@ -2,9 +2,9 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -// Test whether a machine which exactly matches the blacklist entry is +// Test whether a machine which exactly matches the blocklist entry is // successfully blocked. -// Uses test_gfxBlacklist.json +// Uses test_gfxBlocklist.json // Performs the initial setup async function run_test() { @@ -48,13 +48,13 @@ async function run_test() { createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8"); await promiseStartupManager(); - function checkBlacklist() { - var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION); + function checkBlocklist() { + var status = gfxInfo.getFeatureStatusStr("DIRECT2D"); + Assert.equal(status, "BLOCKED_DRIVER_VERSION"); // Make sure unrelated features aren't affected - status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT3D_9_LAYERS); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + status = gfxInfo.getFeatureStatusStr("DIRECT3D_9_LAYERS"); + Assert.equal(status, "STATUS_OK"); do_test_finished(); } @@ -62,8 +62,8 @@ async function run_test() { Services.obs.addObserver(function () { // If we wait until after we go through the event loop, gfxInfo is sure to // have processed the gfxItems event. - executeSoon(checkBlacklist); + executeSoon(checkBlocklist); }, "blocklist-data-gfxItems"); - mockGfxBlocklistItemsFromDisk("../data/test_gfxBlacklist.json"); + mockGfxBlocklistItemsFromDisk("../data/test_gfxBlocklist.json"); } diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OS.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_OS.js similarity index 77% rename from toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OS.js rename to toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_OS.js index 3f525b48ce3f..229b6db36a4b 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OS.js +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_OS.js @@ -3,8 +3,8 @@ */ // Test whether a machine which differs only on OS version, but otherwise -// exactly matches the blacklist entry, is not blocked. -// Uses test_gfxBlacklist.json +// exactly matches the blocklist entry, is not blocked. +// Uses test_gfxBlocklist.json // Performs the initial setup async function run_test() { @@ -48,12 +48,12 @@ async function run_test() { createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8"); await promiseStartupManager(); - function checkBlacklist() { - var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + function checkBlocklist() { + var status = gfxInfo.getFeatureStatusStr("DIRECT2D"); + Assert.equal(status, "STATUS_OK"); - status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT3D_9_LAYERS); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + status = gfxInfo.getFeatureStatusStr("DIRECT3D_9_LAYERS"); + Assert.equal(status, "STATUS_OK"); do_test_finished(); } @@ -61,8 +61,8 @@ async function run_test() { Services.obs.addObserver(function () { // If we wait until after we go through the event loop, gfxInfo is sure to // have processed the gfxItems event. - executeSoon(checkBlacklist); + executeSoon(checkBlocklist); }, "blocklist-data-gfxItems"); - mockGfxBlocklistItemsFromDisk("../data/test_gfxBlacklist.json"); + mockGfxBlocklistItemsFromDisk("../data/test_gfxBlocklist.json"); } diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_match.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_OSVersion_match.js similarity index 78% rename from toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_match.js rename to toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_OSVersion_match.js index d9d357be76fe..f600f8466918 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_match.js +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_OSVersion_match.js @@ -3,7 +3,7 @@ */ // Test whether new OS versions are matched properly. -// Uses test_gfxBlacklist_OSVersion.json +// Uses test_gfxBlocklist_OSVersion.json // Performs the initial setup async function run_test() { @@ -48,13 +48,13 @@ async function run_test() { createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8"); await promiseStartupManager(); - function checkBlacklist() { + function checkBlocklist() { if (Services.appinfo.OS == "WINNT") { - var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION); + var status = gfxInfo.getFeatureStatusStr("DIRECT2D"); + Assert.equal(status, "BLOCKED_DRIVER_VERSION"); } else if (Services.appinfo.OS == "Darwin") { - status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_OPENGL_LAYERS); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION); + status = gfxInfo.getFeatureStatusStr("OPENGL_LAYERS"); + Assert.equal(status, "BLOCKED_DRIVER_VERSION"); } do_test_finished(); @@ -63,8 +63,8 @@ async function run_test() { Services.obs.addObserver(function () { // If we wait until after we go through the event loop, gfxInfo is sure to // have processed the gfxItems event. - executeSoon(checkBlacklist); + executeSoon(checkBlocklist); }, "blocklist-data-gfxItems"); - mockGfxBlocklistItemsFromDisk("../data/test_gfxBlacklist_OSVersion.json"); + mockGfxBlocklistItemsFromDisk("../data/test_gfxBlocklist_OSVersion.json"); } diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_mismatch_DriverVersion.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_OSVersion_mismatch_DriverVersion.js similarity index 79% rename from toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_mismatch_DriverVersion.js rename to toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_OSVersion_mismatch_DriverVersion.js index a1c8107f1dc9..a5fb4743d31d 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_mismatch_DriverVersion.js +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_OSVersion_mismatch_DriverVersion.js @@ -4,7 +4,7 @@ // Test whether blocklists specifying new OSes correctly don't block if driver // versions are appropriately up-to-date. -// Uses test_gfxBlacklist_OSVersion.json +// Uses test_gfxBlocklist_OSVersion.json // Performs the initial setup async function run_test() { @@ -48,13 +48,13 @@ async function run_test() { createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8"); await promiseStartupManager(); - function checkBlacklist() { + function checkBlocklist() { if (Services.appinfo.OS == "WINNT") { - var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + var status = gfxInfo.getFeatureStatusStr("DIRECT2D"); + Assert.equal(status, "STATUS_OK"); } else if (Services.appinfo.OS == "Darwin") { - status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_OPENGL_LAYERS); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + status = gfxInfo.getFeatureStatusStr("OPENGL_LAYERS"); + Assert.equal(status, "STATUS_OK"); } do_test_finished(); @@ -63,8 +63,8 @@ async function run_test() { Services.obs.addObserver(function () { // If we wait until after we go through the event loop, gfxInfo is sure to // have processed the gfxItems event. - executeSoon(checkBlacklist); + executeSoon(checkBlocklist); }, "blocklist-data-gfxItems"); - mockGfxBlocklistItemsFromDisk("../data/test_gfxBlacklist_OSVersion.json"); + mockGfxBlocklistItemsFromDisk("../data/test_gfxBlocklist_OSVersion.json"); } diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_mismatch_OSVersion.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_OSVersion_mismatch_OSVersion.js similarity index 76% rename from toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_mismatch_OSVersion.js rename to toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_OSVersion_mismatch_OSVersion.js index be076d98c37e..38b711f58cf6 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_mismatch_OSVersion.js +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_OSVersion_mismatch_OSVersion.js @@ -2,9 +2,9 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -// Test whether old OS versions are not matched when the blacklist contains +// Test whether old OS versions are not matched when the blocklist contains // only new OS versions. -// Uses test_gfxBlacklist_OSVersion.json +// Uses test_gfxBlocklist_OSVersion.json // Performs the initial setup async function run_test() { @@ -49,13 +49,13 @@ async function run_test() { createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8"); await promiseStartupManager(); - function checkBlacklist() { + function checkBlocklist() { if (Services.appinfo.OS == "WINNT") { - var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + var status = gfxInfo.getFeatureStatusStr("DIRECT2D"); + Assert.equal(status, "STATUS_OK"); } else if (Services.appinfo.OS == "Darwin") { - status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_OPENGL_LAYERS); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + status = gfxInfo.getFeatureStatusStr("OPENGL_LAYERS"); + Assert.equal(status, "STATUS_OK"); } do_test_finished(); @@ -64,8 +64,8 @@ async function run_test() { Services.obs.addObserver(function () { // If we wait until after we go through the event loop, gfxInfo is sure to // have processed the gfxItems event. - executeSoon(checkBlacklist); + executeSoon(checkBlocklist); }, "blocklist-data-gfxItems"); - mockGfxBlocklistItemsFromDisk("../data/test_gfxBlacklist_OSVersion.json"); + mockGfxBlocklistItemsFromDisk("../data/test_gfxBlocklist_OSVersion.json"); } diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Vendor.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_Vendor.js similarity index 76% rename from toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Vendor.js rename to toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_Vendor.js index e5d137db6016..68b2ce6f94dd 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Vendor.js +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_Vendor.js @@ -3,8 +3,8 @@ */ // Test whether a machine which differs only on vendor, but otherwise -// exactly matches the blacklist entry, is not blocked. -// Uses test_gfxBlacklist.json +// exactly matches the blocklist entry, is not blocked. +// Uses test_gfxBlocklist.json // Performs the initial setup async function run_test() { @@ -48,12 +48,12 @@ async function run_test() { createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8"); await promiseStartupManager(); - function checkBlacklist() { - var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + function checkBlocklist() { + var status = gfxInfo.getFeatureStatusStr("DIRECT2D"); + Assert.equal(status, "STATUS_OK"); - status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT3D_9_LAYERS); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + status = gfxInfo.getFeatureStatusStr("DIRECT3D_9_LAYERS"); + Assert.equal(status, "STATUS_OK"); do_test_finished(); } @@ -61,8 +61,8 @@ async function run_test() { Services.obs.addObserver(function () { // If we wait until after we go through the event loop, gfxInfo is sure to // have processed the gfxItems event. - executeSoon(checkBlacklist); + executeSoon(checkBlocklist); }, "blocklist-data-gfxItems"); - mockGfxBlocklistItemsFromDisk("../data/test_gfxBlacklist.json"); + mockGfxBlocklistItemsFromDisk("../data/test_gfxBlocklist.json"); } diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_Version.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_Version.js new file mode 100644 index 000000000000..a97148560dea --- /dev/null +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_Version.js @@ -0,0 +1,157 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +// Test whether a machine which exactly matches the blocklist entry is +// successfully blocked. +// Uses test_gfxBlocklist_AllOS.json + +// Performs the initial setup +async function run_test() { + var gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo); + + // We can't do anything if we can't spoof the stuff we need. + if (!(gfxInfo instanceof Ci.nsIGfxInfoDebug)) { + do_test_finished(); + return; + } + + gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug); + + // Save OS in variable since createAppInfo below will change it to "xpcshell". + const OS = Services.appinfo.OS; + // Set the vendor/device ID, etc, to match the test file. + switch (OS) { + case "WINNT": + gfxInfo.spoofVendorID("0xabcd"); + gfxInfo.spoofDeviceID("0x1234"); + gfxInfo.spoofDriverVersion("8.52.322.2201"); + // Windows 7 + gfxInfo.spoofOSVersion(0x60001); + break; + case "Linux": + gfxInfo.spoofVendorID("0xabcd"); + gfxInfo.spoofDeviceID("0x1234"); + break; + case "Darwin": + gfxInfo.spoofVendorID("0xabcd"); + gfxInfo.spoofDeviceID("0x1234"); + gfxInfo.spoofOSVersion(0xa0900); + break; + case "Android": + gfxInfo.spoofVendorID("0xabcd"); + gfxInfo.spoofDeviceID("0x1234"); + gfxInfo.spoofDriverVersion("5"); + break; + } + + do_test_pending(); + + createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "15.0", "8"); + await promiseStartupManager(); + + function checkBlocklist() { + var failureId = {}; + var status; + + status = gfxInfo.getFeatureStatusStr("DIRECT2D", failureId); + Assert.equal(status, "BLOCKED_DRIVER_VERSION"); + Assert.equal(failureId.value, "FEATURE_FAILURE_DL_BLOCKLIST_g1"); + + status = gfxInfo.getFeatureStatusStr("DIRECT3D_9_LAYERS", failureId); + Assert.equal(status, "BLOCKED_DRIVER_VERSION"); + Assert.equal(failureId.value, "FEATURE_FAILURE_DL_BLOCKLIST_g2"); + + status = gfxInfo.getFeatureStatusStr("DIRECT3D_10_LAYERS", failureId); + Assert.equal(status, "STATUS_OK"); + Assert.equal(failureId.value, ""); + + status = gfxInfo.getFeatureStatusStr("DIRECT3D_10_1_LAYERS", failureId); + Assert.equal(status, "STATUS_OK"); + Assert.equal(failureId.value, ""); + + status = gfxInfo.getFeatureStatusStr("OPENGL_LAYERS"); + Assert.equal(status, "BLOCKED_DRIVER_VERSION"); + + status = gfxInfo.getFeatureStatusStr("WEBGL_OPENGL", failureId); + Assert.equal(status, "BLOCKED_DRIVER_VERSION"); + Assert.equal(failureId.value, "FEATURE_FAILURE_DL_BLOCKLIST_g11"); + + status = gfxInfo.getFeatureStatusStr("WEBGL_ANGLE", failureId); + Assert.equal(status, "BLOCKED_DRIVER_VERSION"); + Assert.equal(failureId.value, "FEATURE_FAILURE_DL_BLOCKLIST_NO_ID"); + + status = gfxInfo.getFeatureStatusStr("WEBGL2", failureId); + Assert.equal(status, "BLOCKED_DRIVER_VERSION"); + Assert.equal(failureId.value, "FEATURE_FAILURE_DL_BLOCKLIST_NO_ID"); + + status = gfxInfo.getFeatureStatusStr("STAGEFRIGHT", failureId); + Assert.equal(status, "STATUS_OK"); + + status = gfxInfo.getFeatureStatusStr( + "WEBRTC_HW_ACCELERATION_H264", + failureId + ); + if (OS == "Android" && status != "STATUS_OK") { + // Hardware acceleration for H.264 varies by device. + Assert.equal(status, "BLOCKED_DEVICE"); + Assert.equal(failureId.value, "FEATURE_FAILURE_WEBRTC_H264"); + } else { + Assert.equal(status, "STATUS_OK"); + } + + status = gfxInfo.getFeatureStatusStr( + "WEBRTC_HW_ACCELERATION_ENCODE", + failureId + ); + if (OS == "Android" && status != "STATUS_OK") { + Assert.equal(status, "BLOCKED_DEVICE"); + Assert.equal(failureId.value, "FEATURE_FAILURE_WEBRTC_ENCODE"); + } else { + Assert.equal(status, "STATUS_OK"); + } + + status = gfxInfo.getFeatureStatusStr( + "WEBRTC_HW_ACCELERATION_DECODE", + failureId + ); + if (OS == "Android" && status != "STATUS_OK") { + Assert.equal(status, "BLOCKED_DEVICE"); + Assert.equal(failureId.value, "FEATURE_FAILURE_WEBRTC_DECODE"); + } else { + Assert.equal(status, "STATUS_OK"); + } + + status = gfxInfo.getFeatureStatusStr("DIRECT3D_11_LAYERS", failureId); + Assert.equal(status, "STATUS_OK"); + + status = gfxInfo.getFeatureStatusStr("HARDWARE_VIDEO_DECODING", failureId); + if (OS == "Linux" && status != "STATUS_OK") { + // Linux test suite is running on SW OpenGL backend and we disable + // HW video decoding there. + Assert.equal(status, "BLOCKED_PLATFORM_TEST"); + Assert.equal( + failureId.value, + "FEATURE_FAILURE_VIDEO_DECODING_TEST_FAILED" + ); + } else { + Assert.equal(status, "STATUS_OK"); + } + + status = gfxInfo.getFeatureStatusStr("DIRECT3D_11_ANGLE", failureId); + Assert.equal(status, "STATUS_OK"); + + status = gfxInfo.getFeatureStatusStr("DX_INTEROP2", failureId); + Assert.equal(status, "STATUS_OK"); + + do_test_finished(); + } + + Services.obs.addObserver(function () { + // If we wait until after we go through the event loop, gfxInfo is sure to + // have processed the gfxItems event. + executeSoon(checkBlocklist); + }, "blocklist-data-gfxItems"); + + mockGfxBlocklistItemsFromDisk("../data/test_gfxBlocklist_AllOS.json"); +} diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_prefs.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_prefs.js similarity index 67% rename from toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_prefs.js rename to toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_prefs.js index 6e5f71b3646a..e7a1e3df21c6 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_prefs.js +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_prefs.js @@ -2,9 +2,9 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -// Test whether the blacklist successfully adds and removes the prefs that store -// its decisions when the remote blacklist is changed. -// Uses test_gfxBlacklist.json and test_gfxBlacklist2.json +// Test whether the blocklist successfully adds and removes the prefs that store +// its decisions when the remote blocklist is changed. +// Uses test_gfxBlocklist.json and test_gfxBlocklist2.json // Performs the initial setup async function run_test() { @@ -53,26 +53,26 @@ async function run_test() { createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8"); await promiseStartupManager(); - function blacklistAdded() { + function blocklistAdded() { // If we wait until after we go through the event loop, gfxInfo is sure to // have processed the gfxItems event. - executeSoon(ensureBlacklistSet); + executeSoon(ensureBlocklistSet); } - function ensureBlacklistSet() { - var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION); + function ensureBlocklistSet() { + var status = gfxInfo.getFeatureStatusStr("DIRECT2D"); + Assert.equal(status, "BLOCKED_DRIVER_VERSION"); // Make sure unrelated features aren't affected - status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT3D_9_LAYERS); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + status = gfxInfo.getFeatureStatusStr("DIRECT3D_9_LAYERS"); + Assert.equal(status, "STATUS_OK"); Assert.equal( Services.prefs.getIntPref("gfx.blacklist.direct2d"), - Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION + "BLOCKED_DRIVER_VERSION" ); - Services.obs.removeObserver(blacklistAdded, "blocklist-data-gfxItems"); - Services.obs.addObserver(blacklistRemoved, "blocklist-data-gfxItems"); + Services.obs.removeObserver(blocklistAdded, "blocklist-data-gfxItems"); + Services.obs.addObserver(blocklistRemoved, "blocklist-data-gfxItems"); mockGfxBlocklistItems([ { os: "WINNT 6.1", @@ -95,18 +95,18 @@ async function run_test() { ]); } - function blacklistRemoved() { + function blocklistRemoved() { // If we wait until after we go through the event loop, gfxInfo is sure to // have processed the gfxItems event. - executeSoon(ensureBlacklistUnset); + executeSoon(ensureBlocklistUnset); } - function ensureBlacklistUnset() { - var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + function ensureBlocklistUnset() { + var status = gfxInfo.getFeatureStatusStr("DIRECT2D"); + Assert.equal(status, "STATUS_OK"); // Make sure unrelated features aren't affected - status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT3D_9_LAYERS); - Assert.equal(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK); + status = gfxInfo.getFeatureStatusStr("DIRECT3D_9_LAYERS"); + Assert.equal(status, "STATUS_OK"); var exists = false; try { @@ -119,6 +119,6 @@ async function run_test() { do_test_finished(); } - Services.obs.addObserver(blacklistAdded, "blocklist-data-gfxItems"); - mockGfxBlocklistItemsFromDisk("../data/test_gfxBlacklist.json"); + Services.obs.addObserver(blocklistAdded, "blocklist-data-gfxItems"); + mockGfxBlocklistItemsFromDisk("../data/test_gfxBlocklist.json"); } diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/xpcshell.toml b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/xpcshell.toml index c05d62bd25e9..6ddd0364ee00 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/xpcshell.toml +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/xpcshell.toml @@ -69,37 +69,37 @@ skip-if = ["os == 'android' && verify"] # times out because it takes too much ti requesttimeoutfactor = 2 skip-if = ["os == 'android' && verify"] # times out in chaos mode on Android because several minutes are spent waiting at https://hg.mozilla.org/mozilla-central/file/3350b680/toolkit/mozapps/extensions/Blocklist.jsm#l698 -["test_gfxBlacklist_Device.js"] +["test_gfxBlocklist_Device.js"] -["test_gfxBlacklist_DriverNew.js"] +["test_gfxBlocklist_DriverNew.js"] -["test_gfxBlacklist_Equal_DriverNew.js"] +["test_gfxBlocklist_Equal_DriverNew.js"] -["test_gfxBlacklist_Equal_DriverOld.js"] +["test_gfxBlocklist_Equal_DriverOld.js"] -["test_gfxBlacklist_Equal_OK.js"] +["test_gfxBlocklist_Equal_OK.js"] -["test_gfxBlacklist_GTE_DriverOld.js"] +["test_gfxBlocklist_GTE_DriverOld.js"] -["test_gfxBlacklist_GTE_OK.js"] +["test_gfxBlocklist_GTE_OK.js"] -["test_gfxBlacklist_No_Comparison.js"] +["test_gfxBlocklist_No_Comparison.js"] -["test_gfxBlacklist_OK.js"] +["test_gfxBlocklist_OK.js"] -["test_gfxBlacklist_OS.js"] +["test_gfxBlocklist_OS.js"] -["test_gfxBlacklist_OSVersion_match.js"] +["test_gfxBlocklist_OSVersion_match.js"] -["test_gfxBlacklist_OSVersion_mismatch_DriverVersion.js"] +["test_gfxBlocklist_OSVersion_mismatch_DriverVersion.js"] -["test_gfxBlacklist_OSVersion_mismatch_OSVersion.js"] +["test_gfxBlocklist_OSVersion_mismatch_OSVersion.js"] -["test_gfxBlacklist_Vendor.js"] +["test_gfxBlocklist_Vendor.js"] -["test_gfxBlacklist_Version.js"] +["test_gfxBlocklist_Version.js"] -["test_gfxBlacklist_prefs.js"] +["test_gfxBlocklist_prefs.js"] # Bug 1248787 - consistently fails skip-if = ["true"] diff --git a/tools/lint/rejected-words.yml b/tools/lint/rejected-words.yml index a6ff2d63a619..f627f6a34ae5 100644 --- a/tools/lint/rejected-words.yml +++ b/tools/lint/rejected-words.yml @@ -272,22 +272,7 @@ avoid-blacklist-and-whitelist: - toolkit/modules/Troubleshoot.sys.mjs - toolkit/mozapps/extensions/internal/XPIInstall.sys.mjs - toolkit/mozapps/extensions/test/browser/browser_html_discover_view.js - - toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Device.js - - toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_DriverNew.js - - toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_DriverNew.js - - toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_DriverOld.js - - toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Equal_OK.js - - toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_GTE_DriverOld.js - - toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_GTE_OK.js - - toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_No_Comparison.js - - toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OK.js - - toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OS.js - - toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_match.js - - toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_mismatch_DriverVersion.js - - toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_OSVersion_mismatch_OSVersion.js - - toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_prefs.js - - toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Vendor.js - - toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlacklist_Version.js + - toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_gfxBlocklist_prefs.js - toolkit/mozapps/extensions/test/xpcshell/test_permissions.js - toolkit/mozapps/extensions/test/xpcshell/test_permissions_prefs.js - toolkit/mozapps/extensions/test/xpinstall/browser_bug645699.js diff --git a/widget/GfxDriverInfo.cpp b/widget/GfxDriverInfo.cpp index 7b6a42453bf4..d97e9333d3d3 100644 --- a/widget/GfxDriverInfo.cpp +++ b/widget/GfxDriverInfo.cpp @@ -659,12 +659,6 @@ const GfxDeviceFamily* GfxDriverInfo::GetDeviceFamily(DeviceFamily id) { return deviceFamily; } -// Macro for assigning a window protocol id to a string. -#define DECLARE_WINDOW_PROTOCOL_ID(name, windowProtocolId) \ - case WindowProtocol::name: \ - sWindowProtocol[idx]->AssignLiteral(windowProtocolId); \ - break; - const nsAString& GfxDriverInfo::GetWindowProtocol(WindowProtocol id) { if (id >= WindowProtocol::Max) { MOZ_ASSERT_UNREACHABLE("WindowProtocol id is out of range"); @@ -679,25 +673,18 @@ const nsAString& GfxDriverInfo::GetWindowProtocol(WindowProtocol id) { sWindowProtocol[idx] = new nsString(); switch (id) { - DECLARE_WINDOW_PROTOCOL_ID(X11, "x11"); - DECLARE_WINDOW_PROTOCOL_ID(XWayland, "xwayland"); - DECLARE_WINDOW_PROTOCOL_ID(Wayland, "wayland"); - DECLARE_WINDOW_PROTOCOL_ID(WaylandDRM, "wayland/drm"); - DECLARE_WINDOW_PROTOCOL_ID(WaylandAll, "wayland/all"); - DECLARE_WINDOW_PROTOCOL_ID(X11All, "x11/all"); case WindowProtocol::Max: // Suppress a warning. - DECLARE_WINDOW_PROTOCOL_ID(All, ""); +#define GFXINFO_WINDOW_PROTOCOL(id, name) \ + case WindowProtocol::id: \ + sWindowProtocol[idx]->Assign(u##name##_ns); \ + break; +#include "mozilla/widget/GfxInfoWindowProtocolDefs.h" +#undef GFXINFO_WINDOW_PROTOCOL } return *sWindowProtocol[idx]; } -// Macro for assigning a device vendor id to a string. -#define DECLARE_VENDOR_ID(name, deviceId) \ - case DeviceVendor::name: \ - sDeviceVendors[idx]->AssignLiteral(deviceId); \ - break; - const nsAString& GfxDriverInfo::GetDeviceVendor(DeviceFamily id) { if (id >= DeviceFamily::Max) { MOZ_ASSERT_UNREACHABLE("DeviceVendor id is out of range"); @@ -785,34 +772,18 @@ const nsAString& GfxDriverInfo::GetDeviceVendor(DeviceVendor id) { sDeviceVendors[idx] = new nsString(); switch (id) { - DECLARE_VENDOR_ID(Intel, "0x8086"); - DECLARE_VENDOR_ID(NVIDIA, "0x10de"); - DECLARE_VENDOR_ID(ATI, "0x1002"); - // AMD has 0x1022 but continues to release GPU hardware under ATI. - DECLARE_VENDOR_ID(Microsoft, "0x1414"); - DECLARE_VENDOR_ID(MicrosoftBasic, "0x00ba"); - DECLARE_VENDOR_ID(MicrosoftHyperV, "0x000b"); - DECLARE_VENDOR_ID(Parallels, "0x1ab8"); - DECLARE_VENDOR_ID(VMWare, "0x15ad"); - DECLARE_VENDOR_ID(VirtualBox, "0x80ee"); - DECLARE_VENDOR_ID(Apple, "0x106b"); - DECLARE_VENDOR_ID(Amazon, "0x1d0f"); - // Choose an arbitrary Qualcomm PCI VENdor ID for now. - // TODO: This should be "QCOM" when Windows device ID parsing is reworked. - DECLARE_VENDOR_ID(Qualcomm, "0x5143"); case DeviceVendor::Max: // Suppress a warning. - DECLARE_VENDOR_ID(All, ""); +#define GFXINFO_DEVICE_VENDOR(id, name) \ + case DeviceVendor::id: \ + sDeviceVendors[idx]->Assign(u##name##_ns); \ + break; +#include "mozilla/widget/GfxInfoDeviceVendorDefs.h" +#undef GFXINFO_DEVICE_VENDOR } return *sDeviceVendors[idx]; } -// Macro for assigning a driver vendor id to a string. -#define DECLARE_DRIVER_VENDOR_ID(name, driverVendorId) \ - case DriverVendor::name: \ - sDriverVendors[idx]->AssignLiteral(driverVendorId); \ - break; - const nsAString& GfxDriverInfo::GetDriverVendor(DriverVendor id) { if (id >= DriverVendor::Max) { MOZ_ASSERT_UNREACHABLE("DriverVendor id is out of range"); @@ -827,23 +798,13 @@ const nsAString& GfxDriverInfo::GetDriverVendor(DriverVendor id) { sDriverVendors[idx] = new nsString(); switch (id) { - DECLARE_DRIVER_VENDOR_ID(MesaAll, "mesa/all"); - DECLARE_DRIVER_VENDOR_ID(MesaLLVMPipe, "mesa/llvmpipe"); - DECLARE_DRIVER_VENDOR_ID(MesaSoftPipe, "mesa/softpipe"); - DECLARE_DRIVER_VENDOR_ID(MesaSWRast, "mesa/swrast"); - DECLARE_DRIVER_VENDOR_ID(MesaSWUnknown, "mesa/software-unknown"); - DECLARE_DRIVER_VENDOR_ID(MesaUnknown, "mesa/unknown"); - DECLARE_DRIVER_VENDOR_ID(MesaR600, "mesa/r600"); - DECLARE_DRIVER_VENDOR_ID(MesaRadeonsi, "mesa/radeonsi"); - DECLARE_DRIVER_VENDOR_ID(MesaNouveau, "mesa/nouveau"); - DECLARE_DRIVER_VENDOR_ID(NonMesaAll, "non-mesa/all"); - DECLARE_DRIVER_VENDOR_ID(HardwareMesaAll, "mesa/hw-all"); - DECLARE_DRIVER_VENDOR_ID(SoftwareMesaAll, "mesa/sw-all"); - DECLARE_DRIVER_VENDOR_ID(MesaNonIntelNvidiaAtiAll, - "mesa/non-intel-nvidia-ati-all"); - DECLARE_DRIVER_VENDOR_ID(MesaVM, "mesa/vmwgfx"); case DriverVendor::Max: // Suppress a warning. - DECLARE_DRIVER_VENDOR_ID(All, ""); +#define GFXINFO_DRIVER_VENDOR(id, name) \ + case DriverVendor::id: \ + sDriverVendors[idx]->Assign(u##name##_ns); \ + break; +#include "mozilla/widget/GfxInfoDriverVendorDefs.h" +#undef GFXINFO_DRIVER_VENDOR } return *sDriverVendors[idx]; diff --git a/widget/GfxDriverInfo.h b/widget/GfxDriverInfo.h index 24f78668f80d..1aaf14803e71 100644 --- a/widget/GfxDriverInfo.h +++ b/widget/GfxDriverInfo.h @@ -113,47 +113,17 @@ namespace widget { enum class OperatingSystem : uint8_t { Unknown, - Windows, - WindowsXP, - WindowsServer2003, - WindowsVista, - Windows7, - Windows8, - Windows8_1, - Windows10, - RecentWindows10, - NotRecentWindows10, - Linux, - OSX, - OSX10_5, - OSX10_6, - OSX10_7, - OSX10_8, - OSX10_9, - OSX10_10, - OSX10_11, - OSX10_12, - OSX10_13, - OSX10_14, - OSX10_15, - OSX11_0, - Android, - Ios +#define GFXINFO_OS(id, name) id, +#include "mozilla/widget/GfxInfoOperatingSystemDefs.h" +#undef GFXINFO_OS + Count }; enum VersionComparisonOp { - DRIVER_LESS_THAN, // driver < version - DRIVER_BUILD_ID_LESS_THAN, // driver build id < version - DRIVER_LESS_THAN_OR_EQUAL, // driver <= version - DRIVER_BUILD_ID_LESS_THAN_OR_EQUAL, // driver build id <= version - DRIVER_GREATER_THAN, // driver > version - DRIVER_GREATER_THAN_OR_EQUAL, // driver >= version - DRIVER_EQUAL, // driver == version - DRIVER_NOT_EQUAL, // driver != version - DRIVER_BETWEEN_EXCLUSIVE, // driver > version && driver < versionMax - DRIVER_BETWEEN_INCLUSIVE, // driver >= version && driver <= versionMax - DRIVER_BETWEEN_INCLUSIVE_START, // driver >= version && driver < versionMax - DRIVER_COMPARISON_IGNORED +#define GFXINFO_DRIVER_VERSION_CMP(id) DRIVER_##id, +#include "mozilla/widget/GfxInfoDriverVersionCmpDefs.h" +#undef GFXINFO_DRIVER_VERSION_CMP + DRIVER_COUNT }; enum class DeviceFamily : uint8_t { @@ -202,65 +172,23 @@ enum class DeviceFamily : uint8_t { }; enum class DeviceVendor : uint8_t { - All, // There is an assumption that this is the first enum - Intel, - NVIDIA, - ATI, - Microsoft, - Parallels, - VMWare, - VirtualBox, - Qualcomm, - MicrosoftBasic, - MicrosoftHyperV, - Apple, - Amazon, - +#define GFXINFO_DEVICE_VENDOR(id, name) id, +#include "mozilla/widget/GfxInfoDeviceVendorDefs.h" +#undef GFXINFO_DEVICE_VENDOR Max }; enum DriverVendor : uint8_t { - All, // There is an assumption that this is the first enum - // Wildcard for all Mesa drivers. - MesaAll, - // Note that the following list of Mesa drivers is not comprehensive; we pull - // the DRI driver at runtime. These drivers are provided for convenience when - // populating the local blocklist. - MesaLLVMPipe, - MesaSoftPipe, - MesaSWRast, - MesaSWUnknown, - // AMD - MesaR600, - MesaRadeonsi, - // Nouveau: Open-source nvidia - MesaNouveau, - // A generic ID to be provided when we can't determine the DRI driver on Mesa. - MesaUnknown, - // Wildcard for all non-Mesa drivers. - NonMesaAll, - // Wildcard for all hardware Mesa drivers. - HardwareMesaAll, - // Wildcard for all software Mesa drivers. - SoftwareMesaAll, - // Wildcard for all non-Intel/NVIDIA/ATI Mesa drivers. - MesaNonIntelNvidiaAtiAll, - // Running in VM. - MesaVM, - +#define GFXINFO_DRIVER_VENDOR(id, name) id, +#include "mozilla/widget/GfxInfoDriverVendorDefs.h" +#undef GFXINFO_DRIVER_VENDOR Max }; enum class WindowProtocol : uint8_t { - All, // There is an assumption that this is the first enum - X11, - XWayland, - Wayland, - WaylandDRM, - // Wildcard for all Wayland variants, excluding XWayland. - WaylandAll, - // Wildcard for all X11 variants, including XWayland. - X11All, +#define GFXINFO_WINDOW_PROTOCOL(id, name) id, +#include "mozilla/widget/GfxInfoWindowProtocolDefs.h" +#undef GFXINFO_WINDOW_PROTOCOL Max }; diff --git a/widget/GfxInfoBase.cpp b/widget/GfxInfoBase.cpp index f1ee38329db7..c84cce340625 100644 --- a/widget/GfxInfoBase.cpp +++ b/widget/GfxInfoBase.cpp @@ -137,161 +137,20 @@ NS_IMPL_ISUPPORTS(GfxInfoBase, nsIGfxInfo, nsIObserver, #define SUGGESTED_VERSION_PREF BLOCKLIST_PREF_BRANCH "suggested-driver-version" static const char* GetPrefNameForFeature(int32_t aFeature) { - const char* name = nullptr; + const char* fullpref = nullptr; switch (aFeature) { - case nsIGfxInfo::FEATURE_DIRECT2D: - name = BLOCKLIST_PREF_BRANCH "direct2d"; - break; - case nsIGfxInfo::FEATURE_DIRECT3D_9_LAYERS: - name = BLOCKLIST_PREF_BRANCH "layers.direct3d9"; - break; - case nsIGfxInfo::FEATURE_DIRECT3D_10_LAYERS: - name = BLOCKLIST_PREF_BRANCH "layers.direct3d10"; - break; - case nsIGfxInfo::FEATURE_DIRECT3D_10_1_LAYERS: - name = BLOCKLIST_PREF_BRANCH "layers.direct3d10-1"; - break; - case nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS: - name = BLOCKLIST_PREF_BRANCH "layers.direct3d11"; - break; - case nsIGfxInfo::FEATURE_DIRECT3D_11_ANGLE: - name = BLOCKLIST_PREF_BRANCH "direct3d11angle"; - break; - case nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING: - name = BLOCKLIST_PREF_BRANCH "hardwarevideodecoding"; - break; - case nsIGfxInfo::FEATURE_OPENGL_LAYERS: - name = BLOCKLIST_PREF_BRANCH "layers.opengl"; - break; - case nsIGfxInfo::FEATURE_WEBGL_OPENGL: - name = BLOCKLIST_PREF_BRANCH "webgl.opengl"; - break; - case nsIGfxInfo::FEATURE_WEBGL_ANGLE: - name = BLOCKLIST_PREF_BRANCH "webgl.angle"; - break; - case nsIGfxInfo::UNUSED_FEATURE_WEBGL_MSAA: - name = BLOCKLIST_PREF_BRANCH "webgl.msaa"; - break; - case nsIGfxInfo::FEATURE_STAGEFRIGHT: - name = BLOCKLIST_PREF_BRANCH "stagefright"; - break; - case nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION_H264: - name = BLOCKLIST_PREF_BRANCH "webrtc.hw.acceleration.h264"; - break; - case nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION_ENCODE: - name = BLOCKLIST_PREF_BRANCH "webrtc.hw.acceleration.encode"; - break; - case nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION_DECODE: - name = BLOCKLIST_PREF_BRANCH "webrtc.hw.acceleration.decode"; - break; - case nsIGfxInfo::FEATURE_CANVAS2D_ACCELERATION: - name = BLOCKLIST_PREF_BRANCH "canvas2d.acceleration"; - break; - case nsIGfxInfo::FEATURE_DX_INTEROP2: - name = BLOCKLIST_PREF_BRANCH "dx.interop2"; - break; - case nsIGfxInfo::FEATURE_GPU_PROCESS: - name = BLOCKLIST_PREF_BRANCH "gpu.process"; - break; - case nsIGfxInfo::FEATURE_WEBGL2: - name = BLOCKLIST_PREF_BRANCH "webgl2"; - break; - case nsIGfxInfo::FEATURE_D3D11_KEYED_MUTEX: - name = BLOCKLIST_PREF_BRANCH "d3d11.keyed.mutex"; - break; - case nsIGfxInfo::FEATURE_WEBRENDER: - name = BLOCKLIST_PREF_BRANCH "webrender"; - break; - case nsIGfxInfo::FEATURE_WEBRENDER_COMPOSITOR: - name = BLOCKLIST_PREF_BRANCH "webrender.compositor"; - break; - case nsIGfxInfo::FEATURE_DX_NV12: - name = BLOCKLIST_PREF_BRANCH "dx.nv12"; - break; - case nsIGfxInfo::FEATURE_DX_P010: - name = BLOCKLIST_PREF_BRANCH "dx.p010"; - break; - case nsIGfxInfo::FEATURE_DX_P016: - name = BLOCKLIST_PREF_BRANCH "dx.p016"; - break; - case nsIGfxInfo::FEATURE_VP8_HW_DECODE: - name = BLOCKLIST_PREF_BRANCH "vp8.hw-decode"; - break; - case nsIGfxInfo::FEATURE_VP9_HW_DECODE: - name = BLOCKLIST_PREF_BRANCH "vp9.hw-decode"; - break; - case nsIGfxInfo::FEATURE_GL_SWIZZLE: - name = BLOCKLIST_PREF_BRANCH "gl.swizzle"; - break; - case nsIGfxInfo::FEATURE_WEBRENDER_SCISSORED_CACHE_CLEARS: - name = BLOCKLIST_PREF_BRANCH "webrender.scissored_cache_clears"; - break; - case nsIGfxInfo::FEATURE_ALLOW_WEBGL_OUT_OF_PROCESS: - name = BLOCKLIST_PREF_BRANCH "webgl.allow-oop"; - break; - case nsIGfxInfo::FEATURE_THREADSAFE_GL: - name = BLOCKLIST_PREF_BRANCH "gl.threadsafe"; - break; - case nsIGfxInfo::FEATURE_WEBRENDER_OPTIMIZED_SHADERS: - name = BLOCKLIST_PREF_BRANCH "webrender.optimized-shaders"; - break; - case nsIGfxInfo::FEATURE_X11_EGL: - name = BLOCKLIST_PREF_BRANCH "x11.egl"; - break; - case nsIGfxInfo::FEATURE_DMABUF: - name = BLOCKLIST_PREF_BRANCH "dmabuf"; - break; - case nsIGfxInfo::FEATURE_WEBGPU: - name = BLOCKLIST_PREF_BRANCH "webgpu"; - break; - case nsIGfxInfo::FEATURE_VIDEO_OVERLAY: - name = BLOCKLIST_PREF_BRANCH "video-overlay"; - break; - case nsIGfxInfo::FEATURE_HW_DECODED_VIDEO_ZERO_COPY: - name = BLOCKLIST_PREF_BRANCH "hw-video-zero-copy"; - break; - case nsIGfxInfo::FEATURE_WEBRENDER_SHADER_CACHE: - name = BLOCKLIST_PREF_BRANCH "webrender.program-binary-disk"; - break; - case nsIGfxInfo::FEATURE_WEBRENDER_PARTIAL_PRESENT: - name = BLOCKLIST_PREF_BRANCH "webrender.partial-present"; - break; - case nsIGfxInfo::FEATURE_DMABUF_SURFACE_EXPORT: - name = BLOCKLIST_PREF_BRANCH "dmabuf.surface-export"; - break; - case nsIGfxInfo::FEATURE_REUSE_DECODER_DEVICE: - name = BLOCKLIST_PREF_BRANCH "reuse-decoder-device"; - break; - case nsIGfxInfo::FEATURE_BACKDROP_FILTER: - name = BLOCKLIST_PREF_BRANCH "backdrop.filter"; - break; - case nsIGfxInfo::FEATURE_ACCELERATED_CANVAS2D: - name = BLOCKLIST_PREF_BRANCH "accelerated-canvas2d"; - break; - case nsIGfxInfo::FEATURE_H264_HW_DECODE: - name = BLOCKLIST_PREF_BRANCH "h264.hw-decode"; - break; - case nsIGfxInfo::FEATURE_AV1_HW_DECODE: - name = BLOCKLIST_PREF_BRANCH "av1.hw-decode"; - break; - case nsIGfxInfo::FEATURE_VIDEO_SOFTWARE_OVERLAY: - name = BLOCKLIST_PREF_BRANCH "video-software-overlay"; - break; - case nsIGfxInfo::FEATURE_WEBGL_USE_HARDWARE: - name = BLOCKLIST_PREF_BRANCH "webgl-use-hardware"; - break; - case nsIGfxInfo::FEATURE_OVERLAY_VP_AUTO_HDR: - name = BLOCKLIST_PREF_BRANCH "overlay-vp-auto-hdr"; - break; - case nsIGfxInfo::FEATURE_OVERLAY_VP_SUPER_RESOLUTION: - name = BLOCKLIST_PREF_BRANCH "overlay-vp-super-resolution"; - break; +#define GFXINFO_FEATURE(id, name, pref) \ + case nsIGfxInfo::FEATURE_##id: \ + fullpref = BLOCKLIST_PREF_BRANCH pref; \ + break; +#include "mozilla/widget/GfxInfoFeatureDefs.h" +#undef GFXINFO_FEATURE default: MOZ_ASSERT_UNREACHABLE("Unexpected nsIGfxInfo feature?!"); break; } - return name; + return fullpref; } // Returns the value of the pref for the relevant feature in aValue. @@ -364,68 +223,12 @@ static void RemovePrefForDriverVersion() { } static OperatingSystem BlocklistOSToOperatingSystem(const nsAString& os) { - if (os.EqualsLiteral("WINNT 6.1")) { - return OperatingSystem::Windows7; +#define GFXINFO_OS(id, name) \ + if (os.Equals(u##name##_ns)) { \ + return OperatingSystem::id; \ } - if (os.EqualsLiteral("WINNT 6.2")) { - return OperatingSystem::Windows8; - } - if (os.EqualsLiteral("WINNT 6.3")) { - return OperatingSystem::Windows8_1; - } - if (os.EqualsLiteral("WINNT 10.0")) { - return OperatingSystem::Windows10; - } - if (os.EqualsLiteral("Linux")) { - return OperatingSystem::Linux; - } - if (os.EqualsLiteral("Darwin 9")) { - return OperatingSystem::OSX10_5; - } - if (os.EqualsLiteral("Darwin 10")) { - return OperatingSystem::OSX10_6; - } - if (os.EqualsLiteral("Darwin 11")) { - return OperatingSystem::OSX10_7; - } - if (os.EqualsLiteral("Darwin 12")) { - return OperatingSystem::OSX10_8; - } - if (os.EqualsLiteral("Darwin 13")) { - return OperatingSystem::OSX10_9; - } - if (os.EqualsLiteral("Darwin 14")) { - return OperatingSystem::OSX10_10; - } - if (os.EqualsLiteral("Darwin 15")) { - return OperatingSystem::OSX10_11; - } - if (os.EqualsLiteral("Darwin 16")) { - return OperatingSystem::OSX10_12; - } - if (os.EqualsLiteral("Darwin 17")) { - return OperatingSystem::OSX10_13; - } - if (os.EqualsLiteral("Darwin 18")) { - return OperatingSystem::OSX10_14; - } - if (os.EqualsLiteral("Darwin 19")) { - return OperatingSystem::OSX10_15; - } - if (os.EqualsLiteral("Darwin 20")) { - return OperatingSystem::OSX11_0; - } - if (os.EqualsLiteral("Android")) { - return OperatingSystem::Android; - // For historical reasons, "All" in blocklist means "All Windows" - } - if (os.EqualsLiteral("All")) { - return OperatingSystem::Windows; - } - if (os.EqualsLiteral("Darwin")) { - return OperatingSystem::OSX; - } - +#include "mozilla/widget/GfxInfoOperatingSystemDefs.h" +#undef GFXINFO_OS return OperatingSystem::Unknown; } @@ -448,222 +251,57 @@ static GfxDeviceFamily* BlocklistDevicesToDeviceFamily( static int32_t BlocklistFeatureToGfxFeature(const nsAString& aFeature) { MOZ_ASSERT(!aFeature.IsEmpty()); - if (aFeature.EqualsLiteral("DIRECT2D")) { - return nsIGfxInfo::FEATURE_DIRECT2D; - } - if (aFeature.EqualsLiteral("DIRECT3D_9_LAYERS")) { - return nsIGfxInfo::FEATURE_DIRECT3D_9_LAYERS; - } - if (aFeature.EqualsLiteral("DIRECT3D_10_LAYERS")) { - return nsIGfxInfo::FEATURE_DIRECT3D_10_LAYERS; - } - if (aFeature.EqualsLiteral("DIRECT3D_10_1_LAYERS")) { - return nsIGfxInfo::FEATURE_DIRECT3D_10_1_LAYERS; - } - if (aFeature.EqualsLiteral("DIRECT3D_11_LAYERS")) { - return nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS; - } - if (aFeature.EqualsLiteral("DIRECT3D_11_ANGLE")) { - return nsIGfxInfo::FEATURE_DIRECT3D_11_ANGLE; - } - if (aFeature.EqualsLiteral("HARDWARE_VIDEO_DECODING")) { - return nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING; - } - if (aFeature.EqualsLiteral("OPENGL_LAYERS")) { - return nsIGfxInfo::FEATURE_OPENGL_LAYERS; - } - if (aFeature.EqualsLiteral("WEBGL_OPENGL")) { - return nsIGfxInfo::FEATURE_WEBGL_OPENGL; - } - if (aFeature.EqualsLiteral("WEBGL_ANGLE")) { - return nsIGfxInfo::FEATURE_WEBGL_ANGLE; - } - if (aFeature.EqualsLiteral("WEBGL_MSAA")) { - return nsIGfxInfo::UNUSED_FEATURE_WEBGL_MSAA; - } - if (aFeature.EqualsLiteral("STAGEFRIGHT")) { - return nsIGfxInfo::FEATURE_STAGEFRIGHT; - } - if (aFeature.EqualsLiteral("WEBRTC_HW_ACCELERATION_ENCODE")) { - return nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION_ENCODE; - } - if (aFeature.EqualsLiteral("WEBRTC_HW_ACCELERATION_DECODE")) { - return nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION_DECODE; - } - if (aFeature.EqualsLiteral("WEBRTC_HW_ACCELERATION_H264")) { - return nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION_H264; - } - if (aFeature.EqualsLiteral("CANVAS2D_ACCELERATION")) { - return nsIGfxInfo::FEATURE_CANVAS2D_ACCELERATION; - } - if (aFeature.EqualsLiteral("DX_INTEROP2")) { - return nsIGfxInfo::FEATURE_DX_INTEROP2; - } - if (aFeature.EqualsLiteral("GPU_PROCESS")) { - return nsIGfxInfo::FEATURE_GPU_PROCESS; - } - if (aFeature.EqualsLiteral("WEBGL2")) { - return nsIGfxInfo::FEATURE_WEBGL2; - } - if (aFeature.EqualsLiteral("D3D11_KEYED_MUTEX")) { - return nsIGfxInfo::FEATURE_D3D11_KEYED_MUTEX; - } - if (aFeature.EqualsLiteral("WEBRENDER")) { - return nsIGfxInfo::FEATURE_WEBRENDER; - } - if (aFeature.EqualsLiteral("WEBRENDER_COMPOSITOR")) { - return nsIGfxInfo::FEATURE_WEBRENDER_COMPOSITOR; - } - if (aFeature.EqualsLiteral("DX_NV12")) { - return nsIGfxInfo::FEATURE_DX_NV12; - } - if (aFeature.EqualsLiteral("VP8_HW_DECODE")) { - return nsIGfxInfo::FEATURE_VP8_HW_DECODE; - } - if (aFeature.EqualsLiteral("VP9_HW_DECODE")) { - return nsIGfxInfo::FEATURE_VP9_HW_DECODE; - } - if (aFeature.EqualsLiteral("GL_SWIZZLE")) { - return nsIGfxInfo::FEATURE_GL_SWIZZLE; - } - if (aFeature.EqualsLiteral("WEBRENDER_SCISSORED_CACHE_CLEARS")) { - return nsIGfxInfo::FEATURE_WEBRENDER_SCISSORED_CACHE_CLEARS; - } - if (aFeature.EqualsLiteral("ALLOW_WEBGL_OUT_OF_PROCESS")) { - return nsIGfxInfo::FEATURE_ALLOW_WEBGL_OUT_OF_PROCESS; - } - if (aFeature.EqualsLiteral("THREADSAFE_GL")) { - return nsIGfxInfo::FEATURE_THREADSAFE_GL; - } - if (aFeature.EqualsLiteral("X11_EGL")) { - return nsIGfxInfo::FEATURE_X11_EGL; - } - if (aFeature.EqualsLiteral("DMABUF")) { - return nsIGfxInfo::FEATURE_DMABUF; - } - if (aFeature.EqualsLiteral("WEBGPU")) { - return nsIGfxInfo::FEATURE_WEBGPU; - } - if (aFeature.EqualsLiteral("VIDEO_OVERLAY")) { - return nsIGfxInfo::FEATURE_VIDEO_OVERLAY; - } - if (aFeature.EqualsLiteral("HW_DECODED_VIDEO_ZERO_COPY")) { - return nsIGfxInfo::FEATURE_HW_DECODED_VIDEO_ZERO_COPY; - } - if (aFeature.EqualsLiteral("REUSE_DECODER_DEVICE")) { - return nsIGfxInfo::FEATURE_REUSE_DECODER_DEVICE; - } - if (aFeature.EqualsLiteral("WEBRENDER_PARTIAL_PRESENT")) { - return nsIGfxInfo::FEATURE_WEBRENDER_PARTIAL_PRESENT; - } - if (aFeature.EqualsLiteral("BACKDROP_FILTER")) { - return nsIGfxInfo::FEATURE_BACKDROP_FILTER; - } - if (aFeature.EqualsLiteral("ACCELERATED_CANVAS2D")) { - return nsIGfxInfo::FEATURE_ACCELERATED_CANVAS2D; - } - if (aFeature.EqualsLiteral("H264_HW_DECODE")) { - return nsIGfxInfo::FEATURE_H264_HW_DECODE; - } - if (aFeature.EqualsLiteral("AV1_HW_DECODE")) { - return nsIGfxInfo::FEATURE_AV1_HW_DECODE; - } - if (aFeature.EqualsLiteral("VIDEO_SOFTWARE_OVERLAY")) { - return nsIGfxInfo::FEATURE_VIDEO_SOFTWARE_OVERLAY; - } - if (aFeature.EqualsLiteral("WEBGL_USE_HARDWARE")) { - return nsIGfxInfo::FEATURE_WEBGL_USE_HARDWARE; - } - if (aFeature.EqualsLiteral("FEATURE_OVERLAY_VP_AUTO_HDR")) { - return nsIGfxInfo::FEATURE_OVERLAY_VP_AUTO_HDR; - } - if (aFeature.EqualsLiteral("FEATURE_OVERLAY_VP_SUPER_RESOLUTION")) { - return nsIGfxInfo::FEATURE_OVERLAY_VP_SUPER_RESOLUTION; - } - if (aFeature.EqualsLiteral("ALL")) { - return GfxDriverInfo::allFeatures; - } - if (aFeature.EqualsLiteral("OPTIONAL")) { - return GfxDriverInfo::optionalFeatures; +#define GFXINFO_FEATURE(id, name, pref) \ + if (aFeature.Equals(u##name##_ns)) { \ + return nsIGfxInfo::FEATURE_##id; \ } +#include "mozilla/widget/GfxInfoFeatureDefs.h" +#undef GFXINFO_FEATURE // If we don't recognize the feature, it may be new, and something // this version doesn't understand. So, nothing to do. This is // different from feature not being specified at all, in which case // this method should not get called and we should continue with the // "optional features" blocklisting. - return 0; + return nsIGfxInfo::FEATURE_INVALID; } static int32_t BlocklistFeatureStatusToGfxFeatureStatus( const nsAString& aStatus) { - if (aStatus.EqualsLiteral("STATUS_OK")) { - return nsIGfxInfo::FEATURE_STATUS_OK; +#define GFXINFO_FEATURE_STATUS(id) \ + if (aStatus.Equals(u## #id##_ns)) { \ + return nsIGfxInfo::FEATURE_##id; \ } - if (aStatus.EqualsLiteral("BLOCKED_DRIVER_VERSION")) { - return nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION; - } - if (aStatus.EqualsLiteral("BLOCKED_DEVICE")) { - return nsIGfxInfo::FEATURE_BLOCKED_DEVICE; - } - if (aStatus.EqualsLiteral("DISCOURAGED")) { - return nsIGfxInfo::FEATURE_DISCOURAGED; - } - if (aStatus.EqualsLiteral("BLOCKED_OS_VERSION")) { - return nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION; - } - if (aStatus.EqualsLiteral("DENIED")) { - return nsIGfxInfo::FEATURE_DENIED; - } - if (aStatus.EqualsLiteral("ALLOW_QUALIFIED")) { - return nsIGfxInfo::FEATURE_ALLOW_QUALIFIED; - } - if (aStatus.EqualsLiteral("ALLOW_ALWAYS")) { - return nsIGfxInfo::FEATURE_ALLOW_ALWAYS; - } - - // Do not allow it to set STATUS_UNKNOWN. Also, we are not - // expecting the "mismatch" status showing up here. - +#include "mozilla/widget/GfxInfoFeatureStatusDefs.h" +#undef GFXINFO_FEATURE_STATUS return nsIGfxInfo::FEATURE_STATUS_OK; } +static void GfxFeatureStatusToBlocklistFeatureStatus(int32_t aStatus, + nsAString& aStatusOut) { + switch (aStatus) { +#define GFXINFO_FEATURE_STATUS(id) \ + case nsIGfxInfo::FEATURE_##id: \ + aStatusOut.Assign(u## #id##_ns); \ + break; +#include "mozilla/widget/GfxInfoFeatureStatusDefs.h" +#undef GFXINFO_FEATURE + default: + MOZ_ASSERT_UNREACHABLE("Unexpected feature status!"); + break; + } +} + static VersionComparisonOp BlocklistComparatorToComparisonOp( const nsAString& op) { - if (op.EqualsLiteral("LESS_THAN")) { - return DRIVER_LESS_THAN; - } - if (op.EqualsLiteral("BUILD_ID_LESS_THAN")) { - return DRIVER_BUILD_ID_LESS_THAN; - } - if (op.EqualsLiteral("LESS_THAN_OR_EQUAL")) { - return DRIVER_LESS_THAN_OR_EQUAL; - } - if (op.EqualsLiteral("BUILD_ID_LESS_THAN_OR_EQUAL")) { - return DRIVER_BUILD_ID_LESS_THAN_OR_EQUAL; - } - if (op.EqualsLiteral("GREATER_THAN")) { - return DRIVER_GREATER_THAN; - } - if (op.EqualsLiteral("GREATER_THAN_OR_EQUAL")) { - return DRIVER_GREATER_THAN_OR_EQUAL; - } - if (op.EqualsLiteral("EQUAL")) { - return DRIVER_EQUAL; - } - if (op.EqualsLiteral("NOT_EQUAL")) { - return DRIVER_NOT_EQUAL; - } - if (op.EqualsLiteral("BETWEEN_EXCLUSIVE")) { - return DRIVER_BETWEEN_EXCLUSIVE; - } - if (op.EqualsLiteral("BETWEEN_INCLUSIVE")) { - return DRIVER_BETWEEN_INCLUSIVE; - } - if (op.EqualsLiteral("BETWEEN_INCLUSIVE_START")) { - return DRIVER_BETWEEN_INCLUSIVE_START; +#define GFXINFO_DRIVER_VERSION_CMP(id) \ + if (op.Equals(u## #id##_ns)) { \ + return DRIVER_##id; \ } +#include "mozilla/widget/GfxInfoDriverVersionCmpDefs.h" +#undef GFXINFO_DRIVER_VERSION_CMP + // The default is to ignore it. return DRIVER_COMPARISON_IGNORED; } @@ -723,7 +361,7 @@ static bool BlocklistEntryToDriverInfo(const nsACString& aBlocklistEntry, aDriverInfo.mDriverVendor = dataValue; } else if (key.EqualsLiteral("feature")) { aDriverInfo.mFeature = BlocklistFeatureToGfxFeature(dataValue); - if (aDriverInfo.mFeature == 0) { + if (aDriverInfo.mFeature == nsIGfxInfo::FEATURE_INVALID) { // If we don't recognize the feature, we do not want to proceed. gfxWarning() << "Unrecognized feature " << value.get(); return false; @@ -893,12 +531,28 @@ GfxInfoBase::GetFeatureStatus(int32_t aFeature, nsACString& aFailureId, return rv; } +NS_IMETHODIMP +GfxInfoBase::GetFeatureStatusStr(const nsAString& aFeature, + nsACString& aFailureId, nsAString& aStatus) { + int32_t feature = BlocklistFeatureToGfxFeature(aFeature); + if (feature == nsIGfxInfo::FEATURE_INVALID) { + NS_ConvertUTF16toUTF8 feature(aFeature); + gfxWarning() << "Unrecognized feature " << feature.get(); + return NS_ERROR_INVALID_ARG; + } + int32_t status = nsIGfxInfo::FEATURE_STATUS_UNKNOWN; + nsresult rv = GetFeatureStatus(feature, aFailureId, &status); + GfxFeatureStatusToBlocklistFeatureStatus(status, aStatus); + return rv; +} + nsTArray GfxInfoBase::GetAllFeatures() { MOZ_RELEASE_ASSERT(XRE_IsParentProcess()); if (!sFeatureStatus) { InitFeatureStatus(new nsTArray()); - for (int32_t i = 1; i <= nsIGfxInfo::FEATURE_MAX_VALUE; ++i) { - int32_t status = 0; + for (int32_t i = nsIGfxInfo::FEATURE_START; i < nsIGfxInfo::FEATURE_COUNT; + ++i) { + int32_t status = nsIGfxInfo::FEATURE_STATUS_INVALID; nsAutoCString failureId; GetFeatureStatus(i, failureId, &status); gfx::GfxInfoFeatureStatus gfxFeatureStatus; @@ -1409,6 +1063,18 @@ GfxInfoBase::GetFeatureSuggestedDriverVersion(int32_t aFeature, discardFailureId); } +NS_IMETHODIMP +GfxInfoBase::GetFeatureSuggestedDriverVersionStr(const nsAString& aFeature, + nsAString& aVersion) { + int32_t feature = BlocklistFeatureToGfxFeature(aFeature); + if (feature == nsIGfxInfo::FEATURE_INVALID) { + NS_ConvertUTF16toUTF8 feature(aFeature); + gfxWarning() << "Unrecognized feature " << feature.get(); + return NS_ERROR_INVALID_ARG; + } + return GetFeatureSuggestedDriverVersion(feature, aVersion); +} + void GfxInfoBase::EvaluateDownloadedBlocklist( nsTArray& aDriverInfo) { // If the list is empty, then we don't actually want to call @@ -1425,7 +1091,8 @@ void GfxInfoBase::EvaluateDownloadedBlocklist( // non-STATUS_OK status. If it does, we set the pref we evaluate in // GetFeatureStatus above, so we don't need to hold on to this blocklist // anywhere permanent. - for (int feature = 1; feature <= nsIGfxInfo::FEATURE_MAX_VALUE; ++feature) { + for (int feature = nsIGfxInfo::FEATURE_START; + feature < nsIGfxInfo::FEATURE_COUNT; ++feature) { int32_t status = nsIGfxInfo::FEATURE_STATUS_UNKNOWN; nsCString failureId; nsAutoString suggestedVersion; diff --git a/widget/GfxInfoBase.h b/widget/GfxInfoBase.h index 476966d47a52..ae111eaa3c47 100644 --- a/widget/GfxInfoBase.h +++ b/widget/GfxInfoBase.h @@ -53,6 +53,11 @@ class GfxInfoBase : public nsIGfxInfo, int32_t* _retval) override; NS_IMETHOD GetFeatureSuggestedDriverVersion(int32_t aFeature, nsAString& _retval) override; + NS_IMETHOD GetFeatureStatusStr(const nsAString& aFeature, + nsACString& aFailureId, + nsAString& _retval) override; + NS_IMETHOD GetFeatureSuggestedDriverVersionStr(const nsAString& aFeature, + nsAString& _retval) override; NS_IMETHOD GetMonitors(JSContext* cx, JS::MutableHandle _retval) override; diff --git a/widget/GfxInfoDeviceVendorDefs.h b/widget/GfxInfoDeviceVendorDefs.h new file mode 100644 index 000000000000..d69bae4e5144 --- /dev/null +++ b/widget/GfxInfoDeviceVendorDefs.h @@ -0,0 +1,28 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// NOTE: No include guard. This is meant to be included to generate different +// code based on how GFXINFO_FEATURE_STATUS is defined, possibly multiple times +// in a single translation unit. + +/* clang-format off */ + +// There is an assumption that this is the first enum +GFXINFO_DEVICE_VENDOR(All, "") +GFXINFO_DEVICE_VENDOR(Intel, "0x8086") +GFXINFO_DEVICE_VENDOR(NVIDIA, "0x10de") +GFXINFO_DEVICE_VENDOR(ATI, "0x1002") +// AMD has 0x1022 but continues to release GPU hardware under ATI. +GFXINFO_DEVICE_VENDOR(Microsoft, "0x1414") +GFXINFO_DEVICE_VENDOR(MicrosoftBasic, "0x00ba") +GFXINFO_DEVICE_VENDOR(MicrosoftHyperV, "0x000b") +GFXINFO_DEVICE_VENDOR(Parallels, "0x1ab8") +GFXINFO_DEVICE_VENDOR(VMWare, "0x15ad") +GFXINFO_DEVICE_VENDOR(VirtualBox, "0x80ee") +GFXINFO_DEVICE_VENDOR(Apple, "0x106b") +GFXINFO_DEVICE_VENDOR(Amazon, "0x1d0f") +// Choose an arbitrary Qualcomm PCI VENdor ID for now. +// TODO: This should be "QCOM" when Windows device ID parsing is reworked. +GFXINFO_DEVICE_VENDOR(Qualcomm, "0x5143") diff --git a/widget/GfxInfoDriverVendorDefs.h b/widget/GfxInfoDriverVendorDefs.h new file mode 100644 index 000000000000..92e4026ee224 --- /dev/null +++ b/widget/GfxInfoDriverVendorDefs.h @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// NOTE: No include guard. This is meant to be included to generate different +// code based on how GFXINFO_FEATURE_STATUS is defined, possibly multiple times +// in a single translation unit. + +/* clang-format off */ + +// There is an assumption that this is the first enum +GFXINFO_DRIVER_VENDOR(All, "") +// Wildcard for all Mesa drivers. +GFXINFO_DRIVER_VENDOR(MesaAll, "mesa/all") +// Note that the following list of Mesa drivers is not comprehensive; we pull +// the DRI driver at runtime. These drivers are provided for convenience when +// populating the local blocklist. +GFXINFO_DRIVER_VENDOR(MesaLLVMPipe, "mesa/llvmpipe") +GFXINFO_DRIVER_VENDOR(MesaSoftPipe, "mesa/softpipe") +GFXINFO_DRIVER_VENDOR(MesaSWRast, "mesa/swrast") +GFXINFO_DRIVER_VENDOR(MesaSWUnknown, "mesa/software-unknown") +// AMD +GFXINFO_DRIVER_VENDOR(MesaR600, "mesa/r600") +GFXINFO_DRIVER_VENDOR(MesaRadeonsi, "mesa/radeonsi") +// Nouveau: Open-source nvidia +GFXINFO_DRIVER_VENDOR(MesaNouveau, "mesa/nouveau") +// A generic ID to be provided when we can't determine the DRI driver on Mesa. +GFXINFO_DRIVER_VENDOR(MesaUnknown, "mesa/unknown") +// Wildcard for all non-Mesa drivers. +GFXINFO_DRIVER_VENDOR(NonMesaAll, "non-mesa/all") +// Wildcard for all hardware Mesa drivers. +GFXINFO_DRIVER_VENDOR(HardwareMesaAll, "mesa/hw-all") +// Wildcard for all software Mesa drivers. +GFXINFO_DRIVER_VENDOR(SoftwareMesaAll, "mesa/sw-all") +// Wildcard for all non-Intel/NVIDIA/ATI Mesa drivers. +GFXINFO_DRIVER_VENDOR(MesaNonIntelNvidiaAtiAll, "mesa/non-intel-nvidia-ati-all") +// Running in VM. +GFXINFO_DRIVER_VENDOR(MesaVM, "mesa/vmwgfx") diff --git a/widget/GfxInfoDriverVersionCmpDefs.h b/widget/GfxInfoDriverVersionCmpDefs.h new file mode 100644 index 000000000000..a92cb28e8912 --- /dev/null +++ b/widget/GfxInfoDriverVersionCmpDefs.h @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// NOTE: No include guard. This is meant to be included to generate different +// code based on how GFXINFO_FEATURE_STATUS is defined, possibly multiple times +// in a single translation unit. + +/* clang-format off */ + +// driver < version +GFXINFO_DRIVER_VERSION_CMP(LESS_THAN) +// driver build id < version +GFXINFO_DRIVER_VERSION_CMP(BUILD_ID_LESS_THAN) +// driver <= version +GFXINFO_DRIVER_VERSION_CMP(LESS_THAN_OR_EQUAL) +// driver build id <= version +GFXINFO_DRIVER_VERSION_CMP(BUILD_ID_LESS_THAN_OR_EQUAL) +// driver > version +GFXINFO_DRIVER_VERSION_CMP(GREATER_THAN) +// driver >= version +GFXINFO_DRIVER_VERSION_CMP(GREATER_THAN_OR_EQUAL) +// driver == version +GFXINFO_DRIVER_VERSION_CMP(EQUAL) +// driver != version +GFXINFO_DRIVER_VERSION_CMP(NOT_EQUAL) +// driver > version && driver < versionMax +GFXINFO_DRIVER_VERSION_CMP(BETWEEN_EXCLUSIVE) +// driver >= version && driver <= versionMax +GFXINFO_DRIVER_VERSION_CMP(BETWEEN_INCLUSIVE) +// driver >= version && driver < versionMax +GFXINFO_DRIVER_VERSION_CMP(BETWEEN_INCLUSIVE_START) +// do not compare driver versions +GFXINFO_DRIVER_VERSION_CMP(COMPARISON_IGNORED) diff --git a/widget/GfxInfoFeatureDefs.h b/widget/GfxInfoFeatureDefs.h new file mode 100644 index 000000000000..4978ef765b89 --- /dev/null +++ b/widget/GfxInfoFeatureDefs.h @@ -0,0 +1,113 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// NOTE: No include guard. This is meant to be included to generate different +// code based on how GFXINFO_FEATURE is defined, possibly multiple times in a +// single translation unit. + +/* clang-format off */ + +/* Wildcard to block all features, starting in 123. */ +GFXINFO_FEATURE(ALL, "ALL", "all") +/* Wildcard to block all optional features, starting in 123. */ +GFXINFO_FEATURE(OPTIONAL, "OPTIONAL", "optional") +/* Whether Direct2D is supported for content rendering, always present. */ +GFXINFO_FEATURE(DIRECT2D, "DIRECT2D", "direct2d") +/* Whether Direct3D 9 is supported for layers, always present. */ +GFXINFO_FEATURE(DIRECT3D_9_LAYERS, "DIRECT3D_9_LAYERS", "layers.direct3d9") +/* Whether Direct3D 10.0 is supported for layers, always present. */ +GFXINFO_FEATURE(DIRECT3D_10_LAYERS, "DIRECT3D_10_LAYERS", "layers.direct3d10") +/* Whether Direct3D 10.1 is supported for layers, always present. */ +GFXINFO_FEATURE(DIRECT3D_10_1_LAYERS, "DIRECT3D_10_1_LAYERS", "layers.direct3d10-1") +/* Whether OpenGL is supported for layers, always present. */ +GFXINFO_FEATURE(OPENGL_LAYERS, "OPENGL_LAYERS", "layers.opengl") +/* Whether WebGL is supported via OpenGL, always present. */ +GFXINFO_FEATURE(WEBGL_OPENGL, "WEBGL_OPENGL", "webgl.opengl") +/* Whether WebGL is supported via ANGLE (D3D9 -- does not check for the presence of ANGLE libs). */ +GFXINFO_FEATURE(WEBGL_ANGLE, "WEBGL_ANGLE", "webgl.angle") +/* (Unused) Whether WebGL antialiasing is supported. */ +GFXINFO_FEATURE(UNUSED_WEBGL_MSAA, "WEBGL_MSAA", "webgl.msaa") +/* Whether Stagefright is supported, starting in 17. */ +GFXINFO_FEATURE(STAGEFRIGHT, "STAGEFRIGHT", "stagefright") +/* Whether Webrtc Hardware H.264 acceleration is supported, starting in 71. */ +GFXINFO_FEATURE(WEBRTC_HW_ACCELERATION_H264, "WEBRTC_HW_ACCELERATION_H264", "webrtc.hw.acceleration.h264") +/* Whether Direct3D 11 is supported for layers, starting in 32. */ +GFXINFO_FEATURE(DIRECT3D_11_LAYERS, "DIRECT3D_11_LAYERS", "layers.direct3d11") +/* Whether hardware accelerated video decoding is supported, starting in 36. */ +GFXINFO_FEATURE(HARDWARE_VIDEO_DECODING, "HARDWARE_VIDEO_DECODING", "hardwarevideodecoding") +/* Whether Direct3D 11 is supported for ANGLE, starting in 38. */ +GFXINFO_FEATURE(DIRECT3D_11_ANGLE, "DIRECT3D_11_ANGLE", "direct3d11angle") +/* Whether Webrtc Hardware acceleration is supported, starting in 42. */ +GFXINFO_FEATURE(WEBRTC_HW_ACCELERATION_ENCODE, "WEBRTC_HW_ACCELERATION_ENCODE", "webrtc.hw.acceleration.encode") +/* Whether Webrtc Hardware acceleration is supported, starting in 42. */ +GFXINFO_FEATURE(WEBRTC_HW_ACCELERATION_DECODE, "WEBRTC_HW_ACCELERATION_DECODE", "webrtc.hw.acceleration.decode") +/* Whether Canvas acceleration is supported, starting in 45 */ +GFXINFO_FEATURE(CANVAS2D_ACCELERATION, "CANVAS2D_ACCELERATION", "canvas2d.acceleration") +/* Whether hardware VP8 decoding is supported, starting in 48; downloadable blocking in 100. */ +GFXINFO_FEATURE(VP8_HW_DECODE, "VP8_HW_DECODE", "vp8.hw-decode") +/* Whether hardware VP9 decoding is supported, starting in 48; downloadable blocking in 100. */ +GFXINFO_FEATURE(VP9_HW_DECODE, "VP9_HW_DECODE", "vp9.hw-decode") +/* Whether NV_dx_interop2 is supported, starting in 50; downloadable blocking in 58. */ +GFXINFO_FEATURE(DX_INTEROP2, "DX_INTEROP2", "dx.interop2") +/* Whether the GPU process is supported, starting in 52; downloadable blocking in 58. */ +GFXINFO_FEATURE(GPU_PROCESS, "GPU_PROCESS", "gpu.process") +/* Whether the WebGL2 is supported, starting in 54. */ +GFXINFO_FEATURE(WEBGL2, "WEBGL2", "webgl2") +/* Whether D3D11 keyed mutex is supported, starting in 56. */ +GFXINFO_FEATURE(D3D11_KEYED_MUTEX, "D3D11_KEYED_MUTEX", "d3d11.keyed.mutex") +/* Whether WebRender is supported, starting in 62. */ +GFXINFO_FEATURE(WEBRENDER, "WEBRENDER", "webrender") +/* Does D3D11 support NV12 video format, starting in 60. */ +GFXINFO_FEATURE(DX_NV12, "DX_NV12", "dx.nv12") +/* Does D3D11 support P010 video format, starting in 64, downloadable blocking in 133. */ +GFXINFO_FEATURE(DX_P010, "DX_P010", "dx.p010") +/* Does D3D11 support P016 video format, starting in 64, downloadable blocking in 133. */ +GFXINFO_FEATURE(DX_P016, "DX_P016", "dx.p016") +/* Whether OpenGL swizzle configuration of texture units is supported, starting in 70. */ +GFXINFO_FEATURE(GL_SWIZZLE, "GL_SWIZZLE", "gl.swizzle") +/* Whether WebRender native compositor is supported, starting in 73 */ +GFXINFO_FEATURE(WEBRENDER_COMPOSITOR, "WEBRENDER_COMPOSITOR", "webrender.compositor") +/* Whether WebRender can use scissored clears for cached surfaces, staring in 79 */ +GFXINFO_FEATURE(WEBRENDER_SCISSORED_CACHE_CLEARS, "WEBRENDER_SCISSORED_CACHE_CLEARS", "webrender.scissored_cache_clears") +/* Support webgl.out-of-process: true (starting in 83) */ +GFXINFO_FEATURE(ALLOW_WEBGL_OUT_OF_PROCESS, "ALLOW_WEBGL_OUT_OF_PROCESS", "webgl.allow-oop") +/* Is OpenGL threadsafe (starting in 83) */ +GFXINFO_FEATURE(THREADSAFE_GL, "THREADSAFE_GL", "gl.threadsafe") +/* Whether webrender uses pre-optimized shaders, starting in 87; downloadable blocking in 133. */ +GFXINFO_FEATURE(WEBRENDER_OPTIMIZED_SHADERS, "WEBRENDER_OPTIMIZED_SHADERS", "webrender.optimized-shaders") +/* Whether we prefer EGL over GLX with X11, starting in 88. */ +GFXINFO_FEATURE(X11_EGL, "X11_EGL", "x11.egl") +/* Whether DMABUF is supported, starting in 88. */ +GFXINFO_FEATURE(DMABUF, "DMABUF", "dmabuf") +/* Whether webrender caches shader program binaries to disk, starting in 89; downloadable blocking in 133. */ +GFXINFO_FEATURE(WEBRENDER_SHADER_CACHE, "WEBRENDER_SHADER_CACHE", "webrender.program-binary-disk") +/* Whether partial present is allowed with WebRender, starting in 98. */ +GFXINFO_FEATURE(WEBRENDER_PARTIAL_PRESENT, "WEBRENDER_PARTIAL_PRESENT", "webrender.partial-present") +/* Whether WebGPU is supported, starting in 100. */ +GFXINFO_FEATURE(WEBGPU, "WEBGPU", "webgpu") +/* Whether video overlay of hardware decoded video is supported, starting in 100. */ +GFXINFO_FEATURE(VIDEO_OVERLAY, "VIDEO_OVERLAY", "video-overlay") +/* Whether hardware decoded video zero copy is supported, starting in 101. */ +GFXINFO_FEATURE(HW_DECODED_VIDEO_ZERO_COPY, "HW_DECODED_VIDEO_ZERO_COPY", "hw-video-zero-copy") +/* Whether DMABUF export is supported, starting in 103; downloadable blocking in 133. */ +GFXINFO_FEATURE(DMABUF_SURFACE_EXPORT, "DMABUF_SURFACE_EXPORT", "dmabuf.surface-export") +/* Whether reuse decoder device is supported, starting in 104. */ +GFXINFO_FEATURE(REUSE_DECODER_DEVICE, "REUSE_DECODER_DEVICE", "reuse-decoder-device") +/* Whether to allow backdrop filter, starting in 105. */ +GFXINFO_FEATURE(BACKDROP_FILTER, "BACKDROP_FILTER", "backdrop.filter") +/* Whether to use Accelerated Canvas2D, starting in 110. */ +GFXINFO_FEATURE(ACCELERATED_CANVAS2D, "ACCELERATED_CANVAS2D", "accelerated-canvas2d") +/* Whether hardware H264 decoding is supported, starting in 114; downloadable blocking in 132. */ +GFXINFO_FEATURE(H264_HW_DECODE, "H264_HW_DECODE", "h264.hw-decode") +/* Whether hardware AV1 decoding is supported, starting in 114; downloadable blocking in 132. */ +GFXINFO_FEATURE(AV1_HW_DECODE, "AV1_HW_DECODE", "av1.hw-decode") +/* Whether video overlay of software decoded video is supported, starting in 116; downloadable blocking in 132. */ +GFXINFO_FEATURE(VIDEO_SOFTWARE_OVERLAY, "VIDEO_SOFTWARE_OVERLAY", "video-software-overlay") +/* Whether WebGL is allowed to use hardware rendering, otherwise software fallbacks, starting in 120 (115esr); downloadable blocking in 132. */ +GFXINFO_FEATURE(WEBGL_USE_HARDWARE, "WEBGL_USE_HARDWARE", "webgl-use-hardware") +/* Whether overlay is allowed to VideoProcessor-HDR on SDR content, starting in 125. */ +GFXINFO_FEATURE(OVERLAY_VP_AUTO_HDR, "FEATURE_OVERLAY_VP_AUTO_HDR", "overlay-vp-auto-hdr") +/* Whether overlay is allowed to VideoProcessor Super Resolution, starting in 125. */ +GFXINFO_FEATURE(OVERLAY_VP_SUPER_RESOLUTION, "FEATURE_OVERLAY_VP_SUPER_RESOLUTION", "overlay-vp-super-resolution") diff --git a/widget/GfxInfoFeatureStatusDefs.h b/widget/GfxInfoFeatureStatusDefs.h new file mode 100644 index 000000000000..06f27b30df60 --- /dev/null +++ b/widget/GfxInfoFeatureStatusDefs.h @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// NOTE: No include guard. This is meant to be included to generate different +// code based on how GFXINFO_FEATURE_STATUS is defined, possibly multiple times +// in a single translation unit. + +/* clang-format off */ + +// Note that the order of these is important. The downloadable blocklist values +// are cached inside of preferences which store the enum value as an integer. +// This means we cannot reorder these statuses and can only append new values to +// the end. + +/* The driver is safe to the best of our knowledge */ +GFXINFO_FEATURE_STATUS(STATUS_OK) +/* We don't know the status of the feature yet. The analysis probably hasn't finished yet. */ +GFXINFO_FEATURE_STATUS(STATUS_UNKNOWN) +/* This feature is blocked on this driver version. Updating driver will typically unblock it. */ +GFXINFO_FEATURE_STATUS(BLOCKED_DRIVER_VERSION) +/* This feature is blocked on this device, regardless of driver version. + * Typically means we hit too many driver crashes without a good reason to hope for them to + * get fixed soon. */ +GFXINFO_FEATURE_STATUS(BLOCKED_DEVICE) +/* This feature is available and can be used, but is not suggested (e.g. shouldn't be used by default */ +GFXINFO_FEATURE_STATUS(DISCOURAGED) +/* This feature is blocked on this OS version. */ +GFXINFO_FEATURE_STATUS(BLOCKED_OS_VERSION) +/* This feature is blocked because of mismatched driver versions. */ +GFXINFO_FEATURE_STATUS(BLOCKED_MISMATCHED_VERSION) +/* This feature is blocked due to not being on the allowlist. */ +GFXINFO_FEATURE_STATUS(DENIED) +/* This feature is safe to be on this device due to the allowlist. */ +GFXINFO_FEATURE_STATUS(ALLOW_ALWAYS) +/* This feature is safe to be on this device due to the allowlist, depending on qualified/experiment status. */ +GFXINFO_FEATURE_STATUS(ALLOW_QUALIFIED) +/* This feature failed in a startup test, e.g. due to a crashing driver. */ +GFXINFO_FEATURE_STATUS(BLOCKED_PLATFORM_TEST) diff --git a/widget/GfxInfoOperatingSystemDefs.h b/widget/GfxInfoOperatingSystemDefs.h new file mode 100644 index 000000000000..2495934b62a7 --- /dev/null +++ b/widget/GfxInfoOperatingSystemDefs.h @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// NOTE: No include guard. This is meant to be included to generate different +// code based on how GFXINFO_FEATURE_STATUS is defined, possibly multiple times +// in a single translation unit. + +/* clang-format off */ + +// For historical reasons, "All" in blocklist means "All Windows" +GFXINFO_OS(Windows, "All") +GFXINFO_OS(Windows7, "WINNT 6.1") +GFXINFO_OS(Windows8, "WINNT 6.2") +GFXINFO_OS(Windows8_1, "WINNT 6.3") +GFXINFO_OS(Windows10, "WINNT 10.0") +GFXINFO_OS(RecentWindows10, "WINNT Recent") +GFXINFO_OS(NotRecentWindows10, "WINNT NotRecent") +GFXINFO_OS(Linux, "Linux") +GFXINFO_OS(OSX, "Darwin") +GFXINFO_OS(OSX10_5, "Darwin 9") +GFXINFO_OS(OSX10_6, "Darwin 10") +GFXINFO_OS(OSX10_7, "Darwin 11") +GFXINFO_OS(OSX10_8, "Darwin 12") +GFXINFO_OS(OSX10_9, "Darwin 13") +GFXINFO_OS(OSX10_10, "Darwin 14") +GFXINFO_OS(OSX10_11, "Darwin 15") +GFXINFO_OS(OSX10_12, "Darwin 16") +GFXINFO_OS(OSX10_13, "Darwin 17") +GFXINFO_OS(OSX10_14, "Darwin 18") +GFXINFO_OS(OSX10_15, "Darwin 19") +GFXINFO_OS(OSX11_0, "Darwin 20") +GFXINFO_OS(Android, "Android") +GFXINFO_OS(Ios, "Ios") diff --git a/widget/GfxInfoWindowProtocolDefs.h b/widget/GfxInfoWindowProtocolDefs.h new file mode 100644 index 000000000000..598c45367c7e --- /dev/null +++ b/widget/GfxInfoWindowProtocolDefs.h @@ -0,0 +1,21 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// NOTE: No include guard. This is meant to be included to generate different +// code based on how GFXINFO_FEATURE_STATUS is defined, possibly multiple times +// in a single translation unit. + +/* clang-format off */ + +// There is an assumption that this is the first enum +GFXINFO_WINDOW_PROTOCOL(All, "") +GFXINFO_WINDOW_PROTOCOL(X11, "x11") +GFXINFO_WINDOW_PROTOCOL(XWayland, "xwayland") +GFXINFO_WINDOW_PROTOCOL(Wayland, "wayland") +GFXINFO_WINDOW_PROTOCOL(WaylandDRM, "wayland/drm") +// Wildcard for all Wayland variants, excluding XWayland. +GFXINFO_WINDOW_PROTOCOL(WaylandAll, "wayland/all") +// Wildcard for all X11 variants, including XWayland. +GFXINFO_WINDOW_PROTOCOL(X11All, "x11/all") diff --git a/widget/moz.build b/widget/moz.build index 7d1e4cdce5c7..0f8f75a17831 100644 --- a/widget/moz.build +++ b/widget/moz.build @@ -204,6 +204,13 @@ EXPORTS.mozilla += [ EXPORTS.mozilla.widget += [ "CompositorWidget.h", + "GfxInfoDeviceVendorDefs.h", + "GfxInfoDriverVendorDefs.h", + "GfxInfoDriverVersionCmpDefs.h", + "GfxInfoFeatureDefs.h", + "GfxInfoFeatureStatusDefs.h", + "GfxInfoOperatingSystemDefs.h", + "GfxInfoWindowProtocolDefs.h", "IconLoader.h", "IMEData.h", "InitData.h", diff --git a/widget/nsIGfxInfo.idl b/widget/nsIGfxInfo.idl index 5d2d04a0bdcc..58e303d9e4b9 100644 --- a/widget/nsIGfxInfo.idl +++ b/widget/nsIGfxInfo.idl @@ -120,139 +120,32 @@ interface nsIGfxInfo : nsISupports Array getFailures(out Array indices); [noscript, notxpcom] void logFailure(in ACString failure); + +%{C++ /* * A set of constants for features that we can ask this GfxInfo object * about via GetFeatureStatus */ - /* Don't assign any value <= 0 */ - /* Values must be contiguous */ - /* Whether Direct2D is supported for content rendering. */ - const long FEATURE_DIRECT2D = 1; - /* Whether Direct3D 9 is supported for layers. */ - const long FEATURE_DIRECT3D_9_LAYERS = 2; - /* Whether Direct3D 10.0 is supported for layers. */ - const long FEATURE_DIRECT3D_10_LAYERS = 3; - /* Whether Direct3D 10.1 is supported for layers. */ - const long FEATURE_DIRECT3D_10_1_LAYERS = 4; - /* Whether OpenGL is supported for layers */ - const long FEATURE_OPENGL_LAYERS = 5; - /* Whether WebGL is supported via OpenGL. */ - const long FEATURE_WEBGL_OPENGL = 6; - /* Whether WebGL is supported via ANGLE (D3D9 -- does not check for the presence of ANGLE libs). */ - const long FEATURE_WEBGL_ANGLE = 7; - /* (Unused) Whether WebGL antialiasing is supported. */ - const long UNUSED_FEATURE_WEBGL_MSAA = 8; - /* Whether Stagefright is supported, starting in 17. */ - const long FEATURE_STAGEFRIGHT = 9; - /* Whether Webrtc Hardware H.264 acceleration is supported, starting in 71. */ - const long FEATURE_WEBRTC_HW_ACCELERATION_H264 = 10; - /* Whether Direct3D 11 is supported for layers, starting in 32. */ - const long FEATURE_DIRECT3D_11_LAYERS = 11; - /* Whether hardware accelerated video decoding is supported, starting in 36. */ - const long FEATURE_HARDWARE_VIDEO_DECODING = 12; - /* Whether Direct3D 11 is supported for ANGLE, starting in 38. */ - const long FEATURE_DIRECT3D_11_ANGLE = 13; - /* Whether Webrtc Hardware acceleration is supported, starting in 42. */ - const long FEATURE_WEBRTC_HW_ACCELERATION_ENCODE = 14; - /* Whether Webrtc Hardware acceleration is supported, starting in 42. */ - const long FEATURE_WEBRTC_HW_ACCELERATION_DECODE = 15; - /* Whether Canvas acceleration is supported, starting in 45 */ - const long FEATURE_CANVAS2D_ACCELERATION = 16; - /* Whether hardware VP8 decoding is supported, starting in 48; not for downloadable blocking. */ - const long FEATURE_VP8_HW_DECODE = 17; - /* Whether hardware VP9 decoding is supported, starting in 48; not for downloadable blocking. */ - const long FEATURE_VP9_HW_DECODE = 18; - /* Whether NV_dx_interop2 is supported, starting in 50; downloadable blocking in 58. */ - const long FEATURE_DX_INTEROP2 = 19; - /* Whether the GPU process is supported, starting in 52; downloadable blocking in 58. */ - const long FEATURE_GPU_PROCESS = 20; - /* Whether the WebGL2 is supported, starting in 54 */ - const long FEATURE_WEBGL2 = 21; - /* Whether D3D11 keyed mutex is supported, starting in 56 */ - const long FEATURE_D3D11_KEYED_MUTEX = 22; - /* Whether WebRender is supported, starting in 62 */ - const long FEATURE_WEBRENDER = 23; - /* Whether WebRender is supported, starting in 62 */ - const long FEATURE_DX_NV12 = 24; - const long FEATURE_DX_P010 = 25; - const long FEATURE_DX_P016 = 26; - /* Whether OpenGL swizzle configuration of texture units is supported, starting in 70 */ - const long FEATURE_GL_SWIZZLE = 27; - /* Whether WebRender native compositor is supported, starting in 73 */ - const long FEATURE_WEBRENDER_COMPOSITOR = 28; - /* Whether WebRender can use scissored clears for cached surfaces, staring in 79 */ - const long FEATURE_WEBRENDER_SCISSORED_CACHE_CLEARS = 29; - /* Support webgl.out-of-process: true (starting in 83) */ - const long FEATURE_ALLOW_WEBGL_OUT_OF_PROCESS = 30; - /* Is OpenGL threadsafe (starting in 83) */ - const long FEATURE_THREADSAFE_GL = 31; - /* Whether webrender uses pre-optimized shaders, starting in 87. */ - const long FEATURE_WEBRENDER_OPTIMIZED_SHADERS = 32; - /* Whether we prefer EGL over GLX with X11, starting in 88. */ - const long FEATURE_X11_EGL = 33; - /* Whether DMABUF is supported, starting in 88. */ - const long FEATURE_DMABUF = 34; - /* Whether webrender caches shader program binaries to disk, starting in 89. */ - const long FEATURE_WEBRENDER_SHADER_CACHE = 35; - /* Whether partial present is allowed with WebRender, starting in 98. */ - const long FEATURE_WEBRENDER_PARTIAL_PRESENT = 36; - /* Whether WebGPU is supported, starting in 100. */ - const long FEATURE_WEBGPU = 37; - /* Whether video overlay of hardware decoded video is supported, starting in 100. */ - const long FEATURE_VIDEO_OVERLAY = 38; - /* Whether hardware decoded video zero copy is supported, starting in 101. */ - const long FEATURE_HW_DECODED_VIDEO_ZERO_COPY = 39; - /* Whether DMABUF export is supported, starting in 103. */ - const long FEATURE_DMABUF_SURFACE_EXPORT = 40; - /* Whether reuse decoder device is supported, starting in 104. */ - const long FEATURE_REUSE_DECODER_DEVICE = 41; - /* Whether to allow backdrop filter, starting in 105. */ - const long FEATURE_BACKDROP_FILTER = 42; - /* Whether to use Accelerated Canvas2D, starting in 110. */ - const long FEATURE_ACCELERATED_CANVAS2D = 43; - /* Whether hardware H264 decoding is supported, starting in 114; not for downloadable blocking. */ - const long FEATURE_H264_HW_DECODE = 44; - /* Whether hardware AV1 decoding is supported, starting in 114; not for downloadable blocking. */ - const long FEATURE_AV1_HW_DECODE = 45; - /* Whether video overlay of software decoded video is supported, starting in 116. */ - const long FEATURE_VIDEO_SOFTWARE_OVERLAY = 46; - /* Whether WebGL is allowed to use hardware rendering, otherwise software fallbacks. */ - const long FEATURE_WEBGL_USE_HARDWARE = 47; - /* Whether overlay is allowed to VideoProcessor-HDR on SDR content */ - const long FEATURE_OVERLAY_VP_AUTO_HDR = 48; - /* Whether overlay is allowed to VideoProcessor Super Resolution */ - const long FEATURE_OVERLAY_VP_SUPER_RESOLUTION = 49; - /* the maximum feature value. */ - const long FEATURE_MAX_VALUE = FEATURE_OVERLAY_VP_SUPER_RESOLUTION; + enum FeatureType : uint8_t { + FEATURE_INVALID = 0, +#define GFXINFO_FEATURE(id, name, pref) FEATURE_##id, +#include "mozilla/widget/GfxInfoFeatureDefs.h" +#undef GFXINFO_FEATURE + FEATURE_COUNT, + /* This must be the first value after INVALID/ALL/OPTIONAL. */ + FEATURE_START = FEATURE_DIRECT2D + }; /* * A set of return values from GetFeatureStatus */ - - /* The driver is safe to the best of our knowledge */ - const long FEATURE_STATUS_OK = 1; - /* We don't know the status of the feature yet. The analysis probably hasn't finished yet. */ - const long FEATURE_STATUS_UNKNOWN = 2; - /* This feature is blocked on this driver version. Updating driver will typically unblock it. */ - const long FEATURE_BLOCKED_DRIVER_VERSION = 3; - /* This feature is blocked on this device, regardless of driver version. - * Typically means we hit too many driver crashes without a good reason to hope for them to - * get fixed soon. */ - const long FEATURE_BLOCKED_DEVICE = 4; - /* This feature is available and can be used, but is not suggested (e.g. shouldn't be used by default */ - const long FEATURE_DISCOURAGED = 5; - /* This feature is blocked on this OS version. */ - const long FEATURE_BLOCKED_OS_VERSION = 6; - /* This feature is blocked because of mismatched driver versions. */ - const long FEATURE_BLOCKED_MISMATCHED_VERSION = 7; - /* This feature is blocked due to not being on the allowlist. */ - const long FEATURE_DENIED = 8; - /* This feature is safe to be on this device due to the allowlist. */ - const long FEATURE_ALLOW_ALWAYS = 9; - /* This feature is safe to be on this device due to the allowlist, depending on qualified/experiment status. */ - const long FEATURE_ALLOW_QUALIFIED = 10; - /* This feature failed in a startup test, e.g. due to a crashing driver. */ - const long FEATURE_BLOCKED_PLATFORM_TEST = 11; + enum FeatureStatusType : uint8_t { + FEATURE_STATUS_INVALID = 0, +#define GFXINFO_FEATURE_STATUS(id) FEATURE_##id, +#include "mozilla/widget/GfxInfoFeatureStatusDefs.h" +#undef GFXINFO_FEATURE_STATUS + }; +%} /** * Ask about a feature, and return the status of that feature. @@ -260,12 +153,14 @@ interface nsIGfxInfo : nsISupports * otherwise it will be empty. */ long getFeatureStatus(in long aFeature, [optional] out ACString aFailureId); + AString getFeatureStatusStr(in AString aFeature, [optional] out ACString aFailureId); /* * Ask about a feature, return the minimum driver version required for it if its status is * FEATURE_BLOCKED_DRIVER_VERSION, otherwise return an empty string. */ AString getFeatureSuggestedDriverVersion(in long aFeature); + AString getFeatureSuggestedDriverVersionStr(in AString aFeature); // only useful on X11 [noscript, notxpcom] void GetData(); diff --git a/widget/windows/GfxInfo.cpp b/widget/windows/GfxInfo.cpp index 7b6f4403c51e..58d4c6c48913 100644 --- a/widget/windows/GfxInfo.cpp +++ b/widget/windows/GfxInfo.cpp @@ -1619,19 +1619,6 @@ const nsTArray& GfxInfo::GetGfxDriverInfo() { V(8, 17, 12, 5730), V(8, 17, 12, 6901), "FEATURE_FAILURE_BUG_1137716", "Nvidia driver > 8.17.12.6901"); - /* Bug 1336710: Crash in rx::Blit9::initialize. */ - APPEND_TO_DRIVER_BLOCKLIST2( - OperatingSystem::WindowsXP, DeviceFamily::IntelGMAX4500HD, - nsIGfxInfo::FEATURE_WEBGL_ANGLE, nsIGfxInfo::FEATURE_BLOCKED_DEVICE, - DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions, - "FEATURE_FAILURE_BUG_1336710"); - - APPEND_TO_DRIVER_BLOCKLIST2( - OperatingSystem::WindowsXP, DeviceFamily::IntelHDGraphicsToSandyBridge, - nsIGfxInfo::FEATURE_WEBGL_ANGLE, nsIGfxInfo::FEATURE_BLOCKED_DEVICE, - DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions, - "FEATURE_FAILURE_BUG_1336710"); - /* Bug 1304360: Graphical artifacts with D3D9 on Windows 7. */ APPEND_TO_DRIVER_BLOCKLIST2(OperatingSystem::Windows7, DeviceFamily::IntelGMAX3000,