diff --git a/toolkit/content/license.html b/toolkit/content/license.html
index 4fbe0aace81..15de57e4120 100644
--- a/toolkit/content/license.html
+++ b/toolkit/content/license.html
@@ -2219,7 +2219,8 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Chromium License
This license applies to parts of the code in
- editor/libeditor/base/nsEditorEventListener.cpp
+ editor/libeditor/base/nsEditorEventListener.cpp,
+ widget/src/cocoa/GfxInfo.mm
and also some files in the directories
ipc/chromium/,
dom/plugins/,
diff --git a/widget/src/cocoa/GfxInfo.h b/widget/src/cocoa/GfxInfo.h
index 80e1c17e49d..34a61539b74 100644
--- a/widget/src/cocoa/GfxInfo.h
+++ b/widget/src/cocoa/GfxInfo.h
@@ -50,6 +50,8 @@ namespace widget {
class GfxInfo : public GfxInfoBase
{
public:
+
+ GfxInfo();
// We only declare the subset of nsIGfxInfo that we actually implement. The
// rest is brought forward from GfxInfoBase.
NS_SCRIPTABLE NS_IMETHOD GetD2DEnabled(PRBool *aD2DEnabled);
@@ -84,6 +86,7 @@ protected:
private:
+ void GetDeviceInfo();
void AddCrashReportAnnotations();
nsString mRendererIDsString;
nsString mAdapterRAMString;
@@ -93,6 +96,9 @@ private:
nsString mDriverDate;
nsString mDeviceKey;
+ PRUint32 mAdapterVendorID;
+ PRUint32 mAdapterDeviceID;
+
PRUint32 mRendererIDs[16];
};
diff --git a/widget/src/cocoa/GfxInfo.mm b/widget/src/cocoa/GfxInfo.mm
index 56703ddbc0b..41db79356a9 100644
--- a/widget/src/cocoa/GfxInfo.mm
+++ b/widget/src/cocoa/GfxInfo.mm
@@ -44,6 +44,9 @@
#include "mozilla/FunctionTimer.h"
#include "nsToolkit.h"
+#import
+#import
+
#if defined(MOZ_CRASHREPORTER)
#include "nsExceptionHandler.h"
#include "nsICrashReporter.h"
@@ -52,6 +55,53 @@
using namespace mozilla::widget;
+GfxInfo::GfxInfo()
+ : mAdapterVendorID(0),
+ mAdapterDeviceID(0)
+{
+}
+
+// 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);
+}
+
+static PRUint32 IntValueOfCFData(CFDataRef d)
+{
+ PRUint32 value = 0;
+
+ if (d) {
+ const PRUint32 *vp = reinterpret_cast(CFDataGetBytePtr(d));
+ 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) {
+ mAdapterVendorID = IntValueOfCFData((CFDataRef)vendor_id_ref);
+ CFRelease(vendor_id_ref);
+ }
+ CFTypeRef device_id_ref = SearchPortForProperty(dsp_port, CFSTR("device-id"));
+ if (device_id_ref) {
+ mAdapterDeviceID = IntValueOfCFData((CFDataRef)device_id_ref);
+ CFRelease(device_id_ref);
+ }
+}
+
nsresult
GfxInfo::Init()
{
@@ -89,6 +139,8 @@ GfxInfo::Init()
CGLDestroyRendererInfo(renderer);
+ GetDeviceInfo();
+
AddCrashReportAnnotations();
return rv;
@@ -205,7 +257,7 @@ GfxInfo::GetAdapterDriverDate2(nsAString & aAdapterDriverDate)
NS_IMETHODIMP
GfxInfo::GetAdapterVendorID(PRUint32 *aAdapterVendorID)
{
- *aAdapterVendorID = 0;
+ *aAdapterVendorID = mAdapterVendorID;
return NS_OK;
}
@@ -220,7 +272,7 @@ GfxInfo::GetAdapterVendorID2(PRUint32 *aAdapterVendorID)
NS_IMETHODIMP
GfxInfo::GetAdapterDeviceID(PRUint32 *aAdapterDeviceID)
{
- *aAdapterDeviceID = 0;
+ *aAdapterDeviceID = mAdapterDeviceID;
return NS_OK;
}