1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/widget/xpwidgets/GfxInfoX11.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,558 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * vim: sw=2 ts=8 et : 1.6 + */ 1.7 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.10 + 1.11 +#include <unistd.h> 1.12 +#include <sys/types.h> 1.13 +#include <sys/wait.h> 1.14 +#include <errno.h> 1.15 +#include <sys/utsname.h> 1.16 +#include "nsCRTGlue.h" 1.17 +#include "prenv.h" 1.18 + 1.19 +#include "GfxInfoX11.h" 1.20 + 1.21 +#ifdef MOZ_CRASHREPORTER 1.22 +#include "nsExceptionHandler.h" 1.23 +#include "nsICrashReporter.h" 1.24 +#endif 1.25 + 1.26 +namespace mozilla { 1.27 +namespace widget { 1.28 + 1.29 +#ifdef DEBUG 1.30 +NS_IMPL_ISUPPORTS_INHERITED(GfxInfo, GfxInfoBase, nsIGfxInfoDebug) 1.31 +#endif 1.32 + 1.33 +// these global variables will be set when firing the glxtest process 1.34 +int glxtest_pipe = 0; 1.35 +pid_t glxtest_pid = 0; 1.36 + 1.37 +nsresult 1.38 +GfxInfo::Init() 1.39 +{ 1.40 + mGLMajorVersion = 0; 1.41 + mMajorVersion = 0; 1.42 + mMinorVersion = 0; 1.43 + mRevisionVersion = 0; 1.44 + mIsMesa = false; 1.45 + mIsNVIDIA = false; 1.46 + mIsFGLRX = false; 1.47 + mIsNouveau = false; 1.48 + mIsIntel = false; 1.49 + mIsOldSwrast = false; 1.50 + mIsLlvmpipe = false; 1.51 + mHasTextureFromPixmap = false; 1.52 + return GfxInfoBase::Init(); 1.53 +} 1.54 + 1.55 +void 1.56 +GfxInfo::GetData() 1.57 +{ 1.58 + // to understand this function, see bug 639842. We retrieve the OpenGL driver information in a 1.59 + // separate process to protect against bad drivers. 1.60 + 1.61 + // if glxtest_pipe == 0, that means that we already read the information 1.62 + if (!glxtest_pipe) 1.63 + return; 1.64 + 1.65 + enum { buf_size = 1024 }; 1.66 + char buf[buf_size]; 1.67 + ssize_t bytesread = read(glxtest_pipe, 1.68 + &buf, 1.69 + buf_size-1); // -1 because we'll append a zero 1.70 + close(glxtest_pipe); 1.71 + glxtest_pipe = 0; 1.72 + 1.73 + // bytesread < 0 would mean that the above read() call failed. 1.74 + // This should never happen. If it did, the outcome would be to blacklist anyway. 1.75 + if (bytesread < 0) 1.76 + bytesread = 0; 1.77 + 1.78 + // let buf be a zero-terminated string 1.79 + buf[bytesread] = 0; 1.80 + 1.81 + // Wait for the glxtest process to finish. This serves 2 purposes: 1.82 + // * avoid having a zombie glxtest process laying around 1.83 + // * get the glxtest process status info. 1.84 + int glxtest_status = 0; 1.85 + bool wait_for_glxtest_process = true; 1.86 + bool waiting_for_glxtest_process_failed = false; 1.87 + int waitpid_errno = 0; 1.88 + while(wait_for_glxtest_process) { 1.89 + wait_for_glxtest_process = false; 1.90 + if (waitpid(glxtest_pid, &glxtest_status, 0) == -1) { 1.91 + waitpid_errno = errno; 1.92 + if (waitpid_errno == EINTR) { 1.93 + wait_for_glxtest_process = true; 1.94 + } else { 1.95 + // Bug 718629 1.96 + // ECHILD happens when the glxtest process got reaped got reaped after a PR_CreateProcess 1.97 + // as per bug 227246. This shouldn't matter, as we still seem to get the data 1.98 + // from the pipe, and if we didn't, the outcome would be to blacklist anyway. 1.99 + waiting_for_glxtest_process_failed = (waitpid_errno != ECHILD); 1.100 + } 1.101 + } 1.102 + } 1.103 + 1.104 + bool exited_with_error_code = !waiting_for_glxtest_process_failed && 1.105 + WIFEXITED(glxtest_status) && 1.106 + WEXITSTATUS(glxtest_status) != EXIT_SUCCESS; 1.107 + bool received_signal = !waiting_for_glxtest_process_failed && 1.108 + WIFSIGNALED(glxtest_status); 1.109 + 1.110 + bool error = waiting_for_glxtest_process_failed || exited_with_error_code || received_signal; 1.111 + 1.112 + nsCString textureFromPixmap; 1.113 + nsCString *stringToFill = nullptr; 1.114 + char *bufptr = buf; 1.115 + if (!error) { 1.116 + while(true) { 1.117 + char *line = NS_strtok("\n", &bufptr); 1.118 + if (!line) 1.119 + break; 1.120 + if (stringToFill) { 1.121 + stringToFill->Assign(line); 1.122 + stringToFill = nullptr; 1.123 + } 1.124 + else if(!strcmp(line, "VENDOR")) 1.125 + stringToFill = &mVendor; 1.126 + else if(!strcmp(line, "RENDERER")) 1.127 + stringToFill = &mRenderer; 1.128 + else if(!strcmp(line, "VERSION")) 1.129 + stringToFill = &mVersion; 1.130 + else if(!strcmp(line, "TFP")) 1.131 + stringToFill = &textureFromPixmap; 1.132 + } 1.133 + } 1.134 + 1.135 + if (!strcmp(textureFromPixmap.get(), "TRUE")) 1.136 + mHasTextureFromPixmap = true; 1.137 + 1.138 + // only useful for Linux kernel version check for FGLRX driver. 1.139 + // assumes X client == X server, which is sad. 1.140 + struct utsname unameobj; 1.141 + if (!uname(&unameobj)) 1.142 + { 1.143 + mOS.Assign(unameobj.sysname); 1.144 + mOSRelease.Assign(unameobj.release); 1.145 + } 1.146 + 1.147 + const char *spoofedVendor = PR_GetEnv("MOZ_GFX_SPOOF_GL_VENDOR"); 1.148 + if (spoofedVendor) 1.149 + mVendor.Assign(spoofedVendor); 1.150 + const char *spoofedRenderer = PR_GetEnv("MOZ_GFX_SPOOF_GL_RENDERER"); 1.151 + if (spoofedRenderer) 1.152 + mRenderer.Assign(spoofedRenderer); 1.153 + const char *spoofedVersion = PR_GetEnv("MOZ_GFX_SPOOF_GL_VERSION"); 1.154 + if (spoofedVersion) 1.155 + mVersion.Assign(spoofedVersion); 1.156 + const char *spoofedOS = PR_GetEnv("MOZ_GFX_SPOOF_OS"); 1.157 + if (spoofedOS) 1.158 + mOS.Assign(spoofedOS); 1.159 + const char *spoofedOSRelease = PR_GetEnv("MOZ_GFX_SPOOF_OS_RELEASE"); 1.160 + if (spoofedOSRelease) 1.161 + mOSRelease.Assign(spoofedOSRelease); 1.162 + 1.163 + if (error || 1.164 + mVendor.IsEmpty() || 1.165 + mRenderer.IsEmpty() || 1.166 + mVersion.IsEmpty() || 1.167 + mOS.IsEmpty() || 1.168 + mOSRelease.IsEmpty()) 1.169 + { 1.170 + mAdapterDescription.AppendLiteral("GLXtest process failed"); 1.171 + if (waiting_for_glxtest_process_failed) 1.172 + mAdapterDescription.AppendPrintf(" (waitpid failed with errno=%d for pid %d)", waitpid_errno, glxtest_pid); 1.173 + if (exited_with_error_code) 1.174 + mAdapterDescription.AppendPrintf(" (exited with status %d)", WEXITSTATUS(glxtest_status)); 1.175 + if (received_signal) 1.176 + mAdapterDescription.AppendPrintf(" (received signal %d)", WTERMSIG(glxtest_status)); 1.177 + if (bytesread) { 1.178 + mAdapterDescription.AppendLiteral(": "); 1.179 + mAdapterDescription.Append(nsDependentCString(buf)); 1.180 + mAdapterDescription.AppendLiteral("\n"); 1.181 + } 1.182 +#ifdef MOZ_CRASHREPORTER 1.183 + CrashReporter::AppendAppNotesToCrashReport(mAdapterDescription); 1.184 +#endif 1.185 + return; 1.186 + } 1.187 + 1.188 + mAdapterDescription.Append(mVendor); 1.189 + mAdapterDescription.AppendLiteral(" -- "); 1.190 + mAdapterDescription.Append(mRenderer); 1.191 + 1.192 + nsAutoCString note; 1.193 + note.Append("OpenGL: "); 1.194 + note.Append(mAdapterDescription); 1.195 + note.Append(" -- "); 1.196 + note.Append(mVersion); 1.197 + if (mHasTextureFromPixmap) 1.198 + note.Append(" -- texture_from_pixmap"); 1.199 + note.Append("\n"); 1.200 +#ifdef MOZ_CRASHREPORTER 1.201 + CrashReporter::AppendAppNotesToCrashReport(note); 1.202 +#endif 1.203 + 1.204 + // determine the major OpenGL version. That's the first integer in the version string. 1.205 + mGLMajorVersion = strtol(mVersion.get(), 0, 10); 1.206 + 1.207 + // determine driver type (vendor) and where in the version string 1.208 + // the actual driver version numbers should be expected to be found (whereToReadVersionNumbers) 1.209 + const char *whereToReadVersionNumbers = nullptr; 1.210 + const char *Mesa_in_version_string = strstr(mVersion.get(), "Mesa"); 1.211 + if (Mesa_in_version_string) { 1.212 + mIsMesa = true; 1.213 + // with Mesa, the version string contains "Mesa major.minor" and that's all the version information we get: 1.214 + // there is no actual driver version info. 1.215 + whereToReadVersionNumbers = Mesa_in_version_string + strlen("Mesa"); 1.216 + if (strcasestr(mVendor.get(), "nouveau")) 1.217 + mIsNouveau = true; 1.218 + if (strcasestr(mRenderer.get(), "intel")) // yes, intel is in the renderer string 1.219 + mIsIntel = true; 1.220 + if (strcasestr(mRenderer.get(), "llvmpipe")) 1.221 + mIsLlvmpipe = true; 1.222 + if (strcasestr(mRenderer.get(), "software rasterizer")) 1.223 + mIsOldSwrast = true; 1.224 + } else if (strstr(mVendor.get(), "NVIDIA Corporation")) { 1.225 + mIsNVIDIA = true; 1.226 + // with the NVIDIA driver, the version string contains "NVIDIA major.minor" 1.227 + // note that here the vendor and version strings behave differently, that's why we don't put this above 1.228 + // alongside Mesa_in_version_string. 1.229 + const char *NVIDIA_in_version_string = strstr(mVersion.get(), "NVIDIA"); 1.230 + if (NVIDIA_in_version_string) 1.231 + whereToReadVersionNumbers = NVIDIA_in_version_string + strlen("NVIDIA"); 1.232 + } else if (strstr(mVendor.get(), "ATI Technologies Inc")) { 1.233 + mIsFGLRX = true; 1.234 + // with the FGLRX driver, the version string only gives a OpenGL version :/ so let's return that. 1.235 + // that can at least give a rough idea of how old the driver is. 1.236 + whereToReadVersionNumbers = mVersion.get(); 1.237 + } 1.238 + 1.239 + // read major.minor version numbers of the driver (not to be confused with the OpenGL version) 1.240 + if (whereToReadVersionNumbers) { 1.241 + // copy into writable buffer, for tokenization 1.242 + strncpy(buf, whereToReadVersionNumbers, buf_size); 1.243 + bufptr = buf; 1.244 + 1.245 + // now try to read major.minor version numbers. In case of failure, gracefully exit: these numbers have 1.246 + // been initialized as 0 anyways 1.247 + char *token = NS_strtok(".", &bufptr); 1.248 + if (token) { 1.249 + mMajorVersion = strtol(token, 0, 10); 1.250 + token = NS_strtok(".", &bufptr); 1.251 + if (token) { 1.252 + mMinorVersion = strtol(token, 0, 10); 1.253 + token = NS_strtok(".", &bufptr); 1.254 + if (token) 1.255 + mRevisionVersion = strtol(token, 0, 10); 1.256 + } 1.257 + } 1.258 + } 1.259 +} 1.260 + 1.261 +static inline uint64_t version(uint32_t major, uint32_t minor, uint32_t revision = 0) 1.262 +{ 1.263 + return (uint64_t(major) << 32) + (uint64_t(minor) << 16) + uint64_t(revision); 1.264 +} 1.265 + 1.266 +const nsTArray<GfxDriverInfo>& 1.267 +GfxInfo::GetGfxDriverInfo() 1.268 +{ 1.269 + // Nothing here yet. 1.270 + //if (!mDriverInfo->Length()) { 1.271 + // 1.272 + //} 1.273 + return *mDriverInfo; 1.274 +} 1.275 + 1.276 +nsresult 1.277 +GfxInfo::GetFeatureStatusImpl(int32_t aFeature, 1.278 + int32_t *aStatus, 1.279 + nsAString & aSuggestedDriverVersion, 1.280 + const nsTArray<GfxDriverInfo>& aDriverInfo, 1.281 + OperatingSystem* aOS /* = nullptr */) 1.282 + 1.283 +{ 1.284 + GetData(); 1.285 + 1.286 + NS_ENSURE_ARG_POINTER(aStatus); 1.287 + *aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN; 1.288 + aSuggestedDriverVersion.SetIsVoid(true); 1.289 + OperatingSystem os = DRIVER_OS_LINUX; 1.290 + if (aOS) 1.291 + *aOS = os; 1.292 + 1.293 + if (mGLMajorVersion == 1) { 1.294 + // We're on OpenGL 1. In most cases that indicates really old hardware. 1.295 + // We better block them, rather than rely on them to fail gracefully, because they don't! 1.296 + // see bug 696636 1.297 + *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; 1.298 + return NS_OK; 1.299 + } 1.300 + 1.301 + // Don't evaluate any special cases if we're checking the downloaded blocklist. 1.302 + if (!aDriverInfo.Length()) { 1.303 + // Only check features relevant to Linux. 1.304 + if (aFeature == nsIGfxInfo::FEATURE_OPENGL_LAYERS || 1.305 + aFeature == nsIGfxInfo::FEATURE_WEBGL_OPENGL || 1.306 + aFeature == nsIGfxInfo::FEATURE_WEBGL_MSAA) { 1.307 + 1.308 + // Disable OpenGL layers when we don't have texture_from_pixmap because it regresses performance. 1.309 + if (aFeature == nsIGfxInfo::FEATURE_OPENGL_LAYERS && !mHasTextureFromPixmap) { 1.310 + *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION; 1.311 + aSuggestedDriverVersion.AssignLiteral("<Anything with EXT_texture_from_pixmap support>"); 1.312 + return NS_OK; 1.313 + } 1.314 + 1.315 + // whitelist the linux test slaves' current configuration. 1.316 + // this is necessary as they're still using the slightly outdated 190.42 driver. 1.317 + // this isn't a huge risk, as at least this is the exact setting in which we do continuous testing, 1.318 + // and this only affects GeForce 9400 cards on linux on this precise driver version, which is very few users. 1.319 + // We do the same thing on Windows XP, see in widget/windows/GfxInfo.cpp 1.320 + if (mIsNVIDIA && 1.321 + !strcmp(mRenderer.get(), "GeForce 9400/PCI/SSE2") && 1.322 + !strcmp(mVersion.get(), "3.2.0 NVIDIA 190.42")) 1.323 + { 1.324 + *aStatus = nsIGfxInfo::FEATURE_NO_INFO; 1.325 + return NS_OK; 1.326 + } 1.327 + 1.328 + if (mIsMesa) { 1.329 + if (mIsNouveau && version(mMajorVersion, mMinorVersion) < version(8,0)) { 1.330 + *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION; 1.331 + aSuggestedDriverVersion.AssignLiteral("Mesa 8.0"); 1.332 + } 1.333 + else if (version(mMajorVersion, mMinorVersion, mRevisionVersion) < version(7,10,3)) { 1.334 + *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION; 1.335 + aSuggestedDriverVersion.AssignLiteral("Mesa 7.10.3"); 1.336 + } 1.337 + else if (mIsOldSwrast) { 1.338 + *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION; 1.339 + } 1.340 + else if (mIsLlvmpipe && version(mMajorVersion, mMinorVersion) < version(9, 1)) { 1.341 + // bug 791905, Mesa bug 57733, fixed in Mesa 9.1 according to 1.342 + // https://bugs.freedesktop.org/show_bug.cgi?id=57733#c3 1.343 + *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION; 1.344 + } 1.345 + else if (aFeature == nsIGfxInfo::FEATURE_WEBGL_MSAA) 1.346 + { 1.347 + if (mIsIntel && version(mMajorVersion, mMinorVersion) < version(8,1)) 1.348 + *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION; 1.349 + aSuggestedDriverVersion.AssignLiteral("Mesa 8.1"); 1.350 + } 1.351 + 1.352 + } else if (mIsNVIDIA) { 1.353 + if (version(mMajorVersion, mMinorVersion, mRevisionVersion) < version(257,21)) { 1.354 + *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION; 1.355 + aSuggestedDriverVersion.AssignLiteral("NVIDIA 257.21"); 1.356 + } 1.357 + } else if (mIsFGLRX) { 1.358 + // FGLRX does not report a driver version number, so we have the OpenGL version instead. 1.359 + // by requiring OpenGL 3, we effectively require recent drivers. 1.360 + if (version(mMajorVersion, mMinorVersion, mRevisionVersion) < version(3, 0)) { 1.361 + *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION; 1.362 + aSuggestedDriverVersion.AssignLiteral("<Something recent>"); 1.363 + } 1.364 + // Bug 724640: FGLRX + Linux 2.6.32 is a crashy combo 1.365 + bool unknownOS = mOS.IsEmpty() || mOSRelease.IsEmpty(); 1.366 + bool badOS = mOS.Find("Linux", true) != -1 && 1.367 + mOSRelease.Find("2.6.32") != -1; 1.368 + if (unknownOS || badOS) { 1.369 + *aStatus = nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION; 1.370 + } 1.371 + } else { 1.372 + // like on windows, let's block unknown vendors. Think of virtual machines. 1.373 + // Also, this case is hit whenever the GLXtest probe failed to get driver info or crashed. 1.374 + *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; 1.375 + } 1.376 + } 1.377 + } 1.378 + 1.379 + return GfxInfoBase::GetFeatureStatusImpl(aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, &os); 1.380 +} 1.381 + 1.382 + 1.383 +NS_IMETHODIMP 1.384 +GfxInfo::GetD2DEnabled(bool *aEnabled) 1.385 +{ 1.386 + return NS_ERROR_FAILURE; 1.387 +} 1.388 + 1.389 +NS_IMETHODIMP 1.390 +GfxInfo::GetDWriteEnabled(bool *aEnabled) 1.391 +{ 1.392 + return NS_ERROR_FAILURE; 1.393 +} 1.394 + 1.395 +/* readonly attribute DOMString DWriteVersion; */ 1.396 +NS_IMETHODIMP 1.397 +GfxInfo::GetDWriteVersion(nsAString & aDwriteVersion) 1.398 +{ 1.399 + return NS_ERROR_FAILURE; 1.400 +} 1.401 + 1.402 +/* readonly attribute DOMString cleartypeParameters; */ 1.403 +NS_IMETHODIMP 1.404 +GfxInfo::GetCleartypeParameters(nsAString & aCleartypeParams) 1.405 +{ 1.406 + return NS_ERROR_FAILURE; 1.407 +} 1.408 + 1.409 +/* readonly attribute DOMString adapterDescription; */ 1.410 +NS_IMETHODIMP 1.411 +GfxInfo::GetAdapterDescription(nsAString & aAdapterDescription) 1.412 +{ 1.413 + GetData(); 1.414 + AppendASCIItoUTF16(mAdapterDescription, aAdapterDescription); 1.415 + return NS_OK; 1.416 +} 1.417 + 1.418 +/* readonly attribute DOMString adapterDescription2; */ 1.419 +NS_IMETHODIMP 1.420 +GfxInfo::GetAdapterDescription2(nsAString & aAdapterDescription) 1.421 +{ 1.422 + return NS_ERROR_FAILURE; 1.423 +} 1.424 + 1.425 +/* readonly attribute DOMString adapterRAM; */ 1.426 +NS_IMETHODIMP 1.427 +GfxInfo::GetAdapterRAM(nsAString & aAdapterRAM) 1.428 +{ 1.429 + aAdapterRAM.AssignLiteral(""); 1.430 + return NS_OK; 1.431 +} 1.432 + 1.433 +/* readonly attribute DOMString adapterRAM2; */ 1.434 +NS_IMETHODIMP 1.435 +GfxInfo::GetAdapterRAM2(nsAString & aAdapterRAM) 1.436 +{ 1.437 + return NS_ERROR_FAILURE; 1.438 +} 1.439 + 1.440 +/* readonly attribute DOMString adapterDriver; */ 1.441 +NS_IMETHODIMP 1.442 +GfxInfo::GetAdapterDriver(nsAString & aAdapterDriver) 1.443 +{ 1.444 + aAdapterDriver.AssignLiteral(""); 1.445 + return NS_OK; 1.446 +} 1.447 + 1.448 +/* readonly attribute DOMString adapterDriver2; */ 1.449 +NS_IMETHODIMP 1.450 +GfxInfo::GetAdapterDriver2(nsAString & aAdapterDriver) 1.451 +{ 1.452 + return NS_ERROR_FAILURE; 1.453 +} 1.454 + 1.455 +/* readonly attribute DOMString adapterDriverVersion; */ 1.456 +NS_IMETHODIMP 1.457 +GfxInfo::GetAdapterDriverVersion(nsAString & aAdapterDriverVersion) 1.458 +{ 1.459 + GetData(); 1.460 + CopyASCIItoUTF16(mVersion, aAdapterDriverVersion); 1.461 + return NS_OK; 1.462 +} 1.463 + 1.464 +/* readonly attribute DOMString adapterDriverVersion2; */ 1.465 +NS_IMETHODIMP 1.466 +GfxInfo::GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion) 1.467 +{ 1.468 + return NS_ERROR_FAILURE; 1.469 +} 1.470 + 1.471 +/* readonly attribute DOMString adapterDriverDate; */ 1.472 +NS_IMETHODIMP 1.473 +GfxInfo::GetAdapterDriverDate(nsAString & aAdapterDriverDate) 1.474 +{ 1.475 + aAdapterDriverDate.AssignLiteral(""); 1.476 + return NS_OK; 1.477 +} 1.478 + 1.479 +/* readonly attribute DOMString adapterDriverDate2; */ 1.480 +NS_IMETHODIMP 1.481 +GfxInfo::GetAdapterDriverDate2(nsAString & aAdapterDriverDate) 1.482 +{ 1.483 + return NS_ERROR_FAILURE; 1.484 +} 1.485 + 1.486 +/* readonly attribute DOMString adapterVendorID; */ 1.487 +NS_IMETHODIMP 1.488 +GfxInfo::GetAdapterVendorID(nsAString & aAdapterVendorID) 1.489 +{ 1.490 + GetData(); 1.491 + CopyUTF8toUTF16(mVendor, aAdapterVendorID); 1.492 + return NS_OK; 1.493 +} 1.494 + 1.495 +/* readonly attribute DOMString adapterVendorID2; */ 1.496 +NS_IMETHODIMP 1.497 +GfxInfo::GetAdapterVendorID2(nsAString & aAdapterVendorID) 1.498 +{ 1.499 + return NS_ERROR_FAILURE; 1.500 +} 1.501 + 1.502 +/* readonly attribute DOMString adapterDeviceID; */ 1.503 +NS_IMETHODIMP 1.504 +GfxInfo::GetAdapterDeviceID(nsAString & aAdapterDeviceID) 1.505 +{ 1.506 + GetData(); 1.507 + CopyUTF8toUTF16(mRenderer, aAdapterDeviceID); 1.508 + return NS_OK; 1.509 +} 1.510 + 1.511 +/* readonly attribute DOMString adapterDeviceID2; */ 1.512 +NS_IMETHODIMP 1.513 +GfxInfo::GetAdapterDeviceID2(nsAString & aAdapterDeviceID) 1.514 +{ 1.515 + return NS_ERROR_FAILURE; 1.516 +} 1.517 + 1.518 +/* readonly attribute boolean isGPU2Active; */ 1.519 +NS_IMETHODIMP 1.520 +GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active) 1.521 +{ 1.522 + return NS_ERROR_FAILURE; 1.523 +} 1.524 + 1.525 +#ifdef DEBUG 1.526 + 1.527 +// Implement nsIGfxInfoDebug 1.528 +// We don't support spoofing anything on Linux 1.529 + 1.530 +/* void spoofVendorID (in DOMString aVendorID); */ 1.531 +NS_IMETHODIMP GfxInfo::SpoofVendorID(const nsAString & aVendorID) 1.532 +{ 1.533 + CopyUTF16toUTF8(aVendorID, mVendor); 1.534 + return NS_OK; 1.535 +} 1.536 + 1.537 +/* void spoofDeviceID (in unsigned long aDeviceID); */ 1.538 +NS_IMETHODIMP GfxInfo::SpoofDeviceID(const nsAString & aDeviceID) 1.539 +{ 1.540 + CopyUTF16toUTF8(aDeviceID, mRenderer); 1.541 + return NS_OK; 1.542 +} 1.543 + 1.544 +/* void spoofDriverVersion (in DOMString aDriverVersion); */ 1.545 +NS_IMETHODIMP GfxInfo::SpoofDriverVersion(const nsAString & aDriverVersion) 1.546 +{ 1.547 + CopyUTF16toUTF8(aDriverVersion, mVersion); 1.548 + return NS_OK; 1.549 +} 1.550 + 1.551 +/* void spoofOSVersion (in unsigned long aVersion); */ 1.552 +NS_IMETHODIMP GfxInfo::SpoofOSVersion(uint32_t aVersion) 1.553 +{ 1.554 + // We don't support OS versioning on Linux. There's just "Linux". 1.555 + return NS_OK; 1.556 +} 1.557 + 1.558 +#endif 1.559 + 1.560 +} // end namespace widget 1.561 +} // end namespace mozilla