diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
commit | def92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch) | |
tree | 2ef34b9ad8bb9a9220e05d60352558b15f513894 /dom/webgpu/CanvasContext.cpp | |
parent | Adding debian version 125.0.3-1. (diff) | |
download | firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/webgpu/CanvasContext.cpp')
-rw-r--r-- | dom/webgpu/CanvasContext.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/dom/webgpu/CanvasContext.cpp b/dom/webgpu/CanvasContext.cpp index 49f34196c4..46633d9160 100644 --- a/dom/webgpu/CanvasContext.cpp +++ b/dom/webgpu/CanvasContext.cpp @@ -10,6 +10,7 @@ #include "nsDisplayList.h" #include "mozilla/dom/HTMLCanvasElement.h" #include "mozilla/gfx/CanvasManagerChild.h" +#include "mozilla/gfx/gfxVars.h" #include "mozilla/layers/CanvasRenderer.h" #include "mozilla/layers/CompositableForwarder.h" #include "mozilla/layers/ImageDataSerializer.h" @@ -125,6 +126,17 @@ void CanvasContext::Configure(const dom::GPUCanvasConfiguration& aConfig) { mUseExternalTextureInSwapChain = wgpu_client_use_external_texture_in_swapChain( aConfig.mDevice->mId, ConvertTextureFormat(aConfig.mFormat)); + if (!gfx::gfxVars::AllowWebGPUPresentWithoutReadback()) { + mUseExternalTextureInSwapChain = false; + } +#ifdef XP_WIN + // When WebRender does not use hardware acceleration, disable external texture + // in swap chain. Since compositor device might not exist. + if (gfx::gfxVars::UseSoftwareWebRender() && + !gfx::gfxVars::AllowSoftwareWebRenderD3D11()) { + mUseExternalTextureInSwapChain = false; + } +#endif mTexture = aConfig.mDevice->InitSwapChain( mConfig.get(), mRemoteTextureOwnerId.ref(), mUseExternalTextureInSwapChain, mGfxFormat, mCanvasSize); @@ -143,7 +155,7 @@ void CanvasContext::Configure(const dom::GPUCanvasConfiguration& aConfig) { } void CanvasContext::Unconfigure() { - if (mBridge && mBridge->IsOpen() && mRemoteTextureOwnerId) { + if (mBridge && mBridge->CanSend() && mRemoteTextureOwnerId) { mBridge->SendSwapChainDrop( *mRemoteTextureOwnerId, layers::ToRemoteTextureTxnType(mFwdTransactionTracker), @@ -213,7 +225,7 @@ void CanvasContext::MaybeQueueSwapChainPresent() { Maybe<layers::SurfaceDescriptor> CanvasContext::SwapChainPresent() { mPendingSwapChainPresent = false; - if (!mBridge || !mBridge->IsOpen() || mRemoteTextureOwnerId.isNothing() || + if (!mBridge || !mBridge->CanSend() || mRemoteTextureOwnerId.isNothing() || !mTexture) { return Nothing(); } @@ -325,7 +337,7 @@ already_AddRefed<mozilla::gfx::SourceSurface> CanvasContext::GetSurfaceSnapshot( return nullptr; } - if (!mBridge || !mBridge->IsOpen() || mRemoteTextureOwnerId.isNothing()) { + if (!mBridge || !mBridge->CanSend() || mRemoteTextureOwnerId.isNothing()) { return nullptr; } |