LCOV - code coverage report
Current view: directory - widget/xpwidgets - GfxInfoX11.cpp (source / functions) Found Hit Coverage
Test: app.info Lines: 226 79 35.0 %
Date: 2012-06-02 Functions: 32 26 81.2 %

       1                 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
       2                 :  * vim: sw=2 ts=8 et :
       3                 :  */
       4                 : /* ***** BEGIN LICENSE BLOCK *****
       5                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       6                 :  *
       7                 :  * The contents of this file are subject to the Mozilla Public License Version
       8                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       9                 :  * the License. You may obtain a copy of the License at:
      10                 :  * http://www.mozilla.org/MPL/
      11                 :  *
      12                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      13                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      14                 :  * for the specific language governing rights and limitations under the
      15                 :  * License.
      16                 :  *
      17                 :  * The Original Code is Mozilla Code.
      18                 :  *
      19                 :  * The Initial Developer of the Original Code is
      20                 :  *   The Mozilla Foundation
      21                 :  * Portions created by the Initial Developer are Copyright (C) 2011
      22                 :  * the Initial Developer. All Rights Reserved.
      23                 :  *
      24                 :  * Contributor(s):
      25                 :  *
      26                 :  * Alternatively, the contents of this file may be used under the terms of
      27                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
      28                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      29                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      30                 :  * of those above. If you wish to allow use of your version of this file only
      31                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      32                 :  * use your version of this file under the terms of the MPL, indicate your
      33                 :  * decision by deleting the provisions above and replace them with the notice
      34                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      35                 :  * the provisions above, a recipient may use your version of this file under
      36                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      37                 :  *
      38                 :  * ***** END LICENSE BLOCK ***** */
      39                 : 
      40                 : #include <unistd.h>
      41                 : #include <sys/types.h>
      42                 : #include <sys/wait.h>
      43                 : #include <errno.h>
      44                 : #include "nsCRTGlue.h"
      45                 : #include "prenv.h"
      46                 : 
      47                 : #include "GfxInfoX11.h"
      48                 : 
      49                 : #ifdef MOZ_CRASHREPORTER
      50                 : #include "nsExceptionHandler.h"
      51                 : #include "nsICrashReporter.h"
      52                 : #endif
      53                 : 
      54                 : namespace mozilla {
      55                 : namespace widget {
      56                 : 
      57                 : #ifdef DEBUG
      58            1108 : NS_IMPL_ISUPPORTS_INHERITED1(GfxInfo, GfxInfoBase, nsIGfxInfoDebug)
      59                 : #endif
      60                 : 
      61                 : // these global variables will be set when firing the glxtest process
      62                 : int glxtest_pipe = 0;
      63                 : pid_t glxtest_pid = 0;
      64                 : 
      65                 : nsresult
      66              26 : GfxInfo::Init()
      67                 : {
      68              26 :     mGLMajorVersion = 0;
      69              26 :     mMajorVersion = 0;
      70              26 :     mMinorVersion = 0;
      71              26 :     mRevisionVersion = 0;
      72              26 :     mIsMesa = false;
      73              26 :     mIsNVIDIA = false;
      74              26 :     mIsFGLRX = false;
      75              26 :     mIsNouveau = false;
      76              26 :     mHasTextureFromPixmap = false;
      77              26 :     return GfxInfoBase::Init();
      78                 : }
      79                 : 
      80                 : void
      81             688 : GfxInfo::GetData()
      82                 : {
      83                 :     // to understand this function, see bug 639842. We retrieve the OpenGL driver information in a
      84                 :     // separate process to protect against bad drivers.
      85                 : 
      86                 :     // if glxtest_pipe == 0, that means that we already read the information
      87             688 :     if (!glxtest_pipe)
      88             688 :         return;
      89                 : 
      90                 :     enum { buf_size = 1024 };
      91                 :     char buf[buf_size];
      92                 :     ssize_t bytesread = read(glxtest_pipe,
      93                 :                              &buf,
      94               0 :                              buf_size-1); // -1 because we'll append a zero
      95               0 :     close(glxtest_pipe);
      96               0 :     glxtest_pipe = 0;
      97                 : 
      98                 :     // bytesread < 0 would mean that the above read() call failed.
      99                 :     // This should never happen. If it did, the outcome would be to blacklist anyway.
     100               0 :     if (bytesread < 0)
     101               0 :         bytesread = 0;
     102                 : 
     103                 :     // let buf be a zero-terminated string
     104               0 :     buf[bytesread] = 0;
     105                 : 
     106                 :     // Wait for the glxtest process to finish. This serves 2 purposes:
     107                 :     // * avoid having a zombie glxtest process laying around
     108                 :     // * get the glxtest process status info.
     109               0 :     int glxtest_status = 0;
     110               0 :     bool wait_for_glxtest_process = true;
     111               0 :     bool waiting_for_glxtest_process_failed = false;
     112               0 :     int waitpid_errno = 0;
     113               0 :     while(wait_for_glxtest_process) {
     114               0 :         wait_for_glxtest_process = false;
     115               0 :         if (waitpid(glxtest_pid, &glxtest_status, 0) == -1) {
     116               0 :             waitpid_errno = errno;
     117               0 :             if (waitpid_errno == EINTR) {
     118               0 :                 wait_for_glxtest_process = true;
     119                 :             } else {
     120                 :                 // Bug 718629
     121                 :                 // ECHILD happens when the glxtest process got reaped got reaped after a PR_CreateProcess
     122                 :                 // as per bug 227246. This shouldn't matter, as we still seem to get the data
     123                 :                 // from the pipe, and if we didn't, the outcome would be to blacklist anyway.
     124               0 :                 waiting_for_glxtest_process_failed = (waitpid_errno != ECHILD);
     125                 :             }
     126                 :         }
     127                 :     }
     128                 : 
     129               0 :     bool exited_with_error_code = !waiting_for_glxtest_process_failed &&
     130                 :                                   WIFEXITED(glxtest_status) && 
     131               0 :                                   WEXITSTATUS(glxtest_status) != EXIT_SUCCESS;
     132               0 :     bool received_signal = !waiting_for_glxtest_process_failed &&
     133               0 :                            WIFSIGNALED(glxtest_status);
     134                 : 
     135               0 :     bool error = waiting_for_glxtest_process_failed || exited_with_error_code || received_signal;
     136                 : 
     137               0 :     nsCString textureFromPixmap; 
     138               0 :     nsCString *stringToFill = nsnull;
     139               0 :     char *bufptr = buf;
     140               0 :     if (!error) {
     141               0 :         while(true) {
     142               0 :             char *line = NS_strtok("\n", &bufptr);
     143               0 :             if (!line)
     144                 :                 break;
     145               0 :             if (stringToFill) {
     146               0 :                 stringToFill->Assign(line);
     147               0 :                 stringToFill = nsnull;
     148                 :             }
     149               0 :             else if(!strcmp(line, "VENDOR"))
     150               0 :                 stringToFill = &mVendor;
     151               0 :             else if(!strcmp(line, "RENDERER"))
     152               0 :                 stringToFill = &mRenderer;
     153               0 :             else if(!strcmp(line, "VERSION"))
     154               0 :                 stringToFill = &mVersion;
     155               0 :             else if(!strcmp(line, "TFP"))
     156               0 :                 stringToFill = &textureFromPixmap;
     157                 :         }
     158                 :     }
     159                 : 
     160               0 :     if (!strcmp(textureFromPixmap.get(), "TRUE"))
     161               0 :         mHasTextureFromPixmap = true;
     162                 : 
     163               0 :     const char *spoofedVendor = PR_GetEnv("MOZ_GFX_SPOOF_GL_VENDOR");
     164               0 :     if (spoofedVendor)
     165               0 :         mVendor.Assign(spoofedVendor);
     166               0 :     const char *spoofedRenderer = PR_GetEnv("MOZ_GFX_SPOOF_GL_RENDERER");
     167               0 :     if (spoofedRenderer)
     168               0 :         mRenderer.Assign(spoofedRenderer);
     169               0 :     const char *spoofedVersion = PR_GetEnv("MOZ_GFX_SPOOF_GL_VERSION");
     170               0 :     if (spoofedVersion)
     171               0 :         mVersion.Assign(spoofedVersion);
     172                 : 
     173               0 :     if (error ||
     174               0 :         mVendor.IsEmpty() ||
     175               0 :         mRenderer.IsEmpty() ||
     176               0 :         mVersion.IsEmpty())
     177                 :     {
     178               0 :         mAdapterDescription.AppendLiteral("GLXtest process failed");
     179               0 :         if (waiting_for_glxtest_process_failed)
     180               0 :             mAdapterDescription.AppendPrintf(" (waitpid failed with errno=%d for pid %d)", waitpid_errno, glxtest_pid);
     181               0 :         if (exited_with_error_code)
     182               0 :             mAdapterDescription.AppendPrintf(" (exited with status %d)", WEXITSTATUS(glxtest_status));
     183               0 :         if (received_signal)
     184               0 :             mAdapterDescription.AppendPrintf(" (received signal %d)", WTERMSIG(glxtest_status));
     185               0 :         if (bytesread) {
     186               0 :             mAdapterDescription.AppendLiteral(": ");
     187               0 :             mAdapterDescription.Append(nsDependentCString(buf));
     188               0 :             mAdapterDescription.AppendLiteral("\n");
     189                 :         }
     190                 : #ifdef MOZ_CRASHREPORTER
     191               0 :         CrashReporter::AppendAppNotesToCrashReport(mAdapterDescription);
     192                 : #endif
     193                 :         return;
     194                 :     }
     195                 : 
     196               0 :     mAdapterDescription.Append(mVendor);
     197               0 :     mAdapterDescription.AppendLiteral(" -- ");
     198               0 :     mAdapterDescription.Append(mRenderer);
     199                 : 
     200               0 :     nsCAutoString note;
     201               0 :     note.Append("OpenGL: ");
     202               0 :     note.Append(mAdapterDescription);
     203               0 :     note.Append(" -- ");
     204               0 :     note.Append(mVersion);
     205               0 :     if (mHasTextureFromPixmap)
     206               0 :         note.Append(" -- texture_from_pixmap");
     207               0 :     note.Append("\n");
     208                 : #ifdef MOZ_CRASHREPORTER
     209               0 :     CrashReporter::AppendAppNotesToCrashReport(note);
     210                 : #endif
     211                 : 
     212                 :     // determine the major OpenGL version. That's the first integer in the version string.
     213               0 :     mGLMajorVersion = strtol(mVersion.get(), 0, 10);
     214                 : 
     215                 :     // determine driver type (vendor) and where in the version string
     216                 :     // the actual driver version numbers should be expected to be found (whereToReadVersionNumbers)
     217               0 :     const char *whereToReadVersionNumbers = nsnull;
     218               0 :     const char *Mesa_in_version_string = strstr(mVersion.get(), "Mesa");
     219               0 :     if (Mesa_in_version_string) {
     220               0 :         mIsMesa = true;
     221                 :         // with Mesa, the version string contains "Mesa major.minor" and that's all the version information we get:
     222                 :         // there is no actual driver version info.
     223               0 :         whereToReadVersionNumbers = Mesa_in_version_string + strlen("Mesa");
     224               0 :         if (strcasestr(mVendor.get(), "nouveau"))
     225               0 :             mIsNouveau = true;
     226               0 :     } else if (strstr(mVendor.get(), "NVIDIA Corporation")) {
     227               0 :         mIsNVIDIA = true;
     228                 :         // with the NVIDIA driver, the version string contains "NVIDIA major.minor"
     229                 :         // note that here the vendor and version strings behave differently, that's why we don't put this above
     230                 :         // alongside Mesa_in_version_string.
     231               0 :         const char *NVIDIA_in_version_string = strstr(mVersion.get(), "NVIDIA");
     232               0 :         if (NVIDIA_in_version_string)
     233               0 :             whereToReadVersionNumbers = NVIDIA_in_version_string + strlen("NVIDIA");
     234               0 :     } else if (strstr(mVendor.get(), "ATI Technologies Inc")) {
     235               0 :         mIsFGLRX = true;
     236                 :         // with the FGLRX driver, the version string only gives a OpenGL version :/ so let's return that.
     237                 :         // that can at least give a rough idea of how old the driver is.
     238               0 :         whereToReadVersionNumbers = mVersion.get();
     239                 :     }
     240                 : 
     241                 :     // read major.minor version numbers of the driver (not to be confused with the OpenGL version)
     242               0 :     if (whereToReadVersionNumbers) {
     243                 :         // copy into writable buffer, for tokenization
     244               0 :         strncpy(buf, whereToReadVersionNumbers, buf_size);
     245               0 :         bufptr = buf;
     246                 : 
     247                 :         // now try to read major.minor version numbers. In case of failure, gracefully exit: these numbers have
     248                 :         // been initialized as 0 anyways
     249               0 :         char *token = NS_strtok(".", &bufptr);
     250               0 :         if (token) {
     251               0 :             mMajorVersion = strtol(token, 0, 10);
     252               0 :             token = NS_strtok(".", &bufptr);
     253               0 :             if (token) {
     254               0 :                 mMinorVersion = strtol(token, 0, 10);
     255               0 :                 token = NS_strtok(".", &bufptr);
     256               0 :                 if (token)
     257               0 :                     mRevisionVersion = strtol(token, 0, 10);
     258                 :             }
     259                 :         }
     260                 :     }
     261                 : }
     262                 : 
     263               0 : static inline PRUint64 version(PRUint32 major, PRUint32 minor, PRUint32 revision = 0)
     264                 : {
     265               0 :     return (PRUint64(major) << 32) + (PRUint64(minor) << 16) + PRUint64(revision);
     266                 : }
     267                 : 
     268                 : const nsTArray<GfxDriverInfo>&
     269              16 : GfxInfo::GetGfxDriverInfo()
     270                 : {
     271                 :   // Nothing here yet.
     272                 :   //if (!mDriverInfo->Length()) {
     273                 :   //
     274                 :   //}
     275              16 :   return *mDriverInfo;
     276                 : }
     277                 : 
     278                 : nsresult
     279              96 : GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, 
     280                 :                               PRInt32 *aStatus, 
     281                 :                               nsAString & aSuggestedDriverVersion, 
     282                 :                               const nsTArray<GfxDriverInfo>& aDriverInfo, 
     283                 :                               OperatingSystem* aOS /* = nsnull */)
     284                 : 
     285                 : {
     286              96 :   GetData();
     287                 : 
     288              96 :   NS_ENSURE_ARG_POINTER(aStatus);
     289              96 :   *aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
     290              96 :   aSuggestedDriverVersion.SetIsVoid(true);
     291              96 :   OperatingSystem os = DRIVER_OS_LINUX;
     292              96 :   if (aOS)
     293               0 :     *aOS = os;
     294                 : 
     295              96 :   if (mGLMajorVersion == 1) {
     296                 :     // We're on OpenGL 1. In most cases that indicates really old hardware.
     297                 :     // We better block them, rather than rely on them to fail gracefully, because they don't!
     298                 :     // see bug 696636
     299               0 :     *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
     300               0 :     return NS_OK;
     301                 :   }
     302                 : 
     303                 : #ifdef MOZ_PLATFORM_MAEMO
     304                 :   *aStatus = nsIGfxInfo::FEATURE_NO_INFO;
     305                 :   // on Maemo, the glxtest probe doesn't build, and we don't really need GfxInfo anyway
     306                 :   return NS_OK;
     307                 : #endif
     308                 : 
     309                 :   // Don't evaluate any special cases if we're checking the downloaded blocklist.
     310              96 :   if (!aDriverInfo.Length()) {
     311                 :     // Only check features relevant to Linux.
     312              16 :     if (aFeature == nsIGfxInfo::FEATURE_OPENGL_LAYERS ||
     313                 :         aFeature == nsIGfxInfo::FEATURE_WEBGL_OPENGL ||
     314                 :         aFeature == nsIGfxInfo::FEATURE_WEBGL_MSAA) {
     315                 : 
     316                 :       // Disable OpenGL layers when we don't have texture_from_pixmap because it regresses performance. 
     317               0 :       if (aFeature == nsIGfxInfo::FEATURE_OPENGL_LAYERS && !mHasTextureFromPixmap) {
     318               0 :         *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
     319               0 :         aSuggestedDriverVersion.AssignLiteral("<Anything with EXT_texture_from_pixmap support>");
     320               0 :         return NS_OK;
     321                 :       }
     322                 : 
     323                 :       // whitelist the linux test slaves' current configuration.
     324                 :       // this is necessary as they're still using the slightly outdated 190.42 driver.
     325                 :       // this isn't a huge risk, as at least this is the exact setting in which we do continuous testing,
     326                 :       // and this only affects GeForce 9400 cards on linux on this precise driver version, which is very few users.
     327                 :       // We do the same thing on Windows XP, see in widget/windows/GfxInfo.cpp
     328               0 :       if (mIsNVIDIA &&
     329               0 :           !strcmp(mRenderer.get(), "GeForce 9400/PCI/SSE2") &&
     330               0 :           !strcmp(mVersion.get(), "3.2.0 NVIDIA 190.42"))
     331                 :       {
     332               0 :         *aStatus = nsIGfxInfo::FEATURE_NO_INFO;
     333               0 :         return NS_OK;
     334                 :       }
     335                 : 
     336               0 :       if (mIsMesa) {
     337               0 :         if (mIsNouveau && version(mMajorVersion, mMinorVersion) < version(8,0)) {
     338               0 :           *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
     339               0 :           aSuggestedDriverVersion.AssignLiteral("Mesa 8.0");
     340               0 :         } else if (version(mMajorVersion, mMinorVersion, mRevisionVersion) < version(7,10,3)) {
     341               0 :           *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
     342               0 :           aSuggestedDriverVersion.AssignLiteral("Mesa 7.10.3");
     343                 :         }
     344               0 :       } else if (mIsNVIDIA) {
     345               0 :         if (version(mMajorVersion, mMinorVersion, mRevisionVersion) < version(257,21)) {
     346               0 :           *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
     347               0 :           aSuggestedDriverVersion.AssignLiteral("NVIDIA 257.21");
     348                 :         }
     349               0 :       } else if (mIsFGLRX) {
     350                 :         // FGLRX does not report a driver version number, so we have the OpenGL version instead.
     351                 :         // by requiring OpenGL 3, we effectively require recent drivers.
     352               0 :         if (version(mMajorVersion, mMinorVersion, mRevisionVersion) < version(3, 0)) {
     353               0 :           *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
     354                 :         }
     355                 :       } else {
     356                 :         // like on windows, let's block unknown vendors. Think of virtual machines.
     357                 :         // Also, this case is hit whenever the GLXtest probe failed to get driver info or crashed.
     358               0 :         *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
     359                 :       }
     360                 :     }
     361                 :   }
     362                 : 
     363              96 :   return GfxInfoBase::GetFeatureStatusImpl(aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, &os);
     364                 : }
     365                 : 
     366                 : 
     367                 : NS_IMETHODIMP
     368               0 : GfxInfo::GetD2DEnabled(bool *aEnabled)
     369                 : {
     370               0 :   return NS_ERROR_FAILURE;
     371                 : }
     372                 : 
     373                 : NS_IMETHODIMP
     374               4 : GfxInfo::GetDWriteEnabled(bool *aEnabled)
     375                 : {
     376               4 :   return NS_ERROR_FAILURE;
     377                 : }
     378                 : 
     379                 : NS_IMETHODIMP
     380               0 : GfxInfo::GetAzureEnabled(bool *aEnabled)
     381                 : {
     382               0 :   return NS_ERROR_FAILURE;
     383                 : }
     384                 : 
     385                 : /* readonly attribute DOMString DWriteVersion; */
     386                 : NS_IMETHODIMP
     387               4 : GfxInfo::GetDWriteVersion(nsAString & aDwriteVersion)
     388                 : {
     389               4 :   return NS_ERROR_FAILURE;
     390                 : }
     391                 : 
     392                 : /* readonly attribute DOMString cleartypeParameters; */
     393                 : NS_IMETHODIMP
     394               0 : GfxInfo::GetCleartypeParameters(nsAString & aCleartypeParams)
     395                 : {
     396               0 :   return NS_ERROR_FAILURE;
     397                 : }
     398                 : 
     399                 : /* readonly attribute DOMString adapterDescription; */
     400                 : NS_IMETHODIMP
     401               4 : GfxInfo::GetAdapterDescription(nsAString & aAdapterDescription)
     402                 : {
     403               4 :   GetData();
     404               4 :   AppendASCIItoUTF16(mAdapterDescription, aAdapterDescription);
     405               4 :   return NS_OK;
     406                 : }
     407                 : 
     408                 : /* readonly attribute DOMString adapterDescription2; */
     409                 : NS_IMETHODIMP
     410               4 : GfxInfo::GetAdapterDescription2(nsAString & aAdapterDescription)
     411                 : {
     412               4 :   return NS_ERROR_FAILURE;
     413                 : }
     414                 : 
     415                 : /* readonly attribute DOMString adapterRAM; */
     416                 : NS_IMETHODIMP
     417               4 : GfxInfo::GetAdapterRAM(nsAString & aAdapterRAM)
     418                 : {
     419               4 :   aAdapterRAM.AssignLiteral("");
     420               4 :   return NS_OK;
     421                 : }
     422                 : 
     423                 : /* readonly attribute DOMString adapterRAM2; */
     424                 : NS_IMETHODIMP
     425               4 : GfxInfo::GetAdapterRAM2(nsAString & aAdapterRAM)
     426                 : {
     427               4 :   return NS_ERROR_FAILURE;
     428                 : }
     429                 : 
     430                 : /* readonly attribute DOMString adapterDriver; */
     431                 : NS_IMETHODIMP
     432               4 : GfxInfo::GetAdapterDriver(nsAString & aAdapterDriver)
     433                 : {
     434               4 :   aAdapterDriver.AssignLiteral("");
     435               4 :   return NS_OK;
     436                 : }
     437                 : 
     438                 : /* readonly attribute DOMString adapterDriver2; */
     439                 : NS_IMETHODIMP
     440               4 : GfxInfo::GetAdapterDriver2(nsAString & aAdapterDriver)
     441                 : {
     442               4 :   return NS_ERROR_FAILURE;
     443                 : }
     444                 : 
     445                 : /* readonly attribute DOMString adapterDriverVersion; */
     446                 : NS_IMETHODIMP
     447             196 : GfxInfo::GetAdapterDriverVersion(nsAString & aAdapterDriverVersion)
     448                 : {
     449             196 :   GetData();
     450             196 :   CopyASCIItoUTF16(mVersion, aAdapterDriverVersion);
     451             196 :   return NS_OK;
     452                 : }
     453                 : 
     454                 : /* readonly attribute DOMString adapterDriverVersion2; */
     455                 : NS_IMETHODIMP
     456               4 : GfxInfo::GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion)
     457                 : {
     458               4 :   return NS_ERROR_FAILURE;
     459                 : }
     460                 : 
     461                 : /* readonly attribute DOMString adapterDriverDate; */
     462                 : NS_IMETHODIMP
     463               4 : GfxInfo::GetAdapterDriverDate(nsAString & aAdapterDriverDate)
     464                 : {
     465               4 :   aAdapterDriverDate.AssignLiteral("");
     466               4 :   return NS_OK;
     467                 : }
     468                 : 
     469                 : /* readonly attribute DOMString adapterDriverDate2; */
     470                 : NS_IMETHODIMP
     471               4 : GfxInfo::GetAdapterDriverDate2(nsAString & aAdapterDriverDate)
     472                 : {
     473               4 :   return NS_ERROR_FAILURE;
     474                 : }
     475                 : 
     476                 : /* readonly attribute DOMString adapterVendorID; */
     477                 : NS_IMETHODIMP
     478             196 : GfxInfo::GetAdapterVendorID(nsAString & aAdapterVendorID)
     479                 : {
     480             196 :   GetData();
     481             196 :   CopyUTF8toUTF16(mVendor, aAdapterVendorID);
     482             196 :   return NS_OK;
     483                 : }
     484                 : 
     485                 : /* readonly attribute DOMString adapterVendorID2; */
     486                 : NS_IMETHODIMP
     487               4 : GfxInfo::GetAdapterVendorID2(nsAString & aAdapterVendorID)
     488                 : {
     489               4 :   return NS_ERROR_FAILURE;
     490                 : }
     491                 : 
     492                 : /* readonly attribute DOMString adapterDeviceID; */
     493                 : NS_IMETHODIMP
     494             196 : GfxInfo::GetAdapterDeviceID(nsAString & aAdapterDeviceID)
     495                 : {
     496             196 :   GetData();
     497             196 :   CopyUTF8toUTF16(mRenderer, aAdapterDeviceID);
     498             196 :   return NS_OK;
     499                 : }
     500                 : 
     501                 : /* readonly attribute DOMString adapterDeviceID2; */
     502                 : NS_IMETHODIMP
     503               4 : GfxInfo::GetAdapterDeviceID2(nsAString & aAdapterDeviceID)
     504                 : {
     505               4 :   return NS_ERROR_FAILURE;
     506                 : }
     507                 : 
     508                 : /* readonly attribute boolean isGPU2Active; */
     509                 : NS_IMETHODIMP
     510               4 : GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active)
     511                 : {
     512               4 :   return NS_ERROR_FAILURE;
     513                 : }
     514                 : 
     515                 : #ifdef DEBUG
     516                 : 
     517                 : // Implement nsIGfxInfoDebug
     518                 : // We don't support spoofing anything on Linux
     519                 : 
     520                 : /* void spoofVendorID (in DOMString aVendorID); */
     521               9 : NS_IMETHODIMP GfxInfo::SpoofVendorID(const nsAString & aVendorID)
     522                 : {
     523               9 :   CopyUTF16toUTF8(aVendorID, mVendor);
     524               9 :   return NS_OK;
     525                 : }
     526                 : 
     527                 : /* void spoofDeviceID (in unsigned long aDeviceID); */
     528               9 : NS_IMETHODIMP GfxInfo::SpoofDeviceID(const nsAString & aDeviceID)
     529                 : {
     530               9 :   CopyUTF16toUTF8(aDeviceID, mRenderer);
     531               9 :   return NS_OK;
     532                 : }
     533                 : 
     534                 : /* void spoofDriverVersion (in DOMString aDriverVersion); */
     535               0 : NS_IMETHODIMP GfxInfo::SpoofDriverVersion(const nsAString & aDriverVersion)
     536                 : {
     537               0 :   CopyUTF16toUTF8(aDriverVersion, mVersion);
     538               0 :   return NS_OK;
     539                 : }
     540                 : 
     541                 : /* void spoofOSVersion (in unsigned long aVersion); */
     542               0 : NS_IMETHODIMP GfxInfo::SpoofOSVersion(PRUint32 aVersion)
     543                 : {
     544                 :   // We don't support OS versioning on Linux. There's just "Linux".
     545               0 :   return NS_OK;
     546                 : }
     547                 : 
     548                 : #endif
     549                 : 
     550                 : } // end namespace widget
     551                 : } // end namespace mozilla

Generated by: LCOV version 1.7