Add d3d11/d2d and compositor information to telemetry. (bug 1179051 part 6, r=dexter)

This commit is contained in:
David Anderson 2015-07-19 14:55:44 -07:00
Родитель 28d2dc3e58
Коммит d67574f90d
3 изменённых файлов: 58 добавлений и 0 удалений

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

@ -157,6 +157,7 @@ const PREF_UPDATE_AUTODOWNLOAD = "app.update.auto";
const EXPERIMENTS_CHANGED_TOPIC = "experiments-changed";
const SEARCH_ENGINE_MODIFIED_TOPIC = "browser-search-engine-modified";
const SEARCH_SERVICE_TOPIC = "browser-search-service";
const COMPOSITOR_CREATED_TOPIC = "compositor:created";
/**
* Get the current browser.
@ -809,12 +810,14 @@ EnvironmentCache.prototype = {
// Watch the search engine change and service topics.
Services.obs.addObserver(this, SEARCH_ENGINE_MODIFIED_TOPIC, false);
Services.obs.addObserver(this, SEARCH_SERVICE_TOPIC, false);
Services.obs.addObserver(this, COMPOSITOR_CREATED_TOPIC, false);
},
_removeObservers: function () {
// Remove the search engine change and service observers.
Services.obs.removeObserver(this, SEARCH_ENGINE_MODIFIED_TOPIC);
Services.obs.removeObserver(this, SEARCH_SERVICE_TOPIC);
Services.obs.removeObserver(this, COMPOSITOR_CREATED_TOPIC);
},
observe: function (aSubject, aTopic, aData) {
@ -834,6 +837,12 @@ EnvironmentCache.prototype = {
// Now that the search engine init is complete, record the default search choice.
this._updateSearchEngine();
break;
case COMPOSITOR_CREATED_TOPIC:
// Full graphics information is not available until we have created at
// least one off-main-thread-composited window. Thus we wait for the
// first compositor to be created and then query nsIGfxInfo again.
this._onCompositorCreated();
break;
}
},
@ -896,6 +905,19 @@ EnvironmentCache.prototype = {
this._onEnvironmentChange("search-engine-changed", oldEnvironment);
},
/**
* Update the graphics features object.
*/
_onCompositorCreated: function () {
let gfxData = this._currentEnvironment.system.gfx;
try {
let gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo);
gfxData.features = gfxInfo.getFeatures();
} catch (e) {
this._log.error("nsIGfxInfo.getFeatures() caught error", e);
}
},
/**
* Get the build data in object form.
* @return Object containing the build data.
@ -1128,6 +1150,7 @@ EnvironmentCache.prototype = {
//DWriteVersion: getGfxField("DWriteVersion", null),
adapters: [],
monitors: [],
features: {},
};
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_WIDGET_GTK)
@ -1139,6 +1162,13 @@ EnvironmentCache.prototype = {
}
#endif
try {
let gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo);
gfxData.features = gfxInfo.getFeatures();
} catch (e) {
this._log.error("nsIGfxInfo.getFeatures() caught error", e);
}
// GfxInfo does not yet expose a way to iterate through all the adapters.
gfxData.adapters.push(getGfxAdapter(""));
gfxData.adapters[0].GPUActive = true;

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

@ -145,6 +145,28 @@ Structure::
},
...
],
features: {
compositor: <string>, // Layers backend for compositing (eg "d3d11", "none", "opengl")
// Each the following features can have one of the following statuses:
// "unused" - This feature has not been requested.
// "unavailable" - Safe Mode or OS restriction prevents use.
// "blocked" - Blocked due to an internal condition such as safe mode.
// "blacklisted" - Blocked due to a blacklist restriction.
// "disabled" - User explicitly disabled this default feature.
// "failed" - This feature was attempted but failed to initialize.
// "available" - User has this feature available.
"d3d11" { // This feature is Windows-only.
status: <string>,
warp: <bool>, // Software rendering (WARP) mode was chosen.
textureSharing: <bool> // Whether or not texture sharing works.
version: <number>, // The D3D11 device feature level.
},
"d2d" { // This feature is Windows-only.
status: <string>,
version: <string>, // Either "1.0" or "1.1".
},
},
},
},
addons: {

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

@ -430,6 +430,9 @@ function checkSystemSection(data) {
}
}
Assert.equal(typeof gfxData.features, "object");
Assert.equal(typeof gfxData.features.compositor, "string");
try {
// If we've not got nsIGfxInfoDebug, then this will throw and stop us doing
// this test.
@ -439,6 +442,9 @@ function checkSystemSection(data) {
Assert.equal(GFX_VENDOR_ID, gfxData.adapters[0].vendorID);
Assert.equal(GFX_DEVICE_ID, gfxData.adapters[0].deviceID);
}
let features = gfxInfo.getFeatures();
Assert.equal(features.compositor, gfxData.features.compositor);
}
catch (e) {}
}