2011-01-06 04:54:31 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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 04:54:31 +00:00
|
|
|
|
|
|
|
#include "GfxInfo.h"
|
2013-11-15 16:28:43 +00:00
|
|
|
#include "GLContext.h"
|
2013-12-18 20:49:13 +00:00
|
|
|
#include "GLContextProvider.h"
|
2011-01-06 04:54:31 +00:00
|
|
|
#include "nsUnicharUtils.h"
|
|
|
|
#include "prenv.h"
|
|
|
|
#include "prprf.h"
|
2011-11-03 14:50:40 +00:00
|
|
|
#include "nsHashKeys.h"
|
2012-12-21 22:32:14 +00:00
|
|
|
#include "nsVersionComparator.h"
|
2011-01-06 04:54:32 +00:00
|
|
|
#include "AndroidBridge.h"
|
2013-11-15 16:28:47 +00:00
|
|
|
#include "nsIWindowWatcher.h"
|
|
|
|
#include "nsServiceManagerUtils.h"
|
2011-01-06 04:54:32 +00:00
|
|
|
|
2011-05-23 16:54:47 +00:00
|
|
|
#if defined(MOZ_CRASHREPORTER)
|
2011-01-06 04:54:31 +00:00
|
|
|
#include "nsExceptionHandler.h"
|
|
|
|
#include "nsICrashReporter.h"
|
|
|
|
#define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1"
|
|
|
|
#endif
|
|
|
|
|
2013-11-15 16:28:43 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace widget {
|
|
|
|
|
2013-11-15 16:28:47 +00:00
|
|
|
class GfxInfo::GLStrings
|
|
|
|
{
|
2013-11-15 16:28:43 +00:00
|
|
|
nsCString mVendor;
|
|
|
|
nsCString mRenderer;
|
|
|
|
nsCString mVersion;
|
|
|
|
bool mReady;
|
|
|
|
|
|
|
|
public:
|
|
|
|
GLStrings()
|
|
|
|
: mReady(false)
|
|
|
|
{}
|
|
|
|
|
|
|
|
const nsCString& Vendor() {
|
|
|
|
EnsureInitialized();
|
|
|
|
return mVendor;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SpoofVendor(const nsCString& s) {
|
|
|
|
EnsureInitialized();
|
|
|
|
mVendor = s;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsCString& Renderer() {
|
|
|
|
EnsureInitialized();
|
|
|
|
return mRenderer;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SpoofRenderer(const nsCString& s) {
|
|
|
|
EnsureInitialized();
|
|
|
|
mRenderer = s;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsCString& Version() {
|
|
|
|
EnsureInitialized();
|
|
|
|
return mVersion;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SpoofVersion(const nsCString& s) {
|
|
|
|
EnsureInitialized();
|
|
|
|
mVersion = s;
|
|
|
|
}
|
|
|
|
|
|
|
|
void EnsureInitialized() {
|
2014-01-09 20:31:55 +00:00
|
|
|
if (mReady) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-07-11 22:10:49 +00:00
|
|
|
nsRefPtr<gl::GLContext> gl;
|
|
|
|
gl = gl::GLContextProvider::CreateOffscreen(gfxIntSize(16, 16),
|
|
|
|
gl::SurfaceCaps::ForRGB());
|
2013-12-18 20:49:13 +00:00
|
|
|
|
2014-01-09 20:31:55 +00: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-18 20:49:13 +00:00
|
|
|
mReady = true;
|
2014-01-09 20:31:55 +00:00
|
|
|
return;
|
2013-11-15 16:28:43 +00:00
|
|
|
}
|
2014-01-09 20:31:55 +00:00
|
|
|
|
|
|
|
gl->MakeCurrent();
|
|
|
|
|
|
|
|
const char *spoofedVendor = PR_GetEnv("MOZ_GFX_SPOOF_GL_VENDOR");
|
|
|
|
if (spoofedVendor)
|
|
|
|
mVendor.Assign(spoofedVendor);
|
|
|
|
else
|
|
|
|
mVendor.Assign((const char*)gl->fGetString(LOCAL_GL_VENDOR));
|
|
|
|
const char *spoofedRenderer = PR_GetEnv("MOZ_GFX_SPOOF_GL_RENDERER");
|
|
|
|
if (spoofedRenderer)
|
|
|
|
mRenderer.Assign(spoofedRenderer);
|
|
|
|
else
|
|
|
|
mRenderer.Assign((const char*)gl->fGetString(LOCAL_GL_RENDERER));
|
|
|
|
const char *spoofedVersion = PR_GetEnv("MOZ_GFX_SPOOF_GL_VERSION");
|
|
|
|
if (spoofedVersion)
|
|
|
|
mVersion.Assign(spoofedVersion);
|
|
|
|
else
|
|
|
|
mVersion.Assign((const char*)gl->fGetString(LOCAL_GL_VERSION));
|
|
|
|
|
|
|
|
mReady = true;
|
2013-11-15 16:28:43 +00:00
|
|
|
}
|
|
|
|
};
|
2011-01-06 04:54:31 +00:00
|
|
|
|
2011-12-15 05:04:35 +00:00
|
|
|
#ifdef DEBUG
|
2014-04-27 07:06:00 +00:00
|
|
|
NS_IMPL_ISUPPORTS_INHERITED(GfxInfo, GfxInfoBase, nsIGfxInfoDebug)
|
2011-12-15 05:04:35 +00:00
|
|
|
#endif
|
|
|
|
|
2012-07-05 14:12:33 +00:00
|
|
|
GfxInfo::GfxInfo()
|
2013-11-15 16:28:43 +00:00
|
|
|
: mInitialized(false)
|
|
|
|
, mGLStrings(new GLStrings)
|
2012-07-05 14:12:33 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-08-26 19:07:59 +00:00
|
|
|
GfxInfo::~GfxInfo()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-01-06 04:54:31 +00:00
|
|
|
/* GetD2DEnabled and GetDwriteEnabled shouldn't be called until after gfxPlatform initialization
|
|
|
|
* has occurred because they depend on it for information. (See bug 591561) */
|
|
|
|
nsresult
|
2011-09-29 06:19:26 +00:00
|
|
|
GfxInfo::GetD2DEnabled(bool *aEnabled)
|
2011-01-06 04:54:31 +00:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2011-09-29 06:19:26 +00:00
|
|
|
GfxInfo::GetDWriteEnabled(bool *aEnabled)
|
2011-01-06 04:54:31 +00:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
2011-06-24 17:41:18 +00:00
|
|
|
|
2011-01-14 12:57:17 +00:00
|
|
|
/* readonly attribute DOMString DWriteVersion; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetDWriteVersion(nsAString & aDwriteVersion)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
2011-05-11 00:30:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* readonly attribute DOMString cleartypeParameters; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetCleartypeParameters(nsAString & aCleartypeParams)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
2011-01-14 12:57:17 +00:00
|
|
|
}
|
|
|
|
|
2012-07-05 14:12:33 +00:00
|
|
|
void
|
2013-11-15 16:28:43 +00:00
|
|
|
GfxInfo::EnsureInitialized()
|
2011-01-06 04:54:31 +00:00
|
|
|
{
|
2013-11-15 16:28:43 +00:00
|
|
|
if (mInitialized)
|
2012-07-05 14:12:33 +00:00
|
|
|
return;
|
2013-11-15 16:28:43 +00:00
|
|
|
|
|
|
|
mGLStrings->EnsureInitialized();
|
|
|
|
|
|
|
|
MOZ_ASSERT(mozilla::AndroidBridge::Bridge());
|
|
|
|
|
|
|
|
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "MODEL", mModel)) {
|
|
|
|
mAdapterDescription.AppendPrintf("Model: %s", NS_LossyConvertUTF16toASCII(mModel).get());
|
2012-07-05 14:12:33 +00:00
|
|
|
}
|
|
|
|
|
2013-11-15 16:28:43 +00:00
|
|
|
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "PRODUCT", mProduct)) {
|
|
|
|
mAdapterDescription.AppendPrintf(", Product: %s", NS_LossyConvertUTF16toASCII(mProduct).get());
|
|
|
|
}
|
2012-07-05 14:12:33 +00:00
|
|
|
|
2013-11-15 16:28:43 +00:00
|
|
|
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "MANUFACTURER", mManufacturer)) {
|
|
|
|
mAdapterDescription.AppendPrintf(", Manufacturer: %s", NS_LossyConvertUTF16toASCII(mManufacturer).get());
|
2012-07-05 14:12:33 +00:00
|
|
|
}
|
|
|
|
|
2013-11-15 16:28:43 +00:00
|
|
|
int32_t sdkVersion;
|
|
|
|
if (!mozilla::AndroidBridge::Bridge()->GetStaticIntField("android/os/Build$VERSION", "SDK_INT", &sdkVersion))
|
|
|
|
sdkVersion = 0;
|
2011-12-15 05:03:03 +00:00
|
|
|
|
2013-11-15 16:28:43 +00:00
|
|
|
// the HARDWARE field isn't available on Android SDK < 8
|
|
|
|
if (sdkVersion >= 8 && mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", mHardware)) {
|
|
|
|
mAdapterDescription.AppendPrintf(", Hardware: %s", NS_LossyConvertUTF16toASCII(mHardware).get());
|
|
|
|
}
|
2011-12-15 05:03:03 +00:00
|
|
|
|
2013-11-15 16:28:43 +00:00
|
|
|
nsString release;
|
|
|
|
mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build$VERSION", "RELEASE", release);
|
|
|
|
mOSVersion = NS_LossyConvertUTF16toASCII(release);
|
2011-12-15 05:03:03 +00:00
|
|
|
|
2013-11-15 16:28:43 +00: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 05:03:03 +00:00
|
|
|
|
2013-11-15 16:28:43 +00:00
|
|
|
mOSVersionInteger = (uint32_t(na) << 24) |
|
|
|
|
(uint32_t(nb) << 16) |
|
|
|
|
(uint32_t(nc) << 8) |
|
|
|
|
uint32_t(nd);
|
2012-12-21 22:32:14 +00:00
|
|
|
|
2013-11-15 16:28:43 +00:00
|
|
|
mAdapterDescription.AppendPrintf(", OpenGL: %s -- %s -- %s",
|
|
|
|
mGLStrings->Vendor().get(),
|
|
|
|
mGLStrings->Renderer().get(),
|
|
|
|
mGLStrings->Version().get());
|
2011-12-15 05:03:03 +00:00
|
|
|
|
2012-07-05 14:12:33 +00:00
|
|
|
AddCrashReportAnnotations();
|
2013-11-15 16:28:43 +00:00
|
|
|
|
|
|
|
mInitialized = true;
|
2011-01-06 04:54:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* readonly attribute DOMString adapterDescription; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDescription(nsAString & aAdapterDescription)
|
|
|
|
{
|
2013-11-15 16:28:42 +00:00
|
|
|
EnsureInitialized();
|
2012-07-05 14:12:33 +00:00
|
|
|
aAdapterDescription = NS_ConvertASCIItoUTF16(mAdapterDescription);
|
2011-01-06 04:54:31 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 13:46:41 +00:00
|
|
|
/* readonly attribute DOMString adapterDescription2; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDescription2(nsAString & aAdapterDescription)
|
|
|
|
{
|
2013-11-15 16:28:42 +00:00
|
|
|
EnsureInitialized();
|
2011-08-12 13:46:41 +00:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-01-06 04:54:31 +00:00
|
|
|
/* readonly attribute DOMString adapterRAM; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterRAM(nsAString & aAdapterRAM)
|
|
|
|
{
|
2013-11-15 16:28:42 +00:00
|
|
|
EnsureInitialized();
|
2014-05-26 18:54:53 +00:00
|
|
|
aAdapterRAM.Truncate();
|
2011-01-06 04:54:31 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 13:46:41 +00:00
|
|
|
/* readonly attribute DOMString adapterRAM2; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterRAM2(nsAString & aAdapterRAM)
|
|
|
|
{
|
2013-11-15 16:28:42 +00:00
|
|
|
EnsureInitialized();
|
2011-08-12 13:46:41 +00:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-01-06 04:54:31 +00:00
|
|
|
/* readonly attribute DOMString adapterDriver; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriver(nsAString & aAdapterDriver)
|
|
|
|
{
|
2013-11-15 16:28:42 +00:00
|
|
|
EnsureInitialized();
|
2014-05-26 18:54:53 +00:00
|
|
|
aAdapterDriver.Truncate();
|
2011-01-06 04:54:31 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 13:46:41 +00:00
|
|
|
/* readonly attribute DOMString adapterDriver2; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriver2(nsAString & aAdapterDriver)
|
|
|
|
{
|
2013-11-15 16:28:42 +00:00
|
|
|
EnsureInitialized();
|
2011-08-12 13:46:41 +00:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-01-06 04:54:31 +00:00
|
|
|
/* readonly attribute DOMString adapterDriverVersion; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverVersion(nsAString & aAdapterDriverVersion)
|
|
|
|
{
|
2013-11-15 16:28:42 +00:00
|
|
|
EnsureInitialized();
|
2013-11-15 16:28:43 +00:00
|
|
|
aAdapterDriverVersion = NS_ConvertASCIItoUTF16(mGLStrings->Version());
|
2011-01-06 04:54:31 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 13:46:41 +00:00
|
|
|
/* readonly attribute DOMString adapterDriverVersion2; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion)
|
|
|
|
{
|
2013-11-15 16:28:42 +00:00
|
|
|
EnsureInitialized();
|
2011-08-12 13:46:41 +00:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-01-06 04:54:31 +00:00
|
|
|
/* readonly attribute DOMString adapterDriverDate; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverDate(nsAString & aAdapterDriverDate)
|
|
|
|
{
|
2013-11-15 16:28:42 +00:00
|
|
|
EnsureInitialized();
|
2014-05-26 18:54:53 +00:00
|
|
|
aAdapterDriverDate.Truncate();
|
2011-01-06 04:54:31 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 13:46:41 +00:00
|
|
|
/* readonly attribute DOMString adapterDriverDate2; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverDate2(nsAString & aAdapterDriverDate)
|
|
|
|
{
|
2013-11-15 16:28:42 +00:00
|
|
|
EnsureInitialized();
|
2011-08-12 13:46:41 +00:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-12-15 05:03:01 +00:00
|
|
|
/* readonly attribute DOMString adapterVendorID; */
|
2011-01-06 04:54:31 +00:00
|
|
|
NS_IMETHODIMP
|
2011-12-15 05:03:01 +00:00
|
|
|
GfxInfo::GetAdapterVendorID(nsAString & aAdapterVendorID)
|
2011-01-06 04:54:31 +00:00
|
|
|
{
|
2013-11-15 16:28:42 +00:00
|
|
|
EnsureInitialized();
|
2013-11-15 16:28:43 +00:00
|
|
|
aAdapterVendorID = NS_ConvertASCIItoUTF16(mGLStrings->Vendor());
|
2011-01-06 04:54:31 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-12-15 05:03:01 +00:00
|
|
|
/* readonly attribute DOMString adapterVendorID2; */
|
2011-08-12 13:46:41 +00:00
|
|
|
NS_IMETHODIMP
|
2011-12-15 05:03:01 +00:00
|
|
|
GfxInfo::GetAdapterVendorID2(nsAString & aAdapterVendorID)
|
2011-08-12 13:46:41 +00:00
|
|
|
{
|
2013-11-15 16:28:42 +00:00
|
|
|
EnsureInitialized();
|
2011-08-12 13:46:41 +00:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-12-15 05:03:01 +00:00
|
|
|
/* readonly attribute DOMString adapterDeviceID; */
|
2011-01-06 04:54:31 +00:00
|
|
|
NS_IMETHODIMP
|
2011-12-15 05:03:01 +00:00
|
|
|
GfxInfo::GetAdapterDeviceID(nsAString & aAdapterDeviceID)
|
2011-01-06 04:54:31 +00:00
|
|
|
{
|
2013-11-15 16:28:42 +00:00
|
|
|
EnsureInitialized();
|
2013-11-15 16:28:43 +00:00
|
|
|
aAdapterDeviceID = NS_ConvertASCIItoUTF16(mGLStrings->Renderer());
|
2011-01-06 04:54:31 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-12-15 05:03:01 +00:00
|
|
|
/* readonly attribute DOMString adapterDeviceID2; */
|
2011-08-12 13:46:41 +00:00
|
|
|
NS_IMETHODIMP
|
2011-12-15 05:03:01 +00:00
|
|
|
GfxInfo::GetAdapterDeviceID2(nsAString & aAdapterDeviceID)
|
2011-08-12 13:46:41 +00:00
|
|
|
{
|
2013-11-15 16:28:42 +00:00
|
|
|
EnsureInitialized();
|
2011-08-12 13:46:41 +00:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2014-07-09 18:21:49 +00:00
|
|
|
/* readonly attribute DOMString adapterSubsysID; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterSubsysID(nsAString & aAdapterSubsysID)
|
|
|
|
{
|
|
|
|
EnsureInitialized();
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* readonly attribute DOMString adapterSubsysID2; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterSubsysID2(nsAString & aAdapterSubsysID)
|
|
|
|
{
|
|
|
|
EnsureInitialized();
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-08-12 13:46:41 +00:00
|
|
|
/* readonly attribute boolean isGPU2Active; */
|
|
|
|
NS_IMETHODIMP
|
2011-09-29 06:19:26 +00:00
|
|
|
GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active)
|
2011-08-12 13:46:41 +00:00
|
|
|
{
|
2013-11-15 16:28:42 +00:00
|
|
|
EnsureInitialized();
|
2011-08-12 13:46:41 +00:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-01-06 04:54:31 +00:00
|
|
|
void
|
2012-07-05 14:12:33 +00:00
|
|
|
GfxInfo::AddCrashReportAnnotations()
|
2011-01-06 04:54:31 +00:00
|
|
|
{
|
2011-05-23 16:54:47 +00:00
|
|
|
#if defined(MOZ_CRASHREPORTER)
|
2011-01-06 04:54:31 +00:00
|
|
|
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterVendorID"),
|
2013-11-15 16:28:43 +00:00
|
|
|
mGLStrings->Vendor());
|
2011-01-06 04:54:31 +00:00
|
|
|
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDeviceID"),
|
2013-11-15 16:28:43 +00:00
|
|
|
mGLStrings->Renderer());
|
2014-07-09 18:21:49 +00:00
|
|
|
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDriverVersion"),
|
|
|
|
mGLStrings->Version());
|
2011-01-06 04:54:31 +00:00
|
|
|
|
|
|
|
/* Add an App Note for now so that we get the data immediately. These
|
|
|
|
* can go away after we store the above in the socorro db */
|
2012-09-02 02:35:17 +00:00
|
|
|
nsAutoCString note;
|
2012-07-05 14:12:33 +00:00
|
|
|
note.AppendPrintf("AdapterDescription: '%s'\n", mAdapterDescription.get());
|
2011-01-06 04:54:31 +00:00
|
|
|
|
|
|
|
CrashReporter::AppendAppNotesToCrashReport(note);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2011-12-15 05:02:59 +00:00
|
|
|
const nsTArray<GfxDriverInfo>&
|
2011-11-03 14:50:40 +00:00
|
|
|
GfxInfo::GetGfxDriverInfo()
|
|
|
|
{
|
2012-07-05 14:12:54 +00:00
|
|
|
if (mDriverInfo->IsEmpty()) {
|
2012-06-13 19:54:02 +00:00
|
|
|
APPEND_TO_DRIVER_BLOCKLIST2( DRIVER_OS_ALL,
|
|
|
|
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorAll), GfxDriverInfo::allDevices,
|
2014-07-01 21:44:09 +00:00
|
|
|
nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_STATUS_OK,
|
2012-06-13 19:54:02 +00:00
|
|
|
DRIVER_COMPARISON_IGNORED, GfxDriverInfo::allDriverVersions );
|
2011-12-15 05:03:06 +00:00
|
|
|
}
|
2012-07-05 14:12:54 +00:00
|
|
|
|
2011-12-15 05:02:59 +00:00
|
|
|
return *mDriverInfo;
|
2011-11-03 14:50:40 +00:00
|
|
|
}
|
|
|
|
|
2011-01-20 01:30:12 +00:00
|
|
|
nsresult
|
2014-04-22 23:23:18 +00:00
|
|
|
GfxInfo::GetFeatureStatusImpl(int32_t aFeature,
|
|
|
|
int32_t *aStatus,
|
2011-11-03 14:50:40 +00:00
|
|
|
nsAString & aSuggestedDriverVersion,
|
2014-04-22 23:23:18 +00:00
|
|
|
const nsTArray<GfxDriverInfo>& aDriverInfo,
|
2012-07-30 14:20:58 +00:00
|
|
|
OperatingSystem* aOS /* = nullptr */)
|
2011-01-06 04:54:31 +00:00
|
|
|
{
|
2011-12-15 05:03:08 +00:00
|
|
|
NS_ENSURE_ARG_POINTER(aStatus);
|
2011-10-17 14:59:28 +00:00
|
|
|
aSuggestedDriverVersion.SetIsVoid(true);
|
2011-12-15 05:03:08 +00:00
|
|
|
*aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
|
2012-11-01 21:13:10 +00:00
|
|
|
OperatingSystem os = mOS;
|
2011-12-15 05:03:08 +00:00
|
|
|
if (aOS)
|
|
|
|
*aOS = os;
|
2011-11-03 14:50:40 +00:00
|
|
|
|
2013-11-15 16:28:43 +00:00
|
|
|
// OpenGL layers are never blacklisted on Android.
|
2013-12-18 20:49:13 +00:00
|
|
|
// This early return is so we avoid potentially slow
|
|
|
|
// GLStrings initialization on startup when we initialize GL layers.
|
2013-11-15 16:28:43 +00:00
|
|
|
if (aFeature == nsIGfxInfo::FEATURE_OPENGL_LAYERS) {
|
2014-07-01 21:44:09 +00:00
|
|
|
*aStatus = nsIGfxInfo::FEATURE_STATUS_OK;
|
2012-07-05 14:12:33 +00:00
|
|
|
return NS_OK;
|
2011-01-12 04:50:45 +00:00
|
|
|
}
|
|
|
|
|
2013-11-15 16:28:43 +00:00
|
|
|
EnsureInitialized();
|
|
|
|
|
2014-01-09 20:31:55 +00:00
|
|
|
if (mGLStrings->Vendor().IsEmpty() || mGLStrings->Renderer().IsEmpty()) {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-07-05 14:13:04 +00:00
|
|
|
// Don't evaluate special cases when evaluating the downloaded blocklist.
|
|
|
|
if (aDriverInfo.IsEmpty()) {
|
|
|
|
if (aFeature == FEATURE_WEBGL_OPENGL) {
|
2013-11-15 16:28:43 +00:00
|
|
|
if (mGLStrings->Renderer().Find("Adreno 200") != -1 ||
|
|
|
|
mGLStrings->Renderer().Find("Adreno 205") != -1)
|
2012-07-05 14:13:04 +00:00
|
|
|
{
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2013-01-25 18:40:38 +00:00
|
|
|
|
2014-05-22 03:48:51 +00:00
|
|
|
if (mHardware.EqualsLiteral("ville")) {
|
2013-01-25 18:40:38 +00:00
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-07-05 14:13:04 +00:00
|
|
|
}
|
2012-11-01 21:13:10 +00:00
|
|
|
|
|
|
|
if (aFeature == FEATURE_STAGEFRIGHT) {
|
|
|
|
NS_LossyConvertUTF16toASCII cManufacturer(mManufacturer);
|
|
|
|
NS_LossyConvertUTF16toASCII cModel(mModel);
|
2013-04-17 20:56:05 +00:00
|
|
|
NS_LossyConvertUTF16toASCII cHardware(mHardware);
|
|
|
|
|
2014-05-22 03:48:51 +00:00
|
|
|
if (cHardware.EqualsLiteral("antares") ||
|
|
|
|
cHardware.EqualsLiteral("harmony") ||
|
|
|
|
cHardware.EqualsLiteral("picasso") ||
|
|
|
|
cHardware.EqualsLiteral("picasso_e") ||
|
|
|
|
cHardware.EqualsLiteral("ventana") ||
|
|
|
|
cHardware.EqualsLiteral("rk30board"))
|
2013-04-17 20:56:05 +00:00
|
|
|
{
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2013-02-18 00:36:05 +00:00
|
|
|
if (CompareVersions(mOSVersion.get(), "2.2.0") >= 0 &&
|
|
|
|
CompareVersions(mOSVersion.get(), "2.3.0") < 0)
|
|
|
|
{
|
|
|
|
// Froyo LG devices are whitelisted.
|
|
|
|
// All other Froyo
|
|
|
|
bool isWhitelisted =
|
|
|
|
cManufacturer.Equals("lge", nsCaseInsensitiveCStringComparator());
|
|
|
|
|
|
|
|
if (!isWhitelisted) {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (CompareVersions(mOSVersion.get(), "2.3.0") >= 0 &&
|
2013-02-18 00:36:01 +00:00
|
|
|
CompareVersions(mOSVersion.get(), "2.4.0") < 0)
|
|
|
|
{
|
|
|
|
// Gingerbread HTC devices are whitelisted.
|
2013-04-11 23:55:36 +00:00
|
|
|
// Gingerbread Samsung devices are whitelisted except for:
|
|
|
|
// Samsung devices identified in Bug 847837
|
2013-09-03 02:36:48 +00:00
|
|
|
// Gingerbread Sony devices are whitelisted.
|
2013-02-18 00:36:09 +00:00
|
|
|
// All other Gingerbread devices are blacklisted.
|
2013-04-11 23:55:36 +00:00
|
|
|
bool isWhitelisted =
|
2013-02-18 00:36:09 +00:00
|
|
|
cManufacturer.Equals("htc", nsCaseInsensitiveCStringComparator()) ||
|
2013-09-03 02:36:48 +00:00
|
|
|
(cManufacturer.Find("sony", true) != -1) ||
|
2013-02-18 00:36:09 +00:00
|
|
|
cManufacturer.Equals("samsung", nsCaseInsensitiveCStringComparator());
|
2013-02-18 00:36:01 +00:00
|
|
|
|
2013-04-11 23:55:36 +00:00
|
|
|
if (cModel.Equals("GT-I8160", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cModel.Equals("GT-I8160L", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cModel.Equals("GT-I8530", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cModel.Equals("GT-I9070", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cModel.Equals("GT-I9070P", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cModel.Equals("GT-I8160P", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cModel.Equals("GT-S7500", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cModel.Equals("GT-S7500T", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cModel.Equals("GT-S7500L", nsCaseInsensitiveCStringComparator()) ||
|
2013-04-22 20:11:07 +00:00
|
|
|
cModel.Equals("GT-S6500T", nsCaseInsensitiveCStringComparator()) ||
|
2013-04-30 02:45:49 +00:00
|
|
|
cHardware.Equals("smdkc110", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cHardware.Equals("smdkc210", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cHardware.Equals("herring", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cHardware.Equals("shw-m110s", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cHardware.Equals("shw-m180s", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cHardware.Equals("n1", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cHardware.Equals("latona", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cHardware.Equals("aalto", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cHardware.Equals("atlas", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cHardware.Equals("qcom", nsCaseInsensitiveCStringComparator()))
|
2013-04-11 23:55:36 +00:00
|
|
|
{
|
|
|
|
isWhitelisted = false;
|
|
|
|
}
|
|
|
|
|
2013-02-18 00:36:01 +00:00
|
|
|
if (!isWhitelisted) {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
2013-02-18 00:36:17 +00:00
|
|
|
else if (CompareVersions(mOSVersion.get(), "3.0.0") >= 0 &&
|
|
|
|
CompareVersions(mOSVersion.get(), "4.0.0") < 0)
|
|
|
|
{
|
|
|
|
// Honeycomb Samsung devices are whitelisted.
|
|
|
|
// All other Honeycomb devices are blacklisted.
|
2014-03-20 13:37:16 +00:00
|
|
|
bool isWhitelisted =
|
2013-02-18 00:36:17 +00:00
|
|
|
cManufacturer.Equals("samsung", nsCaseInsensitiveCStringComparator());
|
|
|
|
|
|
|
|
if (!isWhitelisted) {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
2013-02-18 00:36:01 +00:00
|
|
|
else if (CompareVersions(mOSVersion.get(), "4.0.0") < 0)
|
2012-11-01 21:13:10 +00:00
|
|
|
{
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-12-21 22:32:14 +00:00
|
|
|
else if (CompareVersions(mOSVersion.get(), "4.1.0") < 0)
|
2012-11-01 21:13:10 +00:00
|
|
|
{
|
2013-03-05 01:42:22 +00:00
|
|
|
// Whitelist:
|
2013-04-22 20:10:31 +00:00
|
|
|
// All Samsung ICS devices, except for:
|
2013-05-02 23:00:23 +00:00
|
|
|
// Samsung SGH-I717 (Bug 845729)
|
|
|
|
// Samsung SGH-I727 (Bug 845729)
|
|
|
|
// Samsung SGH-I757 (Bug 845729)
|
2013-03-05 01:42:22 +00:00
|
|
|
// All Galaxy nexus ICS devices
|
|
|
|
// Sony Xperia Ion (LT28) ICS devices
|
2012-11-01 21:13:10 +00:00
|
|
|
bool isWhitelisted =
|
2013-03-05 01:42:22 +00:00
|
|
|
cModel.Equals("LT28h", nsCaseInsensitiveCStringComparator()) ||
|
2012-11-01 21:13:10 +00:00
|
|
|
cManufacturer.Equals("samsung", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cModel.Equals("galaxy nexus", nsCaseInsensitiveCStringComparator()); // some Galaxy Nexus have manufacturer=amazon
|
|
|
|
|
2013-05-02 23:00:23 +00:00
|
|
|
if (cModel.Find("SGH-I717", true) != -1 ||
|
|
|
|
cModel.Find("SGH-I727", true) != -1 ||
|
2013-09-03 02:38:52 +00:00
|
|
|
cModel.Find("SGH-I757", true) != -1)
|
2013-04-22 20:10:31 +00:00
|
|
|
{
|
|
|
|
isWhitelisted = false;
|
|
|
|
}
|
|
|
|
|
2012-11-01 21:13:10 +00:00
|
|
|
if (!isWhitelisted) {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
2013-03-24 22:58:07 +00:00
|
|
|
else if (CompareVersions(mOSVersion.get(), "4.2.0") < 0)
|
|
|
|
{
|
|
|
|
// Whitelist:
|
|
|
|
// All JB phones except for those in blocklist below
|
|
|
|
// Blocklist:
|
2013-05-03 19:08:24 +00:00
|
|
|
// Samsung devices from bug 812881 and 853522.
|
2013-08-01 03:12:14 +00:00
|
|
|
// Motorola XT890 from bug 882342.
|
2013-03-24 22:58:07 +00:00
|
|
|
bool isBlocklisted =
|
2013-05-08 18:10:21 +00:00
|
|
|
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 02:39:41 +00:00
|
|
|
cModel.Find("XT890", true) != -1;
|
2013-03-24 22:58:07 +00:00
|
|
|
|
|
|
|
if (isBlocklisted) {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
2013-07-22 18:34:09 +00: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;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
2012-11-01 21:13:10 +00:00
|
|
|
}
|
2014-03-20 13:37:16 +00:00
|
|
|
|
|
|
|
if (aFeature == FEATURE_WEBRTC_HW_ACCELERATION) {
|
|
|
|
NS_LossyConvertUTF16toASCII cManufacturer(mManufacturer);
|
|
|
|
NS_LossyConvertUTF16toASCII cModel(mModel);
|
|
|
|
NS_LossyConvertUTF16toASCII cHardware(mHardware);
|
|
|
|
|
2014-05-22 03:48:51 +00:00
|
|
|
if (cHardware.EqualsLiteral("hammerhead") &&
|
2014-03-20 13:37:16 +00:00
|
|
|
CompareVersions(mOSVersion.get(), "4.4.2") >= 0 &&
|
|
|
|
cManufacturer.Equals("lge", nsCaseInsensitiveCStringComparator()) &&
|
|
|
|
cModel.Equals("nexus 5", nsCaseInsensitiveCStringComparator())) {
|
2014-07-01 21:44:09 +00:00
|
|
|
*aStatus = nsIGfxInfo::FEATURE_STATUS_OK;
|
2014-03-20 13:37:16 +00:00
|
|
|
return NS_OK;
|
|
|
|
} else {
|
|
|
|
// Blocklist all other devices except Nexus 5 which VP8 hardware acceleration is supported
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
2012-07-05 14:13:04 +00:00
|
|
|
}
|
|
|
|
|
2011-12-15 05:02:59 +00:00
|
|
|
return GfxInfoBase::GetFeatureStatusImpl(aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, &os);
|
2011-01-06 04:54:31 +00:00
|
|
|
}
|
2011-12-15 05:04:35 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
|
|
|
// Implement nsIGfxInfoDebug
|
|
|
|
|
|
|
|
/* void spoofVendorID (in DOMString aVendorID); */
|
|
|
|
NS_IMETHODIMP GfxInfo::SpoofVendorID(const nsAString & aVendorID)
|
|
|
|
{
|
2013-11-15 16:28:43 +00:00
|
|
|
EnsureInitialized();
|
|
|
|
mGLStrings->SpoofVendor(NS_LossyConvertUTF16toASCII(aVendorID));
|
2011-12-15 05:04:35 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* void spoofDeviceID (in unsigned long aDeviceID); */
|
|
|
|
NS_IMETHODIMP GfxInfo::SpoofDeviceID(const nsAString & aDeviceID)
|
|
|
|
{
|
2013-11-15 16:28:43 +00:00
|
|
|
EnsureInitialized();
|
|
|
|
mGLStrings->SpoofRenderer(NS_LossyConvertUTF16toASCII(aDeviceID));
|
2011-12-15 05:04:35 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* void spoofDriverVersion (in DOMString aDriverVersion); */
|
|
|
|
NS_IMETHODIMP GfxInfo::SpoofDriverVersion(const nsAString & aDriverVersion)
|
|
|
|
{
|
2013-11-15 16:28:43 +00:00
|
|
|
EnsureInitialized();
|
|
|
|
mGLStrings->SpoofVersion(NS_LossyConvertUTF16toASCII(aDriverVersion));
|
2011-12-15 05:04:35 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* void spoofOSVersion (in unsigned long aVersion); */
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHODIMP GfxInfo::SpoofOSVersion(uint32_t aVersion)
|
2011-12-15 05:04:35 +00:00
|
|
|
{
|
2013-11-15 16:28:43 +00:00
|
|
|
EnsureInitialized();
|
2012-11-01 21:13:10 +00:00
|
|
|
mOSVersion = aVersion;
|
2011-12-15 05:04:35 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2012-11-01 21:13:10 +00:00
|
|
|
|
2013-11-15 16:28:42 +00:00
|
|
|
nsString GfxInfo::Model()
|
2012-11-01 21:13:10 +00:00
|
|
|
{
|
2013-11-15 16:28:42 +00:00
|
|
|
EnsureInitialized();
|
2012-11-01 21:13:10 +00:00
|
|
|
return mModel;
|
|
|
|
}
|
|
|
|
|
2013-11-15 16:28:42 +00:00
|
|
|
nsString GfxInfo::Hardware()
|
2012-11-01 21:13:10 +00:00
|
|
|
{
|
2013-11-15 16:28:42 +00:00
|
|
|
EnsureInitialized();
|
2012-11-01 21:13:10 +00:00
|
|
|
return mHardware;
|
|
|
|
}
|
|
|
|
|
2013-11-15 16:28:42 +00:00
|
|
|
nsString GfxInfo::Product()
|
2012-11-01 21:13:10 +00:00
|
|
|
{
|
2013-11-15 16:28:42 +00:00
|
|
|
EnsureInitialized();
|
2012-11-01 21:13:10 +00:00
|
|
|
return mProduct;
|
|
|
|
}
|
|
|
|
|
2013-11-15 16:28:42 +00:00
|
|
|
nsString GfxInfo::Manufacturer()
|
2012-11-01 21:13:10 +00:00
|
|
|
{
|
2013-11-15 16:28:42 +00:00
|
|
|
EnsureInitialized();
|
2012-11-01 21:13:10 +00:00
|
|
|
return mManufacturer;
|
|
|
|
}
|
2012-12-21 22:32:14 +00:00
|
|
|
|
2013-11-15 16:28:42 +00:00
|
|
|
uint32_t GfxInfo::OperatingSystemVersion()
|
2012-12-21 22:32:14 +00:00
|
|
|
{
|
2013-11-15 16:28:42 +00:00
|
|
|
EnsureInitialized();
|
2012-12-21 22:32:14 +00:00
|
|
|
return mOSVersionInteger;
|
|
|
|
}
|
2013-11-15 16:28:43 +00:00
|
|
|
|
|
|
|
}
|
2014-03-20 13:37:16 +00:00
|
|
|
}
|