forked from mirrors/gecko-dev
Bug 1896780 - Change IsGpuProcessEnabled() as to complete soon r=gfx-reviewers,bradwerth,jnicol
config state of gfx::Feature::GPU_PROCESS is mirrored to gfx::gfxVars::GPUProcessEnabled(). It is threadsafe. Differential Revision: https://phabricator.services.mozilla.com/D210386
This commit is contained in:
parent
e4ac07652e
commit
c17ebc98c2
6 changed files with 14 additions and 20 deletions
|
|
@ -102,7 +102,8 @@ class gfxVarReceiver;
|
||||||
_(WebglUseHardware, bool, true) \
|
_(WebglUseHardware, bool, true) \
|
||||||
_(WebRenderOverlayVpAutoHDR, bool, false) \
|
_(WebRenderOverlayVpAutoHDR, bool, false) \
|
||||||
_(WebRenderOverlayVpSuperResolution, bool, false) \
|
_(WebRenderOverlayVpSuperResolution, bool, false) \
|
||||||
_(AllowWebGPUPresentWithoutReadback, bool, false)
|
_(AllowWebGPUPresentWithoutReadback, bool, false) \
|
||||||
|
_(GPUProcessEnabled, bool, false)
|
||||||
|
|
||||||
/* Add new entries above this line. */
|
/* Add new entries above this line. */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -306,6 +306,7 @@ bool GPUProcessManager::MaybeDisableGPUProcess(const char* aMessage,
|
||||||
|
|
||||||
if (!aAllowRestart) {
|
if (!aAllowRestart) {
|
||||||
gfxConfig::SetFailed(Feature::GPU_PROCESS, FeatureStatus::Failed, aMessage);
|
gfxConfig::SetFailed(Feature::GPU_PROCESS, FeatureStatus::Failed, aMessage);
|
||||||
|
gfxVars::SetGPUProcessEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wantRestart;
|
bool wantRestart;
|
||||||
|
|
@ -326,6 +327,7 @@ bool GPUProcessManager::MaybeDisableGPUProcess(const char* aMessage,
|
||||||
|
|
||||||
if (aAllowRestart) {
|
if (aAllowRestart) {
|
||||||
gfxConfig::SetFailed(Feature::GPU_PROCESS, FeatureStatus::Failed, aMessage);
|
gfxConfig::SetFailed(Feature::GPU_PROCESS, FeatureStatus::Failed, aMessage);
|
||||||
|
gfxVars::SetGPUProcessEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_ASSERT(!gfxConfig::IsEnabled(Feature::GPU_PROCESS));
|
MOZ_ASSERT(!gfxConfig::IsEnabled(Feature::GPU_PROCESS));
|
||||||
|
|
|
||||||
|
|
@ -2644,6 +2644,10 @@ void gfxPlatform::InitWebRenderConfig() {
|
||||||
manager.Init();
|
manager.Init();
|
||||||
manager.ConfigureWebRender();
|
manager.ConfigureWebRender();
|
||||||
|
|
||||||
|
if (gfxConfig::IsEnabled(Feature::GPU_PROCESS)) {
|
||||||
|
gfxVars::SetGPUProcessEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
bool hasHardware = gfxConfig::IsEnabled(Feature::WEBRENDER);
|
bool hasHardware = gfxConfig::IsEnabled(Feature::WEBRENDER);
|
||||||
|
|
||||||
#ifdef MOZ_WIDGET_GTK
|
#ifdef MOZ_WIDGET_GTK
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,6 @@ import org.mozilla.gecko.util.ProxySelector;
|
||||||
import org.mozilla.gecko.util.ThreadUtils;
|
import org.mozilla.gecko.util.ThreadUtils;
|
||||||
import org.mozilla.geckoview.BuildConfig;
|
import org.mozilla.geckoview.BuildConfig;
|
||||||
import org.mozilla.geckoview.CrashHandler;
|
import org.mozilla.geckoview.CrashHandler;
|
||||||
import org.mozilla.geckoview.GeckoResult;
|
|
||||||
import org.mozilla.geckoview.R;
|
import org.mozilla.geckoview.R;
|
||||||
|
|
||||||
public class GeckoAppShell {
|
public class GeckoAppShell {
|
||||||
|
|
@ -1583,12 +1582,8 @@ public class GeckoAppShell {
|
||||||
@WrapForJNI
|
@WrapForJNI
|
||||||
public static native boolean isParentProcess();
|
public static native boolean isParentProcess();
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a GeckoResult that will be completed to true if the GPU process is enabled and false if
|
|
||||||
* it is disabled.
|
|
||||||
*/
|
|
||||||
@WrapForJNI
|
@WrapForJNI
|
||||||
public static native GeckoResult<Boolean> isGpuProcessEnabled();
|
public static native boolean isGpuProcessEnabled();
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
public static boolean isIsolatedProcess() {
|
public static boolean isIsolatedProcess() {
|
||||||
|
|
|
||||||
|
|
@ -72,11 +72,11 @@ public final class GeckoProcessManager extends IProcessManager.Stub {
|
||||||
*/
|
*/
|
||||||
@Override // IProcessManager
|
@Override // IProcessManager
|
||||||
public ISurfaceAllocator getSurfaceAllocator() {
|
public ISurfaceAllocator getSurfaceAllocator() {
|
||||||
final GeckoResult<Boolean> gpuEnabled = GeckoAppShell.isGpuProcessEnabled();
|
final boolean gpuEnabled = GeckoAppShell.isGpuProcessEnabled();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final GeckoResult<ISurfaceAllocator> allocator = new GeckoResult<>();
|
final GeckoResult<ISurfaceAllocator> allocator = new GeckoResult<>();
|
||||||
if (gpuEnabled.poll(1000)) {
|
if (gpuEnabled) {
|
||||||
// The GPU process is enabled, so look it up and ask it for its surface allocator.
|
// The GPU process is enabled, so look it up and ask it for its surface allocator.
|
||||||
XPCOMEventTarget.runOnLauncherThread(
|
XPCOMEventTarget.runOnLauncherThread(
|
||||||
() -> {
|
() -> {
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
#include "mozilla/Hal.h"
|
#include "mozilla/Hal.h"
|
||||||
#include "mozilla/dom/BrowserChild.h"
|
#include "mozilla/dom/BrowserChild.h"
|
||||||
#include "mozilla/dom/Document.h"
|
#include "mozilla/dom/Document.h"
|
||||||
|
#include "mozilla/gfx/gfxVars.h"
|
||||||
#include "mozilla/intl/OSPreferences.h"
|
#include "mozilla/intl/OSPreferences.h"
|
||||||
#include "mozilla/ipc/GeckoChildProcessHost.h"
|
#include "mozilla/ipc/GeckoChildProcessHost.h"
|
||||||
#include "mozilla/java/GeckoAppShellNatives.h"
|
#include "mozilla/java/GeckoAppShellNatives.h"
|
||||||
|
|
@ -332,17 +333,8 @@ class GeckoAppShellSupport final
|
||||||
|
|
||||||
static bool IsParentProcess() { return XRE_IsParentProcess(); }
|
static bool IsParentProcess() { return XRE_IsParentProcess(); }
|
||||||
|
|
||||||
static jni::Object::LocalRef IsGpuProcessEnabled() {
|
static bool IsGpuProcessEnabled() {
|
||||||
java::GeckoResult::GlobalRef result = java::GeckoResult::New();
|
return gfx::gfxVars::GPUProcessEnabled();
|
||||||
|
|
||||||
NS_DispatchToMainThread(NS_NewRunnableFunction(
|
|
||||||
"GeckoAppShellSupport::IsGpuProcessEnabled", [result]() {
|
|
||||||
result->Complete(gfx::gfxConfig::IsEnabled(gfx::Feature::GPU_PROCESS)
|
|
||||||
? java::sdk::Boolean::TRUE()
|
|
||||||
: java::sdk::Boolean::FALSE());
|
|
||||||
}));
|
|
||||||
|
|
||||||
return jni::Object::Ref::From(result);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue