GfxInfoX11.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2. * vim: sw=2 ts=8 et :
  3. */
  4. /* This Source Code Form is subject to the terms of the Mozilla Public
  5. * License, v. 2.0. If a copy of the MPL was not distributed with this
  6. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  7. #include <unistd.h>
  8. #include <sys/types.h>
  9. #include <sys/wait.h>
  10. #include <errno.h>
  11. #include <sys/utsname.h>
  12. #include "nsCRTGlue.h"
  13. #include "prenv.h"
  14. #include "GfxInfoX11.h"
  15. namespace mozilla {
  16. namespace widget {
  17. #ifdef DEBUG
  18. NS_IMPL_ISUPPORTS_INHERITED(GfxInfo, GfxInfoBase, nsIGfxInfoDebug)
  19. #endif
  20. // these global variables will be set when firing the glxtest process
  21. int glxtest_pipe = -1;
  22. pid_t glxtest_pid = 0;
  23. nsresult
  24. GfxInfo::Init()
  25. {
  26. mGLMajorVersion = 0;
  27. mMajorVersion = 0;
  28. mMinorVersion = 0;
  29. mRevisionVersion = 0;
  30. mIsMesa = false;
  31. mIsNVIDIA = false;
  32. mIsFGLRX = false;
  33. mIsNouveau = false;
  34. mIsIntel = false;
  35. mIsOldSwrast = false;
  36. mIsLlvmpipe = false;
  37. mHasTextureFromPixmap = false;
  38. return GfxInfoBase::Init();
  39. }
  40. void
  41. GfxInfo::GetData()
  42. {
  43. // to understand this function, see bug 639842. We retrieve the OpenGL driver information in a
  44. // separate process to protect against bad drivers.
  45. // if glxtest_pipe == -1, that means that we already read the information
  46. if (glxtest_pipe == -1)
  47. return;
  48. enum { buf_size = 1024 };
  49. char buf[buf_size];
  50. ssize_t bytesread = read(glxtest_pipe,
  51. &buf,
  52. buf_size-1); // -1 because we'll append a zero
  53. close(glxtest_pipe);
  54. glxtest_pipe = -1;
  55. // bytesread < 0 would mean that the above read() call failed.
  56. // This should never happen. If it did, the outcome would be to blacklist anyway.
  57. if (bytesread < 0)
  58. bytesread = 0;
  59. // let buf be a zero-terminated string
  60. buf[bytesread] = 0;
  61. // Wait for the glxtest process to finish. This serves 2 purposes:
  62. // * avoid having a zombie glxtest process laying around
  63. // * get the glxtest process status info.
  64. int glxtest_status = 0;
  65. bool wait_for_glxtest_process = true;
  66. bool waiting_for_glxtest_process_failed = false;
  67. int waitpid_errno = 0;
  68. while(wait_for_glxtest_process) {
  69. wait_for_glxtest_process = false;
  70. if (waitpid(glxtest_pid, &glxtest_status, 0) == -1) {
  71. waitpid_errno = errno;
  72. if (waitpid_errno == EINTR) {
  73. wait_for_glxtest_process = true;
  74. } else {
  75. // Bug 718629
  76. // ECHILD happens when the glxtest process got reaped got reaped after a PR_CreateProcess
  77. // as per bug 227246. This shouldn't matter, as we still seem to get the data
  78. // from the pipe, and if we didn't, the outcome would be to blacklist anyway.
  79. waiting_for_glxtest_process_failed = (waitpid_errno != ECHILD);
  80. }
  81. }
  82. }
  83. bool exited_with_error_code = !waiting_for_glxtest_process_failed &&
  84. WIFEXITED(glxtest_status) &&
  85. WEXITSTATUS(glxtest_status) != EXIT_SUCCESS;
  86. bool received_signal = !waiting_for_glxtest_process_failed &&
  87. WIFSIGNALED(glxtest_status);
  88. bool error = waiting_for_glxtest_process_failed || exited_with_error_code || received_signal;
  89. nsCString textureFromPixmap;
  90. nsCString *stringToFill = nullptr;
  91. char *bufptr = buf;
  92. if (!error) {
  93. while(true) {
  94. char *line = NS_strtok("\n", &bufptr);
  95. if (!line)
  96. break;
  97. if (stringToFill) {
  98. stringToFill->Assign(line);
  99. stringToFill = nullptr;
  100. }
  101. else if(!strcmp(line, "VENDOR"))
  102. stringToFill = &mVendor;
  103. else if(!strcmp(line, "RENDERER"))
  104. stringToFill = &mRenderer;
  105. else if(!strcmp(line, "VERSION"))
  106. stringToFill = &mVersion;
  107. else if(!strcmp(line, "TFP"))
  108. stringToFill = &textureFromPixmap;
  109. }
  110. }
  111. if (!strcmp(textureFromPixmap.get(), "TRUE"))
  112. mHasTextureFromPixmap = true;
  113. // only useful for Linux kernel version check for FGLRX driver.
  114. // assumes X client == X server, which is sad.
  115. struct utsname unameobj;
  116. if (uname(&unameobj) >= 0)
  117. {
  118. mOS.Assign(unameobj.sysname);
  119. mOSRelease.Assign(unameobj.release);
  120. }
  121. const char *spoofedVendor = PR_GetEnv("MOZ_GFX_SPOOF_GL_VENDOR");
  122. if (spoofedVendor)
  123. mVendor.Assign(spoofedVendor);
  124. const char *spoofedRenderer = PR_GetEnv("MOZ_GFX_SPOOF_GL_RENDERER");
  125. if (spoofedRenderer)
  126. mRenderer.Assign(spoofedRenderer);
  127. const char *spoofedVersion = PR_GetEnv("MOZ_GFX_SPOOF_GL_VERSION");
  128. if (spoofedVersion)
  129. mVersion.Assign(spoofedVersion);
  130. const char *spoofedOS = PR_GetEnv("MOZ_GFX_SPOOF_OS");
  131. if (spoofedOS)
  132. mOS.Assign(spoofedOS);
  133. const char *spoofedOSRelease = PR_GetEnv("MOZ_GFX_SPOOF_OS_RELEASE");
  134. if (spoofedOSRelease)
  135. mOSRelease.Assign(spoofedOSRelease);
  136. if (error ||
  137. mVendor.IsEmpty() ||
  138. mRenderer.IsEmpty() ||
  139. mVersion.IsEmpty() ||
  140. mOS.IsEmpty() ||
  141. mOSRelease.IsEmpty())
  142. {
  143. mAdapterDescription.AppendLiteral("GLXtest process failed");
  144. if (waiting_for_glxtest_process_failed)
  145. mAdapterDescription.AppendPrintf(" (waitpid failed with errno=%d for pid %d)", waitpid_errno, glxtest_pid);
  146. if (exited_with_error_code)
  147. mAdapterDescription.AppendPrintf(" (exited with status %d)", WEXITSTATUS(glxtest_status));
  148. if (received_signal)
  149. mAdapterDescription.AppendPrintf(" (received signal %d)", WTERMSIG(glxtest_status));
  150. if (bytesread) {
  151. mAdapterDescription.AppendLiteral(": ");
  152. mAdapterDescription.Append(nsDependentCString(buf));
  153. mAdapterDescription.Append('\n');
  154. }
  155. return;
  156. }
  157. mAdapterDescription.Append(mVendor);
  158. mAdapterDescription.AppendLiteral(" -- ");
  159. mAdapterDescription.Append(mRenderer);
  160. nsAutoCString note;
  161. note.AppendLiteral("OpenGL: ");
  162. note.Append(mAdapterDescription);
  163. note.AppendLiteral(" -- ");
  164. note.Append(mVersion);
  165. if (mHasTextureFromPixmap)
  166. note.AppendLiteral(" -- texture_from_pixmap");
  167. note.Append('\n');
  168. // illumos/Solaris 10 libc lacks a strcasestr function, but NSPR has
  169. // one. A lot of programs just implement one on the spot or use strstr
  170. // and a buffer as some kind of workaround. They've been implementing
  171. // missing functions lately, though, so this may not be needed much longer.
  172. #ifndef strcasestr
  173. #define strcasestr PL_strcasestr
  174. #endif
  175. // determine the major OpenGL version. That's the first integer in the version string.
  176. mGLMajorVersion = strtol(mVersion.get(), 0, 10);
  177. // determine driver type (vendor) and where in the version string
  178. // the actual driver version numbers should be expected to be found (whereToReadVersionNumbers)
  179. const char *whereToReadVersionNumbers = nullptr;
  180. const char *Mesa_in_version_string = strstr(mVersion.get(), "Mesa");
  181. if (Mesa_in_version_string) {
  182. mIsMesa = true;
  183. // with Mesa, the version string contains "Mesa major.minor" and that's all the version information we get:
  184. // there is no actual driver version info.
  185. whereToReadVersionNumbers = Mesa_in_version_string + strlen("Mesa");
  186. if (strcasestr(mVendor.get(), "nouveau"))
  187. mIsNouveau = true;
  188. if (strcasestr(mRenderer.get(), "intel")) // yes, intel is in the renderer string
  189. mIsIntel = true;
  190. if (strcasestr(mRenderer.get(), "llvmpipe"))
  191. mIsLlvmpipe = true;
  192. if (strcasestr(mRenderer.get(), "software rasterizer"))
  193. mIsOldSwrast = true;
  194. } else if (strstr(mVendor.get(), "NVIDIA Corporation")) {
  195. mIsNVIDIA = true;
  196. // with the NVIDIA driver, the version string contains "NVIDIA major.minor"
  197. // note that here the vendor and version strings behave differently, that's why we don't put this above
  198. // alongside Mesa_in_version_string.
  199. const char *NVIDIA_in_version_string = strstr(mVersion.get(), "NVIDIA");
  200. if (NVIDIA_in_version_string)
  201. whereToReadVersionNumbers = NVIDIA_in_version_string + strlen("NVIDIA");
  202. } else if (strstr(mVendor.get(), "ATI Technologies Inc")) {
  203. mIsFGLRX = true;
  204. // with the FGLRX driver, the version string only gives a OpenGL version :/ so let's return that.
  205. // that can at least give a rough idea of how old the driver is.
  206. whereToReadVersionNumbers = mVersion.get();
  207. }
  208. // read major.minor version numbers of the driver (not to be confused with the OpenGL version)
  209. if (whereToReadVersionNumbers) {
  210. // copy into writable buffer, for tokenization
  211. strncpy(buf, whereToReadVersionNumbers, buf_size);
  212. bufptr = buf;
  213. // now try to read major.minor version numbers. In case of failure, gracefully exit: these numbers have
  214. // been initialized as 0 anyways
  215. char *token = NS_strtok(".", &bufptr);
  216. if (token) {
  217. mMajorVersion = strtol(token, 0, 10);
  218. token = NS_strtok(".", &bufptr);
  219. if (token) {
  220. mMinorVersion = strtol(token, 0, 10);
  221. token = NS_strtok(".", &bufptr);
  222. if (token)
  223. mRevisionVersion = strtol(token, 0, 10);
  224. }
  225. }
  226. }
  227. }
  228. static inline uint64_t version(uint32_t major, uint32_t minor, uint32_t revision = 0)
  229. {
  230. return (uint64_t(major) << 32) + (uint64_t(minor) << 16) + uint64_t(revision);
  231. }
  232. const nsTArray<GfxDriverInfo>&
  233. GfxInfo::GetGfxDriverInfo()
  234. {
  235. // Nothing here yet.
  236. //if (!mDriverInfo->Length()) {
  237. //
  238. //}
  239. return *mDriverInfo;
  240. }
  241. nsresult
  242. GfxInfo::GetFeatureStatusImpl(int32_t aFeature,
  243. int32_t *aStatus,
  244. nsAString & aSuggestedDriverVersion,
  245. const nsTArray<GfxDriverInfo>& aDriverInfo,
  246. nsACString& aFailureId,
  247. OperatingSystem* aOS /* = nullptr */)
  248. {
  249. NS_ENSURE_ARG_POINTER(aStatus);
  250. *aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
  251. aSuggestedDriverVersion.SetIsVoid(true);
  252. OperatingSystem os = OperatingSystem::Linux;
  253. if (aOS)
  254. *aOS = os;
  255. if (mShutdownOccurred) {
  256. return NS_OK;
  257. }
  258. GetData();
  259. if (mGLMajorVersion == 1) {
  260. // We're on OpenGL 1. In most cases that indicates really old hardware.
  261. // We better block them, rather than rely on them to fail gracefully, because they don't!
  262. // see bug 696636
  263. *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
  264. aFailureId = "FEATURE_FAILURE_OPENGL_1";
  265. return NS_OK;
  266. }
  267. // Don't evaluate any special cases if we're checking the downloaded blocklist.
  268. if (!aDriverInfo.Length()) {
  269. // Blacklist software GL implementations from using layers acceleration.
  270. // On the test infrastructure, we'll force-enable layers acceleration.
  271. if (aFeature == nsIGfxInfo::FEATURE_OPENGL_LAYERS &&
  272. (mIsLlvmpipe || mIsOldSwrast) &&
  273. !PR_GetEnv("MOZ_LAYERS_ALLOW_SOFTWARE_GL"))
  274. {
  275. *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
  276. aFailureId = "FEATURE_FAILURE_SOFTWARE_GL";
  277. return NS_OK;
  278. }
  279. // Only check features relevant to Linux.
  280. if (aFeature == nsIGfxInfo::FEATURE_OPENGL_LAYERS ||
  281. aFeature == nsIGfxInfo::FEATURE_WEBGL_OPENGL ||
  282. aFeature == nsIGfxInfo::FEATURE_WEBGL_MSAA) {
  283. // whitelist the linux test slaves' current configuration.
  284. // this is necessary as they're still using the slightly outdated 190.42 driver.
  285. // this isn't a huge risk, as at least this is the exact setting in which we do continuous testing,
  286. // and this only affects GeForce 9400 cards on linux on this precise driver version, which is very few users.
  287. // We do the same thing on Windows XP, see in widget/windows/GfxInfo.cpp
  288. if (mIsNVIDIA &&
  289. !strcmp(mRenderer.get(), "GeForce 9400/PCI/SSE2") &&
  290. !strcmp(mVersion.get(), "3.2.0 NVIDIA 190.42"))
  291. {
  292. *aStatus = nsIGfxInfo::FEATURE_STATUS_OK;
  293. return NS_OK;
  294. }
  295. if (mIsMesa) {
  296. if (mIsNouveau && version(mMajorVersion, mMinorVersion) < version(8,0)) {
  297. *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
  298. aFailureId = "FEATURE_FAILURE_MESA_1";
  299. aSuggestedDriverVersion.AssignLiteral("Mesa 8.0");
  300. }
  301. else if (version(mMajorVersion, mMinorVersion, mRevisionVersion) < version(7,10,3)) {
  302. *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
  303. aFailureId = "FEATURE_FAILURE_MESA_2";
  304. aSuggestedDriverVersion.AssignLiteral("Mesa 7.10.3");
  305. }
  306. else if (mIsOldSwrast) {
  307. *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
  308. aFailureId = "FEATURE_FAILURE_SW_RAST";
  309. }
  310. else if (mIsLlvmpipe && version(mMajorVersion, mMinorVersion) < version(9, 1)) {
  311. // bug 791905, Mesa bug 57733, fixed in Mesa 9.1 according to
  312. // https://bugs.freedesktop.org/show_bug.cgi?id=57733#c3
  313. *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
  314. aFailureId = "FEATURE_FAILURE_MESA_3";
  315. }
  316. else if (aFeature == nsIGfxInfo::FEATURE_WEBGL_MSAA)
  317. {
  318. if (mIsIntel && version(mMajorVersion, mMinorVersion) < version(8,1)) {
  319. *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
  320. aFailureId = "FEATURE_FAILURE_MESA_4";
  321. aSuggestedDriverVersion.AssignLiteral("Mesa 8.1");
  322. }
  323. }
  324. else if (mIsNouveau && version(mMajorVersion, mMinorVersion) < version(11,0)) {
  325. *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
  326. aFailureId = "FEATURE_FAILURE_OLD_NOUVEAU";
  327. aSuggestedDriverVersion.AssignLiteral("Mesa 11.0");
  328. }
  329. } else if (mIsNVIDIA) {
  330. if (version(mMajorVersion, mMinorVersion, mRevisionVersion) < version(257,21)) {
  331. *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
  332. aFailureId = "FEATURE_FAILURE_OLD_NV";
  333. aSuggestedDriverVersion.AssignLiteral("NVIDIA 257.21");
  334. }
  335. } else if (mIsFGLRX) {
  336. // FGLRX does not report a driver version number, so we have the OpenGL version instead.
  337. // by requiring OpenGL 3, we effectively require recent drivers.
  338. if (version(mMajorVersion, mMinorVersion, mRevisionVersion) < version(3, 0)) {
  339. *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
  340. aFailureId = "FEATURE_FAILURE_OLD_FGLRX";
  341. aSuggestedDriverVersion.AssignLiteral("<Something recent>");
  342. }
  343. // Bug 724640: FGLRX + Linux 2.6.32 is a crashy combo
  344. bool unknownOS = mOS.IsEmpty() || mOSRelease.IsEmpty();
  345. bool badOS = mOS.Find("Linux", true) != -1 &&
  346. mOSRelease.Find("2.6.32") != -1;
  347. if (unknownOS || badOS) {
  348. *aStatus = nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION;
  349. aFailureId = "FEATURE_FAILURE_OLD_OS";
  350. }
  351. } else {
  352. // like on windows, let's block unknown vendors. Think of virtual machines.
  353. // Also, this case is hit whenever the GLXtest probe failed to get driver info or crashed.
  354. *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
  355. }
  356. }
  357. }
  358. return GfxInfoBase::GetFeatureStatusImpl(aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, aFailureId, &os);
  359. }
  360. NS_IMETHODIMP
  361. GfxInfo::GetD2DEnabled(bool *aEnabled)
  362. {
  363. return NS_ERROR_FAILURE;
  364. }
  365. NS_IMETHODIMP
  366. GfxInfo::GetDWriteEnabled(bool *aEnabled)
  367. {
  368. return NS_ERROR_FAILURE;
  369. }
  370. NS_IMETHODIMP
  371. GfxInfo::GetDWriteVersion(nsAString & aDwriteVersion)
  372. {
  373. return NS_ERROR_FAILURE;
  374. }
  375. NS_IMETHODIMP
  376. GfxInfo::GetCleartypeParameters(nsAString & aCleartypeParams)
  377. {
  378. return NS_ERROR_FAILURE;
  379. }
  380. NS_IMETHODIMP
  381. GfxInfo::GetAdapterDescription(nsAString & aAdapterDescription)
  382. {
  383. GetData();
  384. AppendASCIItoUTF16(mAdapterDescription, aAdapterDescription);
  385. return NS_OK;
  386. }
  387. NS_IMETHODIMP
  388. GfxInfo::GetAdapterDescription2(nsAString & aAdapterDescription)
  389. {
  390. return NS_ERROR_FAILURE;
  391. }
  392. NS_IMETHODIMP
  393. GfxInfo::GetAdapterRAM(nsAString & aAdapterRAM)
  394. {
  395. aAdapterRAM.Truncate();
  396. return NS_OK;
  397. }
  398. NS_IMETHODIMP
  399. GfxInfo::GetAdapterRAM2(nsAString & aAdapterRAM)
  400. {
  401. return NS_ERROR_FAILURE;
  402. }
  403. NS_IMETHODIMP
  404. GfxInfo::GetAdapterDriver(nsAString & aAdapterDriver)
  405. {
  406. aAdapterDriver.Truncate();
  407. return NS_OK;
  408. }
  409. NS_IMETHODIMP
  410. GfxInfo::GetAdapterDriver2(nsAString & aAdapterDriver)
  411. {
  412. return NS_ERROR_FAILURE;
  413. }
  414. NS_IMETHODIMP
  415. GfxInfo::GetAdapterDriverVersion(nsAString & aAdapterDriverVersion)
  416. {
  417. GetData();
  418. CopyASCIItoUTF16(mVersion, aAdapterDriverVersion);
  419. return NS_OK;
  420. }
  421. NS_IMETHODIMP
  422. GfxInfo::GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion)
  423. {
  424. return NS_ERROR_FAILURE;
  425. }
  426. NS_IMETHODIMP
  427. GfxInfo::GetAdapterDriverDate(nsAString & aAdapterDriverDate)
  428. {
  429. aAdapterDriverDate.Truncate();
  430. return NS_OK;
  431. }
  432. NS_IMETHODIMP
  433. GfxInfo::GetAdapterDriverDate2(nsAString & aAdapterDriverDate)
  434. {
  435. return NS_ERROR_FAILURE;
  436. }
  437. NS_IMETHODIMP
  438. GfxInfo::GetAdapterVendorID(nsAString & aAdapterVendorID)
  439. {
  440. GetData();
  441. CopyUTF8toUTF16(mVendor, aAdapterVendorID);
  442. return NS_OK;
  443. }
  444. NS_IMETHODIMP
  445. GfxInfo::GetAdapterVendorID2(nsAString & aAdapterVendorID)
  446. {
  447. return NS_ERROR_FAILURE;
  448. }
  449. NS_IMETHODIMP
  450. GfxInfo::GetAdapterDeviceID(nsAString & aAdapterDeviceID)
  451. {
  452. GetData();
  453. CopyUTF8toUTF16(mRenderer, aAdapterDeviceID);
  454. return NS_OK;
  455. }
  456. NS_IMETHODIMP
  457. GfxInfo::GetAdapterDeviceID2(nsAString & aAdapterDeviceID)
  458. {
  459. return NS_ERROR_FAILURE;
  460. }
  461. NS_IMETHODIMP
  462. GfxInfo::GetAdapterSubsysID(nsAString & aAdapterSubsysID)
  463. {
  464. return NS_ERROR_FAILURE;
  465. }
  466. NS_IMETHODIMP
  467. GfxInfo::GetAdapterSubsysID2(nsAString & aAdapterSubsysID)
  468. {
  469. return NS_ERROR_FAILURE;
  470. }
  471. NS_IMETHODIMP
  472. GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active)
  473. {
  474. return NS_ERROR_FAILURE;
  475. }
  476. #ifdef DEBUG
  477. // Implement nsIGfxInfoDebug
  478. // We don't support spoofing anything on Linux
  479. NS_IMETHODIMP GfxInfo::SpoofVendorID(const nsAString & aVendorID)
  480. {
  481. CopyUTF16toUTF8(aVendorID, mVendor);
  482. return NS_OK;
  483. }
  484. NS_IMETHODIMP GfxInfo::SpoofDeviceID(const nsAString & aDeviceID)
  485. {
  486. CopyUTF16toUTF8(aDeviceID, mRenderer);
  487. return NS_OK;
  488. }
  489. NS_IMETHODIMP GfxInfo::SpoofDriverVersion(const nsAString & aDriverVersion)
  490. {
  491. CopyUTF16toUTF8(aDriverVersion, mVersion);
  492. return NS_OK;
  493. }
  494. NS_IMETHODIMP GfxInfo::SpoofOSVersion(uint32_t aVersion)
  495. {
  496. // We don't support OS versioning on Linux. There's just "Linux".
  497. return NS_OK;
  498. }
  499. #endif
  500. } // end namespace widget
  501. } // end namespace mozilla