2011-01-06 07:54:31 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2011-01-06 07:54:31 +03:00
|
|
|
|
|
|
|
#include "GfxInfo.h"
|
2013-11-15 20:28:43 +04:00
|
|
|
#include "GLContext.h"
|
2013-12-19 00:49:13 +04:00
|
|
|
#include "GLContextProvider.h"
|
2011-01-06 07:54:31 +03:00
|
|
|
#include "nsUnicharUtils.h"
|
|
|
|
#include "prenv.h"
|
2017-11-23 12:59:04 +03:00
|
|
|
#include "nsExceptionHandler.h"
|
2011-11-03 18:50:40 +04:00
|
|
|
#include "nsHashKeys.h"
|
2017-11-23 12:59:04 +03:00
|
|
|
#include "nsICrashReporter.h"
|
2012-12-22 02:32:14 +04:00
|
|
|
#include "nsVersionComparator.h"
|
2011-01-06 07:54:32 +03:00
|
|
|
#include "AndroidBridge.h"
|
2013-11-15 20:28:47 +04:00
|
|
|
#include "nsIWindowWatcher.h"
|
|
|
|
#include "nsServiceManagerUtils.h"
|
2011-01-06 07:54:32 +03:00
|
|
|
|
2011-01-06 07:54:31 +03:00
|
|
|
#define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1"
|
|
|
|
|
2013-11-15 20:28:43 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace widget {
|
|
|
|
|
2013-11-15 20:28:47 +04:00
|
|
|
class GfxInfo::GLStrings {
|
2013-11-15 20:28:43 +04:00
|
|
|
nsCString mVendor;
|
|
|
|
nsCString mRenderer;
|
|
|
|
nsCString mVersion;
|
|
|
|
bool mReady;
|
|
|
|
|
|
|
|
public:
|
|
|
|
GLStrings() : mReady(false) {}
|
|
|
|
|
|
|
|
const nsCString& Vendor() {
|
|
|
|
EnsureInitialized();
|
|
|
|
return mVendor;
|
|
|
|
}
|
|
|
|
|
2015-02-19 00:50:31 +03:00
|
|
|
// This spoofed value wins, even if the environment variable
|
|
|
|
// MOZ_GFX_SPOOF_GL_VENDOR was set.
|
2013-11-15 20:28:43 +04:00
|
|
|
void SpoofVendor(const nsCString& s) { mVendor = s; }
|
|
|
|
|
|
|
|
const nsCString& Renderer() {
|
|
|
|
EnsureInitialized();
|
|
|
|
return mRenderer;
|
|
|
|
}
|
|
|
|
|
2015-02-19 00:50:31 +03:00
|
|
|
// This spoofed value wins, even if the environment variable
|
|
|
|
// MOZ_GFX_SPOOF_GL_RENDERER was set.
|
2013-11-15 20:28:43 +04:00
|
|
|
void SpoofRenderer(const nsCString& s) { mRenderer = s; }
|
|
|
|
|
|
|
|
const nsCString& Version() {
|
|
|
|
EnsureInitialized();
|
|
|
|
return mVersion;
|
|
|
|
}
|
|
|
|
|
2015-02-19 00:50:31 +03:00
|
|
|
// This spoofed value wins, even if the environment variable
|
|
|
|
// MOZ_GFX_SPOOF_GL_VERSION was set.
|
2013-11-15 20:28:43 +04:00
|
|
|
void SpoofVersion(const nsCString& s) { mVersion = s; }
|
|
|
|
|
|
|
|
void EnsureInitialized() {
|
2014-01-10 00:31:55 +04:00
|
|
|
if (mReady) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<gl::GLContext> gl;
|
2016-06-06 23:52:42 +03:00
|
|
|
nsCString discardFailureId;
|
|
|
|
gl = gl::GLContextProvider::CreateHeadless(
|
|
|
|
gl::CreateContextFlags::REQUIRE_COMPAT_PROFILE, &discardFailureId);
|
2013-12-19 00:49:13 +04:00
|
|
|
|
2014-01-10 00:31:55 +04:00
|
|
|
if (!gl) {
|
|
|
|
// Setting mReady to true here means that we won't retry. Everything will
|
|
|
|
// remain blacklisted forever. Ideally, we would like to update that once
|
|
|
|
// any GLContext is successfully created, like the compositor's GLContext.
|
2013-12-19 00:49:13 +04:00
|
|
|
mReady = true;
|
2014-01-10 00:31:55 +04:00
|
|
|
return;
|
2013-11-15 20:28:43 +04:00
|
|
|
}
|
2014-01-10 00:31:55 +04:00
|
|
|
|
|
|
|
gl->MakeCurrent();
|
|
|
|
|
2015-02-19 00:50:31 +03:00
|
|
|
if (mVendor.IsEmpty()) {
|
|
|
|
const char* spoofedVendor = PR_GetEnv("MOZ_GFX_SPOOF_GL_VENDOR");
|
|
|
|
if (spoofedVendor) {
|
2014-01-10 00:31:55 +04:00
|
|
|
mVendor.Assign(spoofedVendor);
|
2015-02-19 00:50:31 +03:00
|
|
|
} else {
|
2014-01-10 00:31:55 +04:00
|
|
|
mVendor.Assign((const char*)gl->fGetString(LOCAL_GL_VENDOR));
|
2015-02-19 00:50:31 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mRenderer.IsEmpty()) {
|
|
|
|
const char* spoofedRenderer = PR_GetEnv("MOZ_GFX_SPOOF_GL_RENDERER");
|
|
|
|
if (spoofedRenderer) {
|
2014-01-10 00:31:55 +04:00
|
|
|
mRenderer.Assign(spoofedRenderer);
|
2015-02-19 00:50:31 +03:00
|
|
|
} else {
|
2014-01-10 00:31:55 +04:00
|
|
|
mRenderer.Assign((const char*)gl->fGetString(LOCAL_GL_RENDERER));
|
2015-02-19 00:50:31 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mVersion.IsEmpty()) {
|
|
|
|
const char* spoofedVersion = PR_GetEnv("MOZ_GFX_SPOOF_GL_VERSION");
|
|
|
|
if (spoofedVersion) {
|
2014-01-10 00:31:55 +04:00
|
|
|
mVersion.Assign(spoofedVersion);
|
2015-02-19 00:50:31 +03:00
|
|
|
} else {
|
2014-01-10 00:31:55 +04:00
|
|
|
mVersion.Assign((const char*)gl->fGetString(LOCAL_GL_VERSION));
|
2015-02-19 00:50:31 +03:00
|
|
|
}
|
|
|
|
}
|
2014-01-10 00:31:55 +04:00
|
|
|
|
|
|
|
mReady = true;
|
2013-11-15 20:28:43 +04:00
|
|
|
}
|
|
|
|
};
|
2011-01-06 07:54:31 +03:00
|
|
|
|
2011-12-15 09:04:35 +04:00
|
|
|
#ifdef DEBUG
|
2014-04-27 11:06:00 +04:00
|
|
|
NS_IMPL_ISUPPORTS_INHERITED(GfxInfo, GfxInfoBase, nsIGfxInfoDebug)
|
2011-12-15 09:04:35 +04:00
|
|
|
#endif
|
|
|
|
|
2012-07-05 18:12:33 +04:00
|
|
|
GfxInfo::GfxInfo()
|
2013-11-15 20:28:43 +04:00
|
|
|
: mInitialized(false),
|
|
|
|
mGLStrings(new GLStrings),
|
2016-02-22 16:23:00 +03:00
|
|
|
mOSVersionInteger(0),
|
|
|
|
mSDKVersion(0) {}
|
2012-07-05 18:12:33 +04:00
|
|
|
|
2014-08-26 23:07:59 +04:00
|
|
|
GfxInfo::~GfxInfo() {}
|
|
|
|
|
2011-01-06 07:54:31 +03:00
|
|
|
/* GetD2DEnabled and GetDwriteEnabled shouldn't be called until after
|
|
|
|
* gfxPlatform initialization has occurred because they depend on it for
|
|
|
|
* information. (See bug 591561) */
|
2011-09-29 10:19:26 +04:00
|
|
|
nsresult GfxInfo::GetD2DEnabled(bool* aEnabled) { return NS_ERROR_FAILURE; }
|
2011-01-06 07:54:31 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
nsresult GfxInfo::GetDWriteEnabled(bool* aEnabled) { return NS_ERROR_FAILURE; }
|
2011-06-24 21:41:18 +04:00
|
|
|
|
2011-01-14 15:57:17 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetDWriteVersion(nsAString& aDwriteVersion) {
|
|
|
|
return NS_ERROR_FAILURE;
|
2011-05-11 04:30:20 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetCleartypeParameters(nsAString& aCleartypeParams) {
|
|
|
|
return NS_ERROR_FAILURE;
|
2011-01-14 15:57:17 +03:00
|
|
|
}
|
|
|
|
|
2013-11-15 20:28:43 +04:00
|
|
|
void GfxInfo::EnsureInitialized() {
|
|
|
|
if (mInitialized) return;
|
|
|
|
|
2015-02-19 00:50:31 +03:00
|
|
|
if (!mozilla::AndroidBridge::Bridge()) {
|
|
|
|
gfxWarning() << "AndroidBridge missing during initialization";
|
|
|
|
return;
|
|
|
|
}
|
2013-11-15 20:28:43 +04:00
|
|
|
|
|
|
|
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build",
|
|
|
|
"MODEL", mModel)) {
|
|
|
|
mAdapterDescription.AppendPrintf("Model: %s",
|
|
|
|
NS_LossyConvertUTF16toASCII(mModel).get());
|
2012-07-05 18:12:33 +04:00
|
|
|
}
|
|
|
|
|
2013-11-15 20:28:43 +04:00
|
|
|
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField(
|
|
|
|
"android/os/Build", "PRODUCT", mProduct)) {
|
|
|
|
mAdapterDescription.AppendPrintf(
|
|
|
|
", Product: %s", NS_LossyConvertUTF16toASCII(mProduct).get());
|
|
|
|
}
|
2012-07-05 18:12:33 +04:00
|
|
|
|
2013-11-15 20:28:43 +04:00
|
|
|
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField(
|
|
|
|
"android/os/Build", "MANUFACTURER", mManufacturer)) {
|
|
|
|
mAdapterDescription.AppendPrintf(
|
|
|
|
", Manufacturer: %s", NS_LossyConvertUTF16toASCII(mManufacturer).get());
|
2012-07-05 18:12:33 +04:00
|
|
|
}
|
|
|
|
|
2016-02-22 16:23:00 +03:00
|
|
|
if (mozilla::AndroidBridge::Bridge()->GetStaticIntField(
|
|
|
|
"android/os/Build$VERSION", "SDK_INT", &mSDKVersion)) {
|
|
|
|
// the HARDWARE field isn't available on Android SDK < 8, but we require 9+
|
|
|
|
// anyway.
|
|
|
|
MOZ_ASSERT(mSDKVersion >= 8);
|
|
|
|
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField(
|
|
|
|
"android/os/Build", "HARDWARE", mHardware)) {
|
|
|
|
mAdapterDescription.AppendPrintf(
|
|
|
|
", Hardware: %s", NS_LossyConvertUTF16toASCII(mHardware).get());
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
mSDKVersion = 0;
|
2013-11-15 20:28:43 +04:00
|
|
|
}
|
2011-12-15 09:03:03 +04:00
|
|
|
|
2013-11-15 20:28:43 +04:00
|
|
|
nsString release;
|
|
|
|
mozilla::AndroidBridge::Bridge()->GetStaticStringField(
|
|
|
|
"android/os/Build$VERSION", "RELEASE", release);
|
|
|
|
mOSVersion = NS_LossyConvertUTF16toASCII(release);
|
2011-12-15 09:03:03 +04:00
|
|
|
|
2013-11-15 20:28:43 +04:00
|
|
|
mOSVersionInteger = 0;
|
|
|
|
char a[5], b[5], c[5], d[5];
|
|
|
|
SplitDriverVersion(mOSVersion.get(), a, b, c, d);
|
|
|
|
uint8_t na = atoi(a);
|
|
|
|
uint8_t nb = atoi(b);
|
|
|
|
uint8_t nc = atoi(c);
|
|
|
|
uint8_t nd = atoi(d);
|
2011-12-15 09:03:03 +04:00
|
|
|
|
2013-11-15 20:28:43 +04:00
|
|
|
mOSVersionInteger = (uint32_t(na) << 24) | (uint32_t(nb) << 16) |
|
|
|
|
(uint32_t(nc) << 8) | uint32_t(nd);
|
2012-12-22 02:32:14 +04:00
|
|
|
|
2013-11-15 20:28:43 +04:00
|
|
|
mAdapterDescription.AppendPrintf(
|
|
|
|
", OpenGL: %s -- %s -- %s", mGLStrings->Vendor().get(),
|
|
|
|
mGLStrings->Renderer().get(), mGLStrings->Version().get());
|
2011-12-15 09:03:03 +04:00
|
|
|
|
2012-07-05 18:12:33 +04:00
|
|
|
AddCrashReportAnnotations();
|
2013-11-15 20:28:43 +04:00
|
|
|
|
|
|
|
mInitialized = true;
|
2011-01-06 07:54:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDescription(nsAString& aAdapterDescription) {
|
2013-11-15 20:28:42 +04:00
|
|
|
EnsureInitialized();
|
2012-07-05 18:12:33 +04:00
|
|
|
aAdapterDescription = NS_ConvertASCIItoUTF16(mAdapterDescription);
|
2011-01-06 07:54:31 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 17:46:41 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDescription2(nsAString& aAdapterDescription) {
|
2013-11-15 20:28:42 +04:00
|
|
|
EnsureInitialized();
|
2011-08-12 17:46:41 +04:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-01-06 07:54:31 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterRAM(nsAString& aAdapterRAM) {
|
2013-11-15 20:28:42 +04:00
|
|
|
EnsureInitialized();
|
2014-05-26 22:54:53 +04:00
|
|
|
aAdapterRAM.Truncate();
|
2011-01-06 07:54:31 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 17:46:41 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterRAM2(nsAString& aAdapterRAM) {
|
2013-11-15 20:28:42 +04:00
|
|
|
EnsureInitialized();
|
2011-08-12 17:46:41 +04:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-01-06 07:54:31 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriver(nsAString& aAdapterDriver) {
|
2013-11-15 20:28:42 +04:00
|
|
|
EnsureInitialized();
|
2014-05-26 22:54:53 +04:00
|
|
|
aAdapterDriver.Truncate();
|
2011-01-06 07:54:31 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 17:46:41 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriver2(nsAString& aAdapterDriver) {
|
2013-11-15 20:28:42 +04:00
|
|
|
EnsureInitialized();
|
2011-08-12 17:46:41 +04:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-01-06 07:54:31 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverVersion(nsAString& aAdapterDriverVersion) {
|
2013-11-15 20:28:42 +04:00
|
|
|
EnsureInitialized();
|
2013-11-15 20:28:43 +04:00
|
|
|
aAdapterDriverVersion = NS_ConvertASCIItoUTF16(mGLStrings->Version());
|
2011-01-06 07:54:31 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 17:46:41 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverVersion2(nsAString& aAdapterDriverVersion) {
|
2013-11-15 20:28:42 +04:00
|
|
|
EnsureInitialized();
|
2011-08-12 17:46:41 +04:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-01-06 07:54:31 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverDate(nsAString& aAdapterDriverDate) {
|
2013-11-15 20:28:42 +04:00
|
|
|
EnsureInitialized();
|
2014-05-26 22:54:53 +04:00
|
|
|
aAdapterDriverDate.Truncate();
|
2011-01-06 07:54:31 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 17:46:41 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverDate2(nsAString& aAdapterDriverDate) {
|
2013-11-15 20:28:42 +04:00
|
|
|
EnsureInitialized();
|
2011-08-12 17:46:41 +04:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-01-06 07:54:31 +03:00
|
|
|
NS_IMETHODIMP
|
2011-12-15 09:03:01 +04:00
|
|
|
GfxInfo::GetAdapterVendorID(nsAString& aAdapterVendorID) {
|
2013-11-15 20:28:42 +04:00
|
|
|
EnsureInitialized();
|
2013-11-15 20:28:43 +04:00
|
|
|
aAdapterVendorID = NS_ConvertASCIItoUTF16(mGLStrings->Vendor());
|
2011-01-06 07:54:31 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 17:46:41 +04:00
|
|
|
NS_IMETHODIMP
|
2011-12-15 09:03:01 +04:00
|
|
|
GfxInfo::GetAdapterVendorID2(nsAString& aAdapterVendorID) {
|
2013-11-15 20:28:42 +04:00
|
|
|
EnsureInitialized();
|
2011-08-12 17:46:41 +04:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-01-06 07:54:31 +03:00
|
|
|
NS_IMETHODIMP
|
2011-12-15 09:03:01 +04:00
|
|
|
GfxInfo::GetAdapterDeviceID(nsAString& aAdapterDeviceID) {
|
2013-11-15 20:28:42 +04:00
|
|
|
EnsureInitialized();
|
2013-11-15 20:28:43 +04:00
|
|
|
aAdapterDeviceID = NS_ConvertASCIItoUTF16(mGLStrings->Renderer());
|
2011-01-06 07:54:31 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 17:46:41 +04:00
|
|
|
NS_IMETHODIMP
|
2011-12-15 09:03:01 +04:00
|
|
|
GfxInfo::GetAdapterDeviceID2(nsAString& aAdapterDeviceID) {
|
2013-11-15 20:28:42 +04:00
|
|
|
EnsureInitialized();
|
2011-08-12 17:46:41 +04:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2014-07-09 22:21:49 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterSubsysID(nsAString& aAdapterSubsysID) {
|
|
|
|
EnsureInitialized();
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterSubsysID2(nsAString& aAdapterSubsysID) {
|
|
|
|
EnsureInitialized();
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-08-12 17:46:41 +04:00
|
|
|
NS_IMETHODIMP
|
2011-09-29 10:19:26 +04:00
|
|
|
GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active) {
|
2013-11-15 20:28:42 +04:00
|
|
|
EnsureInitialized();
|
2011-08-12 17:46:41 +04:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2012-07-05 18:12:33 +04:00
|
|
|
void GfxInfo::AddCrashReportAnnotations() {
|
Bug 1348273 - Convert crash annotations into a machine-readable list of constants; r=ted.mielczarek,njn,dholbert,mak,cpearce,mcmanus,froydnj,Dexter,jrmuizel,jchen,jimm,bz,surkov
This introduces the machinery needed to generate crash annotations from a YAML
file. The relevant C++ functions are updated to take a typed enum. JavaScript
calls are unaffected but they will throw if the string argument does not
correspond to one of the known entries in the C++ enum. The existing whitelists
and blacklists of annotations are also generated from the YAML file and all
duplicate code related to them has been consolidated. Once written out to the
.extra file the annotations are converted in string form and are no different
than the existing ones.
All existing annotations have been included in the list (and some obsolete ones
have been removed) and all call sites have been updated including tests where
appropriate.
--HG--
extra : source : 4f6c43f2830701ec5552e08e3f1b06fe6d045860
2018-07-05 16:42:11 +03:00
|
|
|
CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::AdapterVendorID,
|
2013-11-15 20:28:43 +04:00
|
|
|
mGLStrings->Vendor());
|
Bug 1348273 - Convert crash annotations into a machine-readable list of constants; r=ted.mielczarek,njn,dholbert,mak,cpearce,mcmanus,froydnj,Dexter,jrmuizel,jchen,jimm,bz,surkov
This introduces the machinery needed to generate crash annotations from a YAML
file. The relevant C++ functions are updated to take a typed enum. JavaScript
calls are unaffected but they will throw if the string argument does not
correspond to one of the known entries in the C++ enum. The existing whitelists
and blacklists of annotations are also generated from the YAML file and all
duplicate code related to them has been consolidated. Once written out to the
.extra file the annotations are converted in string form and are no different
than the existing ones.
All existing annotations have been included in the list (and some obsolete ones
have been removed) and all call sites have been updated including tests where
appropriate.
--HG--
extra : source : 4f6c43f2830701ec5552e08e3f1b06fe6d045860
2018-07-05 16:42:11 +03:00
|
|
|
CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::AdapterDeviceID,
|
2013-11-15 20:28:43 +04:00
|
|
|
mGLStrings->Renderer());
|
Bug 1348273 - Convert crash annotations into a machine-readable list of constants; r=ted.mielczarek,njn,dholbert,mak,cpearce,mcmanus,froydnj,Dexter,jrmuizel,jchen,jimm,bz,surkov
This introduces the machinery needed to generate crash annotations from a YAML
file. The relevant C++ functions are updated to take a typed enum. JavaScript
calls are unaffected but they will throw if the string argument does not
correspond to one of the known entries in the C++ enum. The existing whitelists
and blacklists of annotations are also generated from the YAML file and all
duplicate code related to them has been consolidated. Once written out to the
.extra file the annotations are converted in string form and are no different
than the existing ones.
All existing annotations have been included in the list (and some obsolete ones
have been removed) and all call sites have been updated including tests where
appropriate.
--HG--
extra : source : 4f6c43f2830701ec5552e08e3f1b06fe6d045860
2018-07-05 16:42:11 +03:00
|
|
|
CrashReporter::AnnotateCrashReport(
|
|
|
|
CrashReporter::Annotation::AdapterDriverVersion, mGLStrings->Version());
|
2011-01-06 07:54:31 +03:00
|
|
|
}
|
|
|
|
|
2011-12-15 09:02:59 +04:00
|
|
|
const nsTArray<GfxDriverInfo>& GfxInfo::GetGfxDriverInfo() {
|
2018-05-14 18:16:50 +03:00
|
|
|
if (sDriverInfo->IsEmpty()) {
|
2016-06-03 23:13:08 +03:00
|
|
|
APPEND_TO_DRIVER_BLOCKLIST2(
|
|
|
|
OperatingSystem::Android,
|
2012-06-13 23:54:02 +04:00
|
|
|
(nsAString&)GfxDriverInfo::GetDeviceVendor(VendorAll),
|
2014-07-02 01:44:09 +04:00
|
|
|
GfxDriverInfo::allDevices, nsIGfxInfo::FEATURE_OPENGL_LAYERS,
|
2016-04-14 00:12:47 +03:00
|
|
|
nsIGfxInfo::FEATURE_STATUS_OK, DRIVER_COMPARISON_IGNORED,
|
|
|
|
GfxDriverInfo::allDriverVersions, "FEATURE_OK_FORCE_OPENGL");
|
2011-12-15 09:03:06 +04:00
|
|
|
}
|
2012-07-05 18:12:54 +04:00
|
|
|
|
2018-05-14 18:16:50 +03:00
|
|
|
return *sDriverInfo;
|
2011-11-03 18:50:40 +04:00
|
|
|
}
|
|
|
|
|
2014-04-23 03:23:18 +04:00
|
|
|
nsresult GfxInfo::GetFeatureStatusImpl(
|
2016-04-14 00:12:47 +03:00
|
|
|
int32_t aFeature, int32_t* aStatus, nsAString& aSuggestedDriverVersion,
|
2014-04-23 03:23:18 +04:00
|
|
|
const nsTArray<GfxDriverInfo>& aDriverInfo, nsACString& aFailureId,
|
2012-07-30 18:20:58 +04:00
|
|
|
OperatingSystem* aOS /* = nullptr */) {
|
2011-12-15 09:03:08 +04:00
|
|
|
NS_ENSURE_ARG_POINTER(aStatus);
|
2011-10-17 18:59:28 +04:00
|
|
|
aSuggestedDriverVersion.SetIsVoid(true);
|
2011-12-15 09:03:08 +04:00
|
|
|
*aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
|
2012-11-02 01:13:10 +04:00
|
|
|
OperatingSystem os = mOS;
|
2011-12-15 09:03:08 +04:00
|
|
|
if (aOS) *aOS = os;
|
2011-11-03 18:50:40 +04:00
|
|
|
|
2018-05-14 18:16:50 +03:00
|
|
|
if (sShutdownOccurred) {
|
2018-05-09 00:37:25 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2013-11-15 20:28:43 +04:00
|
|
|
// OpenGL layers are never blacklisted on Android.
|
2013-12-19 00:49:13 +04:00
|
|
|
// This early return is so we avoid potentially slow
|
|
|
|
// GLStrings initialization on startup when we initialize GL layers.
|
2013-11-15 20:28:43 +04:00
|
|
|
if (aFeature == nsIGfxInfo::FEATURE_OPENGL_LAYERS) {
|
2014-07-02 01:44:09 +04:00
|
|
|
*aStatus = nsIGfxInfo::FEATURE_STATUS_OK;
|
2012-07-05 18:12:33 +04:00
|
|
|
return NS_OK;
|
2011-01-12 07:50:45 +03:00
|
|
|
}
|
|
|
|
|
2013-11-15 20:28:43 +04:00
|
|
|
EnsureInitialized();
|
|
|
|
|
2014-01-10 00:31:55 +04:00
|
|
|
if (mGLStrings->Vendor().IsEmpty() || mGLStrings->Renderer().IsEmpty()) {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-07-05 18:13:04 +04:00
|
|
|
// Don't evaluate special cases when evaluating the downloaded blocklist.
|
|
|
|
if (aDriverInfo.IsEmpty()) {
|
2016-02-22 16:23:00 +03:00
|
|
|
if (aFeature == nsIGfxInfo::FEATURE_CANVAS2D_ACCELERATION) {
|
2016-04-25 15:49:29 +03:00
|
|
|
if (mSDKVersion < 11) {
|
|
|
|
// It's slower than software due to not having a compositing fast path
|
2016-04-14 00:12:47 +03:00
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION;
|
|
|
|
aFailureId = "FEATURE_FAILURE_CANVAS_2D_SDK";
|
2016-04-25 15:49:29 +03:00
|
|
|
} else if (mGLStrings->Renderer().Find("Vivante GC1000") != -1) {
|
|
|
|
// Blocklist Vivante GC1000. See bug 1248183.
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
aFailureId = "FEATURE_FAILED_CANVAS_2D_HW";
|
|
|
|
} else {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_STATUS_OK;
|
2016-04-14 00:12:47 +03:00
|
|
|
}
|
2016-02-22 16:23:00 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-07-05 18:13:04 +04:00
|
|
|
if (aFeature == FEATURE_WEBGL_OPENGL) {
|
2013-11-15 20:28:43 +04:00
|
|
|
if (mGLStrings->Renderer().Find("Adreno 200") != -1 ||
|
|
|
|
mGLStrings->Renderer().Find("Adreno 205") != -1) {
|
2012-07-05 18:13:04 +04:00
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
2016-04-14 00:12:47 +03:00
|
|
|
aFailureId = "FEATURE_FAILURE_ADRENO_20x";
|
2012-07-05 18:13:04 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2013-01-25 22:40:38 +04:00
|
|
|
|
2014-05-22 07:48:51 +04:00
|
|
|
if (mHardware.EqualsLiteral("ville")) {
|
2013-01-25 22:40:38 +04:00
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
2016-04-14 00:12:47 +03:00
|
|
|
aFailureId = "FEATURE_FAILURE_VILLE";
|
2013-01-25 22:40:38 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-07-05 18:13:04 +04:00
|
|
|
}
|
2012-11-02 01:13:10 +04:00
|
|
|
|
|
|
|
if (aFeature == FEATURE_STAGEFRIGHT) {
|
|
|
|
NS_LossyConvertUTF16toASCII cManufacturer(mManufacturer);
|
|
|
|
NS_LossyConvertUTF16toASCII cModel(mModel);
|
2013-04-18 00:56:05 +04:00
|
|
|
NS_LossyConvertUTF16toASCII cHardware(mHardware);
|
|
|
|
|
2014-05-22 07:48:51 +04:00
|
|
|
if (cHardware.EqualsLiteral("antares") ||
|
|
|
|
cHardware.EqualsLiteral("harmony") ||
|
|
|
|
cHardware.EqualsLiteral("picasso") ||
|
|
|
|
cHardware.EqualsLiteral("picasso_e") ||
|
|
|
|
cHardware.EqualsLiteral("ventana") ||
|
|
|
|
cHardware.EqualsLiteral("rk30board")) {
|
2013-04-18 00:56:05 +04:00
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
2016-04-14 00:12:47 +03:00
|
|
|
aFailureId = "FEATURE_FAILURE_STAGE_HW";
|
2013-04-18 00:56:05 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2016-08-30 08:11:55 +03:00
|
|
|
if (CompareVersions(mOSVersion.get(), "4.1.0") < 0) {
|
2013-03-05 05:42:22 +04:00
|
|
|
// Whitelist:
|
2013-04-23 00:10:31 +04:00
|
|
|
// All Samsung ICS devices, except for:
|
2013-05-03 03:00:23 +04:00
|
|
|
// Samsung SGH-I717 (Bug 845729)
|
|
|
|
// Samsung SGH-I727 (Bug 845729)
|
|
|
|
// Samsung SGH-I757 (Bug 845729)
|
2013-03-05 05:42:22 +04:00
|
|
|
// All Galaxy nexus ICS devices
|
|
|
|
// Sony Xperia Ion (LT28) ICS devices
|
2012-11-02 01:13:10 +04:00
|
|
|
bool isWhitelisted =
|
2013-03-05 05:42:22 +04:00
|
|
|
cModel.Equals("LT28h", nsCaseInsensitiveCStringComparator()) ||
|
2012-11-02 01:13:10 +04:00
|
|
|
cManufacturer.Equals("samsung",
|
|
|
|
nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cModel.Equals(
|
|
|
|
"galaxy nexus",
|
|
|
|
nsCaseInsensitiveCStringComparator()); // some Galaxy Nexus
|
|
|
|
// have
|
|
|
|
// manufacturer=amazon
|
|
|
|
|
2013-05-03 03:00:23 +04:00
|
|
|
if (cModel.Find("SGH-I717", true) != -1 ||
|
|
|
|
cModel.Find("SGH-I727", true) != -1 ||
|
2013-09-03 06:38:52 +04:00
|
|
|
cModel.Find("SGH-I757", true) != -1) {
|
2013-04-23 00:10:31 +04:00
|
|
|
isWhitelisted = false;
|
|
|
|
}
|
|
|
|
|
2012-11-02 01:13:10 +04:00
|
|
|
if (!isWhitelisted) {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
2016-04-14 00:12:47 +03:00
|
|
|
aFailureId = "FEATURE_FAILURE_4_1_HW";
|
2012-11-02 01:13:10 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2013-03-25 02:58:07 +04:00
|
|
|
} else if (CompareVersions(mOSVersion.get(), "4.2.0") < 0) {
|
|
|
|
// Whitelist:
|
|
|
|
// All JB phones except for those in blocklist below
|
|
|
|
// Blocklist:
|
2013-05-03 23:08:24 +04:00
|
|
|
// Samsung devices from bug 812881 and 853522.
|
2013-08-01 07:12:14 +04:00
|
|
|
// Motorola XT890 from bug 882342.
|
2013-05-08 22:10:21 +04:00
|
|
|
bool isBlocklisted = cModel.Find("GT-P3100", true) != -1 ||
|
|
|
|
cModel.Find("GT-P3110", true) != -1 ||
|
|
|
|
cModel.Find("GT-P3113", true) != -1 ||
|
|
|
|
cModel.Find("GT-P5100", true) != -1 ||
|
|
|
|
cModel.Find("GT-P5110", true) != -1 ||
|
|
|
|
cModel.Find("GT-P5113", true) != -1 ||
|
2013-09-03 06:39:41 +04:00
|
|
|
cModel.Find("XT890", true) != -1;
|
2013-03-25 02:58:07 +04:00
|
|
|
|
|
|
|
if (isBlocklisted) {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
2016-04-14 00:12:47 +03:00
|
|
|
aFailureId = "FEATURE_FAILURE_4_2_HW";
|
2013-03-25 02:58:07 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2013-07-22 22:34:09 +04:00
|
|
|
} else if (CompareVersions(mOSVersion.get(), "4.3.0") < 0) {
|
|
|
|
// Blocklist all Sony devices
|
|
|
|
if (cManufacturer.Find("Sony", true) != -1) {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
2016-04-14 00:12:47 +03:00
|
|
|
aFailureId = "FEATURE_FAILURE_4_3_SONY";
|
2013-07-22 22:34:09 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
2012-11-02 01:13:10 +04:00
|
|
|
}
|
2014-03-20 17:37:16 +04:00
|
|
|
|
2015-07-24 22:45:55 +03:00
|
|
|
if (aFeature == FEATURE_WEBRTC_HW_ACCELERATION_ENCODE) {
|
|
|
|
if (mozilla::AndroidBridge::Bridge()) {
|
|
|
|
*aStatus = mozilla::AndroidBridge::Bridge()->GetHWEncoderCapability()
|
|
|
|
? nsIGfxInfo::FEATURE_STATUS_OK
|
|
|
|
: nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
2016-04-14 00:12:47 +03:00
|
|
|
aFailureId = "FEATURE_FAILURE_WEBRTC_ENCODE";
|
2014-03-20 17:37:16 +04:00
|
|
|
return NS_OK;
|
2015-07-24 22:45:55 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (aFeature == FEATURE_WEBRTC_HW_ACCELERATION_DECODE) {
|
|
|
|
if (mozilla::AndroidBridge::Bridge()) {
|
|
|
|
*aStatus = mozilla::AndroidBridge::Bridge()->GetHWDecoderCapability()
|
|
|
|
? nsIGfxInfo::FEATURE_STATUS_OK
|
|
|
|
: nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
2016-04-14 00:12:47 +03:00
|
|
|
aFailureId = "FEATURE_FAILURE_WEBRTC_DECODE";
|
2014-03-20 17:37:16 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
2016-03-21 22:19:13 +03:00
|
|
|
|
|
|
|
if (aFeature == FEATURE_VP8_HW_DECODE ||
|
|
|
|
aFeature == FEATURE_VP9_HW_DECODE) {
|
|
|
|
NS_LossyConvertUTF16toASCII model(mModel);
|
|
|
|
bool isBlocked =
|
|
|
|
// GIFV crash, see bug 1232911.
|
|
|
|
model.Equals("GT-N8013", nsCaseInsensitiveCStringComparator());
|
|
|
|
|
2016-04-14 00:12:47 +03:00
|
|
|
if (isBlocked) {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
aFailureId = "FEATURE_FAILURE_VPx";
|
|
|
|
} else {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_STATUS_OK;
|
|
|
|
}
|
2016-03-21 22:19:13 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-07-05 18:13:04 +04:00
|
|
|
}
|
|
|
|
|
2016-04-14 00:12:47 +03:00
|
|
|
return GfxInfoBase::GetFeatureStatusImpl(
|
|
|
|
aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, aFailureId, &os);
|
2011-01-06 07:54:31 +03:00
|
|
|
}
|
2011-12-15 09:04:35 +04:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
|
|
|
// Implement nsIGfxInfoDebug
|
|
|
|
|
|
|
|
NS_IMETHODIMP GfxInfo::SpoofVendorID(const nsAString& aVendorID) {
|
2013-11-15 20:28:43 +04:00
|
|
|
mGLStrings->SpoofVendor(NS_LossyConvertUTF16toASCII(aVendorID));
|
2011-12-15 09:04:35 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP GfxInfo::SpoofDeviceID(const nsAString& aDeviceID) {
|
2013-11-15 20:28:43 +04:00
|
|
|
mGLStrings->SpoofRenderer(NS_LossyConvertUTF16toASCII(aDeviceID));
|
2011-12-15 09:04:35 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP GfxInfo::SpoofDriverVersion(const nsAString& aDriverVersion) {
|
2013-11-15 20:28:43 +04:00
|
|
|
mGLStrings->SpoofVersion(NS_LossyConvertUTF16toASCII(aDriverVersion));
|
2011-12-15 09:04:35 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP GfxInfo::SpoofOSVersion(uint32_t aVersion) {
|
2013-11-15 20:28:43 +04:00
|
|
|
EnsureInitialized();
|
2012-11-02 01:13:10 +04:00
|
|
|
mOSVersion = aVersion;
|
2011-12-15 09:04:35 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2012-11-02 01:13:10 +04:00
|
|
|
|
2013-11-15 20:28:42 +04:00
|
|
|
nsString GfxInfo::Model() {
|
|
|
|
EnsureInitialized();
|
2012-11-02 01:13:10 +04:00
|
|
|
return mModel;
|
|
|
|
}
|
|
|
|
|
2013-11-15 20:28:42 +04:00
|
|
|
nsString GfxInfo::Hardware() {
|
|
|
|
EnsureInitialized();
|
2012-11-02 01:13:10 +04:00
|
|
|
return mHardware;
|
|
|
|
}
|
|
|
|
|
2013-11-15 20:28:42 +04:00
|
|
|
nsString GfxInfo::Product() {
|
|
|
|
EnsureInitialized();
|
2012-11-02 01:13:10 +04:00
|
|
|
return mProduct;
|
|
|
|
}
|
|
|
|
|
2013-11-15 20:28:42 +04:00
|
|
|
nsString GfxInfo::Manufacturer() {
|
|
|
|
EnsureInitialized();
|
2012-11-02 01:13:10 +04:00
|
|
|
return mManufacturer;
|
|
|
|
}
|
2012-12-22 02:32:14 +04:00
|
|
|
|
2013-11-15 20:28:42 +04:00
|
|
|
uint32_t GfxInfo::OperatingSystemVersion() {
|
|
|
|
EnsureInitialized();
|
2012-12-22 02:32:14 +04:00
|
|
|
return mOSVersionInteger;
|
|
|
|
}
|
2013-11-15 20:28:43 +04:00
|
|
|
|
|
|
|
} // namespace widget
|
2014-03-20 17:37:16 +04:00
|
|
|
} // namespace mozilla
|