From b57f879b5eb21607b3892a6cb29c48797513b921 Mon Sep 17 00:00:00 2001 From: Stanca Serban Date: Fri, 8 Dec 2023 11:00:31 +0200 Subject: [PATCH] Backed out changeset 54e35266f616 (bug 1866412) for causing bp-nu bustages in RenderD3D11TextureHost.cpp. CLOSED TREE --- dom/webgpu/ExternalTextureD3D11.cpp | 2 +- gfx/gl/SharedSurfaceANGLE.cpp | 3 +- gfx/gl/SharedSurfaceD3D11Interop.cpp | 3 +- gfx/ipc/FileHandleWrapper.cpp | 20 -- gfx/ipc/FileHandleWrapper.h | 61 ------ gfx/ipc/GfxMessageUtils.h | 58 ------ gfx/ipc/moz.build | 2 - gfx/layers/d3d11/FenceD3D11.cpp | 190 ------------------ gfx/layers/d3d11/FenceD3D11.h | 86 -------- gfx/layers/d3d11/TextureD3D11.cpp | 8 +- gfx/layers/d3d11/TextureD3D11.h | 6 - gfx/layers/d3d11/TextureHostWrapperD3D11.cpp | 8 +- gfx/layers/ipc/LayersSurfaces.ipdlh | 2 - gfx/layers/moz.build | 2 - .../RenderD3D11TextureHost.cpp | 21 +- .../RenderD3D11TextureHost.h | 15 +- 16 files changed, 14 insertions(+), 473 deletions(-) delete mode 100644 gfx/ipc/FileHandleWrapper.cpp delete mode 100644 gfx/ipc/FileHandleWrapper.h delete mode 100644 gfx/layers/d3d11/FenceD3D11.cpp delete mode 100644 gfx/layers/d3d11/FenceD3D11.h diff --git a/dom/webgpu/ExternalTextureD3D11.cpp b/dom/webgpu/ExternalTextureD3D11.cpp index e8e7533ba557..265ebe9d3093 100644 --- a/dom/webgpu/ExternalTextureD3D11.cpp +++ b/dom/webgpu/ExternalTextureD3D11.cpp @@ -85,7 +85,7 @@ Maybe ExternalTextureD3D11::ToSurfaceDescriptor() { /* gpuProcessTextureId */ Nothing(), /* arrayIndex */ 0, format, gfx::IntSize(mWidth, mHeight), gfx::ColorSpace2::SRGB, gfx::ColorRange::FULL, - /* hasKeyedMutex */ false, /* fenceInfo */ Nothing())); + /* hasKeyedMutex */ false)); } void ExternalTextureD3D11::GetSnapshot(const ipc::Shmem& aDestShmem, diff --git a/gfx/gl/SharedSurfaceANGLE.cpp b/gfx/gl/SharedSurfaceANGLE.cpp index 66eb68b6b5bf..321d74a2b533 100644 --- a/gfx/gl/SharedSurfaceANGLE.cpp +++ b/gfx/gl/SharedSurfaceANGLE.cpp @@ -172,8 +172,7 @@ SharedSurface_ANGLEShareHandle::ToSurfaceDescriptor() { return Some(layers::SurfaceDescriptorD3D10( (WindowsHandle)mShareHandle, /* gpuProcessTextureId */ Nothing(), /* arrayIndex */ 0, format, mDesc.size, mDesc.colorSpace, - gfx::ColorRange::FULL, /* hasKeyedMutex */ true, - /* fenceInfo */ Nothing())); + gfx::ColorRange::FULL, /* hasKeyedMutex */ true)); } //////////////////////////////////////////////////////////////////////////////// diff --git a/gfx/gl/SharedSurfaceD3D11Interop.cpp b/gfx/gl/SharedSurfaceD3D11Interop.cpp index 0a78dfe292d2..4d7d31f81137 100644 --- a/gfx/gl/SharedSurfaceD3D11Interop.cpp +++ b/gfx/gl/SharedSurfaceD3D11Interop.cpp @@ -444,8 +444,7 @@ SharedSurface_D3D11Interop::ToSurfaceDescriptor() { return Some(layers::SurfaceDescriptorD3D10( WindowsHandle(mData.dxgiHandle), /* gpuProcessTextureId */ Nothing(), /* arrayIndex */ 0, format, mDesc.size, mDesc.colorSpace, - gfx::ColorRange::FULL, /* hasKeyedMutex */ true, - /* fenceInfo */ Nothing())); + gfx::ColorRange::FULL, /* hasKeyedMutex */ true)); } ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/gfx/ipc/FileHandleWrapper.cpp b/gfx/ipc/FileHandleWrapper.cpp deleted file mode 100644 index b5c0fb3fa90c..000000000000 --- a/gfx/ipc/FileHandleWrapper.cpp +++ /dev/null @@ -1,20 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* 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/. */ - -#include "FileHandleWrapper.h" - -namespace mozilla::gfx { - -FileHandleWrapper::FileHandleWrapper(mozilla::UniqueFileHandle&& aHandle) - : mHandle(std::move(aHandle)) {} - -FileHandleWrapper::~FileHandleWrapper() {} - -mozilla::detail::FileHandleType FileHandleWrapper::GetHandle() { - return mHandle.get(); -} - -} // namespace mozilla::gfx diff --git a/gfx/ipc/FileHandleWrapper.h b/gfx/ipc/FileHandleWrapper.h deleted file mode 100644 index 09e2dd6ceab4..000000000000 --- a/gfx/ipc/FileHandleWrapper.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* 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/. */ - -#ifndef _include_gfx_ipc_FileHandleWrapper_h__ -#define _include_gfx_ipc_FileHandleWrapper_h__ - -#include "mozilla/UniquePtrExtensions.h" -#include "nsISupportsImpl.h" - -namespace mozilla { - -namespace ipc { -template -struct IPDLParamTraits; -} // namespace ipc - -namespace gfx { - -// -// A class for sharing file handle or shared handle among multiple clients. -// -// The file handles or the shared handles consume system resources. The class -// could reduce the number of shared handles in a process. -// -class FileHandleWrapper { - friend struct mozilla::ipc::IPDLParamTraits; - - public: - NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FileHandleWrapper); - - explicit FileHandleWrapper(mozilla::UniqueFileHandle&& aHandle); - - mozilla::detail::FileHandleType GetHandle(); - - protected: - ~FileHandleWrapper(); - - const mozilla::UniqueFileHandle mHandle; -}; - -struct FenceInfo { - FenceInfo() = default; - FenceInfo(FileHandleWrapper* aFenceHandle, uint64_t aFenceValue) - : mFenceHandle(aFenceHandle), mFenceValue(aFenceValue) {} - - bool operator==(const FenceInfo& aOther) const { - return mFenceHandle == aOther.mFenceHandle && - mFenceValue == aOther.mFenceValue; - } - - RefPtr mFenceHandle; - uint64_t mFenceValue = 0; -}; - -} // namespace gfx -} // namespace mozilla - -#endif // _include_gfx_ipc_FileHandleWrapper_h__ diff --git a/gfx/ipc/GfxMessageUtils.h b/gfx/ipc/GfxMessageUtils.h index 5375550bc7ba..93945387bfe3 100644 --- a/gfx/ipc/GfxMessageUtils.h +++ b/gfx/ipc/GfxMessageUtils.h @@ -21,7 +21,6 @@ #include "ipc/EnumSerializer.h" #include "ipc/IPCMessageUtilsSpecializations.h" #include "mozilla/gfx/CrossProcessPaint.h" -#include "mozilla/gfx/FileHandleWrapper.h" #include "mozilla/gfx/Matrix.h" #include "mozilla/gfx/ScaleFactor.h" #include "mozilla/gfx/ScaleFactors2D.h" @@ -29,9 +28,7 @@ #include "nsRect.h" #include "nsRegion.h" #include "mozilla/Array.h" -#include "mozilla/ipc/FileDescriptor.h" #include "mozilla/ipc/IPDLParamTraits.h" -#include "mozilla/ipc/ProtocolMessageUtils.h" #include "mozilla/ipc/ProtocolUtils.h" #include "mozilla/ipc/ShmemMessageUtils.h" @@ -1189,24 +1186,6 @@ struct ParamTraits { } }; -template <> -struct ParamTraits { - typedef mozilla::gfx::FenceInfo paramType; - - static void Write(MessageWriter* aWriter, const paramType& aParam) { - WriteParam(aWriter, aParam.mFenceHandle); - WriteParam(aWriter, aParam.mFenceValue); - } - - static bool Read(MessageReader* aReader, paramType* aResult) { - if (!ReadParam(aReader, &aResult->mFenceHandle) || - !ReadParam(aReader, &aResult->mFenceValue)) { - return false; - } - return true; - } -}; - } // namespace IPC namespace mozilla { @@ -1260,43 +1239,6 @@ struct IPDLParamTraits { } }; -template <> -struct IPDLParamTraits { - static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor, - gfx::FileHandleWrapper* aParam) { - if (!aParam) { - WriteIPDLParam(aWriter, aActor, false); - return; - } - WriteIPDLParam(aWriter, aActor, true); - - mozilla::ipc::FileDescriptor desc(aParam->GetHandle()); - WriteIPDLParam(aWriter, aActor, desc); - } - - static bool Read(IPC::MessageReader* aReader, IProtocol* aActor, - RefPtr* aResult) { - *aResult = nullptr; - bool notnull = false; - if (!ReadIPDLParam(aReader, aActor, ¬null)) { - return false; - } - - if (!notnull) { - return true; - } - - mozilla::ipc::FileDescriptor desc; - if (!ReadIPDLParam(aReader, aActor, &desc)) { - return false; - } - auto wrapper = - MakeRefPtr(desc.TakePlatformHandle()); - *aResult = std::move(wrapper); - return true; - } -}; - } // namespace ipc } // namespace mozilla diff --git a/gfx/ipc/moz.build b/gfx/ipc/moz.build index b8a52079e417..ab8fb34fcd1e 100644 --- a/gfx/ipc/moz.build +++ b/gfx/ipc/moz.build @@ -14,7 +14,6 @@ EXPORTS.mozilla.gfx += [ "CanvasManagerParent.h", "CanvasRenderThread.h", "CrossProcessPaint.h", - "FileHandleWrapper.h", "GPUChild.h", "GPUParent.h", "GPUProcessHost.h", @@ -46,7 +45,6 @@ UNIFIED_SOURCES += [ "CompositorWidgetVsyncObserver.cpp", "CrossProcessPaint.cpp", "D3DMessageUtils.cpp", - "FileHandleWrapper.cpp", "GPUChild.cpp", "GPUProcessHost.cpp", "GPUProcessImpl.cpp", diff --git a/gfx/layers/d3d11/FenceD3D11.cpp b/gfx/layers/d3d11/FenceD3D11.cpp deleted file mode 100644 index d300eab96512..000000000000 --- a/gfx/layers/d3d11/FenceD3D11.cpp +++ /dev/null @@ -1,190 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* 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/. */ - -#include "FenceD3D11.h" - -#include -#include -#include - -#include "mozilla/gfx/Logging.h" - -namespace mozilla { -namespace layers { - -RefPtr mDevice; - -/* static */ -RefPtr FenceD3D11::Create(ID3D11Device* aDevice) { - MOZ_ASSERT(aDevice); - - if (!aDevice) { - return nullptr; - } - - RefPtr d3d11_5; - auto hr = - aDevice->QueryInterface(__uuidof(ID3D11Device5), getter_AddRefs(d3d11_5)); - if (FAILED(hr)) { - gfxCriticalNoteOnce << "Failed to get ID3D11Device5: " << gfx::hexa(hr); - return nullptr; - } - - RefPtr fenceD3D11; - d3d11_5->CreateFence(0, D3D11_FENCE_FLAG_SHARED, - IID_PPV_ARGS((ID3D11Fence**)getter_AddRefs(fenceD3D11))); - if (FAILED(hr)) { - gfxCriticalNoteOnce << "Fence creation failed: " << gfx::hexa(hr); - return nullptr; - } - - HANDLE sharedHandle = nullptr; - hr = fenceD3D11->CreateSharedHandle(nullptr, GENERIC_ALL, nullptr, - &sharedHandle); - if (FAILED(hr)) { - gfxCriticalNoteOnce << "Fence shared handle creation failed " - << gfx::hexa(hr); - return nullptr; - } - - RefPtr handle = - new gfx::FileHandleWrapper(UniqueFileHandle(sharedHandle)); - RefPtr fence = new FenceD3D11(handle); - fence->mDevice = aDevice; - fence->mSignalFence = fenceD3D11; - - return fence; -} - -/* static */ -RefPtr FenceD3D11::CreateFromHandle( - RefPtr aHandle) { - // Opening shared handle is deferred. - return new FenceD3D11(aHandle); -} - -/* static */ -bool FenceD3D11::IsSupported(ID3D11Device* aDevice) { - RefPtr d3d11_5; - auto hr = - aDevice->QueryInterface(__uuidof(ID3D11Device5), getter_AddRefs(d3d11_5)); - if (FAILED(hr)) { - return false; - } - return true; -} - -FenceD3D11::FenceD3D11(RefPtr& aHandle) - : mHandle(aHandle) { - MOZ_ASSERT(mHandle); -} - -FenceD3D11::~FenceD3D11() {} - -gfx::FenceInfo FenceD3D11::GetFenceInfo() const { - return gfx::FenceInfo(mHandle, mFenceValue); -} - -bool FenceD3D11::IncrementAndSignal() { - MOZ_ASSERT(mDevice); - MOZ_ASSERT(mSignalFence); - - if (!mDevice || !mSignalFence) { - return false; - } - - RefPtr context; - mDevice->GetImmediateContext(getter_AddRefs(context)); - RefPtr context4; - auto hr = context->QueryInterface(__uuidof(ID3D11DeviceContext4), - getter_AddRefs(context4)); - if (FAILED(hr)) { - gfxCriticalNoteOnce << "Failed to get D3D11DeviceContext4: " - << gfx::hexa(hr); - return false; - } - - hr = context4->Signal(mSignalFence, mFenceValue + 1); - if (FAILED(hr)) { - gfxCriticalNoteOnce << "Signal fence failed: " << gfx::hexa(hr); - return false; - } - - mFenceValue++; - return true; -} - -void FenceD3D11::Update(uint64_t aFenceValue) { - MOZ_ASSERT(!mDevice); - MOZ_ASSERT(!mSignalFence); - - if (mFenceValue > aFenceValue) { - MOZ_ASSERT_UNREACHABLE("unexpected to be called"); - return; - } - mFenceValue = aFenceValue; -} - -bool FenceD3D11::Wait(ID3D11Device* aDevice) { - MOZ_ASSERT(aDevice); - - if (!aDevice) { - return false; - } - - // Skip wait if passed device is the same as signaling device. - if (mDevice == aDevice) { - return true; - } - - RefPtr fence; - auto it = mWaitFenceMap.find(aDevice); - if (it == mWaitFenceMap.end()) { - RefPtr d3d11_5; - auto hr = aDevice->QueryInterface(__uuidof(ID3D11Device5), - getter_AddRefs(d3d11_5)); - if (FAILED(hr)) { - gfxCriticalNoteOnce << "Failed to get ID3D11Device5: " << gfx::hexa(hr); - return false; - } - hr = d3d11_5->OpenSharedFence(mHandle->GetHandle(), __uuidof(ID3D11Fence), - (void**)(ID3D11Fence**)getter_AddRefs(fence)); - if (FAILED(hr)) { - gfxCriticalNoteOnce << "Opening fence shared handle failed " - << gfx::hexa(hr); - return false; - } - mWaitFenceMap.emplace(aDevice, fence); - } else { - fence = it->second; - } - - if (!fence) { - MOZ_ASSERT_UNREACHABLE("unexpected to be called"); - return false; - } - - RefPtr context; - aDevice->GetImmediateContext(getter_AddRefs(context)); - RefPtr context4; - auto hr = context->QueryInterface(__uuidof(ID3D11DeviceContext4), - getter_AddRefs(context4)); - if (FAILED(hr)) { - gfxCriticalNoteOnce << "Failed to get D3D11DeviceContext4: " - << gfx::hexa(hr); - return false; - } - hr = context4->Wait(fence, mFenceValue); - if (FAILED(hr)) { - gfxCriticalNoteOnce << "Failed to wait fence: " << gfx::hexa(hr); - return false; - } - - return true; -} - -} // namespace layers -} // namespace mozilla diff --git a/gfx/layers/d3d11/FenceD3D11.h b/gfx/layers/d3d11/FenceD3D11.h deleted file mode 100644 index 19037bc0ce61..000000000000 --- a/gfx/layers/d3d11/FenceD3D11.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* 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/. */ - -#ifndef MOZILLA_GFX_FenceD3D11_H -#define MOZILLA_GFX_FenceD3D11_H - -#include - -#include "mozilla/gfx/FileHandleWrapper.h" -#include "nsISupportsImpl.h" - -struct ID3D11Device; -struct ID3D11Fence; - -namespace mozilla { - -namespace layers { - -// -// A class for wrapping ID3D11Fence. -// -// The class can be used for singaling fence and waiting fence. When the class -// is created by Create(), it can be used for singaling fence and waiting -// fence. When the class is created by CreateFromHandle() it can be used only -// for waiting fence. -// -// There is a case that ID3D12Fence is used for fence signaling. In this case, -// the class can be used for waitng fence by using CreateFromHandle(). -// -// IncrementAndSignal() is used for signaling fence. The fence will be updated -// after all previous work has completed. -// -// For waiting fence, Update() is used to update the target value of the -// waiting. Wait() is then used to wait for the fence. -// -class FenceD3D11 final { - public: - NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FenceD3D11); - - static RefPtr Create(ID3D11Device* aDevice); - static RefPtr CreateFromHandle( - RefPtr aHandle); - - // Check if ID3D11Device suppors ID3D11Fence creation. - static bool IsSupported(ID3D11Device* aDevice); - - // Updates mSignalFence to incremented value after all previous work has - // completed. Used only when FenceD3D11 is created by FenceD3D11::Create(). - bool IncrementAndSignal(); - - // Update FenceValue to the specified value. - // Used only when FenceD3D11 is created by FenceD3D11::CreateFromHandle(). - void Update(uint64_t aFenceValue); - - // Wait for fence until it reaches or exceeds mFenceValue. - bool Wait(ID3D11Device* aDevice); - - uint64_t GetFenceValue() const { return mFenceValue; } - - gfx::FenceInfo GetFenceInfo() const; - - const RefPtr mHandle; - - protected: - explicit FenceD3D11(RefPtr& aHandle); - ~FenceD3D11(); - - // Device that is used for creating mSignalFence. - RefPtr mDevice; - // Fence that is used for updating fence value. - // Valid only when created with FenceD3D11::Create(). - RefPtr mSignalFence; - uint64_t mFenceValue = 0; - // Fences that are used for waiting. - // They are opened for each D3D11 device that the fence is waited on. - // XXX change to LRU cache - std::unordered_map> mWaitFenceMap; -}; - -} // namespace layers -} // namespace mozilla - -#endif // MOZILLA_GFX_FenceD3D11_H diff --git a/gfx/layers/d3d11/TextureD3D11.cpp b/gfx/layers/d3d11/TextureD3D11.cpp index e4bf3bb507bc..482f44e4b037 100644 --- a/gfx/layers/d3d11/TextureD3D11.cpp +++ b/gfx/layers/d3d11/TextureD3D11.cpp @@ -403,8 +403,7 @@ bool D3D11TextureData::SerializeSpecific( } *aOutDesc = SurfaceDescriptorD3D10( (WindowsHandle)sharedHandle, mGpuProcessTextureId, mArrayIndex, mFormat, - mSize, mColorSpace, mColorRange, /* hasKeyedMutex */ mHasKeyedMutex, - /* fenceInfo */ Nothing()); + mSize, mColorSpace, mColorRange, /* hasKeyedMutex */ mHasKeyedMutex); return true; } @@ -762,9 +761,6 @@ DXGITextureHostD3D11::DXGITextureHostD3D11( mHandle((HANDLE)aDescriptor.handle()), mFormat(aDescriptor.format()), mHasKeyedMutex(aDescriptor.hasKeyedMutex()), - mAcquireFenceInfo(aDescriptor.fenceInfo().isSome() - ? aDescriptor.fenceInfo().ref() - : gfx::FenceInfo()), mColorSpace(aDescriptor.colorSpace()), mColorRange(aDescriptor.colorRange()), mIsLocked(false) {} @@ -916,7 +912,7 @@ void DXGITextureHostD3D11::CreateRenderTexture( RefPtr texture = new wr::RenderDXGITextureHost( mHandle, mGpuProcessTextureId, mArrayIndex, mFormat, mColorSpace, - mColorRange, mSize, mHasKeyedMutex, mAcquireFenceInfo); + mColorRange, mSize, mHasKeyedMutex); if (mFlags & TextureFlags::SOFTWARE_DECODED_VIDEO) { texture->SetIsSoftwareDecodedVideo(); } diff --git a/gfx/layers/d3d11/TextureD3D11.h b/gfx/layers/d3d11/TextureD3D11.h index 9be423399ab1..8b1e1fcac7a9 100644 --- a/gfx/layers/d3d11/TextureD3D11.h +++ b/gfx/layers/d3d11/TextureD3D11.h @@ -23,11 +23,6 @@ #include "mozilla/layers/TextureHost.h" namespace mozilla { - -namespace gfx { -struct FenceInfo; -} - namespace gl { class GLBlitHelper; } @@ -389,7 +384,6 @@ class DXGITextureHostD3D11 : public TextureHost { HANDLE mHandle; gfx::SurfaceFormat mFormat; bool mHasKeyedMutex; - gfx::FenceInfo mAcquireFenceInfo; public: const gfx::ColorSpace2 mColorSpace; diff --git a/gfx/layers/d3d11/TextureHostWrapperD3D11.cpp b/gfx/layers/d3d11/TextureHostWrapperD3D11.cpp index 439950aaf4e8..067935a78242 100644 --- a/gfx/layers/d3d11/TextureHostWrapperD3D11.cpp +++ b/gfx/layers/d3d11/TextureHostWrapperD3D11.cpp @@ -244,10 +244,10 @@ RefPtr TextureHostWrapperD3D11::CreateFromBufferTexture( auto colorSpace = ToColorSpace2(bufferTexture->GetYUVColorSpace()); - auto descD3D10 = SurfaceDescriptorD3D10( - WindowsHandle(nullptr), Some(id), - /* arrayIndex */ 0, gfx::SurfaceFormat::NV12, size, colorSpace, - colorRange, /* hasKeyedMutex */ false, /* fenceInfo */ Nothing()); + auto descD3D10 = + SurfaceDescriptorD3D10(WindowsHandle(nullptr), Some(id), + /* arrayIndex */ 0, gfx::SurfaceFormat::NV12, size, + colorSpace, colorRange, /* hasKeyedMutex */ false); RefPtr textureHostD3D11 = new DXGITextureHostD3D11(flags, descD3D10); diff --git a/gfx/layers/ipc/LayersSurfaces.ipdlh b/gfx/layers/ipc/LayersSurfaces.ipdlh index eee05dfc2acd..2a541ce31959 100644 --- a/gfx/layers/ipc/LayersSurfaces.ipdlh +++ b/gfx/layers/ipc/LayersSurfaces.ipdlh @@ -20,7 +20,6 @@ using mozilla::gfx::SurfaceFormat from "mozilla/gfx/Types.h"; using mozilla::gfx::IntRect from "mozilla/gfx/Rect.h"; using mozilla::gfx::IntSize from "mozilla/gfx/Point.h"; using mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h"; -using mozilla::gfx::FenceInfo from "mozilla/gfx/FileHandleWrapper.h"; [MoveOnly] using mozilla::ipc::SharedMemoryBasic::Handle from "mozilla/ipc/SharedMemoryBasic.h"; using gfxImageFormat from "gfxTypes.h"; using mozilla::layers::MaybeVideoBridgeSource from "mozilla/layers/VideoBridgeUtils.h"; @@ -40,7 +39,6 @@ namespace layers { ColorSpace2 colorSpace; ColorRange colorRange; bool hasKeyedMutex; - FenceInfo? fenceInfo; }; [Comparable] struct SurfaceDescriptorDXGIYCbCr { diff --git a/gfx/layers/moz.build b/gfx/layers/moz.build index a2ba02bc94af..8caa6d9cf331 100644 --- a/gfx/layers/moz.build +++ b/gfx/layers/moz.build @@ -38,7 +38,6 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": EXPORTS.mozilla.layers += [ "d3d11/CompositorD3D11.h", "d3d11/DeviceAttachmentsD3D11.h", - "d3d11/FenceD3D11.h", "d3d11/GpuProcessD3D11TextureMap.h", "d3d11/HelpersD3D11.h", "d3d11/ShaderDefinitionsD3D11.h", @@ -46,7 +45,6 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": "d3d11/TextureHostWrapperD3D11.h", ] UNIFIED_SOURCES += [ - "d3d11/FenceD3D11.cpp", "d3d11/GpuProcessD3D11TextureMap.cpp", "d3d11/TextureD3D11.cpp", "d3d11/TextureHostWrapperD3D11.cpp", diff --git a/gfx/webrender_bindings/RenderD3D11TextureHost.cpp b/gfx/webrender_bindings/RenderD3D11TextureHost.cpp index cab49d60dfd9..971a4c5b28a2 100644 --- a/gfx/webrender_bindings/RenderD3D11TextureHost.cpp +++ b/gfx/webrender_bindings/RenderD3D11TextureHost.cpp @@ -15,7 +15,6 @@ #include "mozilla/DebugOnly.h" #include "mozilla/gfx/CanvasManagerParent.h" #include "mozilla/gfx/Logging.h" -#include "mozilla/layers/FenceD3D11.h" #include "mozilla/layers/GpuProcessD3D11TextureMap.h" #include "mozilla/layers/TextureD3D11.h" @@ -26,7 +25,7 @@ RenderDXGITextureHost::RenderDXGITextureHost( HANDLE aHandle, Maybe& aGpuProcessTextureId, uint32_t aArrayIndex, gfx::SurfaceFormat aFormat, gfx::ColorSpace2 aColorSpace, gfx::ColorRange aColorRange, - gfx::IntSize aSize, bool aHasKeyedMutex, gfx::FenceInfo& aAcquireFenceInfo) + gfx::IntSize aSize, bool aHasKeyedMutex) : mHandle(aHandle), mGpuProcessTextureId(aGpuProcessTextureId), mArrayIndex(aArrayIndex), @@ -38,7 +37,6 @@ RenderDXGITextureHost::RenderDXGITextureHost( mColorRange(aColorRange), mSize(aSize), mHasKeyedMutex(aHasKeyedMutex), - mAcquireFenceInfo(aAcquireFenceInfo), mLocked(false) { MOZ_COUNT_CTOR_INHERITED(RenderDXGITextureHost, RenderTextureHost); MOZ_ASSERT((mFormat != gfx::SurfaceFormat::NV12 && @@ -358,20 +356,6 @@ wr::WrExternalImage RenderDXGITextureHost::Lock(uint8_t aChannelIndex, bool RenderDXGITextureHost::LockInternal() { if (!mLocked) { - if (mAcquireFenceInfo.mFenceHandle) { - if (!mAcquireFence) { - mAcquireFence = layers::FenceD3D11::CreateFromHandle( - mAcquireFenceInfo.mFenceHandle); - } - if (mAcquireFence) { - MOZ_ASSERT(mAcquireFenceInfo.mFenceHandle == mAcquireFence->mHandle); - - mAcquireFence->Update(mAcquireFenceInfo.mFenceValue); - RefPtr d3d11Device = - gfx::DeviceManagerDx::Get()->GetCompositorDevice(); - mAcquireFence->Wait(d3d11Device); - } - } if (mKeyedMutex) { HRESULT hr = mKeyedMutex->AcquireSync(0, 10000); if (hr != S_OK) { @@ -457,8 +441,7 @@ gfx::IntSize RenderDXGITextureHost::GetSize(uint8_t aChannelIndex) const { } bool RenderDXGITextureHost::SyncObjectNeeded() { - return mGpuProcessTextureId.isNothing() && - (!mHasKeyedMutex || !mAcquireFenceInfo.mFenceHandle); + return mGpuProcessTextureId.isNothing() && !mHasKeyedMutex; } RenderDXGIYCbCrTextureHost::RenderDXGIYCbCrTextureHost( diff --git a/gfx/webrender_bindings/RenderD3D11TextureHost.h b/gfx/webrender_bindings/RenderD3D11TextureHost.h index 5226f96acc78..b76ed1fcd095 100644 --- a/gfx/webrender_bindings/RenderD3D11TextureHost.h +++ b/gfx/webrender_bindings/RenderD3D11TextureHost.h @@ -7,21 +7,16 @@ #ifndef MOZILLA_GFX_RENDERD3D11TEXTUREHOST_H #define MOZILLA_GFX_RENDERD3D11TEXTUREHOST_H -#include - #include "GLTypes.h" -#include "mozilla/gfx/FileHandleWrapper.h" #include "RenderTextureHostSWGL.h" +#include + struct ID3D11Texture2D; struct IDXGIKeyedMutex; namespace mozilla { -namespace layers { -class FenceD3D11; -} // namespace layers - namespace wr { class RenderDXGITextureHost final : public RenderTextureHostSWGL { @@ -29,8 +24,7 @@ class RenderDXGITextureHost final : public RenderTextureHostSWGL { RenderDXGITextureHost( HANDLE aHandle, Maybe& aGpuProcessTextureId, uint32_t aArrayIndex, gfx::SurfaceFormat aFormat, gfx::ColorSpace2, - gfx::ColorRange aColorRange, gfx::IntSize aSize, bool aHasKeyedMutex, - gfx::FenceInfo& aAcquireFenceInfo); + gfx::ColorRange aColorRange, gfx::IntSize aSize, bool aHasKeyedMutex); wr::WrExternalImage Lock(uint8_t aChannelIndex, gl::GLContext* aGL) override; void Unlock() override; @@ -119,15 +113,12 @@ class RenderDXGITextureHost final : public RenderTextureHostSWGL { bool mIsSoftwareDecodedVideo = false; - RefPtr mAcquireFence; - public: const gfx::SurfaceFormat mFormat; const gfx::ColorSpace2 mColorSpace; const gfx::ColorRange mColorRange; const gfx::IntSize mSize; const bool mHasKeyedMutex; - const gfx::FenceInfo mAcquireFenceInfo; private: bool mLocked;