diff options
author | Moonchild <moonchild@palemoon.org> | 2021-11-17 23:02:46 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-04-04 22:15:34 +0200 |
commit | ef5083db5f52156bebeffbe73317efcf35350228 (patch) | |
tree | d2a456633aa98a074593ae589cd65c6efad79054 /gfx | |
parent | cff9ef7fb81b46264caea00ac3c7a99677d8b856 (diff) | |
download | uxp-ef5083db5f52156bebeffbe73317efcf35350228.tar.gz |
Issue #1841 - Part 2: Remove D3D9 layer compositor references and
layer fallback code.
Diffstat (limited to 'gfx')
-rw-r--r-- | gfx/config/gfxFeature.h | 1 | ||||
-rw-r--r-- | gfx/ipc/GPUChild.cpp | 1 | ||||
-rw-r--r-- | gfx/ipc/GPUParent.cpp | 5 | ||||
-rw-r--r-- | gfx/ipc/GraphicsMessages.ipdlh | 6 | ||||
-rw-r--r-- | gfx/layers/D3D9SurfaceImage.cpp | 83 | ||||
-rw-r--r-- | gfx/layers/D3D9SurfaceImage.h | 48 | ||||
-rw-r--r-- | gfx/layers/IMFYCbCrImage.cpp | 96 | ||||
-rw-r--r-- | gfx/layers/IMFYCbCrImage.h | 2 | ||||
-rw-r--r-- | gfx/layers/client/CompositableClient.cpp | 1 | ||||
-rw-r--r-- | gfx/layers/client/TextureClient.cpp | 11 | ||||
-rw-r--r-- | gfx/layers/composite/TextureHost.cpp | 14 | ||||
-rw-r--r-- | gfx/layers/d3d11/CompositorD3D11.cpp | 1 | ||||
-rw-r--r-- | gfx/layers/ipc/CompositorBridgeParent.cpp | 7 | ||||
-rw-r--r-- | gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp | 1 | ||||
-rw-r--r-- | gfx/src/DriverCrashGuard.cpp | 6 | ||||
-rw-r--r-- | gfx/thebes/gfxPrefs.h | 2 | ||||
-rwxr-xr-x | gfx/thebes/gfxWindowsPlatform.cpp | 66 | ||||
-rw-r--r-- | gfx/thebes/gfxWindowsPlatform.h | 1 | ||||
-rw-r--r-- | gfx/thebes/gfxWindowsSurface.cpp | 8 | ||||
-rw-r--r-- | gfx/thebes/gfxWindowsSurface.h | 3 | ||||
-rw-r--r-- | gfx/thebes/moz.build | 2 |
21 files changed, 140 insertions, 225 deletions
diff --git a/gfx/config/gfxFeature.h b/gfx/config/gfxFeature.h index bdc79e4fe0..78346aa53d 100644 --- a/gfx/config/gfxFeature.h +++ b/gfx/config/gfxFeature.h @@ -18,7 +18,6 @@ namespace gfx { /* Name, Type, Description */ \ _(HW_COMPOSITING, Feature, "Compositing") \ _(D3D11_COMPOSITING, Feature, "Direct3D11 Compositing") \ - _(D3D9_COMPOSITING, Feature, "Direct3D9 Compositing") \ _(OPENGL_COMPOSITING, Feature, "OpenGL Compositing") \ _(DIRECT2D, Feature, "Direct2D") \ _(D3D11_HW_ANGLE, Feature, "Direct3D11 hardware ANGLE") \ diff --git a/gfx/ipc/GPUChild.cpp b/gfx/ipc/GPUChild.cpp index 06371ebbac..9a82721233 100644 --- a/gfx/ipc/GPUChild.cpp +++ b/gfx/ipc/GPUChild.cpp @@ -54,7 +54,6 @@ GPUChild::Init() DevicePrefs devicePrefs; devicePrefs.hwCompositing() = gfxConfig::GetValue(Feature::HW_COMPOSITING); devicePrefs.d3d11Compositing() = gfxConfig::GetValue(Feature::D3D11_COMPOSITING); - devicePrefs.d3d9Compositing() = gfxConfig::GetValue(Feature::D3D9_COMPOSITING); devicePrefs.oglCompositing() = gfxConfig::GetValue(Feature::OPENGL_COMPOSITING); devicePrefs.useD2D1() = gfxConfig::GetValue(Feature::DIRECT2D); diff --git a/gfx/ipc/GPUParent.cpp b/gfx/ipc/GPUParent.cpp index 7d8a3a4349..c634dd56fb 100644 --- a/gfx/ipc/GPUParent.cpp +++ b/gfx/ipc/GPUParent.cpp @@ -28,7 +28,6 @@ #include "ProcessUtils.h" #include "VsyncBridgeParent.h" #if defined(XP_WIN) -# include "DeviceManagerD3D9.h" # include "mozilla/gfx/DeviceManagerDx.h" #endif #ifdef MOZ_WIDGET_GTK @@ -86,7 +85,6 @@ GPUParent::Init(base::ProcessId aParentPid, gfxPlatform::InitMoz2DLogging(); #if defined(XP_WIN) DeviceManagerDx::Init(); - DeviceManagerD3D9::Init(); #endif if (NS_FAILED(NS_InitMinimalXPCOM())) { @@ -145,7 +143,6 @@ GPUParent::RecvInit(nsTArray<GfxPrefSetting>&& prefs, // Inherit device preferences. gfxConfig::Inherit(Feature::HW_COMPOSITING, devicePrefs.hwCompositing()); gfxConfig::Inherit(Feature::D3D11_COMPOSITING, devicePrefs.d3d11Compositing()); - gfxConfig::Inherit(Feature::D3D9_COMPOSITING, devicePrefs.d3d9Compositing()); gfxConfig::Inherit(Feature::OPENGL_COMPOSITING, devicePrefs.oglCompositing()); gfxConfig::Inherit(Feature::DIRECT2D, devicePrefs.useD2D1()); @@ -237,7 +234,6 @@ bool GPUParent::RecvGetDeviceStatus(GPUDeviceData* aOut) { CopyFeatureChange(Feature::D3D11_COMPOSITING, &aOut->d3d11Compositing()); - CopyFeatureChange(Feature::D3D9_COMPOSITING, &aOut->d3d9Compositing()); CopyFeatureChange(Feature::OPENGL_COMPOSITING, &aOut->oglCompositing()); #if defined(XP_WIN) @@ -350,7 +346,6 @@ GPUParent::ActorDestroy(ActorDestroyReason aWhy) Factory::ShutDown(); #if defined(XP_WIN) DeviceManagerDx::Shutdown(); - DeviceManagerD3D9::Shutdown(); #endif LayerTreeOwnerTracker::Shutdown(); gfxVars::Shutdown(); diff --git a/gfx/ipc/GraphicsMessages.ipdlh b/gfx/ipc/GraphicsMessages.ipdlh index cc4115d425..6da1cc142a 100644 --- a/gfx/ipc/GraphicsMessages.ipdlh +++ b/gfx/ipc/GraphicsMessages.ipdlh @@ -1,6 +1,4 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * vim: sw=2 ts=8 et : - */ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ @@ -27,7 +25,6 @@ struct DevicePrefs { FeatureStatus hwCompositing; FeatureStatus d3d11Compositing; - FeatureStatus d3d9Compositing; FeatureStatus oglCompositing; FeatureStatus useD2D1; }; @@ -63,7 +60,6 @@ union GPUDeviceStatus struct GPUDeviceData { FeatureChange d3d11Compositing; - FeatureChange d3d9Compositing; FeatureChange oglCompositing; GPUDeviceStatus gpuDevice; }; diff --git a/gfx/layers/D3D9SurfaceImage.cpp b/gfx/layers/D3D9SurfaceImage.cpp index 91dce6291d..c5538105dc 100644 --- a/gfx/layers/D3D9SurfaceImage.cpp +++ b/gfx/layers/D3D9SurfaceImage.cpp @@ -5,7 +5,7 @@ #include "D3D9SurfaceImage.h" #include "gfx2DGlue.h" -#include "mozilla/layers/TextureD3D9.h" +#include "gfxWindowsPlatform.h" #include "mozilla/layers/CompositableClient.h" #include "mozilla/layers/CompositableForwarder.h" #include "mozilla/layers/ImageBridgeChild.h" @@ -14,6 +14,87 @@ namespace mozilla { namespace layers { +DXGID3D9TextureData::DXGID3D9TextureData(gfx::SurfaceFormat aFormat, + IDirect3DTexture9* aTexture, HANDLE aHandle, + IDirect3DDevice9* aDevice) +: mDevice(aDevice) +, mTexture(aTexture) +, mFormat(aFormat) +, mHandle(aHandle) +{ + MOZ_COUNT_CTOR(DXGID3D9TextureData); +} + +DXGID3D9TextureData::~DXGID3D9TextureData() +{ + gfxWindowsPlatform::sD3D9SharedTextures -= mDesc.Width * mDesc.Height * 4; + MOZ_COUNT_DTOR(DXGID3D9TextureData); +} + +// static +DXGID3D9TextureData* +DXGID3D9TextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat, + TextureFlags aFlags, + IDirect3DDevice9* aDevice) +{ + PROFILER_LABEL_FUNC(js::ProfileEntry::Category::GRAPHICS); + MOZ_ASSERT(aFormat == gfx::SurfaceFormat::B8G8R8A8); + if (aFormat != gfx::SurfaceFormat::B8G8R8A8) { + return nullptr; + } + + RefPtr<IDirect3DTexture9> texture; + HANDLE shareHandle = nullptr; + HRESULT hr = aDevice->CreateTexture(aSize.width, aSize.height, + 1, + D3DUSAGE_RENDERTARGET, + D3DFMT_A8R8G8B8, + D3DPOOL_DEFAULT, + getter_AddRefs(texture), + &shareHandle); + if (FAILED(hr) || !shareHandle) { + return nullptr; + } + + D3DSURFACE_DESC surfaceDesc; + hr = texture->GetLevelDesc(0, &surfaceDesc); + if (FAILED(hr)) { + return nullptr; + } + DXGID3D9TextureData* data = new DXGID3D9TextureData(aFormat, texture, shareHandle, aDevice); + data->mDesc = surfaceDesc; + + gfxWindowsPlatform::sD3D9SharedTextures += aSize.width * aSize.height * 4; + return data; +} + +void +DXGID3D9TextureData::FillInfo(TextureData::Info& aInfo) const +{ + aInfo.size = GetSize(); + aInfo.format = mFormat; + aInfo.supportsMoz2D = false; + aInfo.canExposeMappedData = false; + aInfo.hasIntermediateBuffer = false; + aInfo.hasSynchronization = false; +} + +already_AddRefed<IDirect3DSurface9> +DXGID3D9TextureData::GetD3D9Surface() const +{ + RefPtr<IDirect3DSurface9> textureSurface; + HRESULT hr = mTexture->GetSurfaceLevel(0, getter_AddRefs(textureSurface)); + NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr); + + return textureSurface.forget(); +} + +bool +DXGID3D9TextureData::Serialize(SurfaceDescriptor& aOutDescriptor) +{ + aOutDescriptor = SurfaceDescriptorD3D10((WindowsHandle)(mHandle), mFormat, GetSize()); + return true; +} D3D9SurfaceImage::D3D9SurfaceImage() : Image(nullptr, ImageFormat::D3D9_RGB32_TEXTURE) diff --git a/gfx/layers/D3D9SurfaceImage.h b/gfx/layers/D3D9SurfaceImage.h index a5326bb996..81cfa2cadd 100644 --- a/gfx/layers/D3D9SurfaceImage.h +++ b/gfx/layers/D3D9SurfaceImage.h @@ -40,6 +40,54 @@ protected: RefPtr<IDirect3DDevice9> mDevice; }; +/** + * Wraps a D3D9 texture, shared with the compositor though DXGI. + * At the moment it is only used with D3D11 compositing, and the corresponding + * TextureHost is DXGITextureHostD3D11. + */ +class DXGID3D9TextureData : public TextureData +{ +public: + static DXGID3D9TextureData* + Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat, TextureFlags aFlags, IDirect3DDevice9* aDevice); + + ~DXGID3D9TextureData(); + + virtual void FillInfo(TextureData::Info& aInfo) const override; + + virtual bool Lock(OpenMode) override { return true; } + + virtual void Unlock() override {} + + virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override; + + virtual void Deallocate(LayersIPCChannel* aAllocator) override {} + + IDirect3DDevice9* GetD3D9Device() { return mDevice; } + IDirect3DTexture9* GetD3D9Texture() { return mTexture; } + HANDLE GetShareHandle() const { return mHandle; } + already_AddRefed<IDirect3DSurface9> GetD3D9Surface() const; + + const D3DSURFACE_DESC& GetDesc() const + { + return mDesc; + } + + gfx::IntSize GetSize() const { return gfx::IntSize(mDesc.Width, mDesc.Height); } + +protected: + DXGID3D9TextureData(gfx::SurfaceFormat aFormat, + IDirect3DTexture9* aTexture, HANDLE aHandle, + IDirect3DDevice9* aDevice); + + RefPtr<IDirect3DDevice9> mDevice; + RefPtr<IDirect3DTexture9> mTexture; + gfx::SurfaceFormat mFormat; + HANDLE mHandle; + D3DSURFACE_DESC mDesc; +}; + + // Image class that wraps a IDirect3DSurface9. This class copies the image // passed into SetData(), so that it can be accessed from other D3D devices. // This class also manages the synchronization of the copy, to ensure the diff --git a/gfx/layers/IMFYCbCrImage.cpp b/gfx/layers/IMFYCbCrImage.cpp index 6740fdbe07..47c0ce927a 100644 --- a/gfx/layers/IMFYCbCrImage.cpp +++ b/gfx/layers/IMFYCbCrImage.cpp @@ -4,7 +4,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "IMFYCbCrImage.h" -#include "DeviceManagerD3D9.h" #include "mozilla/layers/TextureD3D11.h" #include "mozilla/layers/CompositableClient.h" #include "mozilla/layers/CompositableForwarder.h" @@ -135,97 +134,6 @@ FinishTextures(IDirect3DDevice9* aDevice, return true; } -static bool UploadData(IDirect3DDevice9* aDevice, - RefPtr<IDirect3DTexture9>& aTexture, - HANDLE& aHandle, - uint8_t* aSrc, - const gfx::IntSize& aSrcSize, - int32_t aSrcStride) -{ - RefPtr<IDirect3DSurface9> surf; - D3DLOCKED_RECT rect; - aTexture = InitTextures(aDevice, aSrcSize, D3DFMT_A8, surf, aHandle, rect); - if (!aTexture) { - return false; - } - - if (aSrcStride == rect.Pitch) { - memcpy(rect.pBits, aSrc, rect.Pitch * aSrcSize.height); - } else { - for (int i = 0; i < aSrcSize.height; i++) { - memcpy((uint8_t*)rect.pBits + i * rect.Pitch, - aSrc + i * aSrcStride, - aSrcSize.width); - } - } - - return FinishTextures(aDevice, aTexture, surf); -} - -TextureClient* -IMFYCbCrImage::GetD3D9TextureClient(KnowsCompositor* aForwarder) -{ - RefPtr<IDirect3DDevice9> device = DeviceManagerD3D9::GetDevice(); - if (!device) { - return nullptr; - } - - RefPtr<IDirect3DTexture9> textureY; - HANDLE shareHandleY = 0; - if (!UploadData(device, textureY, shareHandleY, - mData.mYChannel, mData.mYSize, mData.mYStride)) { - return nullptr; - } - - RefPtr<IDirect3DTexture9> textureCb; - HANDLE shareHandleCb = 0; - if (!UploadData(device, textureCb, shareHandleCb, - mData.mCbChannel, mData.mCbCrSize, mData.mCbCrStride)) { - return nullptr; - } - - RefPtr<IDirect3DTexture9> textureCr; - HANDLE shareHandleCr = 0; - if (!UploadData(device, textureCr, shareHandleCr, - mData.mCrChannel, mData.mCbCrSize, mData.mCbCrStride)) { - return nullptr; - } - - RefPtr<IDirect3DQuery9> query; - HRESULT hr = device->CreateQuery(D3DQUERYTYPE_EVENT, getter_AddRefs(query)); - hr = query->Issue(D3DISSUE_END); - - int iterations = 0; - bool valid = false; - while (iterations < 10) { - HRESULT hr = query->GetData(nullptr, 0, D3DGETDATA_FLUSH); - if (hr == S_FALSE) { - Sleep(1); - iterations++; - continue; - } - if (hr == S_OK) { - valid = true; - } - break; - } - - if (!valid) { - return nullptr; - } - - mTextureClient = TextureClient::CreateWithData( - DXGIYCbCrTextureData::Create(TextureFlags::DEFAULT, - textureY, textureCb, textureCr, - shareHandleY, shareHandleCb, shareHandleCr, - GetSize(), mData.mYSize, mData.mCbCrSize), - TextureFlags::DEFAULT, - aForwarder->GetTextureForwarder() - ); - - return mTextureClient; -} - TextureClient* IMFYCbCrImage::GetTextureClient(KnowsCompositor* aForwarder) { @@ -242,10 +150,6 @@ IMFYCbCrImage::GetTextureClient(KnowsCompositor* aForwarder) LayersBackend backend = aForwarder->GetCompositorBackendType(); if (!device || backend != LayersBackend::LAYERS_D3D11) { - if (backend == LayersBackend::LAYERS_D3D9 || - backend == LayersBackend::LAYERS_D3D11) { - return GetD3D9TextureClient(aForwarder); - } return nullptr; } diff --git a/gfx/layers/IMFYCbCrImage.h b/gfx/layers/IMFYCbCrImage.h index 9a42987279..511f865dec 100644 --- a/gfx/layers/IMFYCbCrImage.h +++ b/gfx/layers/IMFYCbCrImage.h @@ -24,8 +24,6 @@ public: protected: - TextureClient* GetD3D9TextureClient(KnowsCompositor* aForwarder); - ~IMFYCbCrImage(); RefPtr<IMFMediaBuffer> mBuffer; diff --git a/gfx/layers/client/CompositableClient.cpp b/gfx/layers/client/CompositableClient.cpp index 52b9a46372..936ba7abca 100644 --- a/gfx/layers/client/CompositableClient.cpp +++ b/gfx/layers/client/CompositableClient.cpp @@ -17,7 +17,6 @@ #ifdef XP_WIN #include "gfxWindowsPlatform.h" // for gfxWindowsPlatform #include "mozilla/layers/TextureD3D11.h" -#include "mozilla/layers/TextureD3D9.h" #endif #include "gfxUtils.h" #include "IPDLActor.h" diff --git a/gfx/layers/client/TextureClient.cpp b/gfx/layers/client/TextureClient.cpp index 462cd40d43..e8139e9a92 100644 --- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -33,9 +33,7 @@ #include "mozilla/layers/ShadowLayers.h" #ifdef XP_WIN -#include "DeviceManagerD3D9.h" #include "mozilla/gfx/DeviceManagerDx.h" -#include "mozilla/layers/TextureD3D9.h" #include "mozilla/layers/TextureD3D11.h" #include "mozilla/layers/TextureDIB.h" #include "gfxWindowsPlatform.h" @@ -1033,15 +1031,6 @@ TextureClient::CreateForDrawing(TextureForwarder* aAllocator, { data = DXGITextureData::Create(aSize, aFormat, aAllocFlags); } - if (aLayersBackend == LayersBackend::LAYERS_D3D9 && - moz2DBackend == gfx::BackendType::CAIRO && - aAllocator->IsSameProcess() && - aSize.width <= aMaxTextureSize && - aSize.height <= aMaxTextureSize && - NS_IsMainThread() && - DeviceManagerD3D9::GetDevice()) { - data = D3D9TextureData::Create(aSize, aFormat, aAllocFlags); - } if (!data && aFormat == SurfaceFormat::B8G8R8X8 && moz2DBackend == gfx::BackendType::CAIRO && diff --git a/gfx/layers/composite/TextureHost.cpp b/gfx/layers/composite/TextureHost.cpp index 94e7b5427c..d550945ef6 100644 --- a/gfx/layers/composite/TextureHost.cpp +++ b/gfx/layers/composite/TextureHost.cpp @@ -168,11 +168,6 @@ already_AddRefed<TextureHost> CreateTextureHostD3D11(const SurfaceDescriptor& aD ISurfaceAllocator* aDeallocator, TextureFlags aFlags); -// implemented in TextureD3D9.cpp -already_AddRefed<TextureHost> CreateTextureHostD3D9(const SurfaceDescriptor& aDesc, - ISurfaceAllocator* aDeallocator, - TextureFlags aFlags); - already_AddRefed<TextureHost> TextureHost::Create(const SurfaceDescriptor& aDesc, ISurfaceAllocator* aDeallocator, @@ -211,16 +206,9 @@ TextureHost::Create(const SurfaceDescriptor& aDesc, #endif #ifdef XP_WIN - case SurfaceDescriptor::TSurfaceDescriptorD3D9: - return CreateTextureHostD3D9(aDesc, aDeallocator, aFlags); - case SurfaceDescriptor::TSurfaceDescriptorD3D10: case SurfaceDescriptor::TSurfaceDescriptorDXGIYCbCr: - if (aBackend == LayersBackend::LAYERS_D3D9) { - return CreateTextureHostD3D9(aDesc, aDeallocator, aFlags); - } else { - return CreateTextureHostD3D11(aDesc, aDeallocator, aFlags); - } + return CreateTextureHostD3D11(aDesc, aDeallocator, aFlags); #endif default: MOZ_CRASH("GFX: Unsupported Surface type host"); diff --git a/gfx/layers/d3d11/CompositorD3D11.cpp b/gfx/layers/d3d11/CompositorD3D11.cpp index 505e5881d4..7655d097b2 100644 --- a/gfx/layers/d3d11/CompositorD3D11.cpp +++ b/gfx/layers/d3d11/CompositorD3D11.cpp @@ -28,7 +28,6 @@ #include "BlendShaderConstants.h" #include "D3D11ShareHandleImage.h" -#include "D3D9SurfaceImage.h" #include <dxgi1_2.h> diff --git a/gfx/layers/ipc/CompositorBridgeParent.cpp b/gfx/layers/ipc/CompositorBridgeParent.cpp index 25ac10130d..e650b2dcf1 100644 --- a/gfx/layers/ipc/CompositorBridgeParent.cpp +++ b/gfx/layers/ipc/CompositorBridgeParent.cpp @@ -63,7 +63,6 @@ #include "nsXULAppAPI.h" // for XRE_GetIOMessageLoop #ifdef XP_WIN #include "mozilla/layers/CompositorD3D11.h" -#include "mozilla/layers/CompositorD3D9.h" #endif #include "GeckoProfiler.h" #include "mozilla/ipc/ProtocolTypes.h" @@ -1617,8 +1616,6 @@ CompositorBridgeParent::NewCompositor(const nsTArray<LayersBackend>& aBackendHin #ifdef XP_WIN } else if (aBackendHints[i] == LayersBackend::LAYERS_D3D11) { compositor = new CompositorD3D11(this, mWidget); - } else if (aBackendHints[i] == LayersBackend::LAYERS_D3D9) { - compositor = new CompositorD3D9(this, mWidget); #endif } nsCString failureReason; @@ -1637,10 +1634,6 @@ CompositorBridgeParent::NewCompositor(const nsTArray<LayersBackend>& aBackendHin << failureReason.get(); } #ifdef XP_WIN - else if (aBackendHints[i] == LayersBackend::LAYERS_D3D9){ - gfxCriticalNote << "[D3D9] Failed to init compositor with reason: " - << failureReason.get(); - } else if (aBackendHints[i] == LayersBackend::LAYERS_D3D11){ gfxCriticalNote << "[D3D11] Failed to init compositor with reason: " << failureReason.get(); diff --git a/gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp b/gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp index 56d0386868..623bf9e5df 100644 --- a/gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp +++ b/gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp @@ -61,7 +61,6 @@ #include "nsXULAppAPI.h" // for XRE_GetIOMessageLoop #ifdef XP_WIN #include "mozilla/layers/CompositorD3D11.h" -#include "mozilla/layers/CompositorD3D9.h" #endif #include "GeckoProfiler.h" #include "mozilla/ipc/ProtocolTypes.h" diff --git a/gfx/src/DriverCrashGuard.cpp b/gfx/src/DriverCrashGuard.cpp index 42b7416344..3b69d387c5 100644 --- a/gfx/src/DriverCrashGuard.cpp +++ b/gfx/src/DriverCrashGuard.cpp @@ -5,6 +5,7 @@ #include "DriverCrashGuard.h"
#include "gfxEnv.h"
#include "gfxPrefs.h"
+#include "gfxConfig.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
#include "nsServiceManagerUtils.h"
@@ -432,10 +433,7 @@ D3D11LayersCrashGuard::UpdateEnvironment() (!gfxPrefs::Direct2DDisabled() && FeatureEnabled(nsIGfxInfo::FEATURE_DIRECT2D));
changed |= CheckAndUpdateBoolPref("feature-d2d", d2dEnabled);
- bool d3d11Enabled = !gfxPrefs::LayersPreferD3D9();
- if (!FeatureEnabled(nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS)) {
- d3d11Enabled = false;
- }
+ bool d3d11Enabled = gfxConfig::IsEnabled(Feature::D3D11_COMPOSITING);
changed |= CheckAndUpdateBoolPref("feature-d3d11", d3d11Enabled);
#endif
diff --git a/gfx/thebes/gfxPrefs.h b/gfx/thebes/gfxPrefs.h index c061a3f04b..143d9199ca 100644 --- a/gfx/thebes/gfxPrefs.h +++ b/gfx/thebes/gfxPrefs.h @@ -450,7 +450,6 @@ private: DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.print-histogram", FPSPrintHistogram, bool, false); DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.write-to-file", WriteFPSToFile, bool, false); DECL_GFX_PREF(Once, "layers.acceleration.force", LayersAccelerationForceEnabledDoNotUseDirectly, bool, false); - DECL_GFX_PREF(Skip, "layers.allow-d3d9-fallback", LayersAllowD3D9Fallback, bool, false); DECL_GFX_PREF(Once, "layers.amd-switchable-gfx.enabled", LayersAMDSwitchableGfxEnabled, bool, false); DECL_GFX_PREF(Once, "layers.async-pan-zoom.enabled", AsyncPanZoomEnabledDoNotUseDirectly, bool, true); DECL_GFX_PREF(Once, "layers.async-pan-zoom.separate-event-thread", AsyncPanZoomSeparateEventThread, bool, false); @@ -495,7 +494,6 @@ private: DECL_GFX_PREF(Live, "layers.offmainthreadcomposition.frame-rate", LayersCompositionFrameRate, int32_t,-1); DECL_GFX_PREF(Live, "layers.orientation.sync.timeout", OrientationSyncMillis, uint32_t, (uint32_t)0); DECL_GFX_PREF(Once, "layers.overzealous-gralloc-unlocking", OverzealousGrallocUnlocking, bool, false); - DECL_GFX_PREF(Skip, "layers.prefer-d3d9", LayersPreferD3D9, bool, false); DECL_GFX_PREF(Once, "layers.prefer-opengl", LayersPreferOpenGL, bool, false); DECL_GFX_PREF(Live, "layers.progressive-paint", ProgressivePaint, bool, false); DECL_GFX_PREF(Live, "layers.shared-buffer-provider.enabled", PersistentBufferProviderSharedEnabled, bool, false); diff --git a/gfx/thebes/gfxWindowsPlatform.cpp b/gfx/thebes/gfxWindowsPlatform.cpp index 78cfaf24ef..2a86340787 100755 --- a/gfx/thebes/gfxWindowsPlatform.cpp +++ b/gfx/thebes/gfxWindowsPlatform.cpp @@ -35,7 +35,6 @@ #include "gfxGDIFont.h" #include "mozilla/layers/CompositorThread.h" -#include "DeviceManagerD3D9.h" #include "mozilla/layers/ReadbackManagerD3D11.h" #include "gfxDWriteFontList.h" @@ -324,7 +323,6 @@ gfxWindowsPlatform::~gfxWindowsPlatform() { mozilla::gfx::Factory::D2DCleanup(); - DeviceManagerD3D9::Shutdown(); DeviceManagerDx::Shutdown(); /* @@ -356,7 +354,6 @@ gfxWindowsPlatform::InitAcceleration() mFeatureLevels.AppendElement(D3D_FEATURE_LEVEL_9_3); DeviceManagerDx::Init(); - DeviceManagerD3D9::Init(); InitializeConfig(); InitializeDevices(); @@ -380,7 +377,7 @@ gfxWindowsPlatform::CanUseHardwareVideoDecoding() if (!dm) { return false; } - if (!gfxPrefs::LayersPreferD3D9() && !dm->TextureSharingWorks()) { + if (!dm->TextureSharingWorks()) { return false; } return !dm->IsWARP() && gfxPlatform::CanUseHardwareVideoDecoding(); @@ -1338,7 +1335,6 @@ gfxWindowsPlatform::InitializeConfig() if (XRE_IsParentProcess()) { // The parent process first determines which features can be attempted. // This information is relayed to content processes and the GPU process. - InitializeD3D9Config(); InitializeD3D11Config(); InitializeANGLEConfig(); InitializeD2DConfig(); @@ -1349,40 +1345,6 @@ gfxWindowsPlatform::InitializeConfig() } void -gfxWindowsPlatform::InitializeD3D9Config() -{ - MOZ_ASSERT(XRE_IsParentProcess()); - - FeatureState& d3d9 = gfxConfig::GetFeature(Feature::D3D9_COMPOSITING); - - if (!gfxConfig::IsEnabled(Feature::HW_COMPOSITING)) { - d3d9.DisableByDefault(FeatureStatus::Unavailable, "Hardware compositing is disabled", - NS_LITERAL_CSTRING("FEATURE_FAILURE_D3D9_NEED_HWCOMP")); - return; - } - - d3d9.SetDefaultFromPref( - gfxPrefs::GetLayersAllowD3D9FallbackPrefName(), - true, - gfxPrefs::GetLayersAllowD3D9FallbackPrefDefault()); - - if (!d3d9.IsEnabled() && gfxPrefs::LayersPreferD3D9()) { - d3d9.UserEnable("Direct3D9 enabled via layers.prefer-d3d9"); - } - - nsCString message; - nsCString failureId; - if (!gfxPlatform::IsGfxInfoStatusOkay(nsIGfxInfo::FEATURE_DIRECT3D_9_LAYERS, &message, - failureId)) { - d3d9.Disable(FeatureStatus::Blacklisted, message.get(), failureId); - } - - if (gfxConfig::IsForcedOnByUser(Feature::HW_COMPOSITING)) { - d3d9.UserForceEnable("Hardware compositing is force-enabled"); - } -} - -void gfxWindowsPlatform::InitializeD3D11Config() { MOZ_ASSERT(XRE_IsParentProcess()); @@ -1412,13 +1374,6 @@ gfxWindowsPlatform::InitializeD3D11Config() } } - // If the user prefers D3D9, act as though they disabled D3D11. - if (gfxPrefs::LayersPreferD3D9()) { - d3d11.UserDisable("Disabled due to user preference for Direct3D 9", - NS_LITERAL_CSTRING("FEATURE_FAILURE_D3D11_PREF")); - return; - } - nsCString message; nsCString failureId; if (!gfxPlatform::IsGfxInfoStatusOkay(nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS, &message, failureId)) { @@ -1481,8 +1436,8 @@ gfxWindowsPlatform::InitializeD3D11() // is not blacklisted for D3D11 layers. This first attempt will try to create // a hardware accelerated device. If this creation fails or the hardware is // blacklisted, then this function will abort if WARP is disabled, causing us - // to fallback to D3D9 or Basic layers. If WARP is not disabled it will use - // a WARP device which should always be available on Windows 7 and higher. + // to fallback to Basic layers. If WARP is not disabled it will use a WARP + // device which should always be available on Windows 7 and higher. if (!gfxConfig::IsEnabled(Feature::D3D11_COMPOSITING)) { return; } @@ -1604,8 +1559,8 @@ gfxWindowsPlatform::InitGPUProcessSupport() NS_LITERAL_CSTRING("FEATURE_FAILURE_NO_D3D11")); } 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 and use D3D9, we - // revert back to in-process rendering. + // 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", @@ -1941,17 +1896,9 @@ gfxWindowsPlatform::GetAcceleratedCompositorBackends(nsTArray<LayersBackend>& aB aBackends.AppendElement(LayersBackend::LAYERS_OPENGL); } - if (gfxConfig::IsEnabled(Feature::D3D9_COMPOSITING) && gfxPrefs::LayersPreferD3D9()) { - aBackends.AppendElement(LayersBackend::LAYERS_D3D9); - } - if (gfxConfig::IsEnabled(Feature::D3D11_COMPOSITING)) { aBackends.AppendElement(LayersBackend::LAYERS_D3D11); } - - if (gfxConfig::IsEnabled(Feature::D3D9_COMPOSITING) && !gfxPrefs::LayersPreferD3D9()) { - aBackends.AppendElement(LayersBackend::LAYERS_D3D9); - } } void @@ -1962,7 +1909,6 @@ gfxWindowsPlatform::ImportGPUDeviceData(const mozilla::gfx::GPUDeviceData& aData gfxPlatform::ImportGPUDeviceData(aData); gfxConfig::ImportChange(Feature::D3D11_COMPOSITING, aData.d3d11Compositing()); - gfxConfig::ImportChange(Feature::D3D9_COMPOSITING, aData.d3d9Compositing()); DeviceManagerDx* dm = DeviceManagerDx::Get(); if (gfxConfig::IsEnabled(Feature::D3D11_COMPOSITING)) { @@ -2000,7 +1946,6 @@ gfxWindowsPlatform::ImportContentDeviceData(const mozilla::gfx::ContentDeviceDat const DevicePrefs& prefs = aData.prefs(); gfxConfig::Inherit(Feature::D3D11_COMPOSITING, prefs.d3d11Compositing()); - gfxConfig::Inherit(Feature::D3D9_COMPOSITING, prefs.d3d9Compositing()); gfxConfig::Inherit(Feature::DIRECT2D, prefs.useD2D1()); if (gfxConfig::IsEnabled(Feature::D3D11_COMPOSITING)) { @@ -2019,7 +1964,6 @@ gfxWindowsPlatform::BuildContentDeviceData(ContentDeviceData* aOut) const FeatureState& d3d11 = gfxConfig::GetFeature(Feature::D3D11_COMPOSITING); aOut->prefs().d3d11Compositing() = d3d11.GetValue(); - aOut->prefs().d3d9Compositing() = gfxConfig::GetValue(Feature::D3D9_COMPOSITING); aOut->prefs().useD2D1() = gfxConfig::GetValue(Feature::DIRECT2D); if (d3d11.IsEnabled()) { diff --git a/gfx/thebes/gfxWindowsPlatform.h b/gfx/thebes/gfxWindowsPlatform.h index b56dab338a..111f294591 100644 --- a/gfx/thebes/gfxWindowsPlatform.h +++ b/gfx/thebes/gfxWindowsPlatform.h @@ -49,7 +49,6 @@ class FeatureState; class DeviceManagerDx; } namespace layers { -class DeviceManagerD3D9; class ReadbackManagerD3D11; } } diff --git a/gfx/thebes/gfxWindowsSurface.cpp b/gfx/thebes/gfxWindowsSurface.cpp index e2d90883bb..5a993aba0b 100644 --- a/gfx/thebes/gfxWindowsSurface.cpp +++ b/gfx/thebes/gfxWindowsSurface.cpp @@ -21,14 +21,6 @@ gfxWindowsSurface::gfxWindowsSurface(HDC dc, uint32_t flags) : InitWithDC(flags); } -gfxWindowsSurface::gfxWindowsSurface(IDirect3DSurface9 *surface, uint32_t flags) : - mOwnsDC(false), mDC(0), mWnd(nullptr) -{ - cairo_surface_t *surf = cairo_win32_surface_create_with_d3dsurface9(surface); - Init(surf); -} - - void gfxWindowsSurface::MakeInvalid(mozilla::gfx::IntSize& size) { diff --git a/gfx/thebes/gfxWindowsSurface.h b/gfx/thebes/gfxWindowsSurface.h index 594357a260..c425f18185 100644 --- a/gfx/thebes/gfxWindowsSurface.h +++ b/gfx/thebes/gfxWindowsSurface.h @@ -27,9 +27,6 @@ public: gfxWindowsSurface(HDC dc, uint32_t flags = 0); - // Create from a shared d3d9surface - gfxWindowsSurface(IDirect3DSurface9 *surface, uint32_t flags = 0); - // Create a DIB surface gfxWindowsSurface(const mozilla::gfx::IntSize& size, gfxImageFormat imageFormat = mozilla::gfx::SurfaceFormat::X8R8G8B8_UINT32); diff --git a/gfx/thebes/moz.build b/gfx/thebes/moz.build index 6339f36c7a..bee77cbbec 100644 --- a/gfx/thebes/moz.build +++ b/gfx/thebes/moz.build @@ -197,7 +197,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'): DEFINES['MOZ_ENABLE_FREETYPE'] = True if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': - for var in ('MOZ_ENABLE_D3D9_LAYER', 'MOZ_ENABLE_D3D10_LAYER'): + for var in ('MOZ_ENABLE_D3D10_LAYER'): if CONFIG[var]: DEFINES[var] = True |