Bug 1554540 - Expose window protocol (X11, Wayland) in nsIGfxInfo and about:support. r=kats,stransky,flod a=jcristau
authorAndrew Osmond <aosmond@mozilla.com>
Sun, 26 May 2019 20:02:32 -0400
changeset 533533 4e5980a74c9c5023f5f64741a4bee1c1055af24c
parent 533532 18270856aca64b956756fe307e9a2bfeea313f30
child 533534 f787bc6258149666dd364f2d559c032a4b1a07e2
push id11346
push usermalexandru@mozilla.com
push dateFri, 31 May 2019 16:15:31 +0000
treeherdermozilla-beta@72e634f9360a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats, stransky, flod, jcristau
bugs1554540
milestone68.0
Bug 1554540 - Expose window protocol (X11, Wayland) in nsIGfxInfo and about:support. r=kats,stransky,flod a=jcristau Differential Revision: https://phabricator.services.mozilla.com/D32651
toolkit/content/aboutSupport.js
toolkit/crashreporter/CrashAnnotations.yaml
toolkit/locales/en-US/toolkit/about/aboutSupport.ftl
toolkit/modules/Troubleshoot.jsm
widget/GfxInfoX11.cpp
widget/GfxInfoX11.h
widget/android/GfxInfo.cpp
widget/android/GfxInfo.h
widget/cocoa/GfxInfo.h
widget/cocoa/GfxInfo.mm
widget/moz.build
widget/nsIGfxInfo.idl
widget/windows/GfxInfo.cpp
widget/windows/GfxInfo.h
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -474,16 +474,17 @@ var snapshotFormatters = {
       "webgl1Extensions",
       "webgl2WSIInfo",
       "webgl2Renderer",
       "webgl2Version",
       "webgl2DriverExtensions",
       "webgl2Extensions",
       ["supportsHardwareH264", "hardware-h264"],
       ["direct2DEnabled", "#Direct2D"],
+      ["windowProtocol", "graphics-window-protocol"],
       "usesTiling",
       "contentUsesTiling",
       "offMainThreadPaintEnabled",
       "offMainThreadPaintWorkerCount",
       "targetFrameRate",
     ];
     for (let feature of featureKeys) {
       if (Array.isArray(feature)) {
--- a/toolkit/crashreporter/CrashAnnotations.yaml
+++ b/toolkit/crashreporter/CrashAnnotations.yaml
@@ -463,16 +463,21 @@ IPCTransportFailureReason:
 
 IsGarbageCollecting:
   description: >
     If true then the JavaScript garbage collector was running when the crash
     occurred.
   type: boolean
   ping: true
 
+IsWayland:
+  description: >
+    If true then the Wayland windowing system was in use.
+  type: boolean
+
 JavaStackTrace:
   description: >
     Java stack trace, only present on Firefox for Android if we encounter an
     uncaught Java exception.
   type: string
 
 JSLargeAllocationFailure:
   description: >
--- a/toolkit/locales/en-US/toolkit/about/aboutSupport.ftl
+++ b/toolkit/locales/en-US/toolkit/about/aboutSupport.ftl
@@ -77,16 +77,18 @@ graphics-title = Graphics
 graphics-features-title = Features
 graphics-diagnostics-title = Diagnostics
 graphics-failure-log-title = Failure Log
 graphics-gpu1-title = GPU #1
 graphics-gpu2-title = GPU #2
 graphics-decision-log-title = Decision Log
 graphics-crash-guards-title = Crash Guard Disabled Features
 graphics-workarounds-title = Workarounds
+# Windowing system in use on Linux (e.g. X11, Wayland).
+graphics-window-protocol = Window Protocol
 place-database-title = Places Database
 place-database-integrity = Integrity
 place-database-verify-integrity = Verify Integrity
 js-title = JavaScript
 js-incremental-gc = Incremental GC
 a11y-title = Accessibility
 a11y-activated = Activated
 a11y-force-disabled = Prevent Accessibility
--- a/toolkit/modules/Troubleshoot.jsm
+++ b/toolkit/modules/Troubleshoot.jsm
@@ -462,16 +462,17 @@ var dataProviders = {
       DWriteEnabled: "directWriteEnabled",
       DWriteVersion: "directWriteVersion",
       cleartypeParameters: "clearTypeParameters",
       UsesTiling: "usesTiling",
       ContentUsesTiling: "contentUsesTiling",
       OffMainThreadPaintEnabled: "offMainThreadPaintEnabled",
       OffMainThreadPaintWorkerCount: "offMainThreadPaintWorkerCount",
       TargetFrameRate: "targetFrameRate",
+      windowProtocol: null,
     };
 
     for (let prop in gfxInfoProps) {
       try {
         data[gfxInfoProps[prop] || prop] = gfxInfo[prop];
       } catch (e) {}
     }
 
--- a/widget/GfxInfoX11.cpp
+++ b/widget/GfxInfoX11.cpp
@@ -14,16 +14,18 @@
 #include "nsExceptionHandler.h"
 #include "nsICrashReporter.h"
 #include "prenv.h"
 #include "nsPrintfCString.h"
 #include "nsWhitespaceTokenizer.h"
 
 #include "GfxInfoX11.h"
 
+#include <gdk/gdkx.h>
+
 #ifdef DEBUG
 bool fire_glxtest_process();
 #endif
 
 namespace mozilla {
 namespace widget {
 
 #ifdef DEBUG
@@ -35,28 +37,31 @@ int glxtest_pipe = -1;
 pid_t glxtest_pid = 0;
 
 nsresult GfxInfo::Init() {
   mGLMajorVersion = 0;
   mGLMinorVersion = 0;
   mHasTextureFromPixmap = false;
   mIsMesa = false;
   mIsAccelerated = true;
+  mIsWayland = false;
   return GfxInfoBase::Init();
 }
 
 void GfxInfo::AddCrashReportAnnotations() {
   CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::AdapterVendorID,
                                      mVendorId);
   CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::AdapterDeviceID,
                                      mDeviceId);
   CrashReporter::AnnotateCrashReport(
       CrashReporter::Annotation::AdapterDriverVendor, mDriverVendor);
   CrashReporter::AnnotateCrashReport(
       CrashReporter::Annotation::AdapterDriverVersion, mDriverVersion);
+  CrashReporter::AnnotateCrashReport(
+      CrashReporter::Annotation::IsWayland, mIsWayland);
 }
 
 void GfxInfo::GetData() {
   // to understand this function, see bug 639842. We retrieve the OpenGL driver
   // information in a separate process to protect against bad drivers.
 
   // if glxtest_pipe == -1, that means that we already read the information
   if (glxtest_pipe == -1) return;
@@ -281,16 +286,17 @@ void GfxInfo::GetData() {
   if (mVendorId.IsEmpty()) {
     mVendorId.Assign(glVendor.get());
   }
   if (mDeviceId.IsEmpty()) {
     mDeviceId.Assign(glRenderer.get());
   }
 
   mAdapterDescription.Assign(glRenderer);
+  mIsWayland = !GDK_IS_X11_DISPLAY(gdk_display_get_default());
 
   AddCrashReportAnnotations();
 }
 
 const nsTArray<GfxDriverInfo>& GfxInfo::GetGfxDriverInfo() {
   if (!sDriverInfo->Length()) {
     // Mesa 10.0 provides the GLX_MESA_query_renderer extension, which allows us
     // to query device IDs backing a GL context for blacklisting.
@@ -422,16 +428,27 @@ GfxInfo::GetDWriteVersion(nsAString& aDw
 }
 
 NS_IMETHODIMP
 GfxInfo::GetCleartypeParameters(nsAString& aCleartypeParams) {
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
+GfxInfo::GetWindowProtocol(nsAString& aWindowProtocol) {
+  if (mIsWayland) {
+    aWindowProtocol.AssignLiteral("wayland");
+    return NS_OK;
+  }
+
+  aWindowProtocol.AssignLiteral("x11");
+  return NS_OK;
+}
+
+NS_IMETHODIMP
 GfxInfo::GetAdapterDescription(nsAString& aAdapterDescription) {
   GetData();
   AppendASCIItoUTF16(mAdapterDescription, aAdapterDescription);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 GfxInfo::GetAdapterDescription2(nsAString& aAdapterDescription) {
--- a/widget/GfxInfoX11.h
+++ b/widget/GfxInfoX11.h
@@ -17,16 +17,17 @@ namespace widget {
 class GfxInfo final : public GfxInfoBase {
  public:
   // We only declare the subset of nsIGfxInfo that we actually implement. The
   // rest is brought forward from GfxInfoBase.
   NS_IMETHOD GetD2DEnabled(bool* aD2DEnabled) override;
   NS_IMETHOD GetDWriteEnabled(bool* aDWriteEnabled) override;
   NS_IMETHOD GetDWriteVersion(nsAString& aDwriteVersion) override;
   NS_IMETHOD GetCleartypeParameters(nsAString& aCleartypeParams) override;
+  NS_IMETHOD GetWindowProtocol(nsAString& aWindowProtocol) override;
   NS_IMETHOD GetAdapterDescription(nsAString& aAdapterDescription) override;
   NS_IMETHOD GetAdapterDriver(nsAString& aAdapterDriver) override;
   NS_IMETHOD GetAdapterVendorID(nsAString& aAdapterVendorID) override;
   NS_IMETHOD GetAdapterDeviceID(nsAString& aAdapterDeviceID) override;
   NS_IMETHOD GetAdapterSubsysID(nsAString& aAdapterSubsysID) override;
   NS_IMETHOD GetAdapterRAM(nsAString& aAdapterRAM) override;
   NS_IMETHOD GetAdapterDriverVendor(nsAString& aAdapterDriverVendor) override;
   NS_IMETHOD GetAdapterDriverVersion(nsAString& aAdapterDriverVersion) override;
@@ -74,16 +75,17 @@ class GfxInfo final : public GfxInfoBase
   nsCString mAdapterDescription;
   nsCString mAdapterRAM;
   nsCString mOS;
   nsCString mOSRelease;
   bool mHasTextureFromPixmap;
   unsigned int mGLMajorVersion, mGLMinorVersion;
   bool mIsMesa;
   bool mIsAccelerated;
+  bool mIsWayland;
 
   void AddCrashReportAnnotations();
 };
 
 }  // namespace widget
 }  // namespace mozilla
 
 #endif /* __GfxInfoX11_h__ */
--- a/widget/android/GfxInfo.cpp
+++ b/widget/android/GfxInfo.cpp
@@ -134,16 +134,21 @@ GfxInfo::GetDWriteVersion(nsAString& aDw
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 GfxInfo::GetCleartypeParameters(nsAString& aCleartypeParams) {
   return NS_ERROR_FAILURE;
 }
 
+NS_IMETHODIMP
+GfxInfo::GetWindowProtocol(nsAString& aWindowProtocol) {
+  return NS_ERROR_FAILURE;
+}
+
 void GfxInfo::EnsureInitialized() {
   if (mInitialized) return;
 
   if (!mozilla::AndroidBridge::Bridge()) {
     gfxWarning() << "AndroidBridge missing during initialization";
     return;
   }
 
--- a/widget/android/GfxInfo.h
+++ b/widget/android/GfxInfo.h
@@ -26,16 +26,17 @@ class GfxInfo : public GfxInfoBase {
   GfxInfo();
 
   // We only declare the subset of nsIGfxInfo that we actually implement. The
   // rest is brought forward from GfxInfoBase.
   NS_IMETHOD GetD2DEnabled(bool* aD2DEnabled) override;
   NS_IMETHOD GetDWriteEnabled(bool* aDWriteEnabled) override;
   NS_IMETHOD GetDWriteVersion(nsAString& aDwriteVersion) override;
   NS_IMETHOD GetCleartypeParameters(nsAString& aCleartypeParams) override;
+  NS_IMETHOD GetWindowProtocol(nsAString& aWindowProtocol) override;
   NS_IMETHOD GetAdapterDescription(nsAString& aAdapterDescription) override;
   NS_IMETHOD GetAdapterDriver(nsAString& aAdapterDriver) override;
   NS_IMETHOD GetAdapterVendorID(nsAString& aAdapterVendorID) override;
   NS_IMETHOD GetAdapterDeviceID(nsAString& aAdapterDeviceID) override;
   NS_IMETHOD GetAdapterSubsysID(nsAString& aAdapterSubsysID) override;
   NS_IMETHOD GetAdapterRAM(nsAString& aAdapterRAM) override;
   NS_IMETHOD GetAdapterDriverVendor(nsAString& aAdapterDriverVendor) override;
   NS_IMETHOD GetAdapterDriverVersion(nsAString& aAdapterDriverVersion) override;
--- a/widget/cocoa/GfxInfo.h
+++ b/widget/cocoa/GfxInfo.h
@@ -18,16 +18,17 @@ 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_IMETHOD GetD2DEnabled(bool* aD2DEnabled) override;
   NS_IMETHOD GetDWriteEnabled(bool* aDWriteEnabled) override;
   NS_IMETHOD GetDWriteVersion(nsAString& aDwriteVersion) override;
+  NS_IMETHOD GetWindowProtocol(nsAString& aWindowProtocol) override;
   NS_IMETHOD GetCleartypeParameters(nsAString& aCleartypeParams) override;
   NS_IMETHOD GetAdapterDescription(nsAString& aAdapterDescription) override;
   NS_IMETHOD GetAdapterDriver(nsAString& aAdapterDriver) override;
   NS_IMETHOD GetAdapterVendorID(nsAString& aAdapterVendorID) override;
   NS_IMETHOD GetAdapterDeviceID(nsAString& aAdapterDeviceID) override;
   NS_IMETHOD GetAdapterSubsysID(nsAString& aAdapterSubsysID) override;
   NS_IMETHOD GetAdapterRAM(nsAString& aAdapterRAM) override;
   NS_IMETHOD GetAdapterDriverVendor(nsAString& aAdapterDriverVendor) override;
--- a/widget/cocoa/GfxInfo.mm
+++ b/widget/cocoa/GfxInfo.mm
@@ -113,16 +113,20 @@ GfxInfo::GetDWriteEnabled(bool* aEnabled
 /* readonly attribute DOMString DWriteVersion; */
 NS_IMETHODIMP
 GfxInfo::GetDWriteVersion(nsAString& aDwriteVersion) { return NS_ERROR_FAILURE; }
 
 /* readonly attribute DOMString cleartypeParameters; */
 NS_IMETHODIMP
 GfxInfo::GetCleartypeParameters(nsAString& aCleartypeParams) { return NS_ERROR_FAILURE; }
 
+/* readonly attribute DOMString windowProtocol; */
+NS_IMETHODIMP
+GfxInfo::GetWindowProtocol(nsAString& aWindowProtocol) { return NS_ERROR_FAILURE; }
+
 /* readonly attribute DOMString adapterDescription; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterDescription(nsAString& aAdapterDescription) {
   aAdapterDescription.AssignLiteral("");
   return NS_OK;
 }
 
 /* readonly attribute DOMString adapterDescription2; */
--- a/widget/moz.build
+++ b/widget/moz.build
@@ -245,20 +245,18 @@ if CONFIG['MOZ_INSTRUMENT_EVENT_LOOP']:
     EXPORTS.mozilla += [
         'WidgetTraceEvent.h',
     ]
 
 EXPORTS.ipc = ['nsGUIEventIPC.h']
 
 if CONFIG['MOZ_X11']:
     DIRS += ['x11']
-    UNIFIED_SOURCES += [
-        'GfxInfoX11.cpp'
-    ]
     SOURCES += [
+        'GfxInfoX11.cpp',
         'nsShmImage.cpp',
         'WindowSurfaceX11SHM.cpp',
     ]
 
 if toolkit == 'windows':
     EXPORTS += [
         'PluginWidgetProxy.h',
     ]
--- a/widget/nsIGfxInfo.idl
+++ b/widget/nsIGfxInfo.idl
@@ -15,16 +15,21 @@ interface nsIGfxInfo : nsISupports
    */
   readonly attribute boolean D2DEnabled;
   readonly attribute boolean DWriteEnabled;
   readonly attribute boolean usingGPUProcess;
   readonly attribute AString DWriteVersion;
   readonly attribute AString cleartypeParameters;
 
   /*
+   * These are non-Android linux-specific
+   */
+  readonly attribute AString windowProtocol;
+
+  /*
    * These are valid across all platforms.
    */
   readonly attribute AString ContentBackend;
   readonly attribute boolean WebRenderEnabled;
   readonly attribute boolean isHeadless;
   readonly attribute boolean UsesTiling;
   readonly attribute boolean ContentUsesTiling;
   readonly attribute boolean OffMainThreadPaintEnabled;
--- a/widget/windows/GfxInfo.cpp
+++ b/widget/windows/GfxInfo.cpp
@@ -121,16 +121,21 @@ GfxInfo::GetCleartypeParameters(nsAStrin
 
   if (foundData) {
     aCleartypeParams.Assign(outStr);
     return NS_OK;
   }
   return NS_ERROR_FAILURE;
 }
 
+NS_IMETHODIMP
+GfxInfo::GetWindowProtocol(nsAString& aWindowProtocol) {
+  return NS_ERROR_FAILURE;
+}
+
 static nsresult GetKeyValue(const WCHAR* keyLocation, const WCHAR* keyName,
                             nsAString& destString, int type) {
   HKEY key;
   DWORD dwcbData;
   DWORD dValue;
   DWORD resultType;
   LONG result;
   nsresult retval = NS_OK;
--- a/widget/windows/GfxInfo.h
+++ b/widget/windows/GfxInfo.h
@@ -20,16 +20,17 @@ class GfxInfo : public GfxInfoBase {
   GfxInfo();
 
   // We only declare the subset of nsIGfxInfo that we actually implement. The
   // rest is brought forward from GfxInfoBase.
   NS_IMETHOD GetD2DEnabled(bool* aD2DEnabled) override;
   NS_IMETHOD GetDWriteEnabled(bool* aDWriteEnabled) override;
   NS_IMETHOD GetDWriteVersion(nsAString& aDwriteVersion) override;
   NS_IMETHOD GetCleartypeParameters(nsAString& aCleartypeParams) override;
+  NS_IMETHOD GetWindowProtocol(nsAString& aWindowProtocol) override;
   NS_IMETHOD GetAdapterDescription(nsAString& aAdapterDescription) override;
   NS_IMETHOD GetAdapterDriver(nsAString& aAdapterDriver) override;
   NS_IMETHOD GetAdapterVendorID(nsAString& aAdapterVendorID) override;
   NS_IMETHOD GetAdapterDeviceID(nsAString& aAdapterDeviceID) override;
   NS_IMETHOD GetAdapterSubsysID(nsAString& aAdapterSubsysID) override;
   NS_IMETHOD GetAdapterRAM(nsAString& aAdapterRAM) override;
   NS_IMETHOD GetAdapterDriverVendor(nsAString& aAdapterDriverVendor) override;
   NS_IMETHOD GetAdapterDriverVersion(nsAString& aAdapterDriverVersion) override;