summaryrefslogtreecommitdiff
path: root/chromium/content/browser/gpu/compositor_util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/content/browser/gpu/compositor_util.cc')
-rw-r--r--chromium/content/browser/gpu/compositor_util.cc102
1 files changed, 64 insertions, 38 deletions
diff --git a/chromium/content/browser/gpu/compositor_util.cc b/chromium/content/browser/gpu/compositor_util.cc
index a0cf1e21a2b..16810e326f3 100644
--- a/chromium/content/browser/gpu/compositor_util.cc
+++ b/chromium/content/browser/gpu/compositor_util.cc
@@ -2,15 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/public/browser/compositor_util.h"
+#include "content/browser/gpu/compositor_util.h"
#include "base/command_line.h"
#include "base/metrics/field_trial.h"
+#include "build/build_config.h"
#include "content/public/browser/gpu_data_manager.h"
#include "content/public/common/content_constants.h"
#include "content/public/common/content_switches.h"
#include "gpu/config/gpu_feature_type.h"
+#if defined(OS_MACOSX)
+#include "base/mac/mac_util.h"
+#elif defined(OS_WIN)
+#include "base/win/windows_version.h"
+#endif
+
namespace content {
namespace {
@@ -44,31 +51,22 @@ bool IsForceCompositingModeBlacklisted() {
} // namespace
bool IsThreadedCompositingEnabled() {
-#if defined(OS_WIN) && defined(USE_AURA)
- // We always want compositing on Aura Windows.
+#if defined(USE_AURA)
+ // We always want threaded compositing on Aura.
return true;
#endif
- if (!CanDoAcceleratedCompositing())
- return false;
-
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
// Command line switches take precedence over blacklist and field trials.
if (command_line.HasSwitch(switches::kDisableForceCompositingMode) ||
- command_line.HasSwitch(switches::kDisableThreadedCompositing))
+ command_line.HasSwitch(switches::kDisableThreadedCompositing)) {
return false;
-
-#if defined(OS_CHROMEOS)
- // We always want threaded compositing on ChromeOS unless it's explicitly
- // disabled above.
- return true;
-#endif
-
- if (command_line.HasSwitch(switches::kEnableThreadedCompositing))
+ } else if (command_line.HasSwitch(switches::kEnableThreadedCompositing)) {
return true;
+ }
- if (IsForceCompositingModeBlacklisted())
+ if (!CanDoAcceleratedCompositing() || IsForceCompositingModeBlacklisted())
return false;
base::FieldTrial* trial =
@@ -78,40 +76,68 @@ bool IsThreadedCompositingEnabled() {
}
bool IsForceCompositingModeEnabled() {
-#if defined(OS_WIN) && defined(USE_AURA)
- // We always want compositing on Aura Windows.
- return true;
-#endif
-
- if (!CanDoAcceleratedCompositing())
- return false;
+ // Force compositing mode is a subset of threaded compositing mode.
+ if (IsThreadedCompositingEnabled())
+ return true;
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
// Command line switches take precedence over blacklisting and field trials.
if (command_line.HasSwitch(switches::kDisableForceCompositingMode))
return false;
+ else if (command_line.HasSwitch(switches::kForceCompositingMode))
+ return true;
-#if defined(OS_CHROMEOS)
- // We always want compositing ChromeOS unless it's explicitly disabled above.
- return true;
+ if (!CanDoAcceleratedCompositing() || IsForceCompositingModeBlacklisted())
+ return false;
+
+ // Hardcode some platforms to use FCM, this has to be done here instead of via
+ // the field trial so that this configuration is used on try bots as well.
+ // TODO(gab): Do the same thing in IsThreadedCompositingEnabled() once this is
+ // stable.
+ // TODO(gab): Use the GPU blacklist instead of hardcoding OS versions here
+ // https://codereview.chromium.org/23534006.
+#if defined(OS_MACOSX)
+ // Mac OSX 10.8+ has been shipping with FCM enabled at 100% since M28.
+ return base::mac::IsOSMountainLionOrLater();
+#elif defined(OS_WIN)
+ // Windows Vista+ has been shipping with FCM enabled at 100% since M24.
+ return base::win::GetVersion() >= base::win::VERSION_VISTA;
#endif
- if (command_line.HasSwitch(switches::kForceCompositingMode))
- return true;
+ return false;
+}
- if (IsForceCompositingModeBlacklisted())
- return false;
+bool IsDelegatedRendererEnabled() {
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ bool enabled = false;
- base::FieldTrial* trial =
- base::FieldTrialList::Find(kGpuCompositingFieldTrialName);
+ // Flags override.
+ enabled |= command_line.HasSwitch(switches::kEnableDelegatedRenderer);
+ enabled &= !command_line.HasSwitch(switches::kDisableDelegatedRenderer);
- // Force compositing is enabled in both the force compositing
- // and threaded compositing mode field trials.
- return trial &&
- (trial->group_name() ==
- kGpuCompositingFieldTrialForceCompositingEnabledName ||
- trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName);
+ // Needs compositing, and thread.
+ if (enabled &&
+ (!IsForceCompositingModeEnabled() || !IsThreadedCompositingEnabled())) {
+ enabled = false;
+ LOG(ERROR) << "Disabling delegated-rendering because it needs "
+ << "force-compositing-mode and threaded-compositing.";
+ }
+
+ return enabled;
+}
+
+bool IsDeadlineSchedulingEnabled() {
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+
+ // Default to disabled.
+ bool enabled = false;
+
+ // Flags override.
+ enabled |= command_line.HasSwitch(switches::kEnableDeadlineScheduling);
+ enabled &= !command_line.HasSwitch(switches::kDisableDeadlineScheduling);
+
+ return enabled;
}
} // namespace content