2010-10-01 20:55:19 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07: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/. */
|
2010-10-01 20:55:19 -07:00
|
|
|
|
|
|
|
#include <OpenGL/OpenGL.h>
|
|
|
|
#include <OpenGL/CGLRenderers.h>
|
|
|
|
|
2011-10-10 22:50:08 -07:00
|
|
|
#include "mozilla/Util.h"
|
|
|
|
|
2010-10-01 20:55:19 -07:00
|
|
|
#include "GfxInfo.h"
|
|
|
|
#include "nsUnicharUtils.h"
|
2012-05-17 00:53:20 -07:00
|
|
|
#include "nsCocoaFeatures.h"
|
2011-11-02 12:55:03 -07:00
|
|
|
#include "mozilla/Preferences.h"
|
2010-10-01 20:55:19 -07:00
|
|
|
|
2011-09-27 06:55:42 -07:00
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
#import <IOKit/IOKitLib.h>
|
2011-11-03 07:50:40 -07:00
|
|
|
#import <Cocoa/Cocoa.h>
|
2011-09-27 06:55:42 -07:00
|
|
|
|
2011-05-23 09:54:47 -07:00
|
|
|
#if defined(MOZ_CRASHREPORTER)
|
2010-10-01 20:55:19 -07:00
|
|
|
#include "nsExceptionHandler.h"
|
|
|
|
#include "nsICrashReporter.h"
|
|
|
|
#define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1"
|
|
|
|
#endif
|
|
|
|
|
2011-11-03 07:50:40 -07:00
|
|
|
#define MAC_OS_X_VERSION_MASK 0x0000FFFF
|
|
|
|
#define MAC_OS_X_VERSION_MAJOR_MASK 0x0000FFF0
|
|
|
|
#define MAC_OS_X_VERSION_10_4_HEX 0x00001040 // Not supported
|
|
|
|
#define MAC_OS_X_VERSION_10_5_HEX 0x00001050
|
|
|
|
#define MAC_OS_X_VERSION_10_6_HEX 0x00001060
|
|
|
|
#define MAC_OS_X_VERSION_10_7_HEX 0x00001070
|
2012-08-31 09:42:07 -07:00
|
|
|
#define MAC_OS_X_VERSION_10_8_HEX 0x00001080
|
2011-11-03 07:50:40 -07:00
|
|
|
|
2011-10-10 22:50:08 -07:00
|
|
|
using namespace mozilla;
|
2010-10-01 20:55:19 -07:00
|
|
|
using namespace mozilla::widget;
|
|
|
|
|
2011-12-14 21:04:35 -08:00
|
|
|
#ifdef DEBUG
|
|
|
|
NS_IMPL_ISUPPORTS_INHERITED1(GfxInfo, GfxInfoBase, nsIGfxInfoDebug)
|
|
|
|
#endif
|
|
|
|
|
2011-09-27 06:55:42 -07:00
|
|
|
GfxInfo::GfxInfo()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-12-14 21:04:35 -08:00
|
|
|
static OperatingSystem
|
2012-08-22 08:56:38 -07:00
|
|
|
OSXVersionToOperatingSystem(uint32_t aOSXVersion)
|
2011-12-14 21:04:35 -08:00
|
|
|
{
|
|
|
|
switch (aOSXVersion & MAC_OS_X_VERSION_MAJOR_MASK) {
|
|
|
|
case MAC_OS_X_VERSION_10_5_HEX:
|
|
|
|
return DRIVER_OS_OS_X_10_5;
|
|
|
|
case MAC_OS_X_VERSION_10_6_HEX:
|
|
|
|
return DRIVER_OS_OS_X_10_6;
|
|
|
|
case MAC_OS_X_VERSION_10_7_HEX:
|
|
|
|
return DRIVER_OS_OS_X_10_7;
|
2012-08-31 09:42:07 -07:00
|
|
|
case MAC_OS_X_VERSION_10_8_HEX:
|
|
|
|
return DRIVER_OS_OS_X_10_8;
|
2011-12-14 21:04:35 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
return DRIVER_OS_UNKNOWN;
|
|
|
|
}
|
2011-09-27 06:55:42 -07:00
|
|
|
// The following three functions are derived from Chromium code
|
|
|
|
static CFTypeRef SearchPortForProperty(io_registry_entry_t dspPort,
|
|
|
|
CFStringRef propertyName)
|
|
|
|
{
|
|
|
|
return IORegistryEntrySearchCFProperty(dspPort,
|
|
|
|
kIOServicePlane,
|
|
|
|
propertyName,
|
|
|
|
kCFAllocatorDefault,
|
|
|
|
kIORegistryIterateRecursively |
|
|
|
|
kIORegistryIterateParents);
|
|
|
|
}
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
static uint32_t IntValueOfCFData(CFDataRef d)
|
2011-09-27 06:55:42 -07:00
|
|
|
{
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t value = 0;
|
2011-09-27 06:55:42 -07:00
|
|
|
|
|
|
|
if (d) {
|
2012-08-22 08:56:38 -07:00
|
|
|
const uint32_t *vp = reinterpret_cast<const uint32_t*>(CFDataGetBytePtr(d));
|
2011-09-27 06:55:42 -07:00
|
|
|
if (vp != NULL)
|
|
|
|
value = *vp;
|
|
|
|
}
|
|
|
|
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GfxInfo::GetDeviceInfo()
|
|
|
|
{
|
|
|
|
io_registry_entry_t dsp_port = CGDisplayIOServicePort(kCGDirectMainDisplay);
|
|
|
|
CFTypeRef vendor_id_ref = SearchPortForProperty(dsp_port, CFSTR("vendor-id"));
|
|
|
|
if (vendor_id_ref) {
|
2011-12-14 21:03:01 -08:00
|
|
|
mAdapterVendorID.AppendPrintf("0x%4x", IntValueOfCFData((CFDataRef)vendor_id_ref));
|
2011-09-27 06:55:42 -07:00
|
|
|
CFRelease(vendor_id_ref);
|
|
|
|
}
|
|
|
|
CFTypeRef device_id_ref = SearchPortForProperty(dsp_port, CFSTR("device-id"));
|
|
|
|
if (device_id_ref) {
|
2011-12-14 21:03:01 -08:00
|
|
|
mAdapterDeviceID.AppendPrintf("0x%4x", IntValueOfCFData((CFDataRef)device_id_ref));
|
2011-09-27 06:55:42 -07:00
|
|
|
CFRelease(device_id_ref);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-19 17:33:51 -08:00
|
|
|
nsresult
|
2010-10-01 20:55:19 -07:00
|
|
|
GfxInfo::Init()
|
|
|
|
{
|
2011-01-19 17:33:51 -08:00
|
|
|
nsresult rv = GfxInfoBase::Init();
|
|
|
|
|
2011-09-27 07:18:41 -07:00
|
|
|
// Calling CGLQueryRendererInfo causes us to switch to the discrete GPU
|
|
|
|
// even when we don't want to. We'll avoid doing so for now and just
|
|
|
|
// use the device ids.
|
|
|
|
#if 0
|
2010-10-01 20:55:19 -07:00
|
|
|
CGLRendererInfoObj renderer = 0;
|
|
|
|
GLint rendererCount = 0;
|
|
|
|
|
|
|
|
memset(mRendererIDs, 0, sizeof(mRendererIDs));
|
|
|
|
|
|
|
|
if (CGLQueryRendererInfo(0xffffffff, &renderer, &rendererCount) != kCGLNoError)
|
2011-01-19 17:33:51 -08:00
|
|
|
return rv;
|
2010-10-01 20:55:19 -07:00
|
|
|
|
2011-10-10 22:50:08 -07:00
|
|
|
rendererCount = (GLint) NS_MIN(rendererCount, (GLint) ArrayLength(mRendererIDs));
|
2010-10-01 20:55:19 -07:00
|
|
|
for (GLint i = 0; i < rendererCount; i++) {
|
|
|
|
GLint prop = 0;
|
|
|
|
|
|
|
|
if (!mRendererIDsString.IsEmpty())
|
|
|
|
mRendererIDsString.AppendLiteral(",");
|
|
|
|
if (CGLDescribeRenderer(renderer, i, kCGLRPRendererID, &prop) == kCGLNoError) {
|
|
|
|
#ifdef kCGLRendererIDMatchingMask
|
|
|
|
prop = prop & kCGLRendererIDMatchingMask;
|
|
|
|
#else
|
|
|
|
prop = prop & 0x00FE7F00; // this is the mask token above, but it doesn't seem to exist everywhere?
|
|
|
|
#endif
|
|
|
|
mRendererIDs[i] = prop;
|
|
|
|
mRendererIDsString.AppendPrintf("0x%04x", prop);
|
|
|
|
} else {
|
2010-12-08 07:56:01 -08:00
|
|
|
mRendererIDs[i] = 0;
|
2010-10-01 20:55:19 -07:00
|
|
|
mRendererIDsString.AppendPrintf("???");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CGLDestroyRendererInfo(renderer);
|
2011-09-27 07:18:41 -07:00
|
|
|
#endif
|
2010-10-01 20:55:19 -07:00
|
|
|
|
2011-09-27 06:55:42 -07:00
|
|
|
GetDeviceInfo();
|
|
|
|
|
2010-10-01 20:55:19 -07:00
|
|
|
AddCrashReportAnnotations();
|
2011-01-19 17:33:51 -08:00
|
|
|
|
2012-05-17 00:53:20 -07:00
|
|
|
mOSXVersion = nsCocoaFeatures::OSXVersion();
|
2011-12-14 21:04:35 -08:00
|
|
|
|
2011-01-19 17:33:51 -08:00
|
|
|
return rv;
|
2010-10-01 20:55:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-09-28 23:19:26 -07:00
|
|
|
GfxInfo::GetD2DEnabled(bool *aEnabled)
|
2010-10-01 20:55:19 -07:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-09-28 23:19:26 -07:00
|
|
|
GfxInfo::GetDWriteEnabled(bool *aEnabled)
|
2010-10-01 20:55:19 -07:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-01-14 04:57:17 -08:00
|
|
|
/* readonly attribute DOMString DWriteVersion; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetDWriteVersion(nsAString & aDwriteVersion)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-05-10 17:30:20 -07:00
|
|
|
/* readonly attribute DOMString cleartypeParameters; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetCleartypeParameters(nsAString & aCleartypeParams)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2010-10-01 20:55:19 -07:00
|
|
|
/* readonly attribute DOMString adapterDescription; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDescription(nsAString & aAdapterDescription)
|
|
|
|
{
|
|
|
|
aAdapterDescription = mRendererIDsString;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 06:46:41 -07:00
|
|
|
/* readonly attribute DOMString adapterDescription2; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDescription2(nsAString & aAdapterDescription)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2010-10-01 20:55:19 -07:00
|
|
|
/* readonly attribute DOMString adapterRAM; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterRAM(nsAString & aAdapterRAM)
|
|
|
|
{
|
|
|
|
aAdapterRAM = mAdapterRAMString;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 06:46:41 -07:00
|
|
|
/* readonly attribute DOMString adapterRAM2; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterRAM2(nsAString & aAdapterRAM)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2010-10-01 20:55:19 -07:00
|
|
|
/* readonly attribute DOMString adapterDriver; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriver(nsAString & aAdapterDriver)
|
|
|
|
{
|
|
|
|
aAdapterDriver.AssignLiteral("");
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 06:46:41 -07:00
|
|
|
/* readonly attribute DOMString adapterDriver2; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriver2(nsAString & aAdapterDriver)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2010-10-01 20:55:19 -07:00
|
|
|
/* readonly attribute DOMString adapterDriverVersion; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverVersion(nsAString & aAdapterDriverVersion)
|
|
|
|
{
|
|
|
|
aAdapterDriverVersion.AssignLiteral("");
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 06:46:41 -07:00
|
|
|
/* readonly attribute DOMString adapterDriverVersion2; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2010-10-01 20:55:19 -07:00
|
|
|
/* readonly attribute DOMString adapterDriverDate; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverDate(nsAString & aAdapterDriverDate)
|
|
|
|
{
|
|
|
|
aAdapterDriverDate.AssignLiteral("");
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 06:46:41 -07:00
|
|
|
/* readonly attribute DOMString adapterDriverDate2; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverDate2(nsAString & aAdapterDriverDate)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-12-14 21:03:01 -08:00
|
|
|
/* readonly attribute DOMString adapterVendorID; */
|
2010-10-01 20:55:19 -07:00
|
|
|
NS_IMETHODIMP
|
2011-12-14 21:03:01 -08:00
|
|
|
GfxInfo::GetAdapterVendorID(nsAString & aAdapterVendorID)
|
2010-10-01 20:55:19 -07:00
|
|
|
{
|
2011-12-14 21:03:01 -08:00
|
|
|
aAdapterVendorID = mAdapterVendorID;
|
2010-10-01 20:55:19 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-12-14 21:03:01 -08:00
|
|
|
/* readonly attribute DOMString adapterVendorID2; */
|
2011-08-12 06:46:41 -07:00
|
|
|
NS_IMETHODIMP
|
2011-12-14 21:03:01 -08:00
|
|
|
GfxInfo::GetAdapterVendorID2(nsAString & aAdapterVendorID)
|
2011-08-12 06:46:41 -07:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-12-14 21:03:01 -08:00
|
|
|
/* readonly attribute DOMString adapterDeviceID; */
|
2010-10-01 20:55:19 -07:00
|
|
|
NS_IMETHODIMP
|
2011-12-14 21:03:01 -08:00
|
|
|
GfxInfo::GetAdapterDeviceID(nsAString & aAdapterDeviceID)
|
2010-10-01 20:55:19 -07:00
|
|
|
{
|
2011-12-14 21:03:01 -08:00
|
|
|
aAdapterDeviceID = mAdapterDeviceID;
|
2010-10-01 20:55:19 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-12-14 21:03:01 -08:00
|
|
|
/* readonly attribute DOMString adapterDeviceID2; */
|
2011-08-12 06:46:41 -07:00
|
|
|
NS_IMETHODIMP
|
2011-12-14 21:03:01 -08:00
|
|
|
GfxInfo::GetAdapterDeviceID2(nsAString & aAdapterDeviceID)
|
2011-08-12 06:46:41 -07:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* readonly attribute boolean isGPU2Active; */
|
|
|
|
NS_IMETHODIMP
|
2011-09-28 23:19:26 -07:00
|
|
|
GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active)
|
2011-08-12 06:46:41 -07:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2010-10-01 20:55:19 -07:00
|
|
|
void
|
|
|
|
GfxInfo::AddCrashReportAnnotations()
|
|
|
|
{
|
2011-05-23 09:54:47 -07:00
|
|
|
#if defined(MOZ_CRASHREPORTER)
|
2011-12-14 21:03:01 -08:00
|
|
|
nsString deviceID, vendorID;
|
2012-09-01 19:35:17 -07:00
|
|
|
nsAutoCString narrowDeviceID, narrowVendorID;
|
2010-10-01 20:55:19 -07:00
|
|
|
|
2011-12-14 21:03:01 -08:00
|
|
|
GetAdapterDeviceID(deviceID);
|
|
|
|
CopyUTF16toUTF8(deviceID, narrowDeviceID);
|
|
|
|
GetAdapterVendorID(vendorID);
|
|
|
|
CopyUTF16toUTF8(vendorID, narrowVendorID);
|
2011-11-29 10:54:53 -08:00
|
|
|
|
|
|
|
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterVendorID"),
|
2011-12-14 21:03:01 -08:00
|
|
|
narrowVendorID);
|
2011-11-29 10:54:53 -08:00
|
|
|
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDeviceID"),
|
2011-12-14 21:03:01 -08:00
|
|
|
narrowDeviceID);
|
2010-10-01 20:55:19 -07: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-01 19:35:17 -07:00
|
|
|
nsAutoCString note;
|
2010-10-01 20:55:19 -07:00
|
|
|
/* AppendPrintf only supports 32 character strings, mrghh. */
|
2011-12-14 21:03:01 -08:00
|
|
|
note.Append("AdapterVendorID: ");
|
|
|
|
note.Append(narrowVendorID);
|
|
|
|
note.Append(", AdapterDeviceID: ");
|
|
|
|
note.Append(narrowDeviceID);
|
2010-10-01 20:55:19 -07:00
|
|
|
CrashReporter::AppendAppNotesToCrashReport(note);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2011-12-14 21:02:59 -08:00
|
|
|
// We don't support checking driver versions on Mac.
|
|
|
|
#define IMPLEMENT_MAC_DRIVER_BLOCKLIST(os, vendor, device, features, blockOn) \
|
|
|
|
APPEND_TO_DRIVER_BLOCKLIST(os, vendor, device, features, blockOn, \
|
2012-05-04 12:33:59 -07:00
|
|
|
DRIVER_COMPARISON_IGNORED, V(0,0,0,0), "")
|
2011-12-14 21:02:59 -08:00
|
|
|
|
|
|
|
|
|
|
|
const nsTArray<GfxDriverInfo>&
|
2011-11-03 07:50:40 -07:00
|
|
|
GfxInfo::GetGfxDriverInfo()
|
|
|
|
{
|
2011-12-14 21:02:59 -08:00
|
|
|
if (!mDriverInfo->Length()) {
|
|
|
|
IMPLEMENT_MAC_DRIVER_BLOCKLIST(DRIVER_OS_ALL,
|
2011-12-14 21:03:01 -08:00
|
|
|
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorATI), GfxDriverInfo::allDevices,
|
2011-12-14 21:02:59 -08:00
|
|
|
nsIGfxInfo::FEATURE_WEBGL_MSAA, nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION);
|
2011-12-14 21:03:06 -08:00
|
|
|
IMPLEMENT_MAC_DRIVER_BLOCKLIST(DRIVER_OS_ALL,
|
|
|
|
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorATI), (GfxDeviceFamily*) GfxDriverInfo::GetDeviceFamily(RadeonX1000),
|
|
|
|
nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_BLOCKED_DEVICE);
|
|
|
|
IMPLEMENT_MAC_DRIVER_BLOCKLIST(DRIVER_OS_ALL,
|
|
|
|
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), (GfxDeviceFamily*) GfxDriverInfo::GetDeviceFamily(Geforce7300GT),
|
|
|
|
nsIGfxInfo::FEATURE_WEBGL_OPENGL, nsIGfxInfo::FEATURE_BLOCKED_DEVICE);
|
2011-12-14 21:02:59 -08:00
|
|
|
}
|
|
|
|
return *mDriverInfo;
|
2011-11-03 07:50:40 -07:00
|
|
|
}
|
|
|
|
|
2011-01-19 17:30:12 -08:00
|
|
|
nsresult
|
2012-08-22 08:56:38 -07:00
|
|
|
GfxInfo::GetFeatureStatusImpl(int32_t aFeature,
|
|
|
|
int32_t* aStatus,
|
2011-01-19 17:35:51 -08:00
|
|
|
nsAString& aSuggestedDriverVersion,
|
2011-12-14 21:02:59 -08:00
|
|
|
const nsTArray<GfxDriverInfo>& aDriverInfo,
|
2012-07-30 07:20:58 -07:00
|
|
|
OperatingSystem* aOS /* = nullptr */)
|
2010-10-01 20:55:19 -07:00
|
|
|
{
|
2010-12-08 07:56:01 -08:00
|
|
|
NS_ENSURE_ARG_POINTER(aStatus);
|
2011-09-30 17:20:33 -07:00
|
|
|
aSuggestedDriverVersion.SetIsVoid(true);
|
2011-12-14 21:03:08 -08:00
|
|
|
*aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
|
2011-12-14 21:04:35 -08:00
|
|
|
OperatingSystem os = OSXVersionToOperatingSystem(mOSXVersion);
|
2011-12-14 21:03:08 -08:00
|
|
|
if (aOS)
|
|
|
|
*aOS = os;
|
2011-01-19 17:35:51 -08:00
|
|
|
|
2011-12-14 21:03:08 -08:00
|
|
|
// Don't evaluate special cases when we're evaluating the downloaded blocklist.
|
|
|
|
if (!aDriverInfo.Length()) {
|
|
|
|
// The code around the following has been moved into the global blocklist.
|
2011-09-27 07:18:41 -07:00
|
|
|
#if 0
|
2011-12-14 21:03:08 -08:00
|
|
|
// CGL reports a list of renderers, some renderers are slow (e.g. software)
|
|
|
|
// and AFAIK we can't decide which one will be used among them, so let's implement this by returning NO_INFO
|
|
|
|
// if any not-known-to-be-bad renderer is found.
|
|
|
|
// The assumption that we make here is that the system will spontaneously use the best/fastest renderer in the list.
|
|
|
|
// Note that the presence of software renderer fallbacks means that slow software rendering may be automatically
|
|
|
|
// used, which seems to be the case in bug 611292 where the user had a Intel GMA 945 card (non programmable hardware).
|
|
|
|
// Therefore we need to explicitly blacklist non-OpenGL2 hardware, which could result in a software renderer
|
|
|
|
// being used.
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
for (uint32_t i = 0; i < ArrayLength(mRendererIDs); ++i) {
|
2011-12-14 21:03:08 -08:00
|
|
|
switch (mRendererIDs[i]) {
|
|
|
|
case kCGLRendererATIRage128ID: // non-programmable
|
|
|
|
case kCGLRendererATIRadeonID: // non-programmable
|
|
|
|
case kCGLRendererATIRageProID: // non-programmable
|
|
|
|
case kCGLRendererATIRadeon8500ID: // no OpenGL 2 support, http://en.wikipedia.org/wiki/Radeon_R200
|
|
|
|
case kCGLRendererATIRadeon9700ID: // no OpenGL 2 support, http://en.wikipedia.org/wiki/Radeon_R200
|
|
|
|
case kCGLRendererATIRadeonX1000ID: // can't render to non-power-of-two texture backed framebuffers
|
|
|
|
case kCGLRendererIntel900ID: // non-programmable
|
|
|
|
case kCGLRendererGeForce2MXID: // non-programmable
|
|
|
|
case kCGLRendererGeForce3ID: // no OpenGL 2 support,
|
|
|
|
// http://en.wikipedia.org/wiki/Comparison_of_Nvidia_graphics_processing_units
|
|
|
|
case kCGLRendererGeForceFXID: // incomplete OpenGL 2 support with software fallbacks,
|
|
|
|
// http://en.wikipedia.org/wiki/Comparison_of_Nvidia_graphics_processing_units
|
|
|
|
case kCGLRendererVTBladeXP2ID: // Trident DX8 chip, assuming it's not GL2 capable
|
|
|
|
case kCGLRendererMesa3DFXID: // non-programmable
|
|
|
|
case kCGLRendererGenericFloatID: // software renderer
|
|
|
|
case kCGLRendererGenericID: // software renderer
|
|
|
|
case kCGLRendererAppleSWID: // software renderer
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (mRendererIDs[i])
|
|
|
|
foundGoodDevice = true;
|
|
|
|
}
|
2010-12-06 03:34:35 -08:00
|
|
|
}
|
2011-09-27 07:18:41 -07:00
|
|
|
#endif
|
2011-08-11 15:17:50 -07:00
|
|
|
|
2011-12-14 21:03:08 -08:00
|
|
|
if (aFeature == nsIGfxInfo::FEATURE_WEBGL_MSAA) {
|
|
|
|
// Blacklist all ATI cards on OSX, except for
|
|
|
|
// 0x6760 and 0x9488
|
2012-02-21 11:49:06 -08:00
|
|
|
if (mAdapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorATI), nsCaseInsensitiveStringComparator()) &&
|
2011-12-14 21:03:08 -08:00
|
|
|
(mAdapterDeviceID.LowerCaseEqualsLiteral("0x6760") ||
|
|
|
|
mAdapterDeviceID.LowerCaseEqualsLiteral("0x9488"))) {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_NO_INFO;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2011-11-03 07:50:40 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-03 07:50:40 -07:00
|
|
|
return GfxInfoBase::GetFeatureStatusImpl(aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, &os);
|
2010-10-01 20:55:19 -07:00
|
|
|
}
|
2011-12-14 21:04:35 -08:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
|
|
|
// Implement nsIGfxInfoDebug
|
|
|
|
|
|
|
|
/* void spoofVendorID (in DOMString aVendorID); */
|
|
|
|
NS_IMETHODIMP GfxInfo::SpoofVendorID(const nsAString & aVendorID)
|
|
|
|
{
|
|
|
|
mAdapterVendorID = aVendorID;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* void spoofDeviceID (in unsigned long aDeviceID); */
|
|
|
|
NS_IMETHODIMP GfxInfo::SpoofDeviceID(const nsAString & aDeviceID)
|
|
|
|
{
|
|
|
|
mAdapterDeviceID = aDeviceID;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* void spoofDriverVersion (in DOMString aDriverVersion); */
|
|
|
|
NS_IMETHODIMP GfxInfo::SpoofDriverVersion(const nsAString & aDriverVersion)
|
|
|
|
{
|
|
|
|
mDriverVersion = aDriverVersion;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* void spoofOSVersion (in unsigned long aVersion); */
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHODIMP GfxInfo::SpoofOSVersion(uint32_t aVersion)
|
2011-12-14 21:04:35 -08:00
|
|
|
{
|
|
|
|
mOSXVersion = aVersion;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|