Skip to content

Commit f5c8c74

Browse files
committed
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
1 parent 78f9943 commit f5c8c74

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

gfx/thebes/gfxPlatform.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3252,6 +3252,13 @@ void gfxPlatform::InitWebGPUConfig() {
32523252
FeatureState& featureWebGPU = gfxConfig::GetFeature(Feature::WEBGPU);
32533253
featureWebGPU.EnableByDefault();
32543254

3255+
if (!gfxConfig::IsEnabled(Feature::GPU_PROCESS) &&
3256+
!StaticPrefs::dom_webgpu_allow_in_parent_AtStartup()) {
3257+
featureWebGPU.Disable(FeatureStatus::UnavailableNoGpuProcess,
3258+
"Disabled without GPU process",
3259+
"FEATURE_WEBGPU_NO_GPU_PROCESS"_ns);
3260+
}
3261+
32553262
nsCString message;
32563263
nsCString failureId;
32573264
if (!IsGfxInfoStatusOkay(nsIGfxInfo::FEATURE_WEBGPU, &message, failureId)) {
@@ -4024,6 +4031,14 @@ bool gfxPlatform::FallbackFromAcceleration(FeatureStatus aStatus,
40244031

40254032
/* static */
40264033
void gfxPlatform::DisableGPUProcess() {
4034+
if (gfxVars::AllowWebGPU() &&
4035+
!StaticPrefs::dom_webgpu_allow_in_parent_AtStartup()) {
4036+
gfxConfig::Disable(Feature::WEBGPU, FeatureStatus::UnavailableNoGpuProcess,
4037+
"Disabled by GPU process disabled",
4038+
"FEATURE_WEBGPU_DISABLED_BY_GPU_PROCESS_DISABLED"_ns);
4039+
gfxVars::SetAllowWebGPU(false);
4040+
}
4041+
40274042
if (gfxVars::RemoteCanvasEnabled() &&
40284043
!StaticPrefs::gfx_canvas_remote_allow_in_parent_AtStartup()) {
40294044
gfxConfig::Disable(

modules/libpref/init/StaticPrefList.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5547,6 +5547,17 @@
55475547
#endif
55485548
mirror: always
55495549

5550+
# Is WebGPU allowed to run in the parent process? This should be false if
5551+
# on a platform that supports the GPU process, else true.
5552+
- name: dom.webgpu.allow-in-parent
5553+
type: bool
5554+
#if defined(XP_WIN) || defined(ANDROID)
5555+
value: false
5556+
#else
5557+
value: true
5558+
#endif
5559+
mirror: once
5560+
55505561
# Is support for the Web GPU API enabled on service workers?
55515562
- name: dom.webgpu.service-workers.enabled
55525563
type: RelaxedAtomicBool

0 commit comments

Comments
 (0)