Skip to content

Commit

Permalink
Bug 1844908 - Remove pre-Win10-specific codepath from gfx/. r=gfx-rev…
Browse files Browse the repository at this point in the history
…iewers,nical

Differential Revision: https://phabricator.services.mozilla.com/D184292
  • Loading branch information
vyv03354 committed Aug 17, 2023
1 parent 3009c78 commit 33a7abd
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 94 deletions.
10 changes: 1 addition & 9 deletions gfx/config/gfxConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ void gfxConfigManager::Init() {
#ifdef XP_WIN
DeviceManagerDx::Get()->CheckHardwareStretchingSupport(mHwStretchingSupport);
mScaledResolution = HasScaledResolution();
mIsWin10OrLater = IsWin10OrLater();
mIsWin11OrLater = IsWin11OrLater();
mWrCompositorDCompRequired = true;
#else
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions gfx/config/gfxConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class gfxConfigManager {
mIsNightly(false),
mIsEarlyBetaOrEarlier(false),
mSafeMode(false),
mIsWin10OrLater(false) {}
mIsWin11OrLater(false) {}

void Init();

Expand Down Expand Up @@ -109,7 +109,6 @@ class gfxConfigManager {
bool mIsNightly;
bool mIsEarlyBetaOrEarlier;
bool mSafeMode;
bool mIsWin10OrLater;
bool mIsWin11OrLater;
};

Expand Down
16 changes: 1 addition & 15 deletions gfx/layers/d3d11/TextureD3D11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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
Expand All @@ -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) {
Expand Down
41 changes: 0 additions & 41 deletions gfx/tests/gtest/TestConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -647,7 +629,6 @@ TEST_F(GfxConfigManager, WebRenderIntelBatteryNoHwStretchingNotNightly) {
}

TEST_F(GfxConfigManager, WebRenderNvidiaHighMixedRefreshRateWin10) {
mIsWin10OrLater = true;
mIsWin11OrLater = false;
mMockGfxInfo->mMaxRefreshRate = 120;
mMockGfxInfo->mHasMixedRefreshRate = true;
Expand All @@ -667,7 +648,6 @@ TEST_F(GfxConfigManager, WebRenderNvidiaHighMixedRefreshRateWin10) {
}

TEST_F(GfxConfigManager, WebRenderNvidiaHighMixedRefreshRateWin11) {
mIsWin10OrLater = true;
mIsWin11OrLater = true;
mMockGfxInfo->mMaxRefreshRate = 120;
mMockGfxInfo->mHasMixedRefreshRate = true;
Expand Down Expand Up @@ -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();
Expand Down
21 changes: 2 additions & 19 deletions gfx/thebes/DeviceManagerDx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 0 additions & 4 deletions gfx/thebes/DeviceManagerDx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
6 changes: 2 additions & 4 deletions gfx/thebes/gfxPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 33a7abd

Please sign in to comment.