From 92ca3d17d9e1e3a3c7a8e2af83b887a52f10f570 Mon Sep 17 00:00:00 2001 From: Milan Sreckovic Date: Mon, 30 Jun 2014 14:26:39 -0400 Subject: [PATCH] Bug 918386: Add webidl for adapter subsys. Only relevant on Windows. r=vvukicevic. --- widget/android/GfxInfo.cpp | 18 +++++++++++ widget/android/GfxInfo.h | 2 ++ widget/cocoa/GfxInfo.h | 2 ++ widget/cocoa/GfxInfo.mm | 22 ++++++++++++-- widget/gonk/GfxInfo.cpp | 14 +++++++++ widget/gonk/GfxInfo.h | 2 ++ widget/nsIGfxInfo.idl | 3 ++ widget/windows/GfxInfo.cpp | 54 ++++++++++++++++++++++++--------- widget/windows/GfxInfo.h | 6 ++-- widget/xpwidgets/GfxInfoX11.cpp | 14 +++++++++ widget/xpwidgets/GfxInfoX11.h | 2 ++ 11 files changed, 121 insertions(+), 18 deletions(-) diff --git a/widget/android/GfxInfo.cpp b/widget/android/GfxInfo.cpp index 7cb58aa393c..8a04cf2fcbe 100644 --- a/widget/android/GfxInfo.cpp +++ b/widget/android/GfxInfo.cpp @@ -320,6 +320,22 @@ GfxInfo::GetAdapterDeviceID2(nsAString & aAdapterDeviceID) return NS_ERROR_FAILURE; } +/* 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; +} + /* readonly attribute boolean isGPU2Active; */ NS_IMETHODIMP GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active) @@ -336,6 +352,8 @@ GfxInfo::AddCrashReportAnnotations() mGLStrings->Vendor()); CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDeviceID"), mGLStrings->Renderer()); + CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDriverVersion"), + mGLStrings->Version()); /* 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 */ diff --git a/widget/android/GfxInfo.h b/widget/android/GfxInfo.h index 34c4b35f952..af2f97ec520 100644 --- a/widget/android/GfxInfo.h +++ b/widget/android/GfxInfo.h @@ -37,6 +37,7 @@ public: NS_IMETHOD GetAdapterDriver(nsAString & aAdapterDriver); NS_IMETHOD GetAdapterVendorID(nsAString & aAdapterVendorID); NS_IMETHOD GetAdapterDeviceID(nsAString & aAdapterDeviceID); + NS_IMETHOD GetAdapterSubsysID(nsAString & aAdapterSubsysID); NS_IMETHOD GetAdapterRAM(nsAString & aAdapterRAM); NS_IMETHOD GetAdapterDriverVersion(nsAString & aAdapterDriverVersion); NS_IMETHOD GetAdapterDriverDate(nsAString & aAdapterDriverDate); @@ -44,6 +45,7 @@ public: NS_IMETHOD GetAdapterDriver2(nsAString & aAdapterDriver); NS_IMETHOD GetAdapterVendorID2(nsAString & aAdapterVendorID); NS_IMETHOD GetAdapterDeviceID2(nsAString & aAdapterDeviceID); + NS_IMETHOD GetAdapterSubsysID2(nsAString & aAdapterSubsysID); NS_IMETHOD GetAdapterRAM2(nsAString & aAdapterRAM); NS_IMETHOD GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion); NS_IMETHOD GetAdapterDriverDate2(nsAString & aAdapterDriverDate); diff --git a/widget/cocoa/GfxInfo.h b/widget/cocoa/GfxInfo.h index d1f9e44e50a..141bb7ebdb6 100644 --- a/widget/cocoa/GfxInfo.h +++ b/widget/cocoa/GfxInfo.h @@ -30,6 +30,7 @@ public: NS_IMETHOD GetAdapterDriver(nsAString & aAdapterDriver); NS_IMETHOD GetAdapterVendorID(nsAString & aAdapterVendorID); NS_IMETHOD GetAdapterDeviceID(nsAString & aAdapterDeviceID); + NS_IMETHOD GetAdapterSubsysID(nsAString & aAdapterSubsysID); NS_IMETHOD GetAdapterRAM(nsAString & aAdapterRAM); NS_IMETHOD GetAdapterDriverVersion(nsAString & aAdapterDriverVersion); NS_IMETHOD GetAdapterDriverDate(nsAString & aAdapterDriverDate); @@ -37,6 +38,7 @@ public: NS_IMETHOD GetAdapterDriver2(nsAString & aAdapterDriver); NS_IMETHOD GetAdapterVendorID2(nsAString & aAdapterVendorID); NS_IMETHOD GetAdapterDeviceID2(nsAString & aAdapterDeviceID); + NS_IMETHOD GetAdapterSubsysID2(nsAString & aAdapterSubsysID); NS_IMETHOD GetAdapterRAM2(nsAString & aAdapterRAM); NS_IMETHOD GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion); NS_IMETHOD GetAdapterDriverDate2(nsAString & aAdapterDriverDate); diff --git a/widget/cocoa/GfxInfo.mm b/widget/cocoa/GfxInfo.mm index b3390965e8e..16d23c610bb 100644 --- a/widget/cocoa/GfxInfo.mm +++ b/widget/cocoa/GfxInfo.mm @@ -245,6 +245,20 @@ GfxInfo::GetAdapterDeviceID2(nsAString & aAdapterDeviceID) return NS_ERROR_FAILURE; } +/* 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; +} + /* readonly attribute boolean isGPU2Active; */ NS_IMETHODIMP GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active) @@ -256,18 +270,22 @@ void GfxInfo::AddCrashReportAnnotations() { #if defined(MOZ_CRASHREPORTER) - nsString deviceID, vendorID; - nsAutoCString narrowDeviceID, narrowVendorID; + nsString deviceID, vendorID, driverVersion; + nsAutoCString narrowDeviceID, narrowVendorID, narrowDriverVersion; GetAdapterDeviceID(deviceID); CopyUTF16toUTF8(deviceID, narrowDeviceID); GetAdapterVendorID(vendorID); CopyUTF16toUTF8(vendorID, narrowVendorID); + GetAdapterDriverVersion(driverVersion); + CopyUTF16toUTF8(driverVersion, narrowDriverVersion); CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterVendorID"), narrowVendorID); CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDeviceID"), narrowDeviceID); + CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDriverVersion"), + narrowDriverVersion); /* 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 */ nsAutoCString note; diff --git a/widget/gonk/GfxInfo.cpp b/widget/gonk/GfxInfo.cpp index 956c55fad5a..6e34c073e28 100644 --- a/widget/gonk/GfxInfo.cpp +++ b/widget/gonk/GfxInfo.cpp @@ -140,6 +140,20 @@ GfxInfo::GetAdapterDeviceID2(nsAString & aAdapterDeviceID) return NS_ERROR_FAILURE; } +/* 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; +} + /* readonly attribute boolean isGPU2Active; */ NS_IMETHODIMP GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active) diff --git a/widget/gonk/GfxInfo.h b/widget/gonk/GfxInfo.h index a75c4581e69..84828663fc8 100644 --- a/widget/gonk/GfxInfo.h +++ b/widget/gonk/GfxInfo.h @@ -29,6 +29,7 @@ public: NS_IMETHOD GetAdapterDriver(nsAString & aAdapterDriver); NS_IMETHOD GetAdapterVendorID(nsAString & aAdapterVendorID); NS_IMETHOD GetAdapterDeviceID(nsAString & aAdapterDeviceID); + NS_IMETHOD GetAdapterSubsysID(nsAString & aAdapterSubsysID); NS_IMETHOD GetAdapterRAM(nsAString & aAdapterRAM); NS_IMETHOD GetAdapterDriverVersion(nsAString & aAdapterDriverVersion); NS_IMETHOD GetAdapterDriverDate(nsAString & aAdapterDriverDate); @@ -36,6 +37,7 @@ public: NS_IMETHOD GetAdapterDriver2(nsAString & aAdapterDriver); NS_IMETHOD GetAdapterVendorID2(nsAString & aAdapterVendorID); NS_IMETHOD GetAdapterDeviceID2(nsAString & aAdapterDeviceID); + NS_IMETHOD GetAdapterSubsysID2(nsAString & aAdapterSubsysID); NS_IMETHOD GetAdapterRAM2(nsAString & aAdapterRAM); NS_IMETHOD GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion); NS_IMETHOD GetAdapterDriverDate2(nsAString & aAdapterDriverDate); diff --git a/widget/nsIGfxInfo.idl b/widget/nsIGfxInfo.idl index 4b62932f71d..5678dbdea10 100644 --- a/widget/nsIGfxInfo.idl +++ b/widget/nsIGfxInfo.idl @@ -37,6 +37,9 @@ interface nsIGfxInfo : nsISupports readonly attribute DOMString adapterDeviceID; readonly attribute DOMString adapterDeviceID2; + readonly attribute DOMString adapterSubsysID; + readonly attribute DOMString adapterSubsysID2; + /** * The amount of RAM in MB in the display adapter. */ diff --git a/widget/windows/GfxInfo.cpp b/widget/windows/GfxInfo.cpp index d50f75c4eb2..045c9928510 100644 --- a/widget/windows/GfxInfo.cpp +++ b/widget/windows/GfxInfo.cpp @@ -392,7 +392,7 @@ GfxInfo::Init() mAdapterVendorID.AppendPrintf("0x%04x", ParseIDFromDeviceID(mDeviceID, "VEN_", 4)); mAdapterDeviceID.AppendPrintf("0x%04x", ParseIDFromDeviceID(mDeviceID, "&DEV_", 4)); - mAdapterSubsysID = ParseIDFromDeviceID(mDeviceID, "&SUBSYS_", 8); + mAdapterSubsysID.AppendPrintf("%08x", ParseIDFromDeviceID(mDeviceID, "&SUBSYS_", 8)); // We now check for second display adapter. @@ -496,7 +496,7 @@ GfxInfo::Init() mDriverDate2 = driverDate2; mAdapterVendorID2.AppendPrintf("0x%04x", adapterVendorID2); mAdapterDeviceID2.AppendPrintf("0x%04x", adapterDeviceID2); - mAdapterSubsysID2 = ParseIDFromDeviceID(mDeviceID2, "&SUBSYS_", 8); + mAdapterSubsysID2.AppendPrintf("%08x", ParseIDFromDeviceID(mDeviceID2, "&SUBSYS_", 8)); break; } } @@ -684,6 +684,22 @@ GfxInfo::GetAdapterDeviceID2(nsAString & aAdapterDeviceID) return NS_OK; } +/* readonly attribute DOMString adapterSubsysID; */ +NS_IMETHODIMP +GfxInfo::GetAdapterSubsysID(nsAString & aAdapterSubsysID) +{ + aAdapterSubsysID = mAdapterSubsysID; + return NS_OK; +} + +/* readonly attribute DOMString adapterSubsysID2; */ +NS_IMETHODIMP +GfxInfo::GetAdapterSubsysID2(nsAString & aAdapterSubsysID) +{ + aAdapterSubsysID = mAdapterSubsysID2; + return NS_OK; +} + /* readonly attribute boolean isGPU2Active; */ NS_IMETHODIMP GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active) @@ -719,21 +735,27 @@ GfxInfo::AddCrashReportAnnotations() CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("DriverVersionMismatch\n")); } - nsString deviceID, vendorID; - nsCString narrowDeviceID, narrowVendorID; - nsAutoString adapterDriverVersionString; + nsString deviceID, vendorID, driverVersion, subsysID; + nsCString narrowDeviceID, narrowVendorID, narrowDriverVersion, narrowSubsysID; GetAdapterDeviceID(deviceID); CopyUTF16toUTF8(deviceID, narrowDeviceID); GetAdapterVendorID(vendorID); CopyUTF16toUTF8(vendorID, narrowVendorID); - GetAdapterDriverVersion(adapterDriverVersionString); + GetAdapterDriverVersion(driverVersion); + CopyUTF16toUTF8(driverVersion, narrowDriverVersion); + GetAdapterSubsysID(subsysID); + CopyUTF16toUTF8(subsysID, narrowSubsysID); CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterVendorID"), narrowVendorID); CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDeviceID"), narrowDeviceID); - + CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDriverVersion"), + narrowDriverVersion); + CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterSubsysID"), + narrowSubsysID); + /* 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 */ nsAutoCString note; @@ -742,9 +764,10 @@ GfxInfo::AddCrashReportAnnotations() note.Append(narrowVendorID); note.AppendLiteral(", AdapterDeviceID: "); note.Append(narrowDeviceID); - note.AppendPrintf(", AdapterSubsysID: %08x, ", mAdapterSubsysID); - note.AppendLiteral("AdapterDriverVersion: "); - note.Append(NS_LossyConvertUTF16toASCII(adapterDriverVersionString)); + note.AppendLiteral(", AdapterSubsysID: "); + note.Append(narrowSubsysID); + note.AppendLiteral(", AdapterDriverVersion: "); + note.Append(NS_LossyConvertUTF16toASCII(driverVersion)); if (vendorID == GfxDriverInfo::GetDeviceVendor(VendorAll)) { /* if we didn't find a valid vendorID lets append the mDeviceID string to try to find out why */ @@ -757,9 +780,9 @@ GfxInfo::AddCrashReportAnnotations() note.Append("\n"); if (mHasDualGPU) { - nsString deviceID2, vendorID2; + nsString deviceID2, vendorID2, subsysID2; nsAutoString adapterDriverVersionString2; - nsCString narrowDeviceID2, narrowVendorID2; + nsCString narrowDeviceID2, narrowVendorID2, narrowSubsysID2; note.AppendLiteral("Has dual GPUs. GPU #2: "); GetAdapterDeviceID2(deviceID2); @@ -767,12 +790,15 @@ GfxInfo::AddCrashReportAnnotations() GetAdapterVendorID2(vendorID2); CopyUTF16toUTF8(vendorID2, narrowVendorID2); GetAdapterDriverVersion2(adapterDriverVersionString2); + GetAdapterSubsysID(subsysID2); + CopyUTF16toUTF8(subsysID2, narrowSubsysID2); note.AppendLiteral("AdapterVendorID2: "); note.Append(narrowVendorID2); note.AppendLiteral(", AdapterDeviceID2: "); note.Append(narrowDeviceID2); - note.AppendPrintf(", AdapterSubsysID2: %08x, ", mAdapterSubsysID2); - note.AppendPrintf("AdapterDriverVersion2: "); + note.AppendLiteral(", AdapterSubsysID2: "); + note.Append(narrowSubsysID2); + note.AppendLiteral(", AdapterDriverVersion2: "); note.Append(NS_LossyConvertUTF16toASCII(adapterDriverVersionString2)); } CrashReporter::AppendAppNotesToCrashReport(note); diff --git a/widget/windows/GfxInfo.h b/widget/windows/GfxInfo.h index 62d764dab17..a766842cb08 100644 --- a/widget/windows/GfxInfo.h +++ b/widget/windows/GfxInfo.h @@ -28,6 +28,7 @@ public: NS_IMETHOD GetAdapterDriver(nsAString & aAdapterDriver); NS_IMETHOD GetAdapterVendorID(nsAString & aAdapterVendorID); NS_IMETHOD GetAdapterDeviceID(nsAString & aAdapterDeviceID); + NS_IMETHOD GetAdapterSubsysID(nsAString & aAdapterSubsysID); NS_IMETHOD GetAdapterRAM(nsAString & aAdapterRAM); NS_IMETHOD GetAdapterDriverVersion(nsAString & aAdapterDriverVersion); NS_IMETHOD GetAdapterDriverDate(nsAString & aAdapterDriverDate); @@ -35,6 +36,7 @@ public: NS_IMETHOD GetAdapterDriver2(nsAString & aAdapterDriver); NS_IMETHOD GetAdapterVendorID2(nsAString & aAdapterVendorID); NS_IMETHOD GetAdapterDeviceID2(nsAString & aAdapterDeviceID); + NS_IMETHOD GetAdapterSubsysID2(nsAString & aAdapterSubsysID); NS_IMETHOD GetAdapterRAM2(nsAString & aAdapterRAM); NS_IMETHOD GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion); NS_IMETHOD GetAdapterDriverDate2(nsAString & aAdapterDriverDate); @@ -72,7 +74,7 @@ private: nsString mDeviceKeyDebug; nsString mAdapterVendorID; nsString mAdapterDeviceID; - uint32_t mAdapterSubsysID; + nsString mAdapterSubsysID; nsString mDeviceString2; nsString mDriverVersion2; nsString mDeviceID2; @@ -80,7 +82,7 @@ private: nsString mDeviceKey2; nsString mAdapterVendorID2; nsString mAdapterDeviceID2; - uint32_t mAdapterSubsysID2; + nsString mAdapterSubsysID2; uint32_t mWindowsVersion; bool mHasDualGPU; bool mIsGPU2Active; diff --git a/widget/xpwidgets/GfxInfoX11.cpp b/widget/xpwidgets/GfxInfoX11.cpp index edd53311c91..925b4faea0f 100644 --- a/widget/xpwidgets/GfxInfoX11.cpp +++ b/widget/xpwidgets/GfxInfoX11.cpp @@ -512,6 +512,20 @@ GfxInfo::GetAdapterDeviceID2(nsAString & aAdapterDeviceID) return NS_ERROR_FAILURE; } +/* 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; +} + /* readonly attribute boolean isGPU2Active; */ NS_IMETHODIMP GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active) diff --git a/widget/xpwidgets/GfxInfoX11.h b/widget/xpwidgets/GfxInfoX11.h index 5d201f6b06b..8113fe13284 100644 --- a/widget/xpwidgets/GfxInfoX11.h +++ b/widget/xpwidgets/GfxInfoX11.h @@ -27,6 +27,7 @@ public: NS_IMETHOD GetAdapterDriver(nsAString & aAdapterDriver); NS_IMETHOD GetAdapterVendorID(nsAString & aAdapterVendorID); NS_IMETHOD GetAdapterDeviceID(nsAString & aAdapterDeviceID); + NS_IMETHOD GetAdapterSubsysID(nsAString & aAdapterSubsysID); NS_IMETHOD GetAdapterRAM(nsAString & aAdapterRAM); NS_IMETHOD GetAdapterDriverVersion(nsAString & aAdapterDriverVersion); NS_IMETHOD GetAdapterDriverDate(nsAString & aAdapterDriverDate); @@ -34,6 +35,7 @@ public: NS_IMETHOD GetAdapterDriver2(nsAString & aAdapterDriver); NS_IMETHOD GetAdapterVendorID2(nsAString & aAdapterVendorID); NS_IMETHOD GetAdapterDeviceID2(nsAString & aAdapterDeviceID); + NS_IMETHOD GetAdapterSubsysID2(nsAString & aAdapterSubsysID); NS_IMETHOD GetAdapterRAM2(nsAString & aAdapterRAM); NS_IMETHOD GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion); NS_IMETHOD GetAdapterDriverDate2(nsAString & aAdapterDriverDate);