Bug 1692894 p1: Don't create devices for canvas when remote canvas is in use. r=jrmuizel
This also adds related DLLs to be delay loaded to xul's moz.build. This means that if we don't create the devices they are not loaded at all. Differential Revision: https://phabricator.services.mozilla.com/D105630
This commit is contained in:
@@ -125,10 +125,16 @@ already_AddRefed<DrawTarget> LayerManager::CreateDrawTarget(
|
||||
already_AddRefed<PersistentBufferProvider>
|
||||
LayerManager::CreatePersistentBufferProvider(
|
||||
const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat) {
|
||||
RefPtr<PersistentBufferProviderBasic> bufferProvider =
|
||||
PersistentBufferProviderBasic::Create(
|
||||
RefPtr<PersistentBufferProviderBasic> bufferProvider;
|
||||
// If we are using remote canvas we don't want to use acceleration in
|
||||
// non-remote layer managers, so we always use the fallback software one.
|
||||
if (!gfxPlatform::UseRemoteCanvas() ||
|
||||
!gfxPlatform::IsBackendAccelerated(
|
||||
gfxPlatform::GetPlatform()->GetPreferredCanvasBackend())) {
|
||||
bufferProvider = PersistentBufferProviderBasic::Create(
|
||||
aSize, aFormat,
|
||||
gfxPlatform::GetPlatform()->GetPreferredCanvasBackend());
|
||||
}
|
||||
|
||||
if (!bufferProvider) {
|
||||
bufferProvider = PersistentBufferProviderBasic::Create(
|
||||
|
||||
@@ -343,11 +343,7 @@ TextureType PreferredCanvasTextureType(KnowsCompositor* aKnowsCompositor) {
|
||||
|
||||
static bool ShouldRemoteTextureType(TextureType aTextureType,
|
||||
BackendSelector aSelector) {
|
||||
if (!XRE_IsContentProcess()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aSelector != BackendSelector::Canvas || !gfxVars::RemoteCanvasEnabled()) {
|
||||
if (aSelector != BackendSelector::Canvas || !gfxPlatform::UseRemoteCanvas()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -742,9 +742,11 @@ void WebRenderLayerManager::SetRoot(Layer* aLayer) {
|
||||
already_AddRefed<PersistentBufferProvider>
|
||||
WebRenderLayerManager::CreatePersistentBufferProvider(
|
||||
const gfx::IntSize& aSize, gfx::SurfaceFormat aFormat) {
|
||||
// Ensure devices initialization for canvas 2d. The devices are lazily
|
||||
// initialized with WebRender to reduce memory usage.
|
||||
// Ensure devices initialization for canvas 2d if not remote. The devices are
|
||||
// lazily initialized with WebRender to reduce memory usage.
|
||||
if (!gfxPlatform::UseRemoteCanvas()) {
|
||||
gfxPlatform::GetPlatform()->EnsureDevicesInitialized();
|
||||
}
|
||||
|
||||
RefPtr<PersistentBufferProvider> provider =
|
||||
PersistentBufferProviderShared::Create(aSize, aFormat,
|
||||
|
||||
@@ -1202,6 +1202,18 @@ bool gfxPlatform::IsHeadless() {
|
||||
/* static */
|
||||
bool gfxPlatform::UseWebRender() { return gfx::gfxVars::UseWebRender(); }
|
||||
|
||||
/* static */
|
||||
bool gfxPlatform::UseRemoteCanvas() {
|
||||
return XRE_IsContentProcess() && gfx::gfxVars::RemoteCanvasEnabled();
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool gfxPlatform::IsBackendAccelerated(
|
||||
const mozilla::gfx::BackendType aBackendType) {
|
||||
return aBackendType == BackendType::DIRECT2D ||
|
||||
aBackendType == BackendType::DIRECT2D1_1;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool gfxPlatform::CanMigrateMacGPUs() {
|
||||
int32_t pMigration = StaticPrefs::gfx_compositor_gpu_migration();
|
||||
@@ -1670,11 +1682,18 @@ already_AddRefed<DrawTarget> gfxPlatform::CreateDrawTargetForBackend(
|
||||
already_AddRefed<DrawTarget> gfxPlatform::CreateOffscreenCanvasDrawTarget(
|
||||
const IntSize& aSize, SurfaceFormat aFormat) {
|
||||
NS_ASSERTION(mPreferredCanvasBackend != BackendType::NONE, "No backend.");
|
||||
|
||||
// If we are using remote canvas we don't want to use acceleration in
|
||||
// canvas DrawTargets we are not remoting, so we always use the fallback
|
||||
// software one.
|
||||
if (!gfxPlatform::UseRemoteCanvas() ||
|
||||
!gfxPlatform::IsBackendAccelerated(mPreferredCanvasBackend)) {
|
||||
RefPtr<DrawTarget> target =
|
||||
CreateDrawTargetForBackend(mPreferredCanvasBackend, aSize, aFormat);
|
||||
if (target || mFallbackCanvasBackend == BackendType::NONE) {
|
||||
return target.forget();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
// On Windows, the fallback backend (Cairo) should use its image backend.
|
||||
|
||||
@@ -230,6 +230,11 @@ class gfxPlatform : public mozilla::layers::MemoryPressureListener {
|
||||
|
||||
static bool UseWebRender();
|
||||
|
||||
static bool UseRemoteCanvas();
|
||||
|
||||
static bool IsBackendAccelerated(
|
||||
const mozilla::gfx::BackendType aBackendType);
|
||||
|
||||
static bool CanMigrateMacGPUs();
|
||||
|
||||
/**
|
||||
|
||||
@@ -467,13 +467,18 @@ void gfxWindowsPlatform::UpdateBackendPrefs() {
|
||||
BackendPrefsData data = GetBackendPrefs();
|
||||
// Remove DIRECT2D1 preference if D2D1Device does not exist.
|
||||
if (!Factory::HasD2D1Device()) {
|
||||
data.mCanvasBitmask &= ~BackendTypeBit(BackendType::DIRECT2D1_1);
|
||||
data.mContentBitmask &= ~BackendTypeBit(BackendType::DIRECT2D1_1);
|
||||
if (data.mContentDefault == BackendType::DIRECT2D1_1) {
|
||||
data.mContentDefault = BackendType::SKIA;
|
||||
}
|
||||
|
||||
// Don't exclude DIRECT2D1_1 if using remote canvas, because DIRECT2D1_1 and
|
||||
// hence the device will be used in the GPU process.
|
||||
if (!gfxPlatform::UseRemoteCanvas()) {
|
||||
data.mCanvasBitmask &= ~BackendTypeBit(BackendType::DIRECT2D1_1);
|
||||
if (data.mCanvasDefault == BackendType::DIRECT2D1_1) {
|
||||
data.mCanvasDefault = BackendType::SKIA;
|
||||
}
|
||||
if (data.mContentDefault == BackendType::DIRECT2D1_1) {
|
||||
data.mContentDefault = BackendType::SKIA;
|
||||
}
|
||||
}
|
||||
InitBackendPrefs(std::move(data));
|
||||
|
||||
@@ -5,7 +5,7 @@ random == bug-364968.html bug-364968-ref.html
|
||||
== mozsetimageelement-02.html about:blank
|
||||
== image-outside-document-invalidate.html about:blank
|
||||
== canvas-outside-document-invalidate-01.html about:blank
|
||||
fails-if(azureSkia&&!(webrender&&winWidget)) fails-if(cocoaWidget) == canvas-outside-document-invalidate-02.html about:blank # See bug 666800
|
||||
fails-if(azureSkia&&!(webrender&&winWidget)) fails-if(cocoaWidget) fails-if(remoteCanvas&&swgl&&winWidget) == canvas-outside-document-invalidate-02.html about:blank # See bug 666800
|
||||
#fails with Skia due to Skia bug http://code.google.com/p/skia/issues/detail?id=568
|
||||
fuzzy-if(webrender&&winWidget,117-129,47-54) == element-paint-simple.html element-paint-simple-ref.html
|
||||
== element-paint-repeated.html element-paint-repeated-ref.html
|
||||
|
||||
@@ -46,7 +46,7 @@ fuzzy(0-1,0-2) fuzzy-if(skiaContent&&!remoteCanvas,0-1,0-529) fuzzy-if(remoteCan
|
||||
|
||||
fuzzy-if(winWidget,0-1,0-10000) fuzzy-if(azureSkia,0-1,0-10000) fuzzy-if(Android,0-1,0-10000) == canvas-drawImage-alpha-1.html canvas-drawImage-alpha-1-ref.html
|
||||
#Same as scale-2a but with globalAlpha:
|
||||
fuzzy(0-1,0-2) fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu),0-1,0-7018) fuzzy-if(azureSkia,0-1,0-40000) fuzzy-if(webrender&&winWidget&&!remoteCanvas,1-1,32679-39838) fuzzy-if(remoteCanvas&&webrender,1-73,32679-40000) == canvas-drawImage-alpha-2.html canvas-drawImage-alpha-2-ref.html
|
||||
fuzzy(0-1,0-2) fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu),0-1,0-7018) fuzzy-if(azureSkia,0-1,0-40000) fuzzy-if(webrender&&winWidget&&!remoteCanvas,1-1,32679-39838) fuzzy-if(remoteCanvas&&webrender&&!swgl,1-73,32679-40000) == canvas-drawImage-alpha-2.html canvas-drawImage-alpha-2-ref.html
|
||||
|
||||
== canvas-drawImage-slice-1a.html lime100x100-ref.html
|
||||
== canvas-drawImage-slice-1b.html lime100x100-ref.html
|
||||
|
||||
@@ -407,7 +407,7 @@ fuzzy-if(skiaContent||webrender,0-72,0-1255) == pattern-transformed-01.svg patte
|
||||
|
||||
== radialGradient-basic-01.svg pass.svg
|
||||
== radialGradient-basic-02.svg pass.svg
|
||||
fuzzy(0-1,0-2) fuzzy-if(winWidget,0-32,0-223) fuzzy-if(winWidget&&webrender,96-96,21684-21684) == radialGradient-basic-03.svg radialGradient-basic-03-ref.html
|
||||
fuzzy(0-1,0-2) fuzzy-if(winWidget,0-32,0-223) fuzzy-if(winWidget&&webrender&&!swgl,96-96,21684-21684) == radialGradient-basic-03.svg radialGradient-basic-03-ref.html
|
||||
== radialGradient-basic-04.svg pass.svg
|
||||
== radialGradient-fr-01.svg pass.svg
|
||||
fuzzy(0-1,0-3235) fuzzy-if(winWidget,0-1,0-7030) == radialGradient-fr-02.svg radialGradient-fr-02-ref.svg
|
||||
|
||||
@@ -27,6 +27,9 @@ def Libxul(name, output_category=None):
|
||||
DELAYLOAD_DLLS += [
|
||||
"comdlg32.dll",
|
||||
"credui.dll",
|
||||
"d3d11.dll",
|
||||
"D3DCompiler_47.dll",
|
||||
"dxgi.dll",
|
||||
"hid.dll",
|
||||
"msimg32.dll",
|
||||
"netapi32.dll",
|
||||
|
||||
Reference in New Issue
Block a user