Bug 1135408: Report device resets and their reasons through telemetry. r=vladan

This commit is contained in:
Bas Schouten 2015-02-22 22:53:32 +00:00
Родитель 42d9427fd6
Коммит 45eb4195cb
4 изменённых файлов: 49 добавлений и 5 удалений

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

@ -159,6 +159,16 @@ GetBackendName(mozilla::gfx::BackendType aBackend)
MOZ_CRASH("Incomplete switch");
}
enum class DeviceResetReason
{
OK = 0,
HUNG,
REMOVED,
RESET,
DRIVER_ERROR,
INVALID_CALL
};
class gfxPlatform {
friend class SRGBOverrideObserver;
@ -435,7 +445,7 @@ public:
// check whether format is supported on a platform or not (if unclear, returns true)
virtual bool IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags) { return false; }
virtual bool DidRenderingDeviceReset() { return false; }
virtual bool DidRenderingDeviceReset(DeviceResetReason* aResetReason = nullptr) { return false; }
void GetPrefFonts(nsIAtom *aLanguage, nsString& array, bool aAppendUnicode = true);

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

@ -18,6 +18,7 @@
#include "mozilla/WindowsVersion.h"
#include "nsServiceManagerUtils.h"
#include "nsTArray.h"
#include "mozilla/Telemetry.h"
#include "nsIWindowsRegKey.h"
#include "nsIFile.h"
@ -474,7 +475,9 @@ gfxWindowsPlatform::UpdateRenderMode()
* desktop.
*/
bool didReset = false;
if (DidRenderingDeviceReset()) {
DeviceResetReason resetReason = DeviceResetReason::OK;
if (DidRenderingDeviceReset(&resetReason)) {
Telemetry::Accumulate(Telemetry::DEVICE_RESET_REASON, uint32_t(resetReason));
mD3D11DeviceInitialized = false;
mD3D11Device = nullptr;
mD3D11ContentDevice = nullptr;
@ -1140,10 +1143,35 @@ gfxWindowsPlatform::IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlag
}
bool
gfxWindowsPlatform::DidRenderingDeviceReset()
gfxWindowsPlatform::DidRenderingDeviceReset(DeviceResetReason* aResetReason)
{
if (aResetReason) {
*aResetReason = DeviceResetReason::OK;
}
if (mD3D11Device) {
if (mD3D11Device->GetDeviceRemovedReason() != S_OK) {
HRESULT hr = mD3D11Device->GetDeviceRemovedReason();
if (hr != S_OK) {
if (aResetReason) {
switch (hr) {
case DXGI_ERROR_DEVICE_HUNG:
*aResetReason = DeviceResetReason::HUNG;
break;
case DXGI_ERROR_DEVICE_REMOVED:
*aResetReason = DeviceResetReason::REMOVED;
break;
case DXGI_ERROR_DEVICE_RESET:
*aResetReason = DeviceResetReason::RESET;
break;
case DXGI_ERROR_DRIVER_INTERNAL_ERROR:
*aResetReason = DeviceResetReason::DRIVER_ERROR;
break;
case DXGI_ERROR_INVALID_CALL:
*aResetReason = DeviceResetReason::INVALID_CALL;
default:
MOZ_ASSERT(false);
}
}
return true;
}
}

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

@ -210,7 +210,7 @@ public:
*/
virtual bool IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags);
virtual bool DidRenderingDeviceReset();
virtual bool DidRenderingDeviceReset(DeviceResetReason* aResetReason = nullptr);
// ClearType is not always enabled even when available (e.g. Windows XP)
// if either of these prefs are enabled and apply, use ClearType rendering

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

@ -210,6 +210,12 @@
"n_buckets": 50,
"description": "Time spent on one asynchronous SnowWhite freeing (ms)"
},
"DEVICE_RESET_REASON": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 10,
"description": "GPU Device Reset Reason (ok, hung, removed, reset, internal error, invalid call)"
},
"FORGET_SKIPPABLE_MAX": {
"expires_in_version": "never",
"kind": "exponential",