From 90f11a9082d457b19346c6f9ca3de332b1f22e1f Mon Sep 17 00:00:00 2001 From: Andrew Osmond Date: Thu, 15 Oct 2020 03:41:46 +0000 Subject: [PATCH] Bug 1668575 - Disable DMABUF with software WebRender. r=mattwoodrow Differential Revision: https://phabricator.services.mozilla.com/D93623 --- gfx/layers/CanvasRenderer.cpp | 6 ++++++ gfx/layers/client/TextureClient.cpp | 6 +++--- gfx/layers/ipc/KnowsCompositor.h | 4 ++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/gfx/layers/CanvasRenderer.cpp b/gfx/layers/CanvasRenderer.cpp index 74c86345c432..561d8dc14c8f 100644 --- a/gfx/layers/CanvasRenderer.cpp +++ b/gfx/layers/CanvasRenderer.cpp @@ -112,9 +112,15 @@ TextureType TexTypeForWebgl(KnowsCompositor* const knowsCompositor) { return TextureType::MacIOSurface; } if (kIsWayland) { + if (knowsCompositor->UsingSoftwareWebRender()) { + return TextureType::Unknown; + } return TextureType::DMABUF; } if (kIsX11) { + if (knowsCompositor->UsingSoftwareWebRender()) { + return TextureType::Unknown; + } return TextureType::X11; } if (kIsAndroid) { diff --git a/gfx/layers/client/TextureClient.cpp b/gfx/layers/client/TextureClient.cpp index 6dcc186b4583..bea53cb9b8e3 100644 --- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -274,8 +274,7 @@ static TextureType GetTextureType(gfx::SurfaceFormat aFormat, int32_t maxTextureSize = aKnowsCompositor->GetMaxTextureSize(); if ((layersBackend == LayersBackend::LAYERS_D3D11 || (layersBackend == LayersBackend::LAYERS_WR && - !aKnowsCompositor->GetTextureFactoryIdentifier() - .mUsingSoftwareWebRender)) && + !aKnowsCompositor->UsingSoftwareWebRender())) && (moz2DBackend == gfx::BackendType::DIRECT2D || moz2DBackend == gfx::BackendType::DIRECT2D1_1 || (!!(aAllocFlags & ALLOC_FOR_OUT_OF_BAND_CONTENT))) && @@ -293,7 +292,8 @@ static TextureType GetTextureType(gfx::SurfaceFormat aFormat, #ifdef MOZ_WAYLAND if ((layersBackend == LayersBackend::LAYERS_OPENGL || - layersBackend == LayersBackend::LAYERS_WR) && + (layersBackend == LayersBackend::LAYERS_WR && + !aKnowsCompositor->UsingSoftwareWebRender())) && gfxPlatformGtk::GetPlatform()->UseDMABufTextures() && aFormat != SurfaceFormat::A8) { return TextureType::DMABUF; diff --git a/gfx/layers/ipc/KnowsCompositor.h b/gfx/layers/ipc/KnowsCompositor.h index 6d7e9b677a4a..59d33b1a782a 100644 --- a/gfx/layers/ipc/KnowsCompositor.h +++ b/gfx/layers/ipc/KnowsCompositor.h @@ -117,6 +117,10 @@ class KnowsCompositor { return mTextureFactoryIdentifier.mUseCompositorWnd; } + bool UsingSoftwareWebRender() const { + return mTextureFactoryIdentifier.mUsingSoftwareWebRender; + } + const TextureFactoryIdentifier& GetTextureFactoryIdentifier() const { return mTextureFactoryIdentifier; }