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"
|
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 "nsServiceManagerUtils.h"
|
2011-01-06 07:54:32 +03:00
|
|
|
|
2019-05-17 01:42:00 +03:00
|
|
|
#include "mozilla/Preferences.h"
|
|
|
|
|
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;
|
2021-02-10 19:00:16 +03:00
|
|
|
nsTArray<nsCString> mExtensions;
|
2013-11-15 20:28:43 +04:00
|
|
|
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; }
|
|
|
|
|
2021-02-10 19:00:16 +03:00
|
|
|
const nsTArray<nsCString>& Extensions() {
|
|
|
|
EnsureInitialized();
|
|
|
|
return mExtensions;
|
|
|
|
}
|
|
|
|
|
2013-11-15 20:28:43 +04:00
|
|
|
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(
|
2020-06-15 21:25:55 +03:00
|
|
|
{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
|
2020-06-23 18:21:36 +03:00
|
|
|
// remain blocklisted forever. Ideally, we would like to update that once
|
2014-01-10 00:31:55 +04:00
|
|
|
// 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
|
|
|
|
2021-02-10 19:00:16 +03:00
|
|
|
if (mExtensions.IsEmpty()) {
|
|
|
|
nsCString rawExtensions;
|
|
|
|
rawExtensions.Assign((const char*)gl->fGetString(LOCAL_GL_EXTENSIONS));
|
|
|
|
rawExtensions.Trim(" ");
|
|
|
|
|
|
|
|
for (auto extension : rawExtensions.Split(' ')) {
|
|
|
|
mExtensions.AppendElement(extension);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2020-02-13 18:51:32 +03:00
|
|
|
nsresult GfxInfo::GetHasBattery(bool* aHasBattery) {
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2020-06-25 20:22:20 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetEmbeddedInFirefoxReality(bool* aEmbeddedInFirefoxReality) {
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2019-05-27 03:02:32 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetWindowProtocol(nsAString& aWindowProtocol) {
|
2020-02-10 17:21:30 +03:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetDesktopEnvironment(nsAString& aDesktopEnvironment) {
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
2019-05-27 03:02:32 +03:00
|
|
|
}
|
|
|
|
|
2021-01-25 22:41:04 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetTestType(nsAString& aTestType) { return NS_ERROR_NOT_IMPLEMENTED; }
|
|
|
|
|
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
|
|
|
|
2019-10-04 02:43:35 +03:00
|
|
|
mScreenInfo.mScreenDimensions =
|
|
|
|
mozilla::AndroidBridge::Bridge()->getScreenSize();
|
|
|
|
|
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
|
2019-11-26 22:42:06 +03:00
|
|
|
GfxInfo::GetAdapterRAM(uint32_t* aAdapterRAM) {
|
2013-11-15 20:28:42 +04:00
|
|
|
EnsureInitialized();
|
2019-11-26 22:42:06 +03:00
|
|
|
*aAdapterRAM = 0;
|
2011-01-06 07:54:31 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 17:46:41 +04:00
|
|
|
NS_IMETHODIMP
|
2019-11-26 22:42:06 +03:00
|
|
|
GfxInfo::GetAdapterRAM2(uint32_t* 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;
|
|
|
|
}
|
|
|
|
|
2019-04-30 23:29:18 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverVendor(nsAString& aAdapterDriverVendor) {
|
|
|
|
EnsureInitialized();
|
|
|
|
aAdapterDriverVendor.Truncate();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverVendor2(nsAString& aAdapterDriverVendor) {
|
|
|
|
EnsureInitialized();
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2019-10-04 02:43:35 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetDisplayInfo(nsTArray<nsString>& aDisplayInfo) {
|
|
|
|
EnsureInitialized();
|
|
|
|
nsString displayInfo;
|
|
|
|
displayInfo.AppendPrintf("%dx%d",
|
|
|
|
(int32_t)mScreenInfo.mScreenDimensions.width,
|
|
|
|
(int32_t)mScreenInfo.mScreenDimensions.height);
|
|
|
|
aDisplayInfo.AppendElement(displayInfo);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2019-11-26 22:42:06 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetDisplayWidth(nsTArray<uint32_t>& aDisplayWidth) {
|
|
|
|
aDisplayWidth.AppendElement((uint32_t)mScreenInfo.mScreenDimensions.width);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetDisplayHeight(nsTArray<uint32_t>& aDisplayHeight) {
|
|
|
|
aDisplayHeight.AppendElement((uint32_t)mScreenInfo.mScreenDimensions.height);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2021-01-18 12:26:21 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetDrmRenderDevice(nsACString& aDrmRenderDevice) {
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
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(
|
2020-02-14 01:39:10 +03:00
|
|
|
OperatingSystem::Android, DeviceFamily::All,
|
|
|
|
nsIGfxInfo::FEATURE_OPENGL_LAYERS, 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;
|
|
|
|
}
|
|
|
|
|
2020-06-23 18:21:36 +03:00
|
|
|
// OpenGL layers are never blocklisted 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
|
|
|
|
2019-06-28 10:00:13 +03:00
|
|
|
if (mSDKVersion <= 17) {
|
|
|
|
if (mGLStrings->Renderer().Find("Adreno (TM) 3") != -1) {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
aFailureId = "FEATURE_FAILURE_ADRENO_3xx";
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
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 =
|
2020-05-27 21:11:12 +03:00
|
|
|
cModel.Equals("LT28h", nsCaseInsensitiveCStringComparator) ||
|
2012-11-02 01:13:10 +04:00
|
|
|
cManufacturer.Equals("samsung",
|
2020-05-27 21:11:12 +03:00
|
|
|
nsCaseInsensitiveCStringComparator) ||
|
2012-11-02 01:13:10 +04:00
|
|
|
cModel.Equals(
|
|
|
|
"galaxy nexus",
|
2020-05-27 21:11:12 +03:00
|
|
|
nsCaseInsensitiveCStringComparator); // some Galaxy Nexus
|
|
|
|
// have
|
|
|
|
// manufacturer=amazon
|
2012-11-02 01:13:10 +04:00
|
|
|
|
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()) {
|
2019-10-08 20:15:35 +03:00
|
|
|
*aStatus = WebRtcHwVp8EncodeSupported();
|
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()) {
|
2019-10-08 20:15:35 +03:00
|
|
|
*aStatus = WebRtcHwVp8DecodeSupported();
|
2016-04-14 00:12:47 +03:00
|
|
|
aFailureId = "FEATURE_FAILURE_WEBRTC_DECODE";
|
2014-03-20 17:37:16 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
2019-10-08 20:15:44 +03:00
|
|
|
if (aFeature == FEATURE_WEBRTC_HW_ACCELERATION_H264) {
|
|
|
|
if (mozilla::AndroidBridge::Bridge()) {
|
|
|
|
*aStatus = WebRtcHwH264Supported();
|
|
|
|
aFailureId = "FEATURE_FAILURE_WEBRTC_H264";
|
|
|
|
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.
|
2020-05-27 21:11:12 +03:00
|
|
|
model.Equals("GT-N8013", nsCaseInsensitiveCStringComparator);
|
2016-03-21 22:19:13 +03:00
|
|
|
|
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;
|
|
|
|
}
|
2019-09-10 13:46:13 +03:00
|
|
|
|
|
|
|
if (aFeature == FEATURE_WEBRENDER) {
|
2019-12-13 19:14:40 +03:00
|
|
|
bool isUnblocked = false;
|
|
|
|
const nsCString& gpu = mGLStrings->Renderer();
|
2020-04-17 19:34:10 +03:00
|
|
|
NS_LossyConvertUTF16toASCII model(mModel);
|
2020-07-21 00:05:10 +03:00
|
|
|
|
|
|
|
#ifdef NIGHTLY_BUILD
|
2021-02-16 19:46:36 +03:00
|
|
|
// On Nightly enable Webrender on all Adreno 4xx GPUs
|
|
|
|
isUnblocked |= gpu.Find("Adreno (TM) 4", /*ignoreCase*/ true) >= 0;
|
2019-12-13 19:14:40 +03:00
|
|
|
#endif
|
2021-02-16 19:46:36 +03:00
|
|
|
// Enable Webrender on all Adreno 5xx and 6xx GPUs
|
|
|
|
isUnblocked |= gpu.Find("Adreno (TM) 5", /*ignoreCase*/ true) >= 0 ||
|
|
|
|
gpu.Find("Adreno (TM) 6", /*ignoreCase*/ true) >= 0;
|
2020-07-21 00:05:10 +03:00
|
|
|
|
2021-02-16 19:46:36 +03:00
|
|
|
// Enable Webrender on all Mali-Txxx GPUs
|
|
|
|
isUnblocked |= gpu.Find("Mali-T", /*ignoreCase*/ true) >= 0;
|
|
|
|
|
2021-02-13 00:18:34 +03:00
|
|
|
// Enable Webrender on all Mali-Gxx GPUs...
|
2021-01-25 18:37:31 +03:00
|
|
|
isUnblocked |= gpu.Find("Mali-G", /*ignoreCase*/ true) >= 0 &&
|
2021-02-17 23:59:06 +03:00
|
|
|
// Excluding G31 due to bug 1689947.
|
2021-02-02 19:42:51 +03:00
|
|
|
gpu.Find("Mali-G31", /*ignoreCase*/ true) == kNotFound;
|
2020-11-10 20:24:34 +03:00
|
|
|
|
2019-12-13 19:14:40 +03:00
|
|
|
if (!isUnblocked) {
|
2019-09-10 13:46:13 +03:00
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
aFailureId = "FEATURE_FAILURE_WEBRENDER_BLOCKED_DEVICE";
|
|
|
|
} else {
|
2020-02-18 16:56:10 +03:00
|
|
|
*aStatus = nsIGfxInfo::FEATURE_ALLOW_QUALIFIED;
|
2019-09-10 13:46:13 +03:00
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2020-09-24 12:43:21 +03:00
|
|
|
|
|
|
|
if (aFeature == FEATURE_WEBRENDER_SCISSORED_CACHE_CLEARS) {
|
|
|
|
// Emulator with SwiftShader is buggy when attempting to clear picture
|
|
|
|
// cache textures with a scissor rect set.
|
|
|
|
const bool isEmulatorSwiftShader =
|
|
|
|
mGLStrings->Renderer().Find(
|
|
|
|
"Android Emulator OpenGL ES Translator (Google SwiftShader)") >=
|
|
|
|
0;
|
|
|
|
if (isEmulatorSwiftShader) {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
aFailureId = "FEATURE_FAILURE_BUG_1603515";
|
|
|
|
} else {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_STATUS_OK;
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2021-02-11 16:47:59 +03:00
|
|
|
|
|
|
|
if (aFeature == FEATURE_WEBRENDER_OPTIMIZED_SHADERS) {
|
|
|
|
// Optimized shaders result in completely broken rendering in at least one
|
|
|
|
// Mali-T6xx device. Disable on all T6xx as a precaution until we know
|
|
|
|
// more specifically which devices are affected. See bug 1689064 for
|
|
|
|
// details.
|
|
|
|
const bool isMaliT6xx =
|
|
|
|
mGLStrings->Renderer().Find("Mali-T6", /*ignoreCase*/ true) >= 0;
|
|
|
|
if (isMaliT6xx) {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
aFailureId = "FEATURE_FAILURE_BUG_1689064";
|
|
|
|
} else {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_STATUS_OK;
|
|
|
|
}
|
|
|
|
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
|
|
|
|
2019-05-17 01:42:00 +03:00
|
|
|
static nsCString FeatureCacheOsVerPrefName(int32_t aFeature) {
|
|
|
|
nsCString osPrefName;
|
|
|
|
osPrefName.AppendASCII("gfxinfo.cache.");
|
|
|
|
osPrefName.AppendInt(aFeature);
|
|
|
|
osPrefName.AppendASCII(".osver");
|
|
|
|
return osPrefName;
|
|
|
|
}
|
|
|
|
|
|
|
|
static nsCString FeatureCacheValuePrefName(int32_t aFeature) {
|
|
|
|
nsCString osPrefName;
|
|
|
|
osPrefName.AppendASCII("gfxinfo.cache.");
|
|
|
|
osPrefName.AppendInt(aFeature);
|
|
|
|
osPrefName.AppendASCII(".value");
|
|
|
|
return osPrefName;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool GetCachedFeatureVal(int32_t aFeature, uint32_t aExpectedOsVer,
|
|
|
|
int32_t& aOutStatus) {
|
|
|
|
uint32_t osVer = 0;
|
|
|
|
nsresult rv =
|
|
|
|
Preferences::GetUint(FeatureCacheOsVerPrefName(aFeature).get(), &osVer);
|
|
|
|
if (NS_FAILED(rv) || osVer != aExpectedOsVer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
int32_t status = 0;
|
|
|
|
rv = Preferences::GetInt(FeatureCacheValuePrefName(aFeature).get(), &status);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
aOutStatus = status;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void SetCachedFeatureVal(int32_t aFeature, uint32_t aOsVer,
|
|
|
|
int32_t aStatus) {
|
|
|
|
// Ignore failures; not much we can do anyway.
|
|
|
|
Preferences::SetUint(FeatureCacheOsVerPrefName(aFeature).get(), aOsVer);
|
|
|
|
Preferences::SetInt(FeatureCacheValuePrefName(aFeature).get(), aStatus);
|
|
|
|
}
|
|
|
|
|
2019-10-08 20:15:35 +03:00
|
|
|
int32_t GfxInfo::WebRtcHwVp8EncodeSupported() {
|
2019-05-17 01:42:00 +03:00
|
|
|
MOZ_ASSERT(mozilla::AndroidBridge::Bridge());
|
|
|
|
|
2019-10-08 20:15:44 +03:00
|
|
|
// The Android side of this calculation is very slow, so we cache the result
|
2019-05-17 01:42:00 +03:00
|
|
|
// in preferences, invalidating if the OS version changes.
|
|
|
|
|
|
|
|
int32_t status = 0;
|
|
|
|
if (GetCachedFeatureVal(FEATURE_WEBRTC_HW_ACCELERATION_ENCODE,
|
|
|
|
mOSVersionInteger, status)) {
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2019-10-08 20:15:35 +03:00
|
|
|
status = mozilla::AndroidBridge::Bridge()->HasHWVP8Encoder()
|
2019-05-17 01:42:00 +03:00
|
|
|
? nsIGfxInfo::FEATURE_STATUS_OK
|
|
|
|
: nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
|
|
|
|
SetCachedFeatureVal(FEATURE_WEBRTC_HW_ACCELERATION_ENCODE, mOSVersionInteger,
|
|
|
|
status);
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2019-10-08 20:15:35 +03:00
|
|
|
int32_t GfxInfo::WebRtcHwVp8DecodeSupported() {
|
2019-05-17 01:42:00 +03:00
|
|
|
MOZ_ASSERT(mozilla::AndroidBridge::Bridge());
|
|
|
|
|
|
|
|
// The Android side of this caclulation is very slow, so we cache the result
|
|
|
|
// in preferences, invalidating if the OS version changes.
|
|
|
|
|
|
|
|
int32_t status = 0;
|
|
|
|
if (GetCachedFeatureVal(FEATURE_WEBRTC_HW_ACCELERATION_DECODE,
|
|
|
|
mOSVersionInteger, status)) {
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2019-10-08 20:15:35 +03:00
|
|
|
status = mozilla::AndroidBridge::Bridge()->HasHWVP8Decoder()
|
2019-05-17 01:42:00 +03:00
|
|
|
? nsIGfxInfo::FEATURE_STATUS_OK
|
|
|
|
: nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
|
|
|
|
SetCachedFeatureVal(FEATURE_WEBRTC_HW_ACCELERATION_DECODE, mOSVersionInteger,
|
|
|
|
status);
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
2019-10-08 20:15:44 +03:00
|
|
|
|
|
|
|
int32_t GfxInfo::WebRtcHwH264Supported() {
|
|
|
|
MOZ_ASSERT(mozilla::AndroidBridge::Bridge());
|
|
|
|
|
|
|
|
// The Android side of this calculation is very slow, so we cache the result
|
|
|
|
// in preferences, invalidating if the OS version changes.
|
|
|
|
|
|
|
|
int32_t status = 0;
|
|
|
|
if (GetCachedFeatureVal(FEATURE_WEBRTC_HW_ACCELERATION_H264,
|
|
|
|
mOSVersionInteger, status)) {
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
status = mozilla::AndroidBridge::Bridge()->HasHWH264()
|
|
|
|
? nsIGfxInfo::FEATURE_STATUS_OK
|
|
|
|
: nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
|
|
|
|
SetCachedFeatureVal(FEATURE_WEBRTC_HW_ACCELERATION_H264, mOSVersionInteger,
|
|
|
|
status);
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2019-02-08 22:36:08 +03:00
|
|
|
NS_IMETHODIMP GfxInfo::FireTestProcess() { return NS_OK; }
|
|
|
|
|
2011-12-15 09:04:35 +04:00
|
|
|
#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
|