2010-10-02 07:55:19 +04: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/. */
|
2010-10-02 07:55:19 +04:00
|
|
|
|
|
|
|
#include <OpenGL/OpenGL.h>
|
|
|
|
#include <OpenGL/CGLRenderers.h>
|
|
|
|
|
2013-12-09 06:52:54 +04:00
|
|
|
#include "mozilla/ArrayUtils.h"
|
2011-10-11 09:50:08 +04:00
|
|
|
|
2010-10-02 07:55:19 +04:00
|
|
|
#include "GfxInfo.h"
|
|
|
|
#include "nsUnicharUtils.h"
|
2017-11-23 12:59:04 +03:00
|
|
|
#include "nsExceptionHandler.h"
|
2012-05-17 11:53:20 +04:00
|
|
|
#include "nsCocoaFeatures.h"
|
2017-11-23 12:59:04 +03:00
|
|
|
#include "nsICrashReporter.h"
|
2011-11-02 23:55:03 +04:00
|
|
|
#include "mozilla/Preferences.h"
|
2013-01-15 16:22:03 +04:00
|
|
|
#include <algorithm>
|
2010-10-02 07:55:19 +04:00
|
|
|
|
2011-09-27 17:55:42 +04:00
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
#import <IOKit/IOKitLib.h>
|
2011-11-03 18:50:40 +04:00
|
|
|
#import <Cocoa/Cocoa.h>
|
2011-09-27 17:55:42 +04:00
|
|
|
|
2010-10-02 07:55:19 +04:00
|
|
|
#define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1"
|
|
|
|
|
2011-10-11 09:50:08 +04:00
|
|
|
using namespace mozilla;
|
2010-10-02 07:55:19 +04:00
|
|
|
using namespace mozilla::widget;
|
|
|
|
|
2011-12-15 09:04:35 +04:00
|
|
|
#ifdef DEBUG
|
2015-07-29 01:45:34 +03:00
|
|
|
NS_IMPL_ISUPPORTS_INHERITED(GfxInfo, GfxInfoBase, nsIGfxInfoDebug)
|
2011-12-15 09:04:35 +04:00
|
|
|
#endif
|
|
|
|
|
2017-10-31 13:25:04 +03:00
|
|
|
GfxInfo::GfxInfo() : mOSXVersion{0}
|
2011-09-27 17:55:42 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-12-15 09:04:35 +04:00
|
|
|
static OperatingSystem
|
2012-08-22 19:56:38 +04:00
|
|
|
OSXVersionToOperatingSystem(uint32_t aOSXVersion)
|
2011-12-15 09:04:35 +04:00
|
|
|
{
|
2014-11-29 01:28:59 +03:00
|
|
|
if (nsCocoaFeatures::ExtractMajorVersion(aOSXVersion) == 10) {
|
|
|
|
switch (nsCocoaFeatures::ExtractMinorVersion(aOSXVersion)) {
|
|
|
|
case 6:
|
2016-06-03 23:13:08 +03:00
|
|
|
return OperatingSystem::OSX10_6;
|
2014-11-29 01:28:59 +03:00
|
|
|
case 7:
|
2016-06-03 23:13:08 +03:00
|
|
|
return OperatingSystem::OSX10_7;
|
2014-11-29 01:28:59 +03:00
|
|
|
case 8:
|
2016-06-03 23:13:08 +03:00
|
|
|
return OperatingSystem::OSX10_8;
|
2014-11-29 01:28:59 +03:00
|
|
|
case 9:
|
2016-06-03 23:13:08 +03:00
|
|
|
return OperatingSystem::OSX10_9;
|
2014-11-29 01:28:59 +03:00
|
|
|
case 10:
|
2016-06-03 23:13:08 +03:00
|
|
|
return OperatingSystem::OSX10_10;
|
2016-02-20 00:59:37 +03:00
|
|
|
case 11:
|
2016-06-03 23:13:08 +03:00
|
|
|
return OperatingSystem::OSX10_11;
|
2016-07-05 00:25:25 +03:00
|
|
|
case 12:
|
|
|
|
return OperatingSystem::OSX10_12;
|
2017-09-28 17:21:10 +03:00
|
|
|
case 13:
|
|
|
|
return OperatingSystem::OSX10_13;
|
2014-11-29 01:28:59 +03:00
|
|
|
}
|
2011-12-15 09:04:35 +04:00
|
|
|
}
|
|
|
|
|
2016-06-03 23:13:08 +03:00
|
|
|
return OperatingSystem::Unknown;
|
2011-12-15 09:04:35 +04:00
|
|
|
}
|
2011-09-27 17:55:42 +04: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 19:56:38 +04:00
|
|
|
static uint32_t IntValueOfCFData(CFDataRef d)
|
2011-09-27 17:55:42 +04:00
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t value = 0;
|
2011-09-27 17:55:42 +04:00
|
|
|
|
|
|
|
if (d) {
|
2012-08-22 19:56:38 +04:00
|
|
|
const uint32_t *vp = reinterpret_cast<const uint32_t*>(CFDataGetBytePtr(d));
|
2011-09-27 17:55:42 +04: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) {
|
2015-06-02 00:04:15 +03:00
|
|
|
mAdapterVendorID.AppendPrintf("0x%04x", IntValueOfCFData((CFDataRef)vendor_id_ref));
|
2011-09-27 17:55:42 +04:00
|
|
|
CFRelease(vendor_id_ref);
|
|
|
|
}
|
|
|
|
CFTypeRef device_id_ref = SearchPortForProperty(dsp_port, CFSTR("device-id"));
|
|
|
|
if (device_id_ref) {
|
2015-06-02 00:04:15 +03:00
|
|
|
mAdapterDeviceID.AppendPrintf("0x%04x", IntValueOfCFData((CFDataRef)device_id_ref));
|
2011-09-27 17:55:42 +04:00
|
|
|
CFRelease(device_id_ref);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-20 04:33:51 +03:00
|
|
|
nsresult
|
2010-10-02 07:55:19 +04:00
|
|
|
GfxInfo::Init()
|
|
|
|
{
|
2011-01-20 04:33:51 +03:00
|
|
|
nsresult rv = GfxInfoBase::Init();
|
|
|
|
|
2011-09-27 18:18:41 +04: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.
|
2010-10-02 07:55:19 +04:00
|
|
|
|
2011-09-27 17:55:42 +04:00
|
|
|
GetDeviceInfo();
|
|
|
|
|
2010-10-02 07:55:19 +04:00
|
|
|
AddCrashReportAnnotations();
|
2011-01-20 04:33:51 +03:00
|
|
|
|
2012-05-17 11:53:20 +04:00
|
|
|
mOSXVersion = nsCocoaFeatures::OSXVersion();
|
2011-12-15 09:04:35 +04:00
|
|
|
|
2011-01-20 04:33:51 +03:00
|
|
|
return rv;
|
2010-10-02 07:55:19 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-09-29 10:19:26 +04:00
|
|
|
GfxInfo::GetD2DEnabled(bool *aEnabled)
|
2010-10-02 07:55:19 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-09-29 10:19:26 +04:00
|
|
|
GfxInfo::GetDWriteEnabled(bool *aEnabled)
|
2010-10-02 07:55:19 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-01-14 15:57:17 +03:00
|
|
|
/* readonly attribute DOMString DWriteVersion; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetDWriteVersion(nsAString & aDwriteVersion)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-05-11 04:30:20 +04:00
|
|
|
/* readonly attribute DOMString cleartypeParameters; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetCleartypeParameters(nsAString & aCleartypeParams)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2010-10-02 07:55:19 +04:00
|
|
|
/* readonly attribute DOMString adapterDescription; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDescription(nsAString & aAdapterDescription)
|
|
|
|
{
|
2013-08-02 09:25:16 +04:00
|
|
|
aAdapterDescription.AssignLiteral("");
|
2010-10-02 07:55:19 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 17:46:41 +04:00
|
|
|
/* readonly attribute DOMString adapterDescription2; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDescription2(nsAString & aAdapterDescription)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2010-10-02 07:55:19 +04:00
|
|
|
/* readonly attribute DOMString adapterRAM; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterRAM(nsAString & aAdapterRAM)
|
|
|
|
{
|
|
|
|
aAdapterRAM = mAdapterRAMString;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 17:46:41 +04:00
|
|
|
/* readonly attribute DOMString adapterRAM2; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterRAM2(nsAString & aAdapterRAM)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2010-10-02 07:55:19 +04:00
|
|
|
/* readonly attribute DOMString adapterDriver; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriver(nsAString & aAdapterDriver)
|
|
|
|
{
|
|
|
|
aAdapterDriver.AssignLiteral("");
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 17:46:41 +04:00
|
|
|
/* readonly attribute DOMString adapterDriver2; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriver2(nsAString & aAdapterDriver)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2010-10-02 07:55:19 +04:00
|
|
|
/* readonly attribute DOMString adapterDriverVersion; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverVersion(nsAString & aAdapterDriverVersion)
|
|
|
|
{
|
|
|
|
aAdapterDriverVersion.AssignLiteral("");
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 17:46:41 +04:00
|
|
|
/* readonly attribute DOMString adapterDriverVersion2; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2010-10-02 07:55:19 +04:00
|
|
|
/* readonly attribute DOMString adapterDriverDate; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverDate(nsAString & aAdapterDriverDate)
|
|
|
|
{
|
|
|
|
aAdapterDriverDate.AssignLiteral("");
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 17:46:41 +04:00
|
|
|
/* readonly attribute DOMString adapterDriverDate2; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverDate2(nsAString & aAdapterDriverDate)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-12-15 09:03:01 +04:00
|
|
|
/* readonly attribute DOMString adapterVendorID; */
|
2010-10-02 07:55:19 +04:00
|
|
|
NS_IMETHODIMP
|
2011-12-15 09:03:01 +04:00
|
|
|
GfxInfo::GetAdapterVendorID(nsAString & aAdapterVendorID)
|
2010-10-02 07:55:19 +04:00
|
|
|
{
|
2011-12-15 09:03:01 +04:00
|
|
|
aAdapterVendorID = mAdapterVendorID;
|
2010-10-02 07:55:19 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-12-15 09:03:01 +04:00
|
|
|
/* readonly attribute DOMString adapterVendorID2; */
|
2011-08-12 17:46:41 +04:00
|
|
|
NS_IMETHODIMP
|
2011-12-15 09:03:01 +04:00
|
|
|
GfxInfo::GetAdapterVendorID2(nsAString & aAdapterVendorID)
|
2011-08-12 17:46:41 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-12-15 09:03:01 +04:00
|
|
|
/* readonly attribute DOMString adapterDeviceID; */
|
2010-10-02 07:55:19 +04:00
|
|
|
NS_IMETHODIMP
|
2011-12-15 09:03:01 +04:00
|
|
|
GfxInfo::GetAdapterDeviceID(nsAString & aAdapterDeviceID)
|
2010-10-02 07:55:19 +04:00
|
|
|
{
|
2011-12-15 09:03:01 +04:00
|
|
|
aAdapterDeviceID = mAdapterDeviceID;
|
2010-10-02 07:55:19 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-12-15 09:03:01 +04:00
|
|
|
/* readonly attribute DOMString adapterDeviceID2; */
|
2011-08-12 17:46:41 +04:00
|
|
|
NS_IMETHODIMP
|
2011-12-15 09:03:01 +04:00
|
|
|
GfxInfo::GetAdapterDeviceID2(nsAString & aAdapterDeviceID)
|
2011-08-12 17:46:41 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2014-07-09 22:21:49 +04:00
|
|
|
/* readonly attribute DOMString adapterSubsysID; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterSubsysID(nsAString & aAdapterSubsysID)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* readonly attribute DOMString adapterSubsysID2; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterSubsysID2(nsAString & aAdapterSubsysID)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-08-12 17:46:41 +04:00
|
|
|
/* readonly attribute boolean isGPU2Active; */
|
|
|
|
NS_IMETHODIMP
|
2011-09-29 10:19:26 +04:00
|
|
|
GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active)
|
2011-08-12 17:46:41 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2010-10-02 07:55:19 +04:00
|
|
|
void
|
|
|
|
GfxInfo::AddCrashReportAnnotations()
|
|
|
|
{
|
2014-07-09 22:21:49 +04:00
|
|
|
nsString deviceID, vendorID, driverVersion;
|
|
|
|
nsAutoCString narrowDeviceID, narrowVendorID, narrowDriverVersion;
|
2010-10-02 07:55:19 +04:00
|
|
|
|
2011-12-15 09:03:01 +04:00
|
|
|
GetAdapterDeviceID(deviceID);
|
|
|
|
CopyUTF16toUTF8(deviceID, narrowDeviceID);
|
|
|
|
GetAdapterVendorID(vendorID);
|
|
|
|
CopyUTF16toUTF8(vendorID, narrowVendorID);
|
2014-07-09 22:21:49 +04:00
|
|
|
GetAdapterDriverVersion(driverVersion);
|
|
|
|
CopyUTF16toUTF8(driverVersion, narrowDriverVersion);
|
2011-11-29 22:54:53 +04:00
|
|
|
|
|
|
|
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterVendorID"),
|
2011-12-15 09:03:01 +04:00
|
|
|
narrowVendorID);
|
2011-11-29 22:54:53 +04:00
|
|
|
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDeviceID"),
|
2011-12-15 09:03:01 +04:00
|
|
|
narrowDeviceID);
|
2014-07-09 22:21:49 +04:00
|
|
|
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDriverVersion"),
|
|
|
|
narrowDriverVersion);
|
2010-10-02 07:55:19 +04: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 06:35:17 +04:00
|
|
|
nsAutoCString note;
|
2010-10-02 07:55:19 +04:00
|
|
|
/* AppendPrintf only supports 32 character strings, mrghh. */
|
2017-09-04 08:14:11 +03:00
|
|
|
note.AppendLiteral("AdapterVendorID: ");
|
2011-12-15 09:03:01 +04:00
|
|
|
note.Append(narrowVendorID);
|
2017-09-04 08:14:11 +03:00
|
|
|
note.AppendLiteral(", AdapterDeviceID: ");
|
2011-12-15 09:03:01 +04:00
|
|
|
note.Append(narrowDeviceID);
|
2010-10-02 07:55:19 +04:00
|
|
|
CrashReporter::AppendAppNotesToCrashReport(note);
|
|
|
|
}
|
|
|
|
|
2011-12-15 09:02:59 +04:00
|
|
|
// We don't support checking driver versions on Mac.
|
2016-04-14 00:12:47 +03:00
|
|
|
#define IMPLEMENT_MAC_DRIVER_BLOCKLIST(os, vendor, device, features, blockOn, ruleId) \
|
2011-12-15 09:02:59 +04:00
|
|
|
APPEND_TO_DRIVER_BLOCKLIST(os, vendor, device, features, blockOn, \
|
2016-04-14 00:12:47 +03:00
|
|
|
DRIVER_COMPARISON_IGNORED, V(0,0,0,0), ruleId, "")
|
2011-12-15 09:02:59 +04:00
|
|
|
|
|
|
|
|
|
|
|
const nsTArray<GfxDriverInfo>&
|
2011-11-03 18:50:40 +04:00
|
|
|
GfxInfo::GetGfxDriverInfo()
|
|
|
|
{
|
2011-12-15 09:02:59 +04:00
|
|
|
if (!mDriverInfo->Length()) {
|
2016-06-03 23:13:08 +03:00
|
|
|
IMPLEMENT_MAC_DRIVER_BLOCKLIST(OperatingSystem::OSX,
|
2011-12-15 09:03:01 +04:00
|
|
|
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorATI), GfxDriverInfo::allDevices,
|
2016-04-14 00:12:47 +03:00
|
|
|
nsIGfxInfo::FEATURE_WEBGL_MSAA, nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION, "FEATURE_FAILURE_MAC_ATI_NO_MSAA");
|
2016-06-03 23:13:08 +03:00
|
|
|
IMPLEMENT_MAC_DRIVER_BLOCKLIST(OperatingSystem::OSX,
|
2011-12-15 09:03:06 +04:00
|
|
|
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorATI), (GfxDeviceFamily*) GfxDriverInfo::GetDeviceFamily(RadeonX1000),
|
2016-04-14 00:12:47 +03:00
|
|
|
nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_BLOCKED_DEVICE, "FEATURE_FAILURE_MAC_RADEONX1000_NO_TEXTURE2D");
|
2016-06-03 23:13:08 +03:00
|
|
|
IMPLEMENT_MAC_DRIVER_BLOCKLIST(OperatingSystem::OSX,
|
2016-04-14 00:12:47 +03:00
|
|
|
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), (GfxDeviceFamily*) GfxDriverInfo::GetDeviceFamily(Geforce7300GT),
|
|
|
|
nsIGfxInfo::FEATURE_WEBGL_OPENGL, nsIGfxInfo::FEATURE_BLOCKED_DEVICE, "FEATURE_FAILURE_MAC_7300_NO_WEBGL");
|
2011-12-15 09:02:59 +04:00
|
|
|
}
|
|
|
|
return *mDriverInfo;
|
2011-11-03 18:50:40 +04:00
|
|
|
}
|
|
|
|
|
2011-01-20 04:30:12 +03:00
|
|
|
nsresult
|
2016-04-14 00:12:47 +03:00
|
|
|
GfxInfo::GetFeatureStatusImpl(int32_t aFeature,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t* aStatus,
|
2011-01-20 04:35:51 +03:00
|
|
|
nsAString& aSuggestedDriverVersion,
|
2011-12-15 09:02:59 +04:00
|
|
|
const nsTArray<GfxDriverInfo>& aDriverInfo,
|
2016-04-14 00:12:47 +03:00
|
|
|
nsACString& aFailureId,
|
2012-07-30 18:20:58 +04:00
|
|
|
OperatingSystem* aOS /* = nullptr */)
|
2010-10-02 07:55:19 +04:00
|
|
|
{
|
2010-12-08 18:56:01 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aStatus);
|
2011-10-01 04:20:33 +04:00
|
|
|
aSuggestedDriverVersion.SetIsVoid(true);
|
2011-12-15 09:03:08 +04:00
|
|
|
*aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
|
2011-12-15 09:04:35 +04:00
|
|
|
OperatingSystem os = OSXVersionToOperatingSystem(mOSXVersion);
|
2011-12-15 09:03:08 +04:00
|
|
|
if (aOS)
|
|
|
|
*aOS = os;
|
2011-01-20 04:35:51 +03:00
|
|
|
|
2011-12-15 09:03:08 +04:00
|
|
|
// Don't evaluate special cases when we're evaluating the downloaded blocklist.
|
|
|
|
if (!aDriverInfo.Length()) {
|
|
|
|
if (aFeature == nsIGfxInfo::FEATURE_WEBGL_MSAA) {
|
|
|
|
// Blacklist all ATI cards on OSX, except for
|
|
|
|
// 0x6760 and 0x9488
|
2016-04-14 00:12:47 +03:00
|
|
|
if (mAdapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorATI), nsCaseInsensitiveStringComparator()) &&
|
2011-12-15 09:03:08 +04:00
|
|
|
(mAdapterDeviceID.LowerCaseEqualsLiteral("0x6760") ||
|
|
|
|
mAdapterDeviceID.LowerCaseEqualsLiteral("0x9488"))) {
|
2014-07-02 01:44:09 +04:00
|
|
|
*aStatus = nsIGfxInfo::FEATURE_STATUS_OK;
|
2011-12-15 09:03:08 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2016-02-24 12:25:00 +03:00
|
|
|
} else if (aFeature == nsIGfxInfo::FEATURE_CANVAS2D_ACCELERATION) {
|
|
|
|
// See bug 1249659
|
2016-06-03 23:13:08 +03:00
|
|
|
switch(os) {
|
|
|
|
case OperatingSystem::OSX10_5:
|
|
|
|
case OperatingSystem::OSX10_6:
|
|
|
|
case OperatingSystem::OSX10_7:
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION;
|
|
|
|
aFailureId = "FEATURE_FAILURE_CANVAS_OSX_VERSION";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_STATUS_OK;
|
|
|
|
break;
|
2016-04-14 00:12:47 +03:00
|
|
|
}
|
2016-02-24 12:25:00 +03:00
|
|
|
return NS_OK;
|
2011-11-03 18:50:40 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-14 00:12:47 +03:00
|
|
|
return GfxInfoBase::GetFeatureStatusImpl(aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, aFailureId, &os);
|
2010-10-02 07:55:19 +04:00
|
|
|
}
|
2011-12-15 09:04:35 +04:00
|
|
|
|
2015-07-13 11:12:44 +03:00
|
|
|
nsresult
|
|
|
|
GfxInfo::FindMonitors(JSContext* aCx, JS::HandleObject aOutArray)
|
|
|
|
{
|
|
|
|
// Getting the refresh rate is a little hard on OS X. We could use
|
|
|
|
// CVDisplayLinkGetNominalOutputVideoRefreshPeriod, but that's a little
|
|
|
|
// involved. Ideally we could query it from vsync. For now, we leave it out.
|
|
|
|
int32_t deviceCount = 0;
|
|
|
|
for (NSScreen* screen in [NSScreen screens]) {
|
|
|
|
NSRect rect = [screen frame];
|
|
|
|
|
|
|
|
JS::Rooted<JSObject*> obj(aCx, JS_NewPlainObject(aCx));
|
|
|
|
|
|
|
|
JS::Rooted<JS::Value> screenWidth(aCx, JS::Int32Value((int)rect.size.width));
|
|
|
|
JS_SetProperty(aCx, obj, "screenWidth", screenWidth);
|
|
|
|
|
|
|
|
JS::Rooted<JS::Value> screenHeight(aCx, JS::Int32Value((int)rect.size.height));
|
|
|
|
JS_SetProperty(aCx, obj, "screenHeight", screenHeight);
|
|
|
|
|
|
|
|
JS::Rooted<JS::Value> scale(aCx, JS::NumberValue(nsCocoaUtils::GetBackingScaleFactor(screen)));
|
|
|
|
JS_SetProperty(aCx, obj, "scale", scale);
|
|
|
|
|
|
|
|
JS::Rooted<JS::Value> element(aCx, JS::ObjectValue(*obj));
|
|
|
|
JS_SetElement(aCx, aOutArray, deviceCount++, element);
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-12-15 09:04:35 +04: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 19:56:38 +04:00
|
|
|
NS_IMETHODIMP GfxInfo::SpoofOSVersion(uint32_t aVersion)
|
2011-12-15 09:04:35 +04:00
|
|
|
{
|
|
|
|
mOSXVersion = aVersion;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|