From 99b56e9be6cb567b47a075b0e9a98d07f95aeef5 Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Tue, 12 Jul 2022 06:56:20 +0000 Subject: [PATCH] Bug 1777426 - Add gfx.canvas.accelerated.async-present for toggling async present with Canvas2D independent of WebGL. r=aosmond Differential Revision: https://phabricator.services.mozilla.com/D150881 --- dom/canvas/DrawTargetWebgl.cpp | 3 +++ modules/libpref/init/StaticPrefList.yaml | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/dom/canvas/DrawTargetWebgl.cpp b/dom/canvas/DrawTargetWebgl.cpp index d024a734d0aa..0b9e386f6206 100644 --- a/dom/canvas/DrawTargetWebgl.cpp +++ b/dom/canvas/DrawTargetWebgl.cpp @@ -2926,6 +2926,9 @@ Maybe DrawTargetWebgl::GetFrontBuffer() { // Copy and swizzle the WebGL framebuffer to the swap chain front buffer. webgl::SwapChainOptions options; options.bgra = true; + // Allow async present to be toggled on for accelerated Canvas2D independent + // of WebGL via pref. + options.forceAsyncPresent = StaticPrefs::gfx_canvas_accelerated_async_present(); mSharedContext->mWebgl->CopyToSwapChain(mFramebuffer, options); } } diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 66ba0440f939..ae95e1eb8fa3 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -5250,6 +5250,11 @@ #endif mirror: always +- name: gfx.canvas.accelerated.async-present + type: RelaxedAtomicBool + value: true + mirror: always + - name: gfx.canvas.accelerated.cache-items type: RelaxedAtomicUint32 value: 2048