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:
Gregory Pappas 2023-08-07 14:22:30 +00:00
parent 6941e534d8
commit 48c65d766c
6 changed files with 26 additions and 144 deletions

View File

@ -928,9 +928,6 @@ void CompositorD3D11::EndFrame() {
if (oldSize == mSize) {
Present();
if (StaticPrefs::gfx_compositor_clearstate()) {
mContext->ClearState();
}
}
// Block until the previous frame's work has been completed.

View File

@ -1282,19 +1282,6 @@ bool DeviceManagerDx::HasCrashyInitData() {
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() {
MutexAutoLock lock(mDeviceLock);
if (!mDeviceStatus) {

View File

@ -119,10 +119,6 @@ class DeviceManagerDx final {
// was successful.
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.
bool HasDeviceReset(DeviceResetReason* aOutReason = nullptr);

View File

@ -55,20 +55,7 @@ typedef struct _D3DKMTQS_ADAPTER_INFO {
ULONG64 Reserved[8];
} D3DKMTQS_ADAPTER_INFO;
typedef struct _D3DKMTQS_SEGMENT_INFO_WIN7 {
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 {
typedef struct _D3DKMTQS_SEGMENT_INFO {
ULONGLONG Filler[3];
struct {
ULONGLONG Filler;
@ -79,7 +66,7 @@ typedef struct _D3DKMTQS_SEGMENT_INFO_WIN8 {
ULONGLONG Filler3[5];
ULONG64 Filler4[8];
} D3DKMTQS_SEGMENT_INFO_WIN8;
} D3DKMTQS_SEGMENT_INFO;
typedef struct _D3DKMTQS_SYSTEM_MEMORY {
ULONGLONG BytesAllocated;
@ -99,16 +86,7 @@ typedef struct _D3DKMTQS_PROCESS_INFO {
} D3DKMTQS_PROCESS_INFO;
typedef struct _D3DKMTQS_PROCESS_SEGMENT_INFO {
union {
struct {
ULONGLONG BytesCommitted;
} Win8;
struct {
ULONG BytesCommitted;
ULONG UnknownRandomness;
} Win7;
};
ULONGLONG BytesCommitted;
ULONGLONG Filler[2];
ULONG Filler2;
struct {
@ -140,8 +118,7 @@ typedef enum _D3DKMTQS_TYPE {
typedef union _D3DKMTQS_RESULT {
D3DKMTQS_ADAPTER_INFO AdapterInfo;
D3DKMTQS_SEGMENT_INFO_WIN7 SegmentInfoWin7;
D3DKMTQS_SEGMENT_INFO_WIN8 SegmentInfoWin8;
D3DKMTQS_SEGMENT_INFO SegmentInfo;
D3DKMTQS_PROCESS_INFO ProcessInfo;
D3DKMTQS_PROCESS_SEGMENT_INFO ProcessSegmentInfo;
D3DKMTQS_PROCESS_NODE_INFO ProcessNodeInformation;

View File

@ -190,28 +190,15 @@ class GPUAdapterReporter final : public nsIMemoryReporter {
queryStatistics.QuerySegment.SegmentId = i;
if (NT_SUCCESS(queryD3DKMTStatistics(&queryStatistics))) {
bool aperture;
// SegmentInformation has a different definition in Win7 than later
// versions
if (!IsWin8OrLater())
aperture = queryStatistics.QueryResult.SegmentInfoWin7.Aperture;
else
aperture = queryStatistics.QueryResult.SegmentInfoWin8.Aperture;
bool aperture = queryStatistics.QueryResult.SegmentInfo.Aperture;
memset(&queryStatistics, 0, sizeof(D3DKMTQS));
queryStatistics.Type = D3DKMTQS_PROCESS_SEGMENT;
queryStatistics.AdapterLuid = adapterDesc.AdapterLuid;
queryStatistics.hProcess = ProcessHandle;
queryStatistics.QueryProcessSegment.SegmentId = i;
if (NT_SUCCESS(queryD3DKMTStatistics(&queryStatistics))) {
ULONGLONG bytesCommitted;
if (!IsWin8OrLater())
bytesCommitted = queryStatistics.QueryResult.ProcessSegmentInfo
.Win7.BytesCommitted;
else
bytesCommitted = queryStatistics.QueryResult.ProcessSegmentInfo
.Win8.BytesCommitted;
ULONGLONG bytesCommitted =
queryStatistics.QueryResult.ProcessSegmentInfo.BytesCommitted;
if (aperture)
sharedBytesUsed += bytesCommitted;
else
@ -652,12 +639,11 @@ mozilla::gfx::BackendType gfxWindowsPlatform::GetPreferredCanvasBackend() {
}
bool gfxWindowsPlatform::CreatePlatformFontList() {
// bug 630201 - older pre-RTM versions of Direct2D/DirectWrite cause odd
// crashers so block them altogether
if (IsNotWin7PreRTM() && DWriteEnabled()) {
if (DWriteEnabled()) {
if (gfxPlatformFontList::Initialize(new gfxDWriteFontList)) {
return true;
}
// DWrite font initialization failed! Don't know why this would happen,
// but apparently it can - see bug 594865.
// So we're going to fall back to GDI fonts & rendering.
@ -1199,17 +1185,7 @@ bool gfxWindowsPlatform::IsOptimus() {
}
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() {
FeatureState& d3d11ANGLE = gfxConfig::GetFeature(Feature::D3D11_HW_ANGLE);
@ -1270,26 +1246,6 @@ void gfxWindowsPlatform::InitializeD3D11Config() {
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 failureId;
if (StaticPrefs::layers_d3d11_enable_blacklist_AtStartup() &&
@ -1528,26 +1484,7 @@ void gfxWindowsPlatform::InitGPUProcessSupport() {
gpuProc.Disable(FeatureStatus::Unavailable,
"Not using GPU Process since D3D11 is unavailable",
"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.
}
@ -1562,14 +1499,11 @@ class D3DVsyncSource final : public VsyncSource {
D3DVsyncSource()
: mPrevVsync(TimeStamp::Now()),
mVsyncEnabled(false),
mWaitVBlankMonitor(NULL),
mIsWindows8OrLater(false) {
mWaitVBlankMonitor(NULL) {
mVsyncThread = new base::Thread("WindowsVsyncThread");
MOZ_RELEASE_ASSERT(mVsyncThread->Start(),
"GFX: Could not start Windows vsync thread");
SetVsyncRate();
mIsWindows8OrLater = IsWin8OrLater();
}
void SetVsyncRate() {
@ -1674,22 +1608,20 @@ class D3DVsyncSource final : public VsyncSource {
int64_t usAdjust = (adjust * microseconds) / frequency.QuadPart;
vsync -= TimeDuration::FromMicroseconds((double)usAdjust);
if (IsWin10OrLater()) {
// On Windows 10 and on, DWMGetCompositionTimingInfo, mostly
// reports the upcoming vsync time, which is in the future.
// It can also sometimes report a vblank time in the past.
// Since large parts of Gecko assume TimeStamps can't be in future,
// use the previous vsync.
// On Windows 10 and on, DWMGetCompositionTimingInfo, mostly
// reports the upcoming vsync time, which is in the future.
// It can also sometimes report a vblank time in the past.
// Since large parts of Gecko assume TimeStamps can't be in future,
// use the previous vsync.
// Windows 10 and Intel HD vsync timestamps are messy and
// all over the place once in a while. Most of the time,
// it reports the upcoming vsync. Sometimes, that upcoming
// vsync is in the past. Sometimes that upcoming vsync is before
// the previously seen vsync.
// In these error cases, normalize to Now();
if (vsync >= now) {
vsync = vsync - mVsyncRate;
}
// Windows 10 and Intel HD vsync timestamps are messy and
// all over the place once in a while. Most of the time,
// it reports the upcoming vsync. Sometimes, that upcoming
// vsync is in the past. Sometimes that upcoming vsync is before
// the previously seen vsync.
// In these error cases, normalize to Now();
if (vsync >= now) {
vsync = vsync - mVsyncRate;
}
// 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.
// 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) {
vsync = now;
}
@ -1737,8 +1669,7 @@ class D3DVsyncSource final : public VsyncSource {
}
HRESULT hr = E_FAIL;
if (mIsWindows8OrLater &&
!StaticPrefs::gfx_vsync_force_disable_waitforvblank()) {
if (!StaticPrefs::gfx_vsync_force_disable_waitforvblank()) {
UpdateVBlankOutput();
if (mWaitVBlankOutput) {
const TimeStamp vblank_begin_wait = TimeStamp::Now();
@ -1835,7 +1766,6 @@ class D3DVsyncSource final : public VsyncSource {
HMONITOR mWaitVBlankMonitor;
RefPtr<IDXGIOutput> mWaitVBlankOutput;
bool mIsWindows8OrLater;
}; // D3DVsyncSource
already_AddRefed<mozilla::gfx::VsyncSource>

View File

@ -5801,11 +5801,6 @@
value: true # Match naive behavior, but hopefully we can stop soon!
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
# OS is using for composition).
#