tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit b20c4113043b8a50ba7743d922ef48863cfcc7a9
parent 3f22e78e34249196edab0a5b756394169533b8a1
Author: Gregory Pappas <gp3033@protonmail.com>
Date:   Sat, 22 Nov 2025 18:44:13 +0000

Bug 2001783 - Expose gfx.compositor.gpu-migration pref to macOS only r=gfx-reviewers,lsalzman

Also simplify. In the past, gpu migration was enabled for Layers but disabled
for WebRender and could be force enabled with the third state of this pref.
Now there is only WebRender!

Differential Revision: https://phabricator.services.mozilla.com/D273711

Diffstat:
Mgfx/thebes/gfxPlatform.cpp | 10----------
Mgfx/thebes/gfxPlatform.h | 2--
Mmodules/libpref/init/StaticPrefList.yaml | 10++++------
Mwidget/cocoa/nsCocoaWindow.mm | 2+-
4 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp @@ -1238,16 +1238,6 @@ bool gfxPlatform::IsBackendAccelerated( return false; } -/* static */ -bool gfxPlatform::CanMigrateMacGPUs() { - int32_t pMigration = StaticPrefs::gfx_compositor_gpu_migration(); - - bool forceDisable = pMigration == 0; - bool forceEnable = pMigration == 2; - - return forceEnable || !forceDisable; -} - static bool sLayersIPCIsUp = false; /* static */ diff --git a/gfx/thebes/gfxPlatform.h b/gfx/thebes/gfxPlatform.h @@ -227,8 +227,6 @@ class gfxPlatform : public mozilla::layers::MemoryPressureListener { static bool IsBackendAccelerated( const mozilla::gfx::BackendType aBackendType); - static bool CanMigrateMacGPUs(); - /** * Create an offscreen surface of the given dimensions * and image format. diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml @@ -6917,16 +6917,14 @@ value: true # Match naive behavior, but hopefully we can stop soon! mirror: always +#ifdef XP_MACOSX # Whether GL contexts can be migrated to a different GPU (to match the one the # OS is using for composition). -# -# 0 = force disable migration -# 1 = use migration where in safe configurations (the default) -# 2 = force enable migration (for testing) - name: gfx.compositor.gpu-migration - type: RelaxedAtomicInt32 - value: 1 + type: RelaxedAtomicBool + value: true mirror: always +#endif #ifdef XP_DARWIN - name: gfx.core-animation.tint-opaque diff --git a/widget/cocoa/nsCocoaWindow.mm b/widget/cocoa/nsCocoaWindow.mm @@ -1170,7 +1170,7 @@ bool nsCocoaWindow::PreRender(WidgetRenderingContext* aContext) // composition is done, thus keeping the GL context locked forever. mCompositingLock.Lock(); - if (aContext->mGL && gfxPlatform::CanMigrateMacGPUs()) { + if (aContext->mGL && StaticPrefs::gfx_compositor_gpu_migration()) { GLContextCGL::Cast(aContext->mGL)->MigrateToActiveGPU(); }