Bug 1267516 - Add warning and technical info if HW accl is disabled. draft
authorBenoit Girard <b56girard@gmail.com>
Fri, 12 Aug 2016 17:51:31 -0400
changeset 400257 f3489a7aacff4ccd2e2a3a60b24a84dbb863dd4d
parent 399698 233ab21b64b5d5e9f2f16ea2d4cfb4c8b293c5c4
child 528176 eaf244ce42d2989d8ab2a726e1ab10a2ffb8b752
push id26114
push userb56girard@gmail.com
push dateFri, 12 Aug 2016 21:51:13 +0000
bugs1267516
milestone51.0a1
Bug 1267516 - Add warning and technical info if HW accl is disabled. MozReview-Commit-ID: Csr6FzJVusM
browser/components/preferences/in-content/advanced.js
browser/components/preferences/in-content/advanced.xul
browser/locales/en-US/chrome/browser/preferences/advanced.dtd
browser/themes/shared/incontentprefs/preferences.inc.css
toolkit/content/aboutSupport.xhtml
--- a/browser/components/preferences/in-content/advanced.js
+++ b/browser/components/preferences/in-content/advanced.js
@@ -39,16 +39,17 @@ var gAdvancedPane = {
     Services.prefs.addObserver("app.update.", this, false);
     this.updateReadPrefs();
 #endif
     this.updateOfflineApps();
 #ifdef MOZ_CRASHREPORTER
     this.initSubmitCrashes();
 #endif
     this.initTelemetry();
+    this.initGraphics();
 #ifdef MOZ_TELEMETRY_REPORTING
     this.initSubmitHealthReport();
 #endif
     this.updateOnScreenKeyboardVisibility();
     this.updateCacheSizeInputField();
     this.updateActualCacheSize();
     this.updateActualAppCacheSize();
 
@@ -269,16 +270,47 @@ var gAdvancedPane = {
   initTelemetry: function ()
   {
 #ifdef MOZ_TELEMETRY_REPORTING
     this._setupLearnMoreLink("toolkit.telemetry.infoURL", "telemetryLearnMore");
 #endif
   },
 
   /**
+   * Report the status of hardware acceleration.
+   */
+  initGraphics: function ()
+  {
+    var statusElement = document.getElementById("allowHWAccelStatus");
+    var statusBox = document.getElementById("allowHWAccelStatusBox");
+
+    let winEnumer = Services.ww.getWindowEnumerator();
+    let hasAcceleratedWindow = false;
+    while (winEnumer.hasMoreElements()) {
+      let winUtils = winEnumer.getNext().
+                     QueryInterface(Ci.nsIInterfaceRequestor).
+                     getInterface(Ci.nsIDOMWindowUtils);
+      hasAcceleratedWindow |= (winUtils.layerManagerType != "Basic");
+    }
+
+    let url = "about:support#graphics";
+    let el = document.getElementById("allowHWAccelTechDetails");
+    el.setAttribute("href", url);
+
+    // If we have an accelerated window, report it
+    if (hasAcceleratedWindow) {
+      statusBox.style.display = "none";
+    } else {
+      statusBox.style.display = "-moz-box";
+      // Otherwise check the failure id for d3d11, d3d9, opengl
+      statusElement.textContent = "Hardware acceleration is not running.";
+    }
+  },
+
+  /**
    * Set the status of the telemetry controls based on the input argument.
    * @param {Boolean} aEnabled False disables the controls, true enables them.
    */
   setTelemetrySectionEnabled: function (aEnabled)
   {
 #ifdef MOZ_TELEMETRY_REPORTING
     // If FHR is disabled, additional data sharing should be disabled as well.
     let disabled = !aEnabled;
--- a/browser/components/preferences/in-content/advanced.xul
+++ b/browser/components/preferences/in-content/advanced.xul
@@ -165,31 +165,39 @@
                   accesskey="&searchStartTyping.accesskey;"
                   preference="accessibility.typeaheadfind"/>
         <checkbox id="blockAutoRefresh"
                   label="&blockAutoRefresh.label;"
                   accesskey="&blockAutoRefresh.accesskey;"
                   preference="accessibility.blockautorefresh"/>
       </groupbox>
       <!-- Browsing -->
-      <groupbox id="browsingGroup" align="start">
+      <groupbox id="browsingGroup">
         <caption><label>&browsing.label;</label></caption>
 
         <checkbox id="useAutoScroll"
                   label="&useAutoScroll.label;"
                   accesskey="&useAutoScroll.accesskey;"
                   preference="general.autoScroll"/>
         <checkbox id="useSmoothScrolling"
                   label="&useSmoothScrolling.label;"
                   accesskey="&useSmoothScrolling.accesskey;"
                   preference="general.smoothScroll"/>
-        <checkbox id="allowHWAccel"
-                  label="&allowHWAccel.label;"
-                  accesskey="&allowHWAccel.accesskey;"
-                  preference="layers.acceleration.disabled"/>
+        <vbox id="allowHWAccelBox">
+          <checkbox id="allowHWAccel"
+                    label="&allowHWAccel.label;"
+                    accesskey="&allowHWAccel.accesskey;"
+                    preference="layers.acceleration.disabled"/>
+          <hbox id="allowHWAccelStatusBox" class="indent" flex="1">
+            <label id="allowHWAccelStatus" flex="1">&allowHWAccel.disabled;</label>
+            <spacer flex="10"/>
+            <label id="allowHWAccelTechDetails"
+                   class="text-link learnMore">&allowHWAccelTechDetails.label;</label>
+          </hbox>
+        </vbox>
         <checkbox id="checkSpelling"
                   label="&checkSpelling.label;"
                   accesskey="&checkSpelling.accesskey;"
                   onsyncfrompreference="return gAdvancedPane.readCheckSpelling();"
                   onsynctopreference="return gAdvancedPane.writeCheckSpelling();"
                   preference="layout.spellcheckDefault"/>
       </groupbox>
     </tabpanel>
@@ -202,47 +210,47 @@
           <checkbox id="submitHealthReportBox" label="&enableHealthReport.label;"
                     accesskey="&enableHealthReport.accesskey;"/>
         </caption>
         <vbox>
           <hbox class="indent">
             <label flex="1">&healthReportDesc.label;</label>
             <spacer flex="10"/>
             <label id="FHRLearnMore"
-                   class="text-link">&healthReportLearnMore.label;</label>
+                   class="text-link learnMore">&healthReportLearnMore.label;</label>
           </hbox>
           <hbox class="indent">
             <groupbox flex="1">
               <caption>
                 <checkbox id="submitTelemetryBox" preference="toolkit.telemetry.enabled"
                           label="&enableTelemetryData.label;"
                           accesskey="&enableTelemetryData.accesskey;"/>
               </caption>
               <hbox class="indent">
                 <label id="telemetryDataDesc" flex="1">&telemetryDesc.label;</label>
                 <spacer flex="10"/>
                 <label id="telemetryLearnMore"
-                       class="text-link">&telemetryLearnMore.label;</label>
+                       class="text-link learnMore">&telemetryLearnMore.label;</label>
               </hbox>
             </groupbox>
           </hbox>
         </vbox>
       </groupbox>
 #endif
 #ifdef MOZ_CRASHREPORTER
       <groupbox>
         <caption>
           <checkbox id="submitCrashesBox" label="&enableCrashReporter.label;"
                     accesskey="&enableCrashReporter.accesskey;"/>
         </caption>
         <hbox class="indent">
           <label flex="1">&crashReporterDesc.label;</label>
           <spacer flex="10"/>
           <label id="crashReporterLearnMore"
-                 class="text-link">&crashReporterLearnMore.label;</label>
+                 class="text-link learnMore">&crashReporterLearnMore.label;</label>
         </hbox>
       </groupbox>
 #endif
     </tabpanel>
 #endif
 
     <!-- Network -->
     <tabpanel id="networkPanel" orient="vertical">
--- a/browser/locales/en-US/chrome/browser/preferences/advanced.dtd
+++ b/browser/locales/en-US/chrome/browser/preferences/advanced.dtd
@@ -20,16 +20,18 @@
 <!ENTITY browsing.label                  "Browsing">
 
 <!ENTITY useAutoScroll.label             "Use autoscrolling">
 <!ENTITY useAutoScroll.accesskey         "a">
 <!ENTITY useSmoothScrolling.label        "Use smooth scrolling">
 <!ENTITY useSmoothScrolling.accesskey    "m">
 <!ENTITY allowHWAccel.label              "Use hardware acceleration when available">
 <!ENTITY allowHWAccel.accesskey          "r">
+<!ENTITY allowHWAccel.disabled           "Hardware acceleration is not running">
+<!ENTITY allowHWAccelTechDetails.label   "Technical Details...">
 <!ENTITY checkSpelling.label             "Check my spelling as I type">
 <!ENTITY checkSpelling.accesskey         "t">
 
 <!ENTITY dataChoicesTab.label            "Data Choices">
 
 <!ENTITY healthReportDesc.label          "Helps you understand your browser performance and shares data with &vendorShortName; about your browser health">
 <!ENTITY enableHealthReport.label        "Enable &brandShortName; Health Report">
 <!ENTITY enableHealthReport.accesskey    "R">
--- a/browser/themes/shared/incontentprefs/preferences.inc.css
+++ b/browser/themes/shared/incontentprefs/preferences.inc.css
@@ -270,19 +270,17 @@ description > html|a {
   /* no margin-inline-start for elements at the beginning of a line */
   margin-inline-start: 0;
 }
 
 #tabsElement {
   margin-inline-end: 4px; /* add the 4px end-margin of other elements */
 }
 
-#telemetryLearnMore,
-#FHRLearnMore,
-#crashReporterLearnMore {
+.learnMore {
   /* provide some margin between the links and the label text */
   /* !important is needed to override the rules defined in common.css */
   margin-inline-start: 20px !important;
   /* center the links */
   margin-top: 8px;
   margin-bottom: 8px;
 }
 
--- a/toolkit/content/aboutSupport.xhtml
+++ b/toolkit/content/aboutSupport.xhtml
@@ -299,17 +299,17 @@
           </tr>
         </thead>
         <tbody id="extensions-tbody">
         </tbody>
       </table>
 
       <!-- - - - - - - - - - - - - - - - - - - - - -->
 
-      <h2 class="major-section">
+      <h2 class="major-section" id="graphics">
         &aboutSupport.graphicsTitle;
       </h2>
 
       <table>
         <tbody id="graphics-features-tbody">
           <tr>
             <th colspan="2" class="title-column">
               &aboutSupport.graphicsFeaturesTitle;