Reorganize and tidy up the graphics section of about:support. (bug 1263849, r=milan)
authorDavid Anderson <danderson@mozilla.com>
Thu, 14 Apr 2016 14:54:33 -0400
changeset 331177 efaa8959220e960eec4c2931294da2208b0403a8
parent 331176 22f36f2a2e4c740a0c750aad18c444de94ac2658
child 331178 8ed07c4d0e3e3e00f650365d5e799ba00df6f539
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmilan
bugs1263849
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Reorganize and tidy up the graphics section of about:support. (bug 1263849, r=milan)
toolkit/content/aboutSupport.js
toolkit/content/aboutSupport.xhtml
toolkit/locales/en-US/chrome/global/aboutSupport.dtd
toolkit/locales/en-US/chrome/global/aboutSupport.properties
toolkit/themes/shared/aboutSupport.css
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -233,27 +233,63 @@ var snapshotFormatters = {
 
         let message = localizedMsg([type.toLowerCase() + 'Enabled']);
         out.push(message);
       }
 
       return out;
     };
 
-    // graphics-info-properties tbody
+    // Create a <tr> element with key and value columns.
+    //
+    // @key      Text in the key column. Localized automatically, unless starts with "#".
+    // @value    Text in the value column. Not localized.
+    function buildRow(key, value) {
+      let title;
+      if (key[0] == "#") {
+        title = key.substr(1);
+      } else {
+        try {
+          title = strings.GetStringFromName(key);
+        } catch (e) {
+          title = key;
+        }
+      }
+      return $.new("tr", [
+        $.new("th", title, "column"),
+        $.new("td", value),
+      ]);
+    }
+
+    // @where    The name in "graphics-<name>-tbody", of the element to append to.
+    // @trs      Array of row elements.
+    function addRows(where, trs) {
+      $.append($('graphics-' + where + '-tbody'), trs);
+    }
+
+    // Build and append a row.
+    //
+    // @where    The name in "graphics-<name>-tbody", of the element to append to.
+    function addRow(where, key, value) {
+      addRows(where, [buildRow(key, value)]);
+    }
+    if (data.clearTypeParameters !== undefined) {
+      addRow("diagnostics", "clearTypeParameters", data.clearTypeParameters);
+    }
     if ("info" in data) {
       apzInfo = formatApzInfo(data.info);
 
       let trs = sortedArrayFromObject(data.info).map(function ([prop, val]) {
         return $.new("tr", [
           $.new("th", prop, "column"),
           $.new("td", String(val)),
         ]);
       });
-      $.append($("graphics-info-properties"), trs);
+      addRows("diagnostics", trs);
+
       delete data.info;
     }
 
     // graphics-failures-tbody tbody
     if ("failures" in data) {
       // If indices is there, it should be the same length as failures,
       // (see Troubleshoot.jsm) but we check anyway:
       if ("indices" in data && data.failures.length == data.indices.length) {
@@ -274,86 +310,125 @@ var snapshotFormatters = {
         delete data.indices;
       } else {
         $.append($("graphics-failures-tbody"),
           [$.new("tr", [$.new("th", "LogFailure", "column"),
                         $.new("td", data.failures.map(function (val) {
                           return $.new("p", val);
                        }))])]);
       }
-
-      delete data.failures;
+    } else {
+      $("graphics-failures-tbody").style.display = "none";
     }
 
-    // graphics-tbody tbody
-
-    let out = Object.create(data);
-
-    if (apzInfo.length == 0)
-      out.asyncPanZoom = localizedMsg(["apzNone"]);
-    else
-      out.asyncPanZoom = apzInfo.join("; ");
+    // Add a new row to the table, and take the key (or keys) out of data.
+    //
+    // @where        Table section to add to.
+    // @key          Data key to use.
+    // @colKey       The localization key to use, if different from key.
+    function addRowFromKey(where, key, colKey) {
+      if (!(key in data))
+        return;
+      colKey = colKey || key;
 
-    out.acceleratedWindows =
-      data.numAcceleratedWindows + "/" + data.numTotalWindows;
-    if (data.windowLayerManagerType)
-      out.acceleratedWindows += " " + data.windowLayerManagerType;
-    if (data.windowLayerManagerRemote)
-      out.acceleratedWindows += " (OMTC)";
-    if (data.numAcceleratedWindowsMessage)
-      out.acceleratedWindows +=
-        " " + localizedMsg(data.numAcceleratedWindowsMessage);
-    delete data.numAcceleratedWindows;
-    delete data.numTotalWindows;
-    delete data.windowLayerManagerType;
-    delete data.numAcceleratedWindowsMessage;
+      let value;
+      let messageKey = key + "Message";
+      if (messageKey in data) {
+        value = localizedMsg(data[messageKey]);
+        delete data[messageKey];
+      } else {
+        value = data[key];
+      }
+      delete data[key];
 
-    if ("direct2DEnabledMessage" in data) {
-      out.direct2DEnabled = localizedMsg(data.direct2DEnabledMessage);
-      delete data.direct2DEnabledMessage;
-      delete data.direct2DEnabled;
+      if (value) {
+        addRow(where, colKey, value);
+      }
     }
 
+    // graphics-features-tbody
+
+    let compositor = data.windowLayerManagerRemote
+                     ? data.windowLayerManagerType
+                     : "BasicLayers (" + strings.GetStringFromName("mainThreadNoOMTC") + ")";
+    addRow("features", "compositing", compositor);
+    delete data.windowLayerManagerRemote;
+    delete data.windowLayerManagerType;
+    delete data.numTotalWindows;
+    delete data.numAcceleratedWindows;
+
+    addRow("features", "asyncPanZoom",
+           apzInfo.length
+           ? apzInfo.join("; ")
+           : localizedMsg(["apzNone"]));
+    addRowFromKey("features", "webglRenderer");
+    addRowFromKey("features", "supportsHardwareH264", "hardwareH264");
+    addRowFromKey("features", "direct2DEnabled", "#Direct2D");
+
     if ("directWriteEnabled" in data) {
-      out.directWriteEnabled = data.directWriteEnabled;
+      let message = data.directWriteEnabled;
       if ("directWriteVersion" in data)
-        out.directWriteEnabled += " (" + data.directWriteVersion + ")";
+        message += " (" + data.directWriteVersion + ")";
+      addRow("features", "#DirectWrite", message);
       delete data.directWriteEnabled;
       delete data.directWriteVersion;
     }
 
-    if ("webglRendererMessage" in data) {
-      out.webglRenderer = localizedMsg(data.webglRendererMessage);
-      delete data.webglRendererMessage;
-      delete data.webglRenderer;
-    }
+    // Adapter tbodies.
+    let adapterKeys = [
+      ["adapterDescription"],
+      ["adapterVendorID"],
+      ["adapterDeviceID"],
+      ["driverVersion"],
+      ["driverDate"],
+      ["adapterDrivers"],
+      ["adapterSubsysID"],
+      ["adapterRAM"],
+    ];
 
-    let localizedOut = {};
-    for (let prop in out) {
-      let val = out[prop];
-      if (typeof(val) == "string" && !val)
-        // Ignore properties that are empty strings.
-        continue;
-      try {
-        var localizedName = strings.GetStringFromName(prop);
+    function showGpu(id, suffix) {
+      function get(prop) {
+        return data[prop + suffix];
+      }
+
+      let trs = [];
+      for (let key of adapterKeys) {
+        let value = get(key);
+        if (value === undefined || value === "")
+          continue;
+        trs.push(buildRow(key, value));
       }
-      catch (err) {
-        // This shouldn't happen, but if there's a reported graphics property
-        // that isn't in the string bundle, don't let it break the page.
-        localizedName = prop;
+
+      if (trs.length == 0) {
+        $("graphics-" + id + "-tbody").style.display = "none";
+        return;
+      }
+
+      let active = "yes";
+      if ("isGPU2Active" in data && ((suffix == "2") != data.isGPU2Active)) {
+        active = "no";
       }
-      localizedOut[localizedName] = val;
+      addRow(id, "active", strings.GetStringFromName(active));
+      addRows(id, trs);
+    };
+    showGpu("gpu-1", "");
+    showGpu("gpu-2", "2");
+
+    // Remove adapter keys.
+    for (let key of adapterKeys) {
+      delete data[key];
+      delete data[key + "2"];
     }
-    let trs = sortedArrayFromObject(localizedOut).map(function ([prop, val]) {
-      return $.new("tr", [
-        $.new("th", prop, "column"),
-        $.new("td", val),
-      ]);
-    });
-    $.append($("graphics-tbody"), trs);
+    delete data.isGPU2Active;
+
+    // Now that we're done, grab any remaining keys in data and drop them into
+    // the diagnostics section.
+    for (let key in data) {
+      addRow("diagnostics", key, data[key]);
+    }
   },
 
   javaScript: function javaScript(data) {
     $("javascript-incremental-gc").textContent = data.incrementalGCEnabled;
   },
 
   accessibility: function accessibility(data) {
     $("a11y-activated").textContent = data.isActive;
--- a/toolkit/content/aboutSupport.xhtml
+++ b/toolkit/content/aboutSupport.xhtml
@@ -294,23 +294,57 @@
 
       <!-- - - - - - - - - - - - - - - - - - - - - -->
 
       <h2 class="major-section">
         &aboutSupport.graphicsTitle;
       </h2>
 
       <table>
+        <tbody id="graphics-features-tbody">
+          <tr>
+            <th colspan="2" class="title-column">
+              &aboutSupport.graphicsFeaturesTitle;
+            </th>
+          </tr>
+        </tbody>
+
         <tbody id="graphics-tbody">
         </tbody>
 
-        <tbody id="graphics-info-properties">
+        <tbody id="graphics-gpu-1-tbody">
+          <tr>
+            <th colspan="2" class="title-column">
+              &aboutSupport.graphicsGPU1Title;
+            </th>
+          </tr>
+        </tbody>
+
+        <tbody id="graphics-gpu-2-tbody">
+          <tr>
+            <th colspan="2" class="title-column">
+              &aboutSupport.graphicsGPU2Title;
+            </th>
+          </tr>
+        </tbody>
+
+        <tbody id="graphics-diagnostics-tbody">
+          <tr>
+            <th colspan="2" class="title-column">
+              &aboutSupport.graphicsDiagnosticsTitle;
+            </th>
+          </tr>
         </tbody>
 
         <tbody id="graphics-failures-tbody">
+          <tr>
+            <th colspan="2" class="title-column">
+              &aboutSupport.graphicsFailureLogTitle;
+            </th>
+          </tr>
         </tbody>
       </table>
 
       <!-- - - - - - - - - - - - - - - - - - - - - -->
 
       <h2 class="major-section">
         &aboutSupport.modifiedKeyPrefsTitle;
       </h2>
--- a/toolkit/locales/en-US/chrome/global/aboutSupport.dtd
+++ b/toolkit/locales/en-US/chrome/global/aboutSupport.dtd
@@ -103,8 +103,14 @@ variant of aboutSupport.showDir.label. -
 
 <!ENTITY aboutSupport.copyTextToClipboard.label "Copy text to clipboard">
 <!ENTITY aboutSupport.copyRawDataToClipboard.label "Copy raw data to clipboard">
 
 <!ENTITY aboutSupport.sandboxTitle "Sandbox">
 
 <!ENTITY aboutSupport.safeModeTitle "Try Safe Mode">
 <!ENTITY aboutSupport.restartInSafeMode.label "Restart with Add-ons Disabled…">
+
+<!ENTITY aboutSupport.graphicsFeaturesTitle "Features">
+<!ENTITY aboutSupport.graphicsDiagnosticsTitle "Diagnostics">
+<!ENTITY aboutSupport.graphicsFailureLogTitle "Failure Log">
+<!ENTITY aboutSupport.graphicsGPU1Title "GPU #1">
+<!ENTITY aboutSupport.graphicsGPU2Title "GPU #2">
--- a/toolkit/locales/en-US/chrome/global/aboutSupport.properties
+++ b/toolkit/locales/en-US/chrome/global/aboutSupport.properties
@@ -22,28 +22,16 @@ crashesTimeHours=#1 hour ago;#1 hours ag
 # #1 number of days (1 or more) which have passed since the crash
 crashesTimeDays=#1 day ago;#1 days ago
 
 # LOCALIZATION NOTE (downloadsTitleFiles): Semi-colon list of plural forms.
 # See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
 # #1 number of pending crash reports
 pendingReports=All Crash Reports (including #1 pending crash in the given time range);All Crash Reports (including #1 pending crashes in the given time range)
 
-# LOCALIZATION NOTE In the following strings, "Direct2D", "DirectWrite" and "ClearType" 
-# are proper nouns and should not be translated. Feel free to leave english strings if 
-# there are no good translations, these are only used in about:support
-
-# LOCALIZATION NOTE: This can be localized with a more generic term, like
-# "Graphics-accelerated Windows". It describes a number of windows, e.g.:
-# "GPU Accelerated Windows: 2/2 (Direct3D 9)"
-# "GPU Accelerated Windows: 0/2"
-acceleratedWindows = GPU Accelerated Windows
-
-supportsHardwareH264 = Supports Hardware H264 Decoding
-
 # LOCALIZATION NOTE (rawDataCopied) Text displayed in a mobile "Toast" to user when the
 # raw data is successfully copied to the clipboard via button press.
 rawDataCopied=Raw data copied to clipboard
 
 # LOCALIZATION NOTE (textCopied) Text displayed in a mobile "Toast" to user when the
 # text is successfully copied to the clipboard via button press.
 textCopied=Text copied to clipboard
 
@@ -57,38 +45,39 @@ tryNewerDriver = Blocked for your graphi
 blockedGfxCard = Blocked for your graphics card because of unresolved driver issues.
 
 # LOCALIZATION NOTE The verb "blocked" here refers to a graphics feature such as "Direct2D" or "OpenGL layers".
 blockedOSVersion = Blocked for your operating system version.
 
 # LOCALIZATION NOTE The verb "blocked" here refers to a graphics feature such as "Direct2D" or "OpenGL layers".
 blockedMismatchedVersion = Blocked for your graphics driver version mismatch between registry and DLL.
 
-direct2DEnabled = Direct2D Enabled
-directWriteEnabled = DirectWrite Enabled
+# LOCALIZATION NOTE In the following strings, "Direct2D", "DirectWrite" and "ClearType" 
+# are proper nouns and should not be translated. Feel free to leave english strings if 
+# there are no good translations, these are only used in about:support
 clearTypeParameters = ClearType Parameters
-clearTypeParametersNotFound = ClearType parameters not found
-adapterDescription = Adapter Description
+
+compositing = Compositing
+hardwareH264 = Hardware H264 Decoding
+mainThreadNoOMTC = main thread, no OMTC
+yes = Yes
+no = No
+
+adapterDescription = Description
 adapterVendorID = Vendor ID
 adapterDeviceID = Device ID
 adapterSubsysID = Subsys ID
-adapterDrivers = Adapter Drivers
-adapterRAM = Adapter RAM
+adapterDrivers = Drivers
+adapterRAM = RAM
 driverVersion = Driver Version
 driverDate = Driver Date
-adapterDescription2 = Adapter Description (GPU #2) 
-adapterVendorID2 = Vendor ID (GPU #2) 
-adapterDeviceID2 = Device ID (GPU #2)
-adapterSubsysID2 = Subsys ID (GPU #2)
-adapterDrivers2 = Adapter Drivers (GPU #2)
-adapterRAM2 = Adapter RAM (GPU #2)
-driverVersion2 = Driver Version (GPU #2)
-driverDate2 = Driver Date (GPU #2)
-isGPU2Active = GPU #2 Active
+active = Active
 webglRenderer = WebGL Renderer
+GPU1 = GPU #1
+GPU2 = GPU #2
 
 minLibVersions = Expected minimum version
 loadedLibVersions = Version in use
 
 hasSeccompBPF = Seccomp-BPF (System Call Filtering)
 hasSeccompTSync = Seccomp Thread Synchronization
 hasUserNamespaces = User Namespaces
 hasPrivilegedUserNamespaces = User Namespaces for privileged processes
--- a/toolkit/themes/shared/aboutSupport.css
+++ b/toolkit/themes/shared/aboutSupport.css
@@ -48,16 +48,22 @@ thead th {
 }
 
 th {
   text-align: start;
   background-color: var(--in-content-table-header-background);
   color: var(--in-content-selected-text);
 }
 
+th.title-column {
+  white-space: nowrap;
+  width: 0px;
+  font-size: medium;
+}
+
 th.column {
   white-space: nowrap;
   width: 0px;
 }
 
 td {
   text-align: start;
   border-color: var(--in-content-table-border-dark-color);