Bug 1514840 - Add telemetry scalar for DXGI_COLOR_SPACE. r=jrmuizel

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ryan Hunt 2019-01-28 16:56:03 +00:00
Родитель ff4a3ea0b8
Коммит bf27296612
5 изменённых файлов: 72 добавлений и 0 удалений

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

@ -137,6 +137,37 @@ void DeviceManagerDx::ReleaseD3D11() {
sD3D11CreateDeviceFn = nullptr; sD3D11CreateDeviceFn = nullptr;
} }
nsTArray<DXGI_OUTPUT_DESC1> DeviceManagerDx::EnumerateOutputs() {
RefPtr<IDXGIAdapter> adapter = GetDXGIAdapter();
if (!adapter) {
NS_WARNING("Failed to acquire a DXGI adapter for enumerating outputs.");
return nsTArray<DXGI_OUTPUT_DESC1>();
}
nsTArray<DXGI_OUTPUT_DESC1> outputs;
for (UINT i = 0;; ++i) {
RefPtr<IDXGIOutput> output = nullptr;
if (FAILED(adapter->EnumOutputs(i, getter_AddRefs(output)))) {
break;
}
RefPtr<IDXGIOutput6> output6 = nullptr;
if (FAILED(output->QueryInterface(__uuidof(IDXGIOutput6),
getter_AddRefs(output6)))) {
break;
}
DXGI_OUTPUT_DESC1 desc;
if (FAILED(output6->GetDesc1(&desc))) {
break;
}
outputs.AppendElement(desc);
}
return outputs;
}
static inline bool ProcessOwnsCompositor() { static inline bool ProcessOwnsCompositor() {
return XRE_GetProcessType() == GeckoProcessType_GPU || return XRE_GetProcessType() == GeckoProcessType_GPU ||
XRE_GetProcessType() == GeckoProcessType_VR || XRE_GetProcessType() == GeckoProcessType_VR ||

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

@ -20,6 +20,7 @@
#include <objbase.h> #include <objbase.h>
#include <dxgi.h> #include <dxgi.h>
#include <dxgi1_6.h>
// This header is available in the June 2010 SDK and in the Win8 SDK // This header is available in the June 2010 SDK and in the Win8 SDK
#include <d3dcommon.h> #include <d3dcommon.h>
@ -81,6 +82,9 @@ class DeviceManagerDx final {
// stability issues when supplying InitData to CreateTexture2D. // stability issues when supplying InitData to CreateTexture2D.
bool HasCrashyInitData(); bool HasCrashyInitData();
// Enumerate and return all outputs on the current adapter.
nsTArray<DXGI_OUTPUT_DESC1> EnumerateOutputs();
bool CreateCompositorDevices(); bool CreateCompositorDevices();
void CreateContentDevices(); void CreateContentDevices();
void CreateDirectCompositionDevice(); void CreateDirectCompositionDevice();

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

@ -439,6 +439,8 @@ void gfxWindowsPlatform::InitAcceleration() {
// CanUseHardwareVideoDecoding depends on DeviceManagerDx state, // CanUseHardwareVideoDecoding depends on DeviceManagerDx state,
// so update the cached value now. // so update the cached value now.
UpdateCanUseHardwareVideoDecoding(); UpdateCanUseHardwareVideoDecoding();
RecordStartupTelemetry();
} }
void gfxWindowsPlatform::InitWebRenderConfig() { void gfxWindowsPlatform::InitWebRenderConfig() {
@ -1472,6 +1474,21 @@ void gfxWindowsPlatform::InitializeD3D11Config() {
uint32_t(aDevice)); uint32_t(aDevice));
} }
void gfxWindowsPlatform::RecordStartupTelemetry() {
DeviceManagerDx* dx = DeviceManagerDx::Get();
nsTArray<DXGI_OUTPUT_DESC1> outputs = dx->EnumerateOutputs();
uint32_t allSupportedColorSpaces = 0;
for (auto& output : outputs) {
uint32_t colorSpace = 1 << output.ColorSpace;
allSupportedColorSpaces |= colorSpace;
}
Telemetry::ScalarSet(
Telemetry::ScalarID::GFX_HDR_WINDOWS_DISPLAY_COLORSPACE_BITFIELD,
allSupportedColorSpaces);
}
// Supports lazy device initialization on Windows, so that WebRender can avoid // Supports lazy device initialization on Windows, so that WebRender can avoid
// initializing GPU state and allocating swap chains for most non-GPU processes. // initializing GPU state and allocating swap chains for most non-GPU processes.
void gfxWindowsPlatform::EnsureDevicesInitialized() { void gfxWindowsPlatform::EnsureDevicesInitialized() {

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

@ -258,6 +258,8 @@ class gfxWindowsPlatform : public gfxPlatform {
void InitializeDirectDrawConfig(); void InitializeDirectDrawConfig();
void InitializeAdvancedLayersConfig(); void InitializeAdvancedLayersConfig();
void RecordStartupTelemetry();
RefPtr<IDWriteRenderingParams> mRenderingParams[TEXT_RENDERING_COUNT]; RefPtr<IDWriteRenderingParams> mRenderingParams[TEXT_RENDERING_COUNT];
DWRITE_MEASURING_MODE mMeasuringMode; DWRITE_MEASURING_MODE mMeasuringMode;

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

@ -1904,6 +1904,24 @@ gfx.omtp:
record_in_processes: record_in_processes:
- 'content' - 'content'
gfx.hdr:
windows_display_colorspace_bitfield:
bug_numbers:
- 1514840
description: >
A bitfield representation of the available DXGI color spaces of the connected displays on Windows.
See (https://docs.microsoft.com/en-us/windows/desktop/api/dxgicommon/ne-dxgicommon-dxgi_color_space_type)
for definitions of color spaces. Each N'th bit of this scalar indicates whether the DXGI color space with
index 'N' is available on at least one connected monitor.
keyed: false
kind: uint
expires: "70"
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- rhunt@mozilla.com
record_in_processes:
- 'main'
# The following section contains the form autofill related scalars. # The following section contains the form autofill related scalars.
formautofill: formautofill:
availability: availability: