Bug 1594145 - Add gfx telemetry scalars to geckoview_streaming. r=Dexter,jnicol

Differential Revision: https://phabricator.services.mozilla.com/D52941

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kris Taeleman 2019-11-23 00:18:27 +00:00
Родитель ef679880bc
Коммит 25c223ac03
19 изменённых файлов: 727 добавлений и 112 удалений

Просмотреть файл

@ -9,6 +9,26 @@
namespace mozilla {
namespace layers {
const char* GetLayersBackendName(LayersBackend aBackend) {
switch (aBackend) {
case LayersBackend::LAYERS_NONE:
return "none";
case LayersBackend::LAYERS_OPENGL:
return "opengl";
case LayersBackend::LAYERS_D3D11:
return "d3d11";
case LayersBackend::LAYERS_CLIENT:
return "client";
case LayersBackend::LAYERS_WR:
return "webrender";
case LayersBackend::LAYERS_BASIC:
return "basic";
default:
MOZ_ASSERT_UNREACHABLE("unknown layers backend");
return "unknown";
}
}
EventRegions::EventRegions(const nsIntRegion& aHitRegion,
const nsIntRegion& aMaybeHitRegion,
const nsIntRegion& aDispatchToContentRegion,

Просмотреть файл

@ -155,6 +155,8 @@ enum class LayersBackend : int8_t {
LAYERS_LAST
};
const char* GetLayersBackendName(LayersBackend aBackend);
enum class TextureType : int8_t {
Unknown = 0,
D3D11,

Просмотреть файл

@ -1106,12 +1106,82 @@ void gfxPlatform::Init() {
}
}
if (XRE_IsParentProcess()) {
ReportTelemetry();
}
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
if (obs) {
obs->NotifyObservers(nullptr, "gfx-features-ready", nullptr);
}
}
void gfxPlatform::ReportTelemetry() {
MOZ_RELEASE_ASSERT(XRE_IsParentProcess(),
"GFX: Only allowed to be called from parent process.");
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
nsTArray<uint32_t> displayWidths;
nsTArray<uint32_t> displayHeights;
gfxInfo->GetDisplayWidth(displayWidths);
gfxInfo->GetDisplayHeight(displayHeights);
uint32_t displayCount = displayWidths.Length();
uint32_t displayWidth = displayWidths.Length() > 0 ? displayWidths[0] : 0;
uint32_t displayHeight = displayHeights.Length() > 0 ? displayHeights[0] : 0;
Telemetry::ScalarSet(Telemetry::ScalarID::GFX_DISPLAY_COUNT, displayCount);
Telemetry::ScalarSet(Telemetry::ScalarID::GFX_DISPLAY_PRIMARY_HEIGHT,
displayHeight);
Telemetry::ScalarSet(Telemetry::ScalarID::GFX_DISPLAY_PRIMARY_WIDTH,
displayWidth);
nsString adapterDesc;
gfxInfo->GetAdapterDescription(adapterDesc);
Telemetry::ScalarSet(Telemetry::ScalarID::GFX_ADAPTER_DESCRIPTION,
adapterDesc);
nsString adapterVendorId;
gfxInfo->GetAdapterVendorID(adapterVendorId);
Telemetry::ScalarSet(Telemetry::ScalarID::GFX_ADAPTER_VENDOR_ID,
adapterVendorId);
nsString adapterDeviceId;
gfxInfo->GetAdapterDeviceID(adapterDeviceId);
Telemetry::ScalarSet(Telemetry::ScalarID::GFX_ADAPTER_DEVICE_ID,
adapterDeviceId);
nsString adapterSubsystemId;
gfxInfo->GetAdapterSubsysID(adapterSubsystemId);
Telemetry::ScalarSet(Telemetry::ScalarID::GFX_ADAPTER_SUBSYSTEM_ID,
adapterSubsystemId);
uint32_t adapterRam = 0;
gfxInfo->GetAdapterRAM(&adapterRam);
Telemetry::ScalarSet(Telemetry::ScalarID::GFX_ADAPTER_RAM, adapterRam);
nsString adapterDriver;
gfxInfo->GetAdapterDriver(adapterDriver);
Telemetry::ScalarSet(Telemetry::ScalarID::GFX_ADAPTER_DRIVER_FILES,
adapterDriver);
nsString adapterDriverVendor;
gfxInfo->GetAdapterDriverVendor(adapterDriverVendor);
Telemetry::ScalarSet(Telemetry::ScalarID::GFX_ADAPTER_DRIVER_VENDOR,
adapterDriverVendor);
nsString adapterDriverVersion;
gfxInfo->GetAdapterDriverVersion(adapterDriverVersion);
Telemetry::ScalarSet(Telemetry::ScalarID::GFX_ADAPTER_DRIVER_VERSION,
adapterDriverVersion);
nsString adapterDriverDate;
gfxInfo->GetAdapterDriverDate(adapterDriverDate);
Telemetry::ScalarSet(Telemetry::ScalarID::GFX_ADAPTER_DRIVER_DATE,
adapterDriverDate);
Telemetry::ScalarSet(Telemetry::ScalarID::GFX_HEADLESS, IsHeadless());
}
static bool IsFeatureSupported(long aFeature, bool aDefault) {
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
nsCString blockId;
@ -3596,6 +3666,12 @@ void gfxPlatform::NotifyCompositorCreated(LayersBackend aBackend) {
// Set the backend before we notify so it's available immediately.
mCompositorBackend = aBackend;
if (XRE_IsParentProcess()) {
Telemetry::ScalarSet(
Telemetry::ScalarID::GFX_COMPOSITOR,
NS_ConvertUTF8toUTF16(GetLayersBackendName(mCompositorBackend)));
}
// Notify that we created a compositor, so telemetry can update.
NS_DispatchToMainThread(
NS_NewRunnableFunction("gfxPlatform::NotifyCompositorCreated", [] {

Просмотреть файл

@ -898,6 +898,9 @@ class gfxPlatform : public mozilla::layers::MemoryPressureListener {
virtual void InitPlatformGPUProcessPrefs() {}
void InitOMTPConfig();
// Gather telemetry data about the Gfx Platform and send it
static void ReportTelemetry();
static bool IsDXInterop2Blocked();
static bool IsDXNV12Blocked();
static bool IsDXP010Blocked();

Просмотреть файл

@ -2805,6 +2805,221 @@ gfx.hdr:
record_in_processes:
- 'main'
gfx.display:
count:
bug_numbers:
- 1594145
description: >
Number of displays connected to the device
expires: never
kind: uint
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
products:
- 'geckoview_streaming'
record_in_processes:
- 'main'
release_channel_collection: opt-out
primary_width:
bug_numbers:
- 1594145
description: >
Width of the primary display, takes device rotation into account.
expires: never
kind: uint
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
products:
- 'geckoview_streaming'
record_in_processes:
- 'main'
release_channel_collection: opt-out
primary_height:
bug_numbers:
- 1594145
description: >
Height of the primary display, takes device rotation into account.
expires: never
kind: uint
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
products:
- 'geckoview_streaming'
record_in_processes:
- 'main'
release_channel_collection: opt-out
gfx.adapter:
description:
bug_numbers:
- 1594145
description: >
Long form description of the Graphics adapter
expires: never
kind: string
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
products:
- 'geckoview_streaming'
record_in_processes:
- 'main'
release_channel_collection: opt-out
vendor_id:
bug_numbers:
- 1594145
description: >
Graphics adapter vendor identification
expires: never
kind: string
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
products:
- 'geckoview_streaming'
record_in_processes:
- 'main'
release_channel_collection: opt-out
device_id:
bug_numbers:
- 1594145
description: >
Graphics adapter device identification
expires: never
kind: string
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
products:
- 'geckoview_streaming'
record_in_processes:
- 'main'
release_channel_collection: opt-out
subsystem_id:
bug_numbers:
- 1594145
description: >
Graphics adapter subsystem identification
expires: never
kind: string
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
products:
- 'geckoview_streaming'
record_in_processes:
- 'main'
release_channel_collection: opt-out
ram:
bug_numbers:
- 1594145
description: >
Graphics adapter dedicated memory
expires: never
kind: uint
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
products:
- 'geckoview_streaming'
record_in_processes:
- 'main'
release_channel_collection: opt-out
driver_files:
bug_numbers:
- 1594145
description: >
List of graphics adapter driver files
expires: never
kind: string
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
products:
- 'geckoview_streaming'
record_in_processes:
- 'main'
release_channel_collection: opt-out
driver_vendor:
bug_numbers:
- 1594145
description: >
Graphics adapter driver vendor identification
expires: never
kind: string
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
products:
- 'geckoview_streaming'
record_in_processes:
- 'main'
release_channel_collection: opt-out
driver_version:
bug_numbers:
- 1594145
description: >
Graphics adapter driver version
expires: never
kind: string
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
products:
- 'geckoview_streaming'
record_in_processes:
- 'main'
release_channel_collection: opt-out
driver_date:
bug_numbers:
- 1594145
description: >
Graphics adapter driver date
expires: never
kind: string
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
products:
- 'geckoview_streaming'
record_in_processes:
- 'main'
release_channel_collection: opt-out
gfx:
compositor:
bug_numbers:
- 1594145
description: >
Name of the graphics compositor in use. possible values are "opengl, d3d11, client, webrender or basic"
expires: never
kind: string
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
products:
- 'geckoview_streaming'
record_in_processes:
- 'main'
release_channel_collection: opt-out
headless:
bug_numbers:
- 1594145
description: >
Boolean indicated whether graphics is running in headless (no display) mode
expires: never
kind: boolean
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
products:
- 'geckoview_streaming'
record_in_processes:
- 'main'
release_channel_collection: opt-out
# The following section contains the form autofill related scalars.
formautofill:
availability:

Просмотреть файл

@ -391,6 +391,211 @@ gfx.webrender:
- kgupta@mozilla.com
expires: never
gfx.display:
count:
description: >
Amount of displays connected to the device
type: quantity
unit: Display count
lifetime: application
gecko_datapoint: gfx.display.count
bugs:
- 1594145
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1594145#c4
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
expires: never
primary_width:
description: >
Width of the primary display, takes device rotation into account.
type: quantity
unit: Pixels
lifetime: application
gecko_datapoint: gfx.display.primary_width
bugs:
- 1594145
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1594145#c4
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
expires: never
primary_height:
description: >
Height of the primary display, takes device rotation into account.
type: quantity
unit: Pixels
lifetime: application
gecko_datapoint: gfx.display.primary_height
bugs:
- 1594145
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1594145#c4
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
expires: never
gfx.adapter.primary:
description:
description: >
Long form description of the Graphics adapter
type: string
lifetime: application
gecko_datapoint: gfx.adapter.description
bugs:
- 1594145
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1594145#c4
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
expires: never
vendor_id:
description: >
Graphics adapter vendor identification
type: string
lifetime: application
gecko_datapoint: gfx.adapter.vendor_id
bugs:
- 1594145
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1594145#c4
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
expires: never
device_id:
description: >
Graphics adapter device identification
type: string
lifetime: application
gecko_datapoint: gfx.adapter.device_id
bugs:
- 1594145
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1594145#c4
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
expires: never
subsystem_id:
description: >
Graphics adapter subsystem identification
type: string
lifetime: application
gecko_datapoint: gfx.adapter.subsystem_id
bugs:
- 1594145
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1594145#c4
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
expires: never
ram:
description: >
Graphics adapter dedicated memory
type: quantity
unit: Megabytes
lifetime: application
gecko_datapoint: gfx.adapter.ram
bugs:
- 1594145
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1594145#c4
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
expires: never
driver_files:
description: >
List of graphics adapter driver files
type: string
lifetime: application
gecko_datapoint: gfx.adapter.driver_files
bugs:
- 1594145
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1594145#c4
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
expires: never
driver_vendor:
description: >
Graphics adapter driver vendor identification
type: string
lifetime: application
gecko_datapoint: gfx.adapter.driver_vendor
bugs:
- 1594145
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1594145#c4
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
expires: never
driver_version:
description: >
Graphics adapter driver version
type: string
lifetime: application
gecko_datapoint: gfx.adapter.driver_version
bugs:
- 1594145
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1594145#c4
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
expires: never
driver_date:
description: >
Graphics adapter driver date
type: string
lifetime: application
gecko_datapoint: gfx.adapter.driver_date
bugs:
- 1594145
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1594145#c4
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
expires: never
gfx.status:
compositor:
description: >
Name of the graphics compositor in use. possible values are "opengl, d3d11, client, webrender or basic"
type: string
lifetime: application
gecko_datapoint: gfx.compositor
bugs:
- 1594145
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1594145#c4
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
expires: never
headless:
description: >
Boolean indicated whether graphics is running in headless (no display) mode
type: boolean
lifetime: application
gecko_datapoint: gfx.headless
bugs:
- 1594145
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1594145#c4
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- ktaeleman@mozilla.com
expires: never
sceneswap_time:
type: timing_distribution
time_unit: millisecond

Просмотреть файл

@ -366,8 +366,8 @@ void glxtest() {
int current_width = scrn->width;
length +=
snprintf(buf + length, bufsize - length, "%dx%d%s%s", current_width,
current_height, idx == defaultScreen ? " default" : "",
snprintf(buf + length, bufsize - length, "%dx%d:%d%s", current_width,
current_height, idx == defaultScreen ? 1 : 0,
idx == screenCount - 1 ? ";\n" : ";");
if (length >= bufsize)
fatal_error("Screen Info strings length too large for buffer size");

Просмотреть файл

@ -1245,26 +1245,6 @@ GfxInfoBase::GetMonitors(JSContext* aCx, JS::MutableHandleValue aResult) {
return NS_OK;
}
static const char* GetLayersBackendName(layers::LayersBackend aBackend) {
switch (aBackend) {
case layers::LayersBackend::LAYERS_NONE:
return "none";
case layers::LayersBackend::LAYERS_OPENGL:
return "opengl";
case layers::LayersBackend::LAYERS_D3D11:
return "d3d11";
case layers::LayersBackend::LAYERS_CLIENT:
return "client";
case layers::LayersBackend::LAYERS_WR:
return "webrender";
case layers::LayersBackend::LAYERS_BASIC:
return "basic";
default:
MOZ_ASSERT_UNREACHABLE("unknown layers backend");
return "unknown";
}
}
static inline bool SetJSPropertyString(JSContext* aCx,
JS::Handle<JSObject*> aObj,
const char* aProp, const char* aString) {
@ -1299,7 +1279,7 @@ nsresult GfxInfoBase::GetFeatures(JSContext* aCx,
gfxPlatform::Initialized()
? gfxPlatform::GetPlatform()->GetCompositorBackend()
: layers::LayersBackend::LAYERS_NONE;
const char* backendName = GetLayersBackendName(backend);
const char* backendName = layers::GetLayersBackendName(backend);
SetJSPropertyString(aCx, obj, "compositor", backendName);
// If graphics isn't initialized yet, just stop now.

Просмотреть файл

@ -132,8 +132,10 @@ void GfxInfo::GetData() {
// Available if using a DRI-based libGL stack.
nsCString driDriver;
nsCString screenInfo;
nsCString adapterRam;
nsCString* stringToFill = nullptr;
char* bufptr = buf;
if (!error) {
while (true) {
@ -157,7 +159,7 @@ void GfxInfo::GetData() {
else if (!strcmp(line, "MESA_ACCELERATED"))
stringToFill = &mesaAccelerated;
else if (!strcmp(line, "MESA_VRAM"))
stringToFill = &mAdapterRAM;
stringToFill = &adapterRam;
else if (!strcmp(line, "DRI_DRIVER"))
stringToFill = &driDriver;
else if (!strcmp(line, "SCREEN_INFO"))
@ -297,16 +299,24 @@ void GfxInfo::GetData() {
PRInt32 start = 0;
PRInt32 loc = screenInfo.Find(";", PR_FALSE, start);
while (loc != kNotFound) {
int isDefault = 0;
nsCString line(screenInfo.get() + start, loc - start);
nsString value;
CopyASCIItoUTF16(line, value);
ScreenInfo info;
if (sscanf(line.get(), "%ux%u:%u", &info.mWidth, &info.mHeight,
&isDefault) == 3) {
info.mIsDefault = isDefault != 0;
mScreenInfo.AppendElement(info);
}
mScreenInfo.AppendElement(value);
start = loc + 1;
loc = screenInfo.Find(";", PR_FALSE, start);
}
}
if (!adapterRam.IsEmpty()) {
mAdapterRAM = (uint32_t)atoi(adapterRam.get());
}
// Fallback to GL_VENDOR and GL_RENDERER.
if (mVendorId.IsEmpty()) {
mVendorId.Assign(glVendor.get());
@ -512,14 +522,14 @@ GfxInfo::GetAdapterDescription2(nsAString& aAdapterDescription) {
}
NS_IMETHODIMP
GfxInfo::GetAdapterRAM(nsAString& aAdapterRAM) {
GfxInfo::GetAdapterRAM(uint32_t* aAdapterRAM) {
GetData();
CopyUTF8toUTF16(mAdapterRAM, aAdapterRAM);
*aAdapterRAM = mAdapterRAM;
return NS_OK;
}
NS_IMETHODIMP
GfxInfo::GetAdapterRAM2(nsAString& aAdapterRAM) { return NS_ERROR_FAILURE; }
GfxInfo::GetAdapterRAM2(uint32_t* aAdapterRAM) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP
GfxInfo::GetAdapterDriver(nsAString& aAdapterDriver) {
@ -604,12 +614,31 @@ GfxInfo::GetAdapterSubsysID2(nsAString& aAdapterSubsysID) {
NS_IMETHODIMP
GfxInfo::GetDisplayInfo(nsTArray<nsString>& aDisplayInfo) {
GetData();
if (!mScreenInfo.IsEmpty()) {
aDisplayInfo = mScreenInfo;
return NS_OK;
for (auto screenInfo : mScreenInfo) {
nsString infoString;
infoString.AppendPrintf("%dx%d %s", screenInfo.mWidth, screenInfo.mHeight,
screenInfo.mIsDefault ? "default" : "");
aDisplayInfo.AppendElement(infoString);
}
return NS_ERROR_FAILURE;
return aDisplayInfo.IsEmpty() ? NS_ERROR_FAILURE : NS_OK;
}
NS_IMETHODIMP
GfxInfo::GetDisplayWidth(nsTArray<uint32_t>& aDisplayWidth) {
for (auto screenInfo : mScreenInfo) {
aDisplayWidth.AppendElement((uint32_t)screenInfo.mWidth);
}
return NS_OK;
}
NS_IMETHODIMP
GfxInfo::GetDisplayHeight(nsTArray<uint32_t>& aDisplayHeight) {
for (auto screenInfo : mScreenInfo) {
aDisplayHeight.AppendElement((uint32_t)screenInfo.mHeight);
}
return NS_OK;
}
NS_IMETHODIMP

Просмотреть файл

@ -28,7 +28,7 @@ class GfxInfo final : public GfxInfoBase {
NS_IMETHOD GetAdapterVendorID(nsAString& aAdapterVendorID) override;
NS_IMETHOD GetAdapterDeviceID(nsAString& aAdapterDeviceID) override;
NS_IMETHOD GetAdapterSubsysID(nsAString& aAdapterSubsysID) override;
NS_IMETHOD GetAdapterRAM(nsAString& aAdapterRAM) override;
NS_IMETHOD GetAdapterRAM(uint32_t* aAdapterRAM) override;
NS_IMETHOD GetAdapterDriverVendor(nsAString& aAdapterDriverVendor) override;
NS_IMETHOD GetAdapterDriverVersion(nsAString& aAdapterDriverVersion) override;
NS_IMETHOD GetAdapterDriverDate(nsAString& aAdapterDriverDate) override;
@ -37,13 +37,15 @@ class GfxInfo final : public GfxInfoBase {
NS_IMETHOD GetAdapterVendorID2(nsAString& aAdapterVendorID) override;
NS_IMETHOD GetAdapterDeviceID2(nsAString& aAdapterDeviceID) override;
NS_IMETHOD GetAdapterSubsysID2(nsAString& aAdapterSubsysID) override;
NS_IMETHOD GetAdapterRAM2(nsAString& aAdapterRAM) override;
NS_IMETHOD GetAdapterRAM2(uint32_t* aAdapterRAM) override;
NS_IMETHOD GetAdapterDriverVendor2(nsAString& aAdapterDriverVendor) override;
NS_IMETHOD GetAdapterDriverVersion2(
nsAString& aAdapterDriverVersion) override;
NS_IMETHOD GetAdapterDriverDate2(nsAString& aAdapterDriverDate) override;
NS_IMETHOD GetIsGPU2Active(bool* aIsGPU2Active) override;
NS_IMETHOD GetDisplayInfo(nsTArray<nsString>& aDisplayInfo) override;
NS_IMETHOD GetDisplayWidth(nsTArray<uint32_t>& aDisplayWidth) override;
NS_IMETHOD GetDisplayHeight(nsTArray<uint32_t>& aDisplayHeight) override;
using GfxInfoBase::GetFeatureStatus;
using GfxInfoBase::GetFeatureSuggestedDriverVersion;
@ -74,10 +76,17 @@ class GfxInfo final : public GfxInfoBase {
nsCString mDriverVendor;
nsCString mDriverVersion;
nsCString mAdapterDescription;
nsCString mAdapterRAM;
uint32_t mAdapterRAM;
nsCString mOS;
nsCString mOSRelease;
nsTArray<nsString> mScreenInfo;
struct ScreenInfo {
uint32_t mWidth;
uint32_t mHeight;
bool mIsDefault;
};
nsTArray<ScreenInfo> mScreenInfo;
bool mHasTextureFromPixmap;
unsigned int mGLMajorVersion, mGLMinorVersion;
bool mIsMesa;

Просмотреть файл

@ -226,14 +226,14 @@ GfxInfo::GetAdapterDescription2(nsAString& aAdapterDescription) {
}
NS_IMETHODIMP
GfxInfo::GetAdapterRAM(nsAString& aAdapterRAM) {
GfxInfo::GetAdapterRAM(uint32_t* aAdapterRAM) {
EnsureInitialized();
aAdapterRAM.Truncate();
*aAdapterRAM = 0;
return NS_OK;
}
NS_IMETHODIMP
GfxInfo::GetAdapterRAM2(nsAString& aAdapterRAM) {
GfxInfo::GetAdapterRAM2(uint32_t* aAdapterRAM) {
EnsureInitialized();
return NS_ERROR_FAILURE;
}
@ -345,6 +345,18 @@ GfxInfo::GetDisplayInfo(nsTArray<nsString>& aDisplayInfo) {
return NS_OK;
}
NS_IMETHODIMP
GfxInfo::GetDisplayWidth(nsTArray<uint32_t>& aDisplayWidth) {
aDisplayWidth.AppendElement((uint32_t)mScreenInfo.mScreenDimensions.width);
return NS_OK;
}
NS_IMETHODIMP
GfxInfo::GetDisplayHeight(nsTArray<uint32_t>& aDisplayHeight) {
aDisplayHeight.AppendElement((uint32_t)mScreenInfo.mScreenDimensions.height);
return NS_OK;
}
void GfxInfo::AddCrashReportAnnotations() {
CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::AdapterVendorID,
mGLStrings->Vendor());

Просмотреть файл

@ -37,7 +37,7 @@ class GfxInfo : public GfxInfoBase {
NS_IMETHOD GetAdapterVendorID(nsAString& aAdapterVendorID) override;
NS_IMETHOD GetAdapterDeviceID(nsAString& aAdapterDeviceID) override;
NS_IMETHOD GetAdapterSubsysID(nsAString& aAdapterSubsysID) override;
NS_IMETHOD GetAdapterRAM(nsAString& aAdapterRAM) override;
NS_IMETHOD GetAdapterRAM(uint32_t* aAdapterRAM) override;
NS_IMETHOD GetAdapterDriverVendor(nsAString& aAdapterDriverVendor) override;
NS_IMETHOD GetAdapterDriverVersion(nsAString& aAdapterDriverVersion) override;
NS_IMETHOD GetAdapterDriverDate(nsAString& aAdapterDriverDate) override;
@ -46,13 +46,15 @@ class GfxInfo : public GfxInfoBase {
NS_IMETHOD GetAdapterVendorID2(nsAString& aAdapterVendorID) override;
NS_IMETHOD GetAdapterDeviceID2(nsAString& aAdapterDeviceID) override;
NS_IMETHOD GetAdapterSubsysID2(nsAString& aAdapterSubsysID) override;
NS_IMETHOD GetAdapterRAM2(nsAString& aAdapterRAM) override;
NS_IMETHOD GetAdapterRAM2(uint32_t* aAdapterRAM) override;
NS_IMETHOD GetAdapterDriverVendor2(nsAString& aAdapterDriverVendor) override;
NS_IMETHOD GetAdapterDriverVersion2(
nsAString& aAdapterDriverVersion) override;
NS_IMETHOD GetAdapterDriverDate2(nsAString& aAdapterDriverDate) override;
NS_IMETHOD GetIsGPU2Active(bool* aIsGPU2Active) override;
NS_IMETHOD GetDisplayInfo(nsTArray<nsString>& aDisplayInfo) override;
NS_IMETHOD GetDisplayWidth(nsTArray<uint32_t>& aDisplayWidth) override;
NS_IMETHOD GetDisplayHeight(nsTArray<uint32_t>& aDisplayHeight) override;
using GfxInfoBase::GetFeatureStatus;
using GfxInfoBase::GetFeatureSuggestedDriverVersion;

Просмотреть файл

@ -30,7 +30,7 @@ class GfxInfo : public GfxInfoBase {
NS_IMETHOD GetAdapterVendorID(nsAString& aAdapterVendorID) override;
NS_IMETHOD GetAdapterDeviceID(nsAString& aAdapterDeviceID) override;
NS_IMETHOD GetAdapterSubsysID(nsAString& aAdapterSubsysID) override;
NS_IMETHOD GetAdapterRAM(nsAString& aAdapterRAM) override;
NS_IMETHOD GetAdapterRAM(uint32_t* aAdapterRAM) override;
NS_IMETHOD GetAdapterDriverVendor(nsAString& aAdapterDriverVendor) override;
NS_IMETHOD GetAdapterDriverVersion(nsAString& aAdapterDriverVersion) override;
NS_IMETHOD GetAdapterDriverDate(nsAString& aAdapterDriverDate) override;
@ -39,13 +39,15 @@ class GfxInfo : public GfxInfoBase {
NS_IMETHOD GetAdapterVendorID2(nsAString& aAdapterVendorID) override;
NS_IMETHOD GetAdapterDeviceID2(nsAString& aAdapterDeviceID) override;
NS_IMETHOD GetAdapterSubsysID2(nsAString& aAdapterSubsysID) override;
NS_IMETHOD GetAdapterRAM2(nsAString& aAdapterRAM) override;
NS_IMETHOD GetAdapterRAM2(uint32_t* aAdapterRAM) override;
NS_IMETHOD GetAdapterDriverVendor2(nsAString& aAdapterDriverVendor) override;
NS_IMETHOD GetAdapterDriverVersion2(
nsAString& aAdapterDriverVersion) override;
NS_IMETHOD GetAdapterDriverDate2(nsAString& aAdapterDriverDate) override;
NS_IMETHOD GetIsGPU2Active(bool* aIsGPU2Active) override;
NS_IMETHOD GetDisplayInfo(nsTArray<nsString>& aDisplayInfo) override;
NS_IMETHOD GetDisplayWidth(nsTArray<uint32_t>& aDisplayWidth) override;
NS_IMETHOD GetDisplayHeight(nsTArray<uint32_t>& aDisplayHeight) override;
using GfxInfoBase::GetFeatureStatus;
using GfxInfoBase::GetFeatureSuggestedDriverVersion;
@ -75,7 +77,7 @@ class GfxInfo : public GfxInfoBase {
void GetSelectedCityInfo();
void AddCrashReportAnnotations();
nsString mAdapterRAMString;
uint32_t mAdapterRAM;
nsString mDeviceID;
nsString mDriverVersion;
nsString mDriverDate;

Просмотреть файл

@ -30,7 +30,7 @@ using namespace mozilla::widget;
NS_IMPL_ISUPPORTS_INHERITED(GfxInfo, GfxInfoBase, nsIGfxInfoDebug)
#endif
GfxInfo::GfxInfo() : mOSXVersion{0} {}
GfxInfo::GfxInfo() : mAdapterRAM(0), mOSXVersion{0} {}
static OperatingSystem OSXVersionToOperatingSystem(uint32_t aOSXVersion) {
if (nsCocoaFeatures::ExtractMajorVersion(aOSXVersion) == 10) {
@ -139,14 +139,14 @@ GfxInfo::GetAdapterDescription2(nsAString& aAdapterDescription) { return NS_ERRO
/* readonly attribute DOMString adapterRAM; */
NS_IMETHODIMP
GfxInfo::GetAdapterRAM(nsAString& aAdapterRAM) {
aAdapterRAM = mAdapterRAMString;
GfxInfo::GetAdapterRAM(uint32_t* aAdapterRAM) {
*aAdapterRAM = mAdapterRAM;
return NS_OK;
}
/* readonly attribute DOMString adapterRAM2; */
NS_IMETHODIMP
GfxInfo::GetAdapterRAM2(nsAString& aAdapterRAM) { return NS_ERROR_FAILURE; }
GfxInfo::GetAdapterRAM2(uint32_t* aAdapterRAM) { return NS_ERROR_FAILURE; }
/* readonly attribute DOMString adapterDriver; */
NS_IMETHODIMP
@ -236,6 +236,24 @@ GfxInfo::GetDisplayInfo(nsTArray<nsString>& aDisplayInfo) {
return NS_OK;
}
NS_IMETHODIMP
GfxInfo::GetDisplayWidth(nsTArray<uint32_t>& aDisplayWidth) {
for (NSScreen* screen in [NSScreen screens]) {
NSRect rect = [screen frame];
aDisplayWidth.AppendElement((uint32_t)rect.size.width);
}
return NS_OK;
}
NS_IMETHODIMP
GfxInfo::GetDisplayHeight(nsTArray<uint32_t>& aDisplayHeight) {
for (NSScreen* screen in [NSScreen screens]) {
NSRect rect = [screen frame];
aDisplayHeight.AppendElement((uint32_t)rect.size.height);
}
return NS_OK;
}
/* readonly attribute boolean isGPU2Active; */
NS_IMETHODIMP
GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active) { return NS_ERROR_FAILURE; }

Просмотреть файл

@ -60,8 +60,8 @@ interface nsIGfxInfo : nsISupports
/**
* The amount of RAM in MB in the display adapter.
*/
readonly attribute AString adapterRAM;
readonly attribute AString adapterRAM2;
readonly attribute unsigned long adapterRAM;
readonly attribute unsigned long adapterRAM2;
readonly attribute AString adapterDriverVendor;
readonly attribute AString adapterDriverVendor2;
@ -78,6 +78,8 @@ interface nsIGfxInfo : nsISupports
* Information about display devices
*/
readonly attribute Array<AString> displayInfo;
readonly attribute Array<unsigned long> displayWidth;
readonly attribute Array<unsigned long> displayHeight;
/**
* Returns an array of objects describing each monitor. Guaranteed properties
@ -280,3 +282,4 @@ interface nsIGfxInfo : nsISupports
boolean controlGPUProcessForXPCShell(in boolean aEnable);
};

Просмотреть файл

@ -42,10 +42,10 @@ GfxInfo::GetAdapterDescription2(nsAString& aAdapterDescription) {
}
NS_IMETHODIMP
GfxInfo::GetAdapterRAM(nsAString& aAdapterRAM) { return NS_ERROR_FAILURE; }
GfxInfo::GetAdapterRAM(uint32_t* aAdapterRAM) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP
GfxInfo::GetAdapterRAM2(nsAString& aAdapterRAM) { return NS_ERROR_FAILURE; }
GfxInfo::GetAdapterRAM2(uint32_t* aAdapterRAM) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP
GfxInfo::GetAdapterDriver(nsAString& aAdapterDriver) {

Просмотреть файл

@ -40,7 +40,7 @@ class GfxInfo : public GfxInfoBase {
NS_IMETHOD GetAdapterVendorID(nsAString& aAdapterVendorID) override;
NS_IMETHOD GetAdapterDeviceID(nsAString& aAdapterDeviceID) override;
NS_IMETHOD GetAdapterSubsysID(nsAString& aAdapterSubsysID) override;
NS_IMETHOD GetAdapterRAM(nsAString& aAdapterRAM) override;
NS_IMETHOD GetAdapterRAM(uint32_t* aAdapterRAM) override;
NS_IMETHOD GetAdapterDriverVersion(nsAString& aAdapterDriverVersion) override;
NS_IMETHOD GetAdapterDriverDate(nsAString& aAdapterDriverDate) override;
NS_IMETHOD GetAdapterDescription2(nsAString& aAdapterDescription) override;
@ -48,7 +48,7 @@ class GfxInfo : public GfxInfoBase {
NS_IMETHOD GetAdapterVendorID2(nsAString& aAdapterVendorID) override;
NS_IMETHOD GetAdapterDeviceID2(nsAString& aAdapterDeviceID) override;
NS_IMETHOD GetAdapterSubsysID2(nsAString& aAdapterSubsysID) override;
NS_IMETHOD GetAdapterRAM2(nsAString& aAdapterRAM) override;
NS_IMETHOD GetAdapterRAM2(uint32_t* aAdapterRAM) override;
NS_IMETHOD GetAdapterDriverVersion2(
nsAString& aAdapterDriverVersion) override;
NS_IMETHOD GetAdapterDriverDate2(nsAString& aAdapterDriverDate) override;

Просмотреть файл

@ -132,7 +132,8 @@ GfxInfo::GetWindowProtocol(nsAString& aWindowProtocol) {
}
static nsresult GetKeyValue(const WCHAR* keyLocation, const WCHAR* keyName,
nsAString& destString, int type) {
uint32_t& destValue, int type) {
MOZ_ASSERT(type == REG_DWORD || type == REG_QWORD);
HKEY key;
DWORD dwcbData;
DWORD dValue;
@ -153,8 +154,7 @@ static nsresult GetKeyValue(const WCHAR* keyLocation, const WCHAR* keyName,
result = RegQueryValueExW(key, keyName, nullptr, &resultType,
(LPBYTE)&dValue, &dwcbData);
if (result == ERROR_SUCCESS && resultType == REG_DWORD) {
dValue = dValue / 1024 / 1024;
destString.AppendInt(int32_t(dValue));
destValue = (uint32_t)(dValue / 1024 / 1024);
} else {
retval = NS_ERROR_FAILURE;
}
@ -167,53 +167,70 @@ static nsresult GetKeyValue(const WCHAR* keyLocation, const WCHAR* keyName,
result = RegQueryValueExW(key, keyName, nullptr, &resultType,
(LPBYTE)&qValue, &dwcbData);
if (result == ERROR_SUCCESS && resultType == REG_QWORD) {
qValue = qValue / 1024 / 1024;
destString.AppendInt(int32_t(qValue));
destValue = (uint32_t)(qValue / 1024 / 1024);
} else {
retval = NS_ERROR_FAILURE;
}
break;
}
case REG_MULTI_SZ: {
// A chain of null-separated strings; we convert the nulls to spaces
WCHAR wCharValue[1024];
dwcbData = sizeof(wCharValue);
result = RegQueryValueExW(key, keyName, nullptr, &resultType,
(LPBYTE)wCharValue, &dwcbData);
if (result == ERROR_SUCCESS && resultType == REG_MULTI_SZ) {
// This bit here could probably be cleaner.
bool isValid = false;
DWORD strLen = dwcbData / sizeof(wCharValue[0]);
for (DWORD i = 0; i < strLen; i++) {
if (wCharValue[i] == '\0') {
if (i < strLen - 1 && wCharValue[i + 1] == '\0') {
isValid = true;
break;
} else {
wCharValue[i] = ' ';
}
}
}
// ensure wCharValue is null terminated
wCharValue[strLen - 1] = '\0';
if (isValid) destString = wCharValue;
} else {
retval = NS_ERROR_FAILURE;
}
break;
}
}
RegCloseKey(key);
return retval;
}
static nsresult GetKeyValue(const WCHAR* keyLocation, const WCHAR* keyName,
nsAString& destString, int type) {
MOZ_ASSERT(type == REG_MULTI_SZ);
HKEY key;
DWORD dwcbData;
DWORD resultType;
LONG result;
nsresult retval = NS_OK;
result =
RegOpenKeyExW(HKEY_LOCAL_MACHINE, keyLocation, 0, KEY_QUERY_VALUE, &key);
if (result != ERROR_SUCCESS) {
return NS_ERROR_FAILURE;
}
// A chain of null-separated strings; we convert the nulls to spaces
WCHAR wCharValue[1024];
dwcbData = sizeof(wCharValue);
result = RegQueryValueExW(key, keyName, nullptr, &resultType,
(LPBYTE)wCharValue, &dwcbData);
if (result == ERROR_SUCCESS && resultType == REG_MULTI_SZ) {
// This bit here could probably be cleaner.
bool isValid = false;
DWORD strLen = dwcbData / sizeof(wCharValue[0]);
for (DWORD i = 0; i < strLen; i++) {
if (wCharValue[i] == '\0') {
if (i < strLen - 1 && wCharValue[i + 1] == '\0') {
isValid = true;
break;
} else {
wCharValue[i] = ' ';
}
}
}
// ensure wCharValue is null terminated
wCharValue[strLen - 1] = '\0';
if (isValid) destString = wCharValue;
} else {
retval = NS_ERROR_FAILURE;
}
RegCloseKey(key);
return retval;
}
static nsresult GetKeyValues(const WCHAR* keyLocation, const WCHAR* keyName,
nsTArray<nsString>& destStrings) {
// First ask for the size of the value
@ -769,34 +786,38 @@ GfxInfo::GetAdapterDescription2(nsAString& aAdapterDescription) {
}
NS_IMETHODIMP
GfxInfo::GetAdapterRAM(nsAString& aAdapterRAM) {
GfxInfo::GetAdapterRAM(uint32_t* aAdapterRAM) {
uint32_t result = 0;
if (NS_FAILED(GetKeyValue(mDeviceKey[mActiveGPUIndex].get(),
L"HardwareInformation.qwMemorySize", aAdapterRAM,
L"HardwareInformation.qwMemorySize", result,
REG_QWORD)) ||
aAdapterRAM.Length() == 0) {
result == 0) {
if (NS_FAILED(GetKeyValue(mDeviceKey[mActiveGPUIndex].get(),
L"HardwareInformation.MemorySize", aAdapterRAM,
L"HardwareInformation.MemorySize", result,
REG_DWORD))) {
aAdapterRAM = L"Unknown";
result = 0;
}
}
*aAdapterRAM = result;
return NS_OK;
}
NS_IMETHODIMP
GfxInfo::GetAdapterRAM2(nsAString& aAdapterRAM) {
if (!mHasDualGPU) {
aAdapterRAM.Truncate();
} else if (NS_FAILED(GetKeyValue(mDeviceKey[1 - mActiveGPUIndex].get(),
L"HardwareInformation.qwMemorySize",
aAdapterRAM, REG_QWORD)) ||
aAdapterRAM.Length() == 0) {
GfxInfo::GetAdapterRAM2(uint32_t* aAdapterRAM) {
uint32_t result = 0;
if (mHasDualGPU) {
if (NS_FAILED(GetKeyValue(mDeviceKey[1 - mActiveGPUIndex].get(),
L"HardwareInformation.MemorySize", aAdapterRAM,
REG_DWORD))) {
aAdapterRAM = L"Unknown";
L"HardwareInformation.qwMemorySize", result,
REG_QWORD)) ||
result == 0) {
if (NS_FAILED(GetKeyValue(mDeviceKey[1 - mActiveGPUIndex].get(),
L"HardwareInformation.MemorySize", result,
REG_DWORD))) {
result = 0;
}
}
}
*aAdapterRAM = result;
return NS_OK;
}
@ -915,6 +936,22 @@ GfxInfo::GetDisplayInfo(nsTArray<nsString>& aDisplayInfo) {
return NS_OK;
}
NS_IMETHODIMP
GfxInfo::GetDisplayWidth(nsTArray<uint32_t>& aDisplayWidth) {
for (auto displayInfo : mDisplayInfo) {
aDisplayWidth.AppendElement((uint32_t)displayInfo.mScreenWidth);
}
return NS_OK;
}
NS_IMETHODIMP
GfxInfo::GetDisplayHeight(nsTArray<uint32_t>& aDisplayHeight) {
for (auto displayInfo : mDisplayInfo) {
aDisplayHeight.AppendElement((uint32_t)displayInfo.mScreenHeight);
}
return NS_OK;
}
/* Cisco's VPN software can cause corruption of the floating point state.
* Make a note of this in our crash reports so that some weird crashes
* make more sense */

Просмотреть файл

@ -31,7 +31,7 @@ class GfxInfo : public GfxInfoBase {
NS_IMETHOD GetAdapterVendorID(nsAString& aAdapterVendorID) override;
NS_IMETHOD GetAdapterDeviceID(nsAString& aAdapterDeviceID) override;
NS_IMETHOD GetAdapterSubsysID(nsAString& aAdapterSubsysID) override;
NS_IMETHOD GetAdapterRAM(nsAString& aAdapterRAM) override;
NS_IMETHOD GetAdapterRAM(uint32_t* aAdapterRAM) override;
NS_IMETHOD GetAdapterDriverVendor(nsAString& aAdapterDriverVendor) override;
NS_IMETHOD GetAdapterDriverVersion(nsAString& aAdapterDriverVersion) override;
NS_IMETHOD GetAdapterDriverDate(nsAString& aAdapterDriverDate) override;
@ -40,13 +40,15 @@ class GfxInfo : public GfxInfoBase {
NS_IMETHOD GetAdapterVendorID2(nsAString& aAdapterVendorID) override;
NS_IMETHOD GetAdapterDeviceID2(nsAString& aAdapterDeviceID) override;
NS_IMETHOD GetAdapterSubsysID2(nsAString& aAdapterSubsysID) override;
NS_IMETHOD GetAdapterRAM2(nsAString& aAdapterRAM) override;
NS_IMETHOD GetAdapterRAM2(uint32_t* aAdapterRAM) override;
NS_IMETHOD GetAdapterDriverVendor2(nsAString& aAdapterDriverVendor) override;
NS_IMETHOD GetAdapterDriverVersion2(
nsAString& aAdapterDriverVersion) override;
NS_IMETHOD GetAdapterDriverDate2(nsAString& aAdapterDriverDate) override;
NS_IMETHOD GetIsGPU2Active(bool* aIsGPU2Active) override;
NS_IMETHOD GetDisplayInfo(nsTArray<nsString>& aDisplayInfo) override;
NS_IMETHOD GetDisplayWidth(nsTArray<uint32_t>& aDisplayWidth) override;
NS_IMETHOD GetDisplayHeight(nsTArray<uint32_t>& aDisplayHeight) override;
using GfxInfoBase::GetFeatureStatus;
using GfxInfoBase::GetFeatureSuggestedDriverVersion;