Bug 1844908 - Remove pre-Win10-specific codepath from gfx/. r=gfx-reviewers,nical

Differential Revision: https://phabricator.services.mozilla.com/D184292
This commit is contained in:
Masatoshi Kimura 2023-08-17 02:58:21 +00:00
Родитель 3009c7892d
Коммит 33a7abd008
7 изменённых файлов: 7 добавлений и 94 удалений

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

@ -60,7 +60,6 @@ void gfxConfigManager::Init() {
#ifdef XP_WIN
DeviceManagerDx::Get()->CheckHardwareStretchingSupport(mHwStretchingSupport);
mScaledResolution = HasScaledResolution();
mIsWin10OrLater = IsWin10OrLater();
mIsWin11OrLater = IsWin11OrLater();
mWrCompositorDCompRequired = true;
#else
@ -262,19 +261,12 @@ void gfxConfigManager::ConfigureWebRender() {
"FEATURE_FAILURE_DCOMP_PREF_DISABLED"_ns);
}
if (!mIsWin10OrLater) {
// XXX relax win version to windows 8.
mFeatureWrDComp->Disable(FeatureStatus::Unavailable,
"Requires Windows 10 or later",
"FEATURE_FAILURE_DCOMP_NOT_WIN10"_ns);
}
if (!mFeatureGPUProcess->IsEnabled()) {
mFeatureWrDComp->Disable(FeatureStatus::Unavailable, "Requires GPU process",
"FEATURE_FAILURE_NO_GPU_PROCESS"_ns);
}
if (mIsWin10OrLater && !mIsWin11OrLater) {
if (!mIsWin11OrLater) {
// Disable DirectComposition for NVIDIA users on Windows 10 with high/mixed
// refresh rate monitors due to rendering artifacts. (See bug 1638709.)
nsAutoString adapterVendorID;

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

@ -49,7 +49,7 @@ class gfxConfigManager {
mIsNightly(false),
mIsEarlyBetaOrEarlier(false),
mSafeMode(false),
mIsWin10OrLater(false) {}
mIsWin11OrLater(false) {}
void Init();
@ -109,7 +109,6 @@ class gfxConfigManager {
bool mIsNightly;
bool mIsEarlyBetaOrEarlier;
bool mSafeMode;
bool mIsWin10OrLater;
bool mIsWin11OrLater;
};

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

@ -510,7 +510,6 @@ D3D11TextureData* D3D11TextureData::Create(IntSize aSize, SurfaceFormat aFormat,
D3D11_SUBRESOURCE_DATA uploadData;
D3D11_SUBRESOURCE_DATA* uploadDataPtr = nullptr;
RefPtr<DataSourceSurface> srcSurf;
DataSourceSurface::MappedSurface sourceMap;
if (aSurface) {
srcSurf = aSurface->GetDataSurface();
@ -521,14 +520,13 @@ D3D11TextureData* D3D11TextureData::Create(IntSize aSize, SurfaceFormat aFormat,
return nullptr;
}
DataSourceSurface::MappedSurface sourceMap;
if (!srcSurf->Map(DataSourceSurface::READ, &sourceMap)) {
gfxCriticalError()
<< "Failed to map source surface for D3D11TextureData::Create";
return nullptr;
}
}
if (srcSurf && !DeviceManagerDx::Get()->HasCrashyInitData()) {
uploadData.pSysMem = sourceMap.mData;
uploadData.SysMemPitch = sourceMap.mStride;
uploadData.SysMemSlicePitch = 0; // unused
@ -555,18 +553,6 @@ D3D11TextureData* D3D11TextureData::Create(IntSize aSize, SurfaceFormat aFormat,
<< " Code: " << gfx::hexa(hr);
return nullptr;
}
if (srcSurf && DeviceManagerDx::Get()->HasCrashyInitData()) {
D3D11_BOX box;
box.front = box.top = box.left = 0;
box.back = 1;
box.right = aSize.width;
box.bottom = aSize.height;
RefPtr<ID3D11DeviceContext> ctx;
device->GetImmediateContext(getter_AddRefs(ctx));
ctx->UpdateSubresource(texture11, 0, &box, sourceMap.mData,
sourceMap.mStride, 0);
}
}
if (srcSurf) {

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

@ -290,7 +290,6 @@ class GfxConfigManager : public ::testing::Test, public gfxConfigManager {
mWrCompositorDCompRequired = true;
mWrScissoredCacheClearsEnabled = true;
++mHwStretchingSupport.mBoth;
mIsWin10OrLater = true;
mIsWin11OrLater = true;
mIsNightly = true;
mIsEarlyBetaOrEarlier = true;
@ -504,23 +503,6 @@ TEST_F(GfxConfigManager, WebRenderSafeMode) {
EXPECT_TRUE(mFeatures.mD3D11HwAngle.IsEnabled());
}
TEST_F(GfxConfigManager, WebRenderEarlierThanWindows10) {
mIsWin10OrLater = false;
ConfigureWebRender();
EXPECT_TRUE(mFeatures.mWr.IsEnabled());
EXPECT_FALSE(mFeatures.mWrCompositor.IsEnabled());
EXPECT_TRUE(mFeatures.mWrAngle.IsEnabled());
EXPECT_FALSE(mFeatures.mWrDComp.IsEnabled());
EXPECT_TRUE(mFeatures.mWrPartial.IsEnabled());
EXPECT_TRUE(mFeatures.mWrShaderCache.IsEnabled());
EXPECT_TRUE(mFeatures.mWrOptimizedShaders.IsEnabled());
EXPECT_TRUE(mFeatures.mWrScissoredCacheClears.IsEnabled());
EXPECT_TRUE(mFeatures.mHwCompositing.IsEnabled());
EXPECT_TRUE(mFeatures.mGPUProcess.IsEnabled());
EXPECT_TRUE(mFeatures.mD3D11HwAngle.IsEnabled());
}
TEST_F(GfxConfigManager, WebRenderDCompDisabled) {
mWrDCompWinEnabled = false;
ConfigureWebRender();
@ -647,7 +629,6 @@ TEST_F(GfxConfigManager, WebRenderIntelBatteryNoHwStretchingNotNightly) {
}
TEST_F(GfxConfigManager, WebRenderNvidiaHighMixedRefreshRateWin10) {
mIsWin10OrLater = true;
mIsWin11OrLater = false;
mMockGfxInfo->mMaxRefreshRate = 120;
mMockGfxInfo->mHasMixedRefreshRate = true;
@ -667,7 +648,6 @@ TEST_F(GfxConfigManager, WebRenderNvidiaHighMixedRefreshRateWin10) {
}
TEST_F(GfxConfigManager, WebRenderNvidiaHighMixedRefreshRateWin11) {
mIsWin10OrLater = true;
mIsWin11OrLater = true;
mMockGfxInfo->mMaxRefreshRate = 120;
mMockGfxInfo->mHasMixedRefreshRate = true;
@ -812,27 +792,6 @@ TEST_F(GfxConfigManager, WebRenderSoftwareReleaseWindowsGPUProcessDisabled) {
EXPECT_TRUE(mFeatures.mD3D11HwAngle.IsEnabled());
}
TEST_F(GfxConfigManager, WebRenderSoftwareReleaseGPUProcessDisabled) {
mIsNightly = mIsEarlyBetaOrEarlier = false;
mIsWin10OrLater = false;
mFeatureD3D11Compositing = nullptr;
mMockGfxInfo->mStatusWr = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
mFeatures.mGPUProcess.UserDisable("", ""_ns);
ConfigureWebRender();
EXPECT_FALSE(mFeatures.mWr.IsEnabled());
EXPECT_FALSE(mFeatures.mWrCompositor.IsEnabled());
EXPECT_FALSE(mFeatures.mWrAngle.IsEnabled());
EXPECT_FALSE(mFeatures.mWrDComp.IsEnabled());
EXPECT_TRUE(mFeatures.mWrPartial.IsEnabled());
EXPECT_FALSE(mFeatures.mWrShaderCache.IsEnabled());
EXPECT_FALSE(mFeatures.mWrOptimizedShaders.IsEnabled());
EXPECT_TRUE(mFeatures.mWrScissoredCacheClears.IsEnabled());
EXPECT_TRUE(mFeatures.mHwCompositing.IsEnabled());
EXPECT_FALSE(mFeatures.mGPUProcess.IsEnabled());
EXPECT_TRUE(mFeatures.mD3D11HwAngle.IsEnabled());
}
TEST_F(GfxConfigManager, WebRenderShaderCacheDisabled) {
mWrShaderCache = Some(false);
ConfigureWebRender();

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

@ -12,7 +12,6 @@
#include "mozilla/StaticPrefs_gfx.h"
#include "mozilla/StaticPrefs_layers.h"
#include "mozilla/Telemetry.h"
#include "mozilla/WindowsVersion.h"
#include "mozilla/gfx/GPUParent.h"
#include "mozilla/gfx/GPUProcessManager.h"
#include "mozilla/gfx/GraphicsMessages.h"
@ -68,9 +67,7 @@ DeviceManagerDx::DeviceManagerDx()
: mDeviceLock("gfxWindowsPlatform.mDeviceLock"),
mCompositorDeviceSupportsVideo(false) {
// Set up the D3D11 feature levels we can ask for.
if (IsWin8OrLater()) {
mFeatureLevels.AppendElement(D3D_FEATURE_LEVEL_11_1);
}
mFeatureLevels.AppendElement(D3D_FEATURE_LEVEL_11_1);
mFeatureLevels.AppendElement(D3D_FEATURE_LEVEL_11_0);
mFeatureLevels.AppendElement(D3D_FEATURE_LEVEL_10_1);
mFeatureLevels.AppendElement(D3D_FEATURE_LEVEL_10_0);
@ -833,12 +830,7 @@ void DeviceManagerDx::CreateWARPCompositorDevice() {
return;
}
// Only test for texture sharing on Windows 8 since it puts the device into
// an unusable state if used on Windows 7
bool textureSharingWorks = false;
if (IsWin8OrLater()) {
textureSharingWorks = D3D11Checks::DoesTextureSharingWork(device);
}
bool textureSharingWorks = D3D11Checks::DoesTextureSharingWork(device);
DXGI_ADAPTER_DESC desc;
D3D11Checks::GetDxgiDesc(device, &desc);
@ -1273,15 +1265,6 @@ bool DeviceManagerDx::CanInitializeKeyedMutexTextures() {
gfxVars::AllowD3D11KeyedMutex();
}
bool DeviceManagerDx::HasCrashyInitData() {
MutexAutoLock lock(mDeviceLock);
if (!mDeviceStatus) {
return false;
}
return (mDeviceStatus->adapter().VendorId == 0x8086 && !IsWin10OrLater());
}
bool DeviceManagerDx::IsWARP() {
MutexAutoLock lock(mDeviceLock);
if (!mDeviceStatus) {

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

@ -81,10 +81,6 @@ class DeviceManagerDx final {
// need to avoid it.
bool CanInitializeKeyedMutexTextures();
// Intel devices on older windows versions seem to occasionally have
// stability issues when supplying InitData to CreateTexture2D.
bool HasCrashyInitData();
// Enumerate and return all outputs on the current adapter.
nsTArray<DXGI_OUTPUT_DESC1> EnumerateOutputs();

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

@ -2433,8 +2433,7 @@ void gfxPlatform::InitAcceleration() {
gfxCriticalNote << "Cannot evaluate keyed mutex feature status";
gfxVars::SetAllowD3D11KeyedMutex(true);
}
if (StaticPrefs::gfx_direct3d11_use_double_buffering() &&
IsWin10OrLater()) {
if (StaticPrefs::gfx_direct3d11_use_double_buffering()) {
gfxVars::SetUseDoubleBufferingWithCompositor(true);
}
#endif
@ -2792,8 +2791,7 @@ void gfxPlatform::InitWebRenderConfig() {
bool useHwVideoZeroCopy = false;
if (StaticPrefs::media_wmf_zero_copy_nv12_textures_AtStartup()) {
// XXX relax limitation to Windows 8.1
if (IsWin10OrLater() && hasHardware) {
if (hasHardware) {
useHwVideoZeroCopy = true;
}