forked from mirrors/gecko-dev
Bug 1843225 - Remove checks from gfxWindowsPlatform which are not needed on Windows 10+ r=emk,gfx-reviewers,nical
Differential Revision: https://phabricator.services.mozilla.com/D183464
This commit is contained in:
parent
6941e534d8
commit
48c65d766c
6 changed files with 26 additions and 144 deletions
|
|
@ -928,9 +928,6 @@ void CompositorD3D11::EndFrame() {
|
||||||
|
|
||||||
if (oldSize == mSize) {
|
if (oldSize == mSize) {
|
||||||
Present();
|
Present();
|
||||||
if (StaticPrefs::gfx_compositor_clearstate()) {
|
|
||||||
mContext->ClearState();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Block until the previous frame's work has been completed.
|
// Block until the previous frame's work has been completed.
|
||||||
|
|
|
||||||
|
|
@ -1282,19 +1282,6 @@ bool DeviceManagerDx::HasCrashyInitData() {
|
||||||
return (mDeviceStatus->adapter().VendorId == 0x8086 && !IsWin10OrLater());
|
return (mDeviceStatus->adapter().VendorId == 0x8086 && !IsWin10OrLater());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeviceManagerDx::CheckRemotePresentSupport() {
|
|
||||||
MOZ_ASSERT(XRE_IsParentProcess());
|
|
||||||
|
|
||||||
RefPtr<IDXGIAdapter1> adapter = GetDXGIAdapter();
|
|
||||||
if (!adapter) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!D3D11Checks::DoesRemotePresentWork(adapter)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DeviceManagerDx::IsWARP() {
|
bool DeviceManagerDx::IsWARP() {
|
||||||
MutexAutoLock lock(mDeviceLock);
|
MutexAutoLock lock(mDeviceLock);
|
||||||
if (!mDeviceStatus) {
|
if (!mDeviceStatus) {
|
||||||
|
|
|
||||||
|
|
@ -119,10 +119,6 @@ class DeviceManagerDx final {
|
||||||
// was successful.
|
// was successful.
|
||||||
bool MaybeResetAndReacquireDevices();
|
bool MaybeResetAndReacquireDevices();
|
||||||
|
|
||||||
// Test whether we can acquire a DXGI 1.2-compatible adapter. This should
|
|
||||||
// only be called on startup before devices are initialized.
|
|
||||||
bool CheckRemotePresentSupport();
|
|
||||||
|
|
||||||
// Device reset helpers.
|
// Device reset helpers.
|
||||||
bool HasDeviceReset(DeviceResetReason* aOutReason = nullptr);
|
bool HasDeviceReset(DeviceResetReason* aOutReason = nullptr);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,20 +55,7 @@ typedef struct _D3DKMTQS_ADAPTER_INFO {
|
||||||
ULONG64 Reserved[8];
|
ULONG64 Reserved[8];
|
||||||
} D3DKMTQS_ADAPTER_INFO;
|
} D3DKMTQS_ADAPTER_INFO;
|
||||||
|
|
||||||
typedef struct _D3DKMTQS_SEGMENT_INFO_WIN7 {
|
typedef struct _D3DKMTQS_SEGMENT_INFO {
|
||||||
ULONG Filler[3];
|
|
||||||
struct {
|
|
||||||
ULONGLONG Filler;
|
|
||||||
ULONG Filler2[2];
|
|
||||||
} Filler_M;
|
|
||||||
|
|
||||||
ULONG Aperture;
|
|
||||||
|
|
||||||
ULONGLONG Filler3[5];
|
|
||||||
ULONG64 Filler4[8];
|
|
||||||
} D3DKMTQS_SEGMENT_INFO_WIN7;
|
|
||||||
|
|
||||||
typedef struct _D3DKMTQS_SEGMENT_INFO_WIN8 {
|
|
||||||
ULONGLONG Filler[3];
|
ULONGLONG Filler[3];
|
||||||
struct {
|
struct {
|
||||||
ULONGLONG Filler;
|
ULONGLONG Filler;
|
||||||
|
|
@ -79,7 +66,7 @@ typedef struct _D3DKMTQS_SEGMENT_INFO_WIN8 {
|
||||||
|
|
||||||
ULONGLONG Filler3[5];
|
ULONGLONG Filler3[5];
|
||||||
ULONG64 Filler4[8];
|
ULONG64 Filler4[8];
|
||||||
} D3DKMTQS_SEGMENT_INFO_WIN8;
|
} D3DKMTQS_SEGMENT_INFO;
|
||||||
|
|
||||||
typedef struct _D3DKMTQS_SYSTEM_MEMORY {
|
typedef struct _D3DKMTQS_SYSTEM_MEMORY {
|
||||||
ULONGLONG BytesAllocated;
|
ULONGLONG BytesAllocated;
|
||||||
|
|
@ -99,16 +86,7 @@ typedef struct _D3DKMTQS_PROCESS_INFO {
|
||||||
} D3DKMTQS_PROCESS_INFO;
|
} D3DKMTQS_PROCESS_INFO;
|
||||||
|
|
||||||
typedef struct _D3DKMTQS_PROCESS_SEGMENT_INFO {
|
typedef struct _D3DKMTQS_PROCESS_SEGMENT_INFO {
|
||||||
union {
|
ULONGLONG BytesCommitted;
|
||||||
struct {
|
|
||||||
ULONGLONG BytesCommitted;
|
|
||||||
} Win8;
|
|
||||||
struct {
|
|
||||||
ULONG BytesCommitted;
|
|
||||||
ULONG UnknownRandomness;
|
|
||||||
} Win7;
|
|
||||||
};
|
|
||||||
|
|
||||||
ULONGLONG Filler[2];
|
ULONGLONG Filler[2];
|
||||||
ULONG Filler2;
|
ULONG Filler2;
|
||||||
struct {
|
struct {
|
||||||
|
|
@ -140,8 +118,7 @@ typedef enum _D3DKMTQS_TYPE {
|
||||||
|
|
||||||
typedef union _D3DKMTQS_RESULT {
|
typedef union _D3DKMTQS_RESULT {
|
||||||
D3DKMTQS_ADAPTER_INFO AdapterInfo;
|
D3DKMTQS_ADAPTER_INFO AdapterInfo;
|
||||||
D3DKMTQS_SEGMENT_INFO_WIN7 SegmentInfoWin7;
|
D3DKMTQS_SEGMENT_INFO SegmentInfo;
|
||||||
D3DKMTQS_SEGMENT_INFO_WIN8 SegmentInfoWin8;
|
|
||||||
D3DKMTQS_PROCESS_INFO ProcessInfo;
|
D3DKMTQS_PROCESS_INFO ProcessInfo;
|
||||||
D3DKMTQS_PROCESS_SEGMENT_INFO ProcessSegmentInfo;
|
D3DKMTQS_PROCESS_SEGMENT_INFO ProcessSegmentInfo;
|
||||||
D3DKMTQS_PROCESS_NODE_INFO ProcessNodeInformation;
|
D3DKMTQS_PROCESS_NODE_INFO ProcessNodeInformation;
|
||||||
|
|
|
||||||
|
|
@ -190,28 +190,15 @@ class GPUAdapterReporter final : public nsIMemoryReporter {
|
||||||
queryStatistics.QuerySegment.SegmentId = i;
|
queryStatistics.QuerySegment.SegmentId = i;
|
||||||
|
|
||||||
if (NT_SUCCESS(queryD3DKMTStatistics(&queryStatistics))) {
|
if (NT_SUCCESS(queryD3DKMTStatistics(&queryStatistics))) {
|
||||||
bool aperture;
|
bool aperture = queryStatistics.QueryResult.SegmentInfo.Aperture;
|
||||||
|
|
||||||
// SegmentInformation has a different definition in Win7 than later
|
|
||||||
// versions
|
|
||||||
if (!IsWin8OrLater())
|
|
||||||
aperture = queryStatistics.QueryResult.SegmentInfoWin7.Aperture;
|
|
||||||
else
|
|
||||||
aperture = queryStatistics.QueryResult.SegmentInfoWin8.Aperture;
|
|
||||||
|
|
||||||
memset(&queryStatistics, 0, sizeof(D3DKMTQS));
|
memset(&queryStatistics, 0, sizeof(D3DKMTQS));
|
||||||
queryStatistics.Type = D3DKMTQS_PROCESS_SEGMENT;
|
queryStatistics.Type = D3DKMTQS_PROCESS_SEGMENT;
|
||||||
queryStatistics.AdapterLuid = adapterDesc.AdapterLuid;
|
queryStatistics.AdapterLuid = adapterDesc.AdapterLuid;
|
||||||
queryStatistics.hProcess = ProcessHandle;
|
queryStatistics.hProcess = ProcessHandle;
|
||||||
queryStatistics.QueryProcessSegment.SegmentId = i;
|
queryStatistics.QueryProcessSegment.SegmentId = i;
|
||||||
if (NT_SUCCESS(queryD3DKMTStatistics(&queryStatistics))) {
|
if (NT_SUCCESS(queryD3DKMTStatistics(&queryStatistics))) {
|
||||||
ULONGLONG bytesCommitted;
|
ULONGLONG bytesCommitted =
|
||||||
if (!IsWin8OrLater())
|
queryStatistics.QueryResult.ProcessSegmentInfo.BytesCommitted;
|
||||||
bytesCommitted = queryStatistics.QueryResult.ProcessSegmentInfo
|
|
||||||
.Win7.BytesCommitted;
|
|
||||||
else
|
|
||||||
bytesCommitted = queryStatistics.QueryResult.ProcessSegmentInfo
|
|
||||||
.Win8.BytesCommitted;
|
|
||||||
if (aperture)
|
if (aperture)
|
||||||
sharedBytesUsed += bytesCommitted;
|
sharedBytesUsed += bytesCommitted;
|
||||||
else
|
else
|
||||||
|
|
@ -652,12 +639,11 @@ mozilla::gfx::BackendType gfxWindowsPlatform::GetPreferredCanvasBackend() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool gfxWindowsPlatform::CreatePlatformFontList() {
|
bool gfxWindowsPlatform::CreatePlatformFontList() {
|
||||||
// bug 630201 - older pre-RTM versions of Direct2D/DirectWrite cause odd
|
if (DWriteEnabled()) {
|
||||||
// crashers so block them altogether
|
|
||||||
if (IsNotWin7PreRTM() && DWriteEnabled()) {
|
|
||||||
if (gfxPlatformFontList::Initialize(new gfxDWriteFontList)) {
|
if (gfxPlatformFontList::Initialize(new gfxDWriteFontList)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// DWrite font initialization failed! Don't know why this would happen,
|
// DWrite font initialization failed! Don't know why this would happen,
|
||||||
// but apparently it can - see bug 594865.
|
// but apparently it can - see bug 594865.
|
||||||
// So we're going to fall back to GDI fonts & rendering.
|
// So we're going to fall back to GDI fonts & rendering.
|
||||||
|
|
@ -1199,17 +1185,7 @@ bool gfxWindowsPlatform::IsOptimus() {
|
||||||
}
|
}
|
||||||
return knowIsOptimus;
|
return knowIsOptimus;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
static inline bool
|
|
||||||
IsWARPStable()
|
|
||||||
{
|
|
||||||
// It seems like nvdxgiwrap makes a mess of WARP. See bug 1154703.
|
|
||||||
if (!IsWin8OrLater() || GetModuleHandleA("nvdxgiwrap.dll")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
static void InitializeANGLEConfig() {
|
static void InitializeANGLEConfig() {
|
||||||
FeatureState& d3d11ANGLE = gfxConfig::GetFeature(Feature::D3D11_HW_ANGLE);
|
FeatureState& d3d11ANGLE = gfxConfig::GetFeature(Feature::D3D11_HW_ANGLE);
|
||||||
|
|
||||||
|
|
@ -1270,26 +1246,6 @@ void gfxWindowsPlatform::InitializeD3D11Config() {
|
||||||
d3d11.UserForceEnable("User force-enabled WARP");
|
d3d11.UserForceEnable("User force-enabled WARP");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsWin8OrLater() &&
|
|
||||||
!DeviceManagerDx::Get()->CheckRemotePresentSupport()) {
|
|
||||||
nsCOMPtr<nsIGfxInfo> gfxInfo;
|
|
||||||
gfxInfo = components::GfxInfo::Service();
|
|
||||||
nsAutoString adaptorId;
|
|
||||||
gfxInfo->GetAdapterDeviceID(adaptorId);
|
|
||||||
// Blocklist Intel HD Graphics 510/520/530 on Windows 7 without platform
|
|
||||||
// update due to the crashes in Bug 1351349.
|
|
||||||
if (adaptorId.EqualsLiteral("0x1912") ||
|
|
||||||
adaptorId.EqualsLiteral("0x1916") ||
|
|
||||||
adaptorId.EqualsLiteral("0x1902")) {
|
|
||||||
#ifdef RELEASE_OR_BETA
|
|
||||||
d3d11.Disable(FeatureStatus::Blocklisted, "Blocklisted, see bug 1351349",
|
|
||||||
"FEATURE_FAILURE_BUG_1351349"_ns);
|
|
||||||
#else
|
|
||||||
Preferences::SetBool("gfx.compositor.clearstate", true);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCString message;
|
nsCString message;
|
||||||
nsCString failureId;
|
nsCString failureId;
|
||||||
if (StaticPrefs::layers_d3d11_enable_blacklist_AtStartup() &&
|
if (StaticPrefs::layers_d3d11_enable_blacklist_AtStartup() &&
|
||||||
|
|
@ -1528,26 +1484,7 @@ void gfxWindowsPlatform::InitGPUProcessSupport() {
|
||||||
gpuProc.Disable(FeatureStatus::Unavailable,
|
gpuProc.Disable(FeatureStatus::Unavailable,
|
||||||
"Not using GPU Process since D3D11 is unavailable",
|
"Not using GPU Process since D3D11 is unavailable",
|
||||||
"FEATURE_FAILURE_NO_D3D11"_ns);
|
"FEATURE_FAILURE_NO_D3D11"_ns);
|
||||||
} else if (!IsWin7SP1OrLater()) {
|
|
||||||
// On Windows 7 Pre-SP1, DXGI 1.2 is not available and remote presentation
|
|
||||||
// for D3D11 will not work. Rather than take a regression we revert back
|
|
||||||
// to in-process rendering.
|
|
||||||
gpuProc.Disable(FeatureStatus::Unavailable,
|
|
||||||
"Windows 7 Pre-SP1 cannot use the GPU process",
|
|
||||||
"FEATURE_FAILURE_OLD_WINDOWS"_ns);
|
|
||||||
} else if (!IsWin8OrLater()) {
|
|
||||||
// Windows 7 SP1 can have DXGI 1.2 only via the Platform Update, so we
|
|
||||||
// explicitly check for that here.
|
|
||||||
if (!DeviceManagerDx::Get()->CheckRemotePresentSupport()) {
|
|
||||||
gpuProc.Disable(FeatureStatus::Unavailable,
|
|
||||||
"GPU Process requires the Windows 7 Platform Update",
|
|
||||||
"FEATURE_FAILURE_PLATFORM_UPDATE"_ns);
|
|
||||||
} else {
|
|
||||||
// Clear anything cached by the above call since we don't need it.
|
|
||||||
DeviceManagerDx::Get()->ResetDevices();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're still enabled at this point, the user set the force-enabled pref.
|
// If we're still enabled at this point, the user set the force-enabled pref.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1562,14 +1499,11 @@ class D3DVsyncSource final : public VsyncSource {
|
||||||
D3DVsyncSource()
|
D3DVsyncSource()
|
||||||
: mPrevVsync(TimeStamp::Now()),
|
: mPrevVsync(TimeStamp::Now()),
|
||||||
mVsyncEnabled(false),
|
mVsyncEnabled(false),
|
||||||
mWaitVBlankMonitor(NULL),
|
mWaitVBlankMonitor(NULL) {
|
||||||
mIsWindows8OrLater(false) {
|
|
||||||
mVsyncThread = new base::Thread("WindowsVsyncThread");
|
mVsyncThread = new base::Thread("WindowsVsyncThread");
|
||||||
MOZ_RELEASE_ASSERT(mVsyncThread->Start(),
|
MOZ_RELEASE_ASSERT(mVsyncThread->Start(),
|
||||||
"GFX: Could not start Windows vsync thread");
|
"GFX: Could not start Windows vsync thread");
|
||||||
SetVsyncRate();
|
SetVsyncRate();
|
||||||
|
|
||||||
mIsWindows8OrLater = IsWin8OrLater();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetVsyncRate() {
|
void SetVsyncRate() {
|
||||||
|
|
@ -1674,22 +1608,20 @@ class D3DVsyncSource final : public VsyncSource {
|
||||||
int64_t usAdjust = (adjust * microseconds) / frequency.QuadPart;
|
int64_t usAdjust = (adjust * microseconds) / frequency.QuadPart;
|
||||||
vsync -= TimeDuration::FromMicroseconds((double)usAdjust);
|
vsync -= TimeDuration::FromMicroseconds((double)usAdjust);
|
||||||
|
|
||||||
if (IsWin10OrLater()) {
|
// On Windows 10 and on, DWMGetCompositionTimingInfo, mostly
|
||||||
// On Windows 10 and on, DWMGetCompositionTimingInfo, mostly
|
// reports the upcoming vsync time, which is in the future.
|
||||||
// reports the upcoming vsync time, which is in the future.
|
// It can also sometimes report a vblank time in the past.
|
||||||
// It can also sometimes report a vblank time in the past.
|
// Since large parts of Gecko assume TimeStamps can't be in future,
|
||||||
// Since large parts of Gecko assume TimeStamps can't be in future,
|
// use the previous vsync.
|
||||||
// use the previous vsync.
|
|
||||||
|
|
||||||
// Windows 10 and Intel HD vsync timestamps are messy and
|
// Windows 10 and Intel HD vsync timestamps are messy and
|
||||||
// all over the place once in a while. Most of the time,
|
// all over the place once in a while. Most of the time,
|
||||||
// it reports the upcoming vsync. Sometimes, that upcoming
|
// it reports the upcoming vsync. Sometimes, that upcoming
|
||||||
// vsync is in the past. Sometimes that upcoming vsync is before
|
// vsync is in the past. Sometimes that upcoming vsync is before
|
||||||
// the previously seen vsync.
|
// the previously seen vsync.
|
||||||
// In these error cases, normalize to Now();
|
// In these error cases, normalize to Now();
|
||||||
if (vsync >= now) {
|
if (vsync >= now) {
|
||||||
vsync = vsync - mVsyncRate;
|
vsync = vsync - mVsyncRate;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// On Windows 7 and 8, DwmFlush wakes up AFTER qpcVBlankTime
|
// On Windows 7 and 8, DwmFlush wakes up AFTER qpcVBlankTime
|
||||||
|
|
@ -1700,7 +1632,7 @@ class D3DVsyncSource final : public VsyncSource {
|
||||||
|
|
||||||
// Our vsync time is some time very far in the past, adjust to Now.
|
// Our vsync time is some time very far in the past, adjust to Now.
|
||||||
// 4 ms is arbitrary, so feel free to pick something else if this isn't
|
// 4 ms is arbitrary, so feel free to pick something else if this isn't
|
||||||
// working. See the comment above within IsWin10OrLater().
|
// working. See the comment above.
|
||||||
if ((now - vsync).ToMilliseconds() > 4.0) {
|
if ((now - vsync).ToMilliseconds() > 4.0) {
|
||||||
vsync = now;
|
vsync = now;
|
||||||
}
|
}
|
||||||
|
|
@ -1737,8 +1669,7 @@ class D3DVsyncSource final : public VsyncSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT hr = E_FAIL;
|
HRESULT hr = E_FAIL;
|
||||||
if (mIsWindows8OrLater &&
|
if (!StaticPrefs::gfx_vsync_force_disable_waitforvblank()) {
|
||||||
!StaticPrefs::gfx_vsync_force_disable_waitforvblank()) {
|
|
||||||
UpdateVBlankOutput();
|
UpdateVBlankOutput();
|
||||||
if (mWaitVBlankOutput) {
|
if (mWaitVBlankOutput) {
|
||||||
const TimeStamp vblank_begin_wait = TimeStamp::Now();
|
const TimeStamp vblank_begin_wait = TimeStamp::Now();
|
||||||
|
|
@ -1835,7 +1766,6 @@ class D3DVsyncSource final : public VsyncSource {
|
||||||
|
|
||||||
HMONITOR mWaitVBlankMonitor;
|
HMONITOR mWaitVBlankMonitor;
|
||||||
RefPtr<IDXGIOutput> mWaitVBlankOutput;
|
RefPtr<IDXGIOutput> mWaitVBlankOutput;
|
||||||
bool mIsWindows8OrLater;
|
|
||||||
}; // D3DVsyncSource
|
}; // D3DVsyncSource
|
||||||
|
|
||||||
already_AddRefed<mozilla::gfx::VsyncSource>
|
already_AddRefed<mozilla::gfx::VsyncSource>
|
||||||
|
|
|
||||||
|
|
@ -5801,11 +5801,6 @@
|
||||||
value: true # Match naive behavior, but hopefully we can stop soon!
|
value: true # Match naive behavior, but hopefully we can stop soon!
|
||||||
mirror: always
|
mirror: always
|
||||||
|
|
||||||
- name: gfx.compositor.clearstate
|
|
||||||
type: RelaxedAtomicBool
|
|
||||||
value: false
|
|
||||||
mirror: always
|
|
||||||
|
|
||||||
# Whether GL contexts can be migrated to a different GPU (to match the one the
|
# Whether GL contexts can be migrated to a different GPU (to match the one the
|
||||||
# OS is using for composition).
|
# OS is using for composition).
|
||||||
#
|
#
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue