widget/xpwidgets/GfxInfoX11.cpp

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

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

mercurial