2011-05-03 20:07:17 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2011-05-03 20:07:17 +00:00
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/wait.h>
|
|
|
|
#include <errno.h>
|
2012-04-02 13:02:00 +00:00
|
|
|
#include <sys/utsname.h>
|
2011-05-03 20:07:17 +00:00
|
|
|
#include "nsCRTGlue.h"
|
2017-11-23 09:59:04 +00:00
|
|
|
#include "nsExceptionHandler.h"
|
|
|
|
#include "nsICrashReporter.h"
|
2011-05-03 20:07:17 +00:00
|
|
|
#include "prenv.h"
|
2019-02-08 19:36:08 +00:00
|
|
|
#include "nsPrintfCString.h"
|
|
|
|
#include "nsWhitespaceTokenizer.h"
|
2011-05-03 20:07:17 +00:00
|
|
|
|
|
|
|
#include "GfxInfoX11.h"
|
|
|
|
|
2019-02-08 19:36:08 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
bool fire_glxtest_process();
|
|
|
|
#endif
|
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace widget {
|
|
|
|
|
2011-12-15 05:04:35 +00:00
|
|
|
#ifdef DEBUG
|
2014-04-27 07:06:00 +00:00
|
|
|
NS_IMPL_ISUPPORTS_INHERITED(GfxInfo, GfxInfoBase, nsIGfxInfoDebug)
|
2011-12-15 05:04:35 +00:00
|
|
|
#endif
|
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
// these global variables will be set when firing the glxtest process
|
2017-09-18 23:47:12 +00:00
|
|
|
int glxtest_pipe = -1;
|
2011-05-03 20:07:17 +00:00
|
|
|
pid_t glxtest_pid = 0;
|
|
|
|
|
|
|
|
nsresult GfxInfo::Init() {
|
2012-02-23 22:21:30 +00:00
|
|
|
mGLMajorVersion = 0;
|
2019-02-08 19:36:08 +00:00
|
|
|
mGLMinorVersion = 0;
|
2016-09-21 06:24:26 +00:00
|
|
|
mHasTextureFromPixmap = false;
|
2019-02-08 19:36:08 +00:00
|
|
|
mIsMesa = false;
|
|
|
|
mIsAccelerated = true;
|
2011-05-03 20:07:17 +00:00
|
|
|
return GfxInfoBase::Init();
|
|
|
|
}
|
|
|
|
|
2019-02-05 09:14:41 +00:00
|
|
|
void GfxInfo::AddCrashReportAnnotations() {
|
|
|
|
CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::AdapterVendorID,
|
2019-02-08 19:36:08 +00:00
|
|
|
mVendorId);
|
2019-02-05 09:14:41 +00:00
|
|
|
CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::AdapterDeviceID,
|
2019-02-08 19:36:08 +00:00
|
|
|
mDeviceId);
|
2019-02-05 09:14:41 +00:00
|
|
|
CrashReporter::AnnotateCrashReport(
|
2019-02-08 19:36:08 +00:00
|
|
|
CrashReporter::Annotation::AdapterDriverVersion, mDriverVersion);
|
2019-02-05 09:14:41 +00:00
|
|
|
}
|
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
void GfxInfo::GetData() {
|
|
|
|
// to understand this function, see bug 639842. We retrieve the OpenGL driver
|
|
|
|
// information in a separate process to protect against bad drivers.
|
2018-11-30 10:46:48 +00:00
|
|
|
|
2017-09-18 23:47:12 +00:00
|
|
|
// if glxtest_pipe == -1, that means that we already read the information
|
|
|
|
if (glxtest_pipe == -1) return;
|
2018-11-30 10:46:48 +00:00
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
enum { buf_size = 1024 };
|
|
|
|
char buf[buf_size];
|
|
|
|
ssize_t bytesread = read(glxtest_pipe, &buf,
|
|
|
|
buf_size - 1); // -1 because we'll append a zero
|
|
|
|
close(glxtest_pipe);
|
2017-09-18 23:47:12 +00:00
|
|
|
glxtest_pipe = -1;
|
2018-11-30 10:46:48 +00:00
|
|
|
|
2012-01-31 20:32:05 +00:00
|
|
|
// bytesread < 0 would mean that the above read() call failed.
|
|
|
|
// This should never happen. If it did, the outcome would be to blacklist
|
|
|
|
// anyway.
|
2011-05-03 20:07:17 +00:00
|
|
|
if (bytesread < 0) bytesread = 0;
|
2018-11-30 10:46:48 +00:00
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
// let buf be a zero-terminated string
|
|
|
|
buf[bytesread] = 0;
|
2018-11-30 10:46:48 +00:00
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
// Wait for the glxtest process to finish. This serves 2 purposes:
|
|
|
|
// * avoid having a zombie glxtest process laying around
|
|
|
|
// * get the glxtest process status info.
|
|
|
|
int glxtest_status = 0;
|
|
|
|
bool wait_for_glxtest_process = true;
|
|
|
|
bool waiting_for_glxtest_process_failed = false;
|
2012-01-17 19:37:41 +00:00
|
|
|
int waitpid_errno = 0;
|
2011-05-03 20:07:17 +00:00
|
|
|
while (wait_for_glxtest_process) {
|
|
|
|
wait_for_glxtest_process = false;
|
|
|
|
if (waitpid(glxtest_pid, &glxtest_status, 0) == -1) {
|
2012-01-17 19:37:41 +00:00
|
|
|
waitpid_errno = errno;
|
2012-01-31 20:32:05 +00:00
|
|
|
if (waitpid_errno == EINTR) {
|
2011-05-03 20:07:17 +00:00
|
|
|
wait_for_glxtest_process = true;
|
2012-01-31 20:32:05 +00:00
|
|
|
} else {
|
|
|
|
// Bug 718629
|
|
|
|
// ECHILD happens when the glxtest process got reaped got reaped after a
|
|
|
|
// PR_CreateProcess as per bug 227246. This shouldn't matter, as we
|
|
|
|
// still seem to get the data from the pipe, and if we didn't, the
|
|
|
|
// outcome would be to blacklist anyway.
|
|
|
|
waiting_for_glxtest_process_failed = (waitpid_errno != ECHILD);
|
2011-05-03 20:07:17 +00:00
|
|
|
}
|
|
|
|
}
|
2018-11-30 10:46:48 +00:00
|
|
|
}
|
2011-05-03 20:07:17 +00:00
|
|
|
|
|
|
|
bool exited_with_error_code = !waiting_for_glxtest_process_failed &&
|
|
|
|
WIFEXITED(glxtest_status) &&
|
|
|
|
WEXITSTATUS(glxtest_status) != EXIT_SUCCESS;
|
|
|
|
bool received_signal =
|
|
|
|
!waiting_for_glxtest_process_failed && WIFSIGNALED(glxtest_status);
|
2018-11-30 10:46:48 +00:00
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
bool error = waiting_for_glxtest_process_failed || exited_with_error_code ||
|
|
|
|
received_signal;
|
2018-11-30 10:46:48 +00:00
|
|
|
|
2019-02-08 19:36:08 +00:00
|
|
|
nsCString glVendor;
|
|
|
|
nsCString glRenderer;
|
|
|
|
nsCString glVersion;
|
2016-09-21 06:24:26 +00:00
|
|
|
nsCString textureFromPixmap;
|
2019-02-08 19:36:08 +00:00
|
|
|
|
|
|
|
// Available if GLX_MESA_query_renderer is supported.
|
|
|
|
nsCString mesaVendor;
|
|
|
|
nsCString mesaDevice;
|
|
|
|
nsCString mesaAccelerated;
|
|
|
|
// Available if using a DRI-based libGL stack.
|
|
|
|
nsCString driDriver;
|
|
|
|
|
2012-07-30 14:20:58 +00:00
|
|
|
nsCString *stringToFill = nullptr;
|
2011-05-03 20:07:17 +00:00
|
|
|
char *bufptr = buf;
|
|
|
|
if (!error) {
|
|
|
|
while (true) {
|
|
|
|
char *line = NS_strtok("\n", &bufptr);
|
|
|
|
if (!line) break;
|
|
|
|
if (stringToFill) {
|
|
|
|
stringToFill->Assign(line);
|
2012-07-30 14:20:58 +00:00
|
|
|
stringToFill = nullptr;
|
2011-05-03 20:07:17 +00:00
|
|
|
} else if (!strcmp(line, "VENDOR"))
|
2019-02-08 19:36:08 +00:00
|
|
|
stringToFill = &glVendor;
|
2011-05-03 20:07:17 +00:00
|
|
|
else if (!strcmp(line, "RENDERER"))
|
2019-02-08 19:36:08 +00:00
|
|
|
stringToFill = &glRenderer;
|
2011-05-03 20:07:17 +00:00
|
|
|
else if (!strcmp(line, "VERSION"))
|
2019-02-08 19:36:08 +00:00
|
|
|
stringToFill = &glVersion;
|
2011-08-05 01:13:25 +00:00
|
|
|
else if (!strcmp(line, "TFP"))
|
|
|
|
stringToFill = &textureFromPixmap;
|
2019-02-08 19:36:08 +00:00
|
|
|
else if (!strcmp(line, "MESA_VENDOR_ID"))
|
|
|
|
stringToFill = &mesaVendor;
|
|
|
|
else if (!strcmp(line, "MESA_DEVICE_ID"))
|
|
|
|
stringToFill = &mesaDevice;
|
|
|
|
else if (!strcmp(line, "MESA_ACCELERATED"))
|
|
|
|
stringToFill = &mesaAccelerated;
|
|
|
|
else if (!strcmp(line, "MESA_VRAM"))
|
|
|
|
stringToFill = &mAdapterRAM;
|
|
|
|
else if (!strcmp(line, "DRI_DRIVER"))
|
|
|
|
stringToFill = &driDriver;
|
2011-05-03 20:07:17 +00:00
|
|
|
}
|
2018-11-30 10:46:48 +00:00
|
|
|
}
|
2011-05-03 20:07:17 +00:00
|
|
|
|
2011-08-05 01:13:25 +00:00
|
|
|
if (!strcmp(textureFromPixmap.get(), "TRUE")) mHasTextureFromPixmap = true;
|
2012-04-02 13:02:00 +00:00
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
// only useful for Linux kernel version check for FGLRX driver.
|
2012-04-02 13:02:00 +00:00
|
|
|
// assumes X client == X server, which is sad.
|
|
|
|
struct utsname unameobj;
|
|
|
|
if (uname(&unameobj) >= 0) {
|
|
|
|
mOS.Assign(unameobj.sysname);
|
|
|
|
mOSRelease.Assign(unameobj.release);
|
2011-05-03 20:07:17 +00:00
|
|
|
}
|
2017-11-23 09:59:04 +00:00
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
const char *spoofedVendor = PR_GetEnv("MOZ_GFX_SPOOF_GL_VENDOR");
|
2019-02-08 19:36:08 +00:00
|
|
|
if (spoofedVendor) glVendor.Assign(spoofedVendor);
|
2011-05-03 20:07:17 +00:00
|
|
|
const char *spoofedRenderer = PR_GetEnv("MOZ_GFX_SPOOF_GL_RENDERER");
|
2019-02-08 19:36:08 +00:00
|
|
|
if (spoofedRenderer) glRenderer.Assign(spoofedRenderer);
|
2011-05-03 20:07:17 +00:00
|
|
|
const char *spoofedVersion = PR_GetEnv("MOZ_GFX_SPOOF_GL_VERSION");
|
2019-02-08 19:36:08 +00:00
|
|
|
if (spoofedVersion) glVersion.Assign(spoofedVersion);
|
2012-04-02 13:02:00 +00:00
|
|
|
const char *spoofedOS = PR_GetEnv("MOZ_GFX_SPOOF_OS");
|
|
|
|
if (spoofedOS) mOS.Assign(spoofedOS);
|
2011-05-03 20:07:17 +00:00
|
|
|
const char *spoofedOSRelease = PR_GetEnv("MOZ_GFX_SPOOF_OS_RELEASE");
|
2012-04-02 13:02:00 +00:00
|
|
|
if (spoofedOSRelease) mOSRelease.Assign(spoofedOSRelease);
|
2018-11-30 10:46:48 +00:00
|
|
|
|
2019-02-08 19:36:08 +00:00
|
|
|
if (error || glVendor.IsEmpty() || glRenderer.IsEmpty() ||
|
|
|
|
glVersion.IsEmpty() || mOS.IsEmpty() || mOSRelease.IsEmpty()) {
|
2011-05-03 20:07:17 +00:00
|
|
|
mAdapterDescription.AppendLiteral("GLXtest process failed");
|
|
|
|
if (waiting_for_glxtest_process_failed)
|
|
|
|
mAdapterDescription.AppendPrintf(
|
|
|
|
" (waitpid failed with errno=%d for pid %d)", waitpid_errno,
|
2012-01-17 19:37:41 +00:00
|
|
|
glxtest_pid);
|
2011-05-03 20:07:17 +00:00
|
|
|
if (exited_with_error_code)
|
|
|
|
mAdapterDescription.AppendPrintf(" (exited with status %d)",
|
|
|
|
WEXITSTATUS(glxtest_status));
|
|
|
|
if (received_signal)
|
|
|
|
mAdapterDescription.AppendPrintf(" (received signal %d)",
|
|
|
|
WTERMSIG(glxtest_status));
|
|
|
|
if (bytesread) {
|
|
|
|
mAdapterDescription.AppendLiteral(": ");
|
|
|
|
mAdapterDescription.Append(nsDependentCString(buf));
|
|
|
|
mAdapterDescription.Append('\n');
|
|
|
|
}
|
|
|
|
|
|
|
|
CrashReporter::AppendAppNotesToCrashReport(mAdapterDescription);
|
2016-09-21 06:24:26 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-02-08 19:36:08 +00:00
|
|
|
// Scan the GL_VERSION string for the GL and driver versions.
|
|
|
|
nsCWhitespaceTokenizer tokenizer(glVersion);
|
|
|
|
while (tokenizer.hasMoreTokens()) {
|
|
|
|
nsCString token(tokenizer.nextToken());
|
|
|
|
unsigned int major = 0, minor = 0, revision = 0, patch = 0;
|
|
|
|
if (sscanf(token.get(), "%u.%u.%u.%u", &major, &minor, &revision, &patch) >=
|
|
|
|
2) {
|
|
|
|
// A survey of GL_VENDOR strings indicates that the first version is
|
|
|
|
// always the GL version, the second is usually the driver version.
|
|
|
|
if (mGLMajorVersion == 0) {
|
|
|
|
mGLMajorVersion = major;
|
|
|
|
mGLMinorVersion = minor;
|
|
|
|
} else if (mDriverVersion.IsEmpty()) { // Not already spoofed.
|
|
|
|
mDriverVersion =
|
|
|
|
nsPrintfCString("%u.%u.%u.%u", major, minor, revision, patch);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-11-30 10:46:48 +00:00
|
|
|
|
2019-02-08 19:36:08 +00:00
|
|
|
if (mGLMajorVersion == 0) {
|
|
|
|
NS_WARNING("Failed to parse GL version!");
|
|
|
|
return;
|
2018-11-30 10:46:48 +00:00
|
|
|
}
|
|
|
|
|
2019-02-08 19:36:08 +00:00
|
|
|
// Mesa always exposes itself in the GL_VERSION string, but not always the
|
|
|
|
// GL_VENDOR string.
|
|
|
|
mIsMesa = glVersion.Find("Mesa") != -1;
|
|
|
|
|
|
|
|
// We need to use custom vendor IDs for mesa so we can treat them
|
|
|
|
// differently than the proprietary drivers.
|
|
|
|
if (mIsMesa) {
|
|
|
|
mIsAccelerated = !mesaAccelerated.Equals("FALSE");
|
|
|
|
// Process software rasterizers before the DRI driver string; we may be
|
|
|
|
// forcing software rasterization on a DRI-accelerated X server by using
|
|
|
|
// LIBGL_ALWAYS_SOFTWARE or a similar restriction.
|
|
|
|
if (strcasestr(glRenderer.get(), "llvmpipe")) {
|
|
|
|
CopyUTF16toUTF8(GfxDriverInfo::GetDeviceVendor(VendorMesaLLVMPipe),
|
|
|
|
mVendorId);
|
|
|
|
mIsAccelerated = false;
|
|
|
|
} else if (strcasestr(glRenderer.get(), "softpipe")) {
|
|
|
|
CopyUTF16toUTF8(GfxDriverInfo::GetDeviceVendor(VendorMesaSoftPipe),
|
|
|
|
mVendorId);
|
|
|
|
mIsAccelerated = false;
|
|
|
|
} else if (strcasestr(glRenderer.get(), "software rasterizer") ||
|
|
|
|
!mIsAccelerated) {
|
|
|
|
// Fallback to reporting swrast if GLX_MESA_query_renderer tells us
|
|
|
|
// we're using an unaccelerated context.
|
|
|
|
CopyUTF16toUTF8(GfxDriverInfo::GetDeviceVendor(VendorMesaSWRast),
|
|
|
|
mVendorId);
|
|
|
|
mIsAccelerated = false;
|
|
|
|
} else if (!driDriver.IsEmpty()) {
|
|
|
|
mVendorId = nsPrintfCString("mesa/%s", driDriver.get());
|
|
|
|
} else {
|
|
|
|
// Some other mesa configuration where we couldn't get enough info.
|
|
|
|
NS_WARNING("Failed to detect Mesa driver being used!");
|
|
|
|
CopyUTF16toUTF8(GfxDriverInfo::GetDeviceVendor(VendorMesaUnknown),
|
|
|
|
mVendorId);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!mesaDevice.IsEmpty()) {
|
|
|
|
mDeviceId = mesaDevice;
|
|
|
|
} else {
|
|
|
|
NS_WARNING(
|
|
|
|
"Failed to get Mesa device ID! GLX_MESA_query_renderer unsupported?");
|
2016-09-21 06:24:26 +00:00
|
|
|
}
|
2019-02-08 19:36:08 +00:00
|
|
|
} else if (glVendor.EqualsLiteral("NVIDIA Corporation")) {
|
|
|
|
CopyUTF16toUTF8(GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), mVendorId);
|
|
|
|
// TODO: Use NV-CONTROL X11 extension to query Device ID and VRAM.
|
|
|
|
} else if (glVendor.EqualsLiteral("ATI Technologies Inc.")) {
|
|
|
|
CopyUTF16toUTF8(GfxDriverInfo::GetDeviceVendor(VendorATI), mVendorId);
|
|
|
|
// TODO: Look into ways to find the device ID on FGLRX.
|
|
|
|
} else {
|
|
|
|
NS_WARNING("Failed to detect GL vendor!");
|
2018-11-30 10:46:48 +00:00
|
|
|
}
|
2011-05-03 20:07:17 +00:00
|
|
|
|
2019-02-08 19:36:08 +00:00
|
|
|
// Fallback to GL_VENDOR and GL_RENDERER.
|
|
|
|
if (mVendorId.IsEmpty()) {
|
|
|
|
mVendorId.Assign(glVendor.get());
|
|
|
|
}
|
|
|
|
if (mDeviceId.IsEmpty()) {
|
|
|
|
mDeviceId.Assign(glRenderer.get());
|
|
|
|
}
|
|
|
|
|
|
|
|
mAdapterDescription.Assign(glRenderer);
|
|
|
|
|
|
|
|
AddCrashReportAnnotations();
|
2011-11-03 14:50:40 +00:00
|
|
|
}
|
|
|
|
|
2016-09-21 06:24:26 +00:00
|
|
|
const nsTArray<GfxDriverInfo> &GfxInfo::GetGfxDriverInfo() {
|
2019-02-08 19:36:08 +00:00
|
|
|
if (!sDriverInfo->Length()) {
|
|
|
|
// Mesa 10.0 provides the GLX_MESA_query_renderer extension, which allows us
|
|
|
|
// to query device IDs backing a GL context for blacklisting.
|
|
|
|
APPEND_TO_DRIVER_BLOCKLIST(
|
|
|
|
OperatingSystem::Linux,
|
|
|
|
(nsAString &)GfxDriverInfo::GetDeviceVendor(VendorMesaAll),
|
|
|
|
GfxDriverInfo::allDevices, GfxDriverInfo::allFeatures,
|
|
|
|
nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN,
|
|
|
|
V(10, 0, 0, 0), "FEATURE_FAILURE_OLD_MESA", "Mesa 10.0");
|
|
|
|
|
|
|
|
// NVIDIA baseline (ported from old blocklist)
|
|
|
|
APPEND_TO_DRIVER_BLOCKLIST(
|
|
|
|
OperatingSystem::Linux,
|
|
|
|
(nsAString &)GfxDriverInfo::GetDeviceVendor(VendorNVIDIA),
|
|
|
|
GfxDriverInfo::allDevices, GfxDriverInfo::allFeatures,
|
|
|
|
nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN,
|
|
|
|
V(257, 21, 0, 0), "FEATURE_FAILURE_OLD_NVIDIA", "NVIDIA 257.21");
|
|
|
|
|
|
|
|
// fglrx baseline (chosen arbitrarily as 2013-07-22 release).
|
|
|
|
APPEND_TO_DRIVER_BLOCKLIST(
|
|
|
|
OperatingSystem::Linux,
|
|
|
|
(nsAString &)GfxDriverInfo::GetDeviceVendor(VendorATI),
|
|
|
|
GfxDriverInfo::allDevices, GfxDriverInfo::allFeatures,
|
|
|
|
nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN,
|
|
|
|
V(13, 15, 100, 1), "FEATURE_FAILURE_OLD_FGLRX", "fglrx 13.15.100.1");
|
|
|
|
}
|
2018-05-14 15:16:50 +00:00
|
|
|
return *sDriverInfo;
|
2016-08-04 21:02:14 +00:00
|
|
|
}
|
|
|
|
|
2019-02-08 19:36:08 +00:00
|
|
|
bool GfxInfo::DoesVendorMatch(const nsAString &aBlocklistVendor,
|
|
|
|
const nsAString &aAdapterVendor) {
|
|
|
|
if (mIsMesa &&
|
|
|
|
aBlocklistVendor.Equals(GfxDriverInfo::GetDeviceVendor(VendorMesaAll),
|
|
|
|
nsCaseInsensitiveStringComparator())) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return GfxInfoBase::DoesVendorMatch(aBlocklistVendor, aAdapterVendor);
|
|
|
|
}
|
|
|
|
|
2016-04-13 21:12:47 +00:00
|
|
|
nsresult GfxInfo::GetFeatureStatusImpl(
|
|
|
|
int32_t aFeature, int32_t *aStatus, nsAString &aSuggestedDriverVersion,
|
|
|
|
const nsTArray<GfxDriverInfo> &aDriverInfo, nsACString &aFailureId,
|
2012-07-30 14:20:58 +00:00
|
|
|
OperatingSystem *aOS /* = nullptr */)
|
2011-11-03 14:50:40 +00:00
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
{
|
2011-12-15 05:03:08 +00:00
|
|
|
NS_ENSURE_ARG_POINTER(aStatus);
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
|
|
|
|
aSuggestedDriverVersion.SetIsVoid(true);
|
2016-06-03 20:13:08 +00:00
|
|
|
OperatingSystem os = OperatingSystem::Linux;
|
2011-12-15 05:03:08 +00:00
|
|
|
if (aOS) *aOS = os;
|
2011-05-03 20:07:17 +00:00
|
|
|
|
2018-05-14 15:16:50 +00:00
|
|
|
if (sShutdownOccurred) {
|
2018-05-08 21:37:25 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
GetData();
|
|
|
|
|
2019-02-08 19:36:08 +00:00
|
|
|
if (mGLMajorVersion == 0) {
|
|
|
|
// If we failed to get a GL version, glxtest failed.
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
aFailureId = "FEATURE_FAILURE_GLXTEST_FAILED";
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-02-23 22:21:30 +00:00
|
|
|
if (mGLMajorVersion == 1) {
|
|
|
|
// We're on OpenGL 1. In most cases that indicates really old hardware.
|
|
|
|
// We better block them, rather than rely on them to fail gracefully,
|
|
|
|
// because they don't! see bug 696636
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
2016-04-13 21:12:47 +00:00
|
|
|
aFailureId = "FEATURE_FAILURE_OPENGL_1";
|
2012-02-23 22:21:30 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2019-02-08 19:36:08 +00:00
|
|
|
// Blacklist software GL implementations from using layers acceleration.
|
|
|
|
// On the test infrastructure, we'll force-enable layers acceleration.
|
|
|
|
if (aFeature == nsIGfxInfo::FEATURE_OPENGL_LAYERS && !mIsAccelerated &&
|
|
|
|
!PR_GetEnv("MOZ_LAYERS_ALLOW_SOFTWARE_GL")) {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
aFailureId = "FEATURE_FAILURE_SOFTWARE_GL";
|
|
|
|
return NS_OK;
|
2011-12-15 05:03:08 +00:00
|
|
|
}
|
2011-11-03 14:50:40 +00:00
|
|
|
|
2016-04-13 21:12:47 +00:00
|
|
|
return GfxInfoBase::GetFeatureStatusImpl(
|
|
|
|
aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, aFailureId, &os);
|
2011-05-03 20:07:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-09-29 06:19:26 +00:00
|
|
|
GfxInfo::GetD2DEnabled(bool *aEnabled) { return NS_ERROR_FAILURE; }
|
2011-05-03 20:07:17 +00:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-09-29 06:19:26 +00:00
|
|
|
GfxInfo::GetDWriteEnabled(bool *aEnabled) { return NS_ERROR_FAILURE; }
|
2011-05-03 20:07:17 +00:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetDWriteVersion(nsAString &aDwriteVersion) {
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-05-11 00:30:20 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetCleartypeParameters(nsAString &aCleartypeParams) {
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDescription(nsAString &aAdapterDescription) {
|
|
|
|
GetData();
|
|
|
|
AppendASCIItoUTF16(mAdapterDescription, aAdapterDescription);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 13:46:41 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDescription2(nsAString &aAdapterDescription) {
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterRAM(nsAString &aAdapterRAM) {
|
2019-02-08 19:36:08 +00:00
|
|
|
GetData();
|
|
|
|
CopyUTF8toUTF16(mAdapterRAM, aAdapterRAM);
|
2011-05-03 20:07:17 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 13:46:41 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterRAM2(nsAString &aAdapterRAM) { return NS_ERROR_FAILURE; }
|
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriver(nsAString &aAdapterDriver) {
|
2014-05-26 18:54:53 +00:00
|
|
|
aAdapterDriver.Truncate();
|
2011-05-03 20:07:17 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 13:46:41 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriver2(nsAString &aAdapterDriver) {
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverVersion(nsAString &aAdapterDriverVersion) {
|
|
|
|
GetData();
|
2019-02-08 19:36:08 +00:00
|
|
|
CopyASCIItoUTF16(mDriverVersion, aAdapterDriverVersion);
|
2011-05-03 20:07:17 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 13:46:41 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverVersion2(nsAString &aAdapterDriverVersion) {
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverDate(nsAString &aAdapterDriverDate) {
|
2014-05-26 18:54:53 +00:00
|
|
|
aAdapterDriverDate.Truncate();
|
2011-05-03 20:07:17 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 13:46:41 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverDate2(nsAString &aAdapterDriverDate) {
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
NS_IMETHODIMP
|
2011-12-15 05:03:01 +00:00
|
|
|
GfxInfo::GetAdapterVendorID(nsAString &aAdapterVendorID) {
|
2011-12-15 05:03:13 +00:00
|
|
|
GetData();
|
2019-02-08 19:36:08 +00:00
|
|
|
CopyUTF8toUTF16(mVendorId, aAdapterVendorID);
|
2011-05-03 20:07:17 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 13:46:41 +00:00
|
|
|
NS_IMETHODIMP
|
2011-12-15 05:03:01 +00:00
|
|
|
GfxInfo::GetAdapterVendorID2(nsAString &aAdapterVendorID) {
|
2011-08-12 13:46:41 +00:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-05-03 20:07:17 +00:00
|
|
|
NS_IMETHODIMP
|
2011-12-15 05:03:01 +00:00
|
|
|
GfxInfo::GetAdapterDeviceID(nsAString &aAdapterDeviceID) {
|
2011-12-15 05:03:13 +00:00
|
|
|
GetData();
|
2019-02-08 19:36:08 +00:00
|
|
|
CopyUTF8toUTF16(mDeviceId, aAdapterDeviceID);
|
2011-05-03 20:07:17 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 13:46:41 +00:00
|
|
|
NS_IMETHODIMP
|
2011-12-15 05:03:01 +00:00
|
|
|
GfxInfo::GetAdapterDeviceID2(nsAString &aAdapterDeviceID) {
|
2011-08-12 13:46:41 +00:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2014-07-09 18:21:49 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterSubsysID(nsAString &aAdapterSubsysID) {
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterSubsysID2(nsAString &aAdapterSubsysID) {
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-08-12 13:46:41 +00:00
|
|
|
NS_IMETHODIMP
|
2011-09-29 06:19:26 +00:00
|
|
|
GfxInfo::GetIsGPU2Active(bool *aIsGPU2Active) { return NS_ERROR_FAILURE; }
|
2011-08-12 13:46:41 +00:00
|
|
|
|
2011-12-15 05:04:35 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
|
|
|
|
// Implement nsIGfxInfoDebug
|
|
|
|
// We don't support spoofing anything on Linux
|
|
|
|
|
|
|
|
NS_IMETHODIMP GfxInfo::SpoofVendorID(const nsAString &aVendorID) {
|
2019-02-08 19:36:08 +00:00
|
|
|
GetData();
|
|
|
|
CopyUTF16toUTF8(aVendorID, mVendorId);
|
|
|
|
mIsAccelerated = !(mVendorId.EqualsLiteral("mesa/llvmpipe") ||
|
|
|
|
mVendorId.EqualsLiteral("mesa/softpipe") ||
|
|
|
|
mVendorId.EqualsLiteral("mesa/swrast"));
|
2011-12-15 05:04:35 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP GfxInfo::SpoofDeviceID(const nsAString &aDeviceID) {
|
2019-02-08 19:36:08 +00:00
|
|
|
GetData();
|
|
|
|
CopyUTF16toUTF8(aDeviceID, mDeviceId);
|
2011-12-15 05:04:35 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP GfxInfo::SpoofDriverVersion(const nsAString &aDriverVersion) {
|
2019-02-08 19:36:08 +00:00
|
|
|
GetData();
|
|
|
|
CopyUTF16toUTF8(aDriverVersion, mDriverVersion);
|
2011-12-15 05:04:35 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHODIMP GfxInfo::SpoofOSVersion(uint32_t aVersion) {
|
2011-12-15 05:04:35 +00:00
|
|
|
// We don't support OS versioning on Linux. There's just "Linux".
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2019-02-08 19:36:08 +00:00
|
|
|
NS_IMETHODIMP GfxInfo::FireTestProcess() {
|
|
|
|
// If the pid is zero, then we have never run the test process to query for
|
|
|
|
// driver information. This would normally be run on startup, but we need to
|
|
|
|
// manually invoke it for XPC shell tests.
|
|
|
|
if (glxtest_pid == 0) {
|
|
|
|
fire_glxtest_process();
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-12-15 05:04:35 +00:00
|
|
|
#endif
|
2011-05-03 20:07:17 +00:00
|
|
|
|
|
|
|
} // end namespace widget
|
|
|
|
} // end namespace mozilla
|