commit f5c8c744ff4ae77986ad5dc0098c41d746af09c9
parent 78f994329ff56d917b806e4b7d593f3f231f9375
Author: Andrew Osmond <aosmond@mozilla.com>
Date: Sat, 4 Oct 2025 16:09:26 +0000
Bug 1992430 - Disable WebGPU if the GPU process is disabled on platforms with a GPU process. r=webgpu-reviewers,jimb
Differential Revision: https://phabricator.services.mozilla.com/D267425
Diffstat:
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp
@@ -3252,6 +3252,13 @@ void gfxPlatform::InitWebGPUConfig() {
FeatureState& featureWebGPU = gfxConfig::GetFeature(Feature::WEBGPU);
featureWebGPU.EnableByDefault();
+ if (!gfxConfig::IsEnabled(Feature::GPU_PROCESS) &&
+ !StaticPrefs::dom_webgpu_allow_in_parent_AtStartup()) {
+ featureWebGPU.Disable(FeatureStatus::UnavailableNoGpuProcess,
+ "Disabled without GPU process",
+ "FEATURE_WEBGPU_NO_GPU_PROCESS"_ns);
+ }
+
nsCString message;
nsCString failureId;
if (!IsGfxInfoStatusOkay(nsIGfxInfo::FEATURE_WEBGPU, &message, failureId)) {
@@ -4024,6 +4031,14 @@ bool gfxPlatform::FallbackFromAcceleration(FeatureStatus aStatus,
/* static */
void gfxPlatform::DisableGPUProcess() {
+ if (gfxVars::AllowWebGPU() &&
+ !StaticPrefs::dom_webgpu_allow_in_parent_AtStartup()) {
+ gfxConfig::Disable(Feature::WEBGPU, FeatureStatus::UnavailableNoGpuProcess,
+ "Disabled by GPU process disabled",
+ "FEATURE_WEBGPU_DISABLED_BY_GPU_PROCESS_DISABLED"_ns);
+ gfxVars::SetAllowWebGPU(false);
+ }
+
if (gfxVars::RemoteCanvasEnabled() &&
!StaticPrefs::gfx_canvas_remote_allow_in_parent_AtStartup()) {
gfxConfig::Disable(
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
@@ -5547,6 +5547,17 @@
#endif
mirror: always
+# Is WebGPU allowed to run in the parent process? This should be false if
+# on a platform that supports the GPU process, else true.
+- name: dom.webgpu.allow-in-parent
+ type: bool
+#if defined(XP_WIN) || defined(ANDROID)
+ value: false
+#else
+ value: true
+#endif
+ mirror: once
+
# Is support for the Web GPU API enabled on service workers?
- name: dom.webgpu.service-workers.enabled
type: RelaxedAtomicBool