summaryrefslogtreecommitdiff
path: root/chromium/content/browser/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/content/browser/gpu')
-rw-r--r--chromium/content/browser/gpu/compositor_util.cc102
-rw-r--r--chromium/content/browser/gpu/compositor_util.h26
-rw-r--r--chromium/content/browser/gpu/compositor_util_browsertest.cc41
-rw-r--r--chromium/content/browser/gpu/gpu_crash_browsertest.cc2
-rw-r--r--chromium/content/browser/gpu/gpu_data_manager_impl.cc15
-rw-r--r--chromium/content/browser/gpu/gpu_data_manager_impl.h5
-rw-r--r--chromium/content/browser/gpu/gpu_data_manager_impl_private.cc62
-rw-r--r--chromium/content/browser/gpu/gpu_data_manager_impl_private.h1
-rw-r--r--chromium/content/browser/gpu/gpu_functional_browsertest.cc3
-rw-r--r--chromium/content/browser/gpu/gpu_internals_ui.cc2
-rw-r--r--chromium/content/browser/gpu/gpu_memory_test.cc12
-rw-r--r--chromium/content/browser/gpu/gpu_pixel_browsertest.cc10
-rw-r--r--chromium/content/browser/gpu/gpu_process_host.cc104
-rw-r--r--chromium/content/browser/gpu/gpu_process_host.h9
-rw-r--r--chromium/content/browser/gpu/webgl_conformance_test.cc2
15 files changed, 234 insertions, 162 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
diff --git a/chromium/content/browser/gpu/compositor_util.h b/chromium/content/browser/gpu/compositor_util.h
new file mode 100644
index 00000000000..c1c6a4229b1
--- /dev/null
+++ b/chromium/content/browser/gpu/compositor_util.h
@@ -0,0 +1,26 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_GPU_COMPOSITOR_UTIL_H_
+#define CONTENT_BROWSER_GPU_COMPOSITOR_UTIL_H_
+
+#include "content/common/content_export.h"
+
+namespace content {
+
+// Returns true if the threaded compositor is on (via flags or field trial).
+CONTENT_EXPORT bool IsThreadedCompositingEnabled();
+
+// Returns true if force-compositing-mode is on (via flags or field trial).
+CONTENT_EXPORT bool IsForceCompositingModeEnabled();
+
+// Returns true if delegated-renderer is on (via flags, or platform default).
+CONTENT_EXPORT bool IsDelegatedRendererEnabled();
+
+// Returns true if deadline scheduling is on (via flags, or platform default).
+CONTENT_EXPORT bool IsDeadlineSchedulingEnabled();
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_GPU_COMPOSITOR_UTIL_H_
diff --git a/chromium/content/browser/gpu/compositor_util_browsertest.cc b/chromium/content/browser/gpu/compositor_util_browsertest.cc
new file mode 100644
index 00000000000..75fc60e429f
--- /dev/null
+++ b/chromium/content/browser/gpu/compositor_util_browsertest.cc
@@ -0,0 +1,41 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/gpu/compositor_util.h"
+#include "content/test/content_browser_test.h"
+
+#if defined(OS_MACOSX)
+#include "base/mac/mac_util.h"
+#elif defined(OS_WIN)
+#include "base/win/windows_version.h"
+#endif
+
+namespace content {
+
+typedef ContentBrowserTest CompositorUtilTest;
+
+// Test that threaded compositing and FCM are in the expected mode on the bots
+// for all platforms.
+IN_PROC_BROWSER_TEST_F(CompositorUtilTest, CompositingModeAsExpected) {
+ enum CompositingMode {
+ DISABLED,
+ ENABLED,
+ THREADED,
+ } expected_mode = DISABLED;
+#if defined(OS_ANDROID) || defined(USE_AURA)
+ expected_mode = THREADED;
+#elif defined(OS_MACOSX)
+ if (base::mac::IsOSMountainLionOrLater())
+ expected_mode = ENABLED;
+#elif defined(OS_WIN)
+ if (base::win::GetVersion() >= base::win::VERSION_VISTA)
+ expected_mode = ENABLED;
+#endif
+
+ EXPECT_EQ(expected_mode == ENABLED || expected_mode == THREADED,
+ IsForceCompositingModeEnabled());
+ EXPECT_EQ(expected_mode == THREADED, IsThreadedCompositingEnabled());
+}
+
+}
diff --git a/chromium/content/browser/gpu/gpu_crash_browsertest.cc b/chromium/content/browser/gpu/gpu_crash_browsertest.cc
index eafbc689cd0..98650d320c1 100644
--- a/chromium/content/browser/gpu/gpu_crash_browsertest.cc
+++ b/chromium/content/browser/gpu/gpu_crash_browsertest.cc
@@ -10,7 +10,7 @@
#include "content/public/common/content_paths.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
-#include "content/shell/shell.h"
+#include "content/shell/browser/shell.h"
#include "content/test/content_browser_test.h"
#include "content/test/content_browser_test_utils.h"
diff --git a/chromium/content/browser/gpu/gpu_data_manager_impl.cc b/chromium/content/browser/gpu/gpu_data_manager_impl.cc
index 747503cedfe..31096574f9e 100644
--- a/chromium/content/browser/gpu/gpu_data_manager_impl.cc
+++ b/chromium/content/browser/gpu/gpu_data_manager_impl.cc
@@ -29,6 +29,11 @@ bool GpuDataManagerImpl::IsFeatureBlacklisted(int feature) const {
return private_->IsFeatureBlacklisted(feature);
}
+bool GpuDataManagerImpl::IsDriverBugWorkaroundActive(int feature) const {
+ base::AutoLock auto_lock(lock_);
+ return private_->IsDriverBugWorkaroundActive(feature);
+}
+
gpu::GPUInfo GpuDataManagerImpl::GetGPUInfo() const {
base::AutoLock auto_lock(lock_);
return private_->GetGPUInfo();
@@ -112,6 +117,11 @@ void GpuDataManagerImpl::DisableHardwareAcceleration() {
private_->DisableHardwareAcceleration();
}
+bool GpuDataManagerImpl::CanUseGpuBrowserCompositor() const {
+ base::AutoLock auto_lock(lock_);
+ return private_->CanUseGpuBrowserCompositor();
+}
+
void GpuDataManagerImpl::Initialize() {
base::AutoLock auto_lock(lock_);
private_->Initialize();
@@ -208,11 +218,6 @@ bool GpuDataManagerImpl::IsUsingAcceleratedSurface() const {
}
#endif
-bool GpuDataManagerImpl::CanUseGpuBrowserCompositor() const {
- base::AutoLock auto_lock(lock_);
- return private_->CanUseGpuBrowserCompositor();
-}
-
void GpuDataManagerImpl::BlockDomainFrom3DAPIs(
const GURL& url, DomainGuilt guilt) {
base::AutoLock auto_lock(lock_);
diff --git a/chromium/content/browser/gpu/gpu_data_manager_impl.h b/chromium/content/browser/gpu/gpu_data_manager_impl.h
index 497d3bdf40b..a1ea2013129 100644
--- a/chromium/content/browser/gpu/gpu_data_manager_impl.h
+++ b/chromium/content/browser/gpu/gpu_data_manager_impl.h
@@ -80,6 +80,7 @@ class CONTENT_EXPORT GpuDataManagerImpl
std::string* gl_renderer,
std::string* gl_version) OVERRIDE;
virtual void DisableHardwareAcceleration() OVERRIDE;
+ virtual bool CanUseGpuBrowserCompositor() const OVERRIDE;
// This collects preliminary GPU info, load GpuBlacklist, and compute the
// preliminary blacklisted features; it should only be called at browser
@@ -141,8 +142,6 @@ class CONTENT_EXPORT GpuDataManagerImpl
bool IsUsingAcceleratedSurface() const;
#endif
- bool CanUseGpuBrowserCompositor() const;
-
// Maintenance of domains requiring explicit user permission before
// using client-facing 3D APIs (WebGL, Pepper 3D), either because
// the domain has caused the GPU to reset, or because too many GPU
@@ -177,6 +176,8 @@ class CONTENT_EXPORT GpuDataManagerImpl
// Called when GPU process initialization failed.
void OnGpuProcessInitFailure();
+ bool IsDriverBugWorkaroundActive(int feature) const;
+
private:
friend class GpuDataManagerImplPrivate;
friend class GpuDataManagerImplPrivateTest;
diff --git a/chromium/content/browser/gpu/gpu_data_manager_impl_private.cc b/chromium/content/browser/gpu/gpu_data_manager_impl_private.cc
index 654048847ec..94adacd798a 100644
--- a/chromium/content/browser/gpu/gpu_data_manager_impl_private.cc
+++ b/chromium/content/browser/gpu/gpu_data_manager_impl_private.cc
@@ -42,7 +42,6 @@
#include "base/win/windows_version.h"
#endif // OS_WIN
#if defined(OS_ANDROID)
-#include "base/android/build_info.h"
#include "ui/gfx/android/device_display_info.h"
#endif // OS_ANDROID
@@ -230,7 +229,7 @@ std::string IntSetToString(const std::set<int>& list) {
void DisplayReconfigCallback(CGDirectDisplayID display,
CGDisplayChangeSummaryFlags flags,
void* gpu_data_manager) {
- if(flags == kCGDisplayBeginConfigurationFlag)
+ if (flags == kCGDisplayBeginConfigurationFlag)
return; // This call contains no information about the display change
GpuDataManagerImpl* manager =
@@ -259,36 +258,11 @@ void ApplyAndroidWorkarounds(const gpu::GPUInfo& gpu_info,
std::string renderer(StringToLowerASCII(gpu_info.gl_renderer));
bool is_img =
gpu_info.gl_vendor.find("Imagination") != std::string::npos;
- bool is_arm =
- gpu_info.gl_vendor.find("ARM") != std::string::npos;
- bool is_qualcomm =
- gpu_info.gl_vendor.find("Qualcomm") != std::string::npos;
- bool is_broadcom =
- gpu_info.gl_vendor.find("Broadcom") != std::string::npos;
- bool is_mali_t604 = is_arm &&
- gpu_info.gl_renderer.find("Mali-T604") != std::string::npos;
- bool is_nvidia =
- gpu_info.gl_vendor.find("NVIDIA") != std::string::npos;
-
- bool is_vivante =
- gpu_info.gl_extensions.find("GL_VIV_shader_binary") !=
- std::string::npos;
-
bool is_nexus7 =
gpu_info.machine_model.find("Nexus 7") != std::string::npos;
bool is_nexus10 =
gpu_info.machine_model.find("Nexus 10") != std::string::npos;
- int sdk_int = base::android::BuildInfo::GetInstance()->sdk_int();
-
- // IMG: avoid context switching perf problems, crashes with share groups
- // Mali-T604: http://crbug.com/154715
- // QualComm, NVIDIA: Crashes with share groups
- if (is_vivante || is_img || is_mali_t604 || (is_nvidia && (sdk_int < 18)) ||
- is_qualcomm || is_broadcom) {
- command_line->AppendSwitch(switches::kEnableVirtualGLContexts);
- }
-
gfx::DeviceDisplayInfo info;
int default_tile_size = 256;
@@ -311,7 +285,7 @@ void ApplyAndroidWorkarounds(const gpu::GPUInfo& gpu_info,
// If we are using the MapImage API double the tile size to reduce
// the number of zero-copy buffers being used.
- if (command_line->HasSwitch(cc::switches::kUseMapImage))
+ if (command_line->HasSwitch(cc::switches::kEnableMapImage))
default_tile_size *= 2;
// Set the command line if it isn't already set and we changed
@@ -362,6 +336,13 @@ void GpuDataManagerImplPrivate::InitializeForTesting(
}
bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const {
+#if defined(OS_CHROMEOS)
+ if (feature == gpu::GPU_FEATURE_TYPE_PANEL_FITTING &&
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisablePanelFitting)) {
+ return true;
+ }
+#endif // OS_CHROMEOS
if (use_swiftshader_) {
// Skia's software rendering is probably more efficient than going through
// software emulation of the GPU, so use that.
@@ -373,6 +354,10 @@ bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const {
return (blacklisted_features_.count(feature) == 1);
}
+bool GpuDataManagerImplPrivate::IsDriverBugWorkaroundActive(int feature) const {
+ return (gpu_driver_bugs_.count(feature) == 1);
+}
+
size_t GpuDataManagerImplPrivate::GetBlacklistedFeatureCount() const {
if (use_swiftshader_)
return 1;
@@ -740,6 +725,11 @@ void GpuDataManagerImplPrivate::AppendGpuCommandLine(
IntSetToString(gpu_driver_bugs_));
}
+ if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) &&
+ !command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) {
+ command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode);
+ }
+
#if defined(OS_WIN)
// DisplayLink 7.1 and earlier can cause the GPU process to crash on startup.
// http://crbug.com/177611
@@ -809,8 +799,9 @@ void GpuDataManagerImplPrivate::UpdateRendererWebPrefs(
prefs->flash_stage3d_baseline_enabled = false;
if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS))
prefs->accelerated_2d_canvas_enabled = false;
- if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_MULTISAMPLING)
- || display_count_ > 1)
+ if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_MULTISAMPLING) ||
+ (IsDriverBugWorkaroundActive(gpu::DISABLE_MULTIMONITOR_MULTISAMPLING) &&
+ display_count_ > 1))
prefs->gl_multisampling_enabled = false;
if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_3D_CSS)) {
prefs->accelerated_compositing_for_3d_transforms_enabled = false;
@@ -833,6 +824,7 @@ void GpuDataManagerImplPrivate::UpdateRendererWebPrefs(
prefs->accelerated_compositing_enabled = true;
prefs->accelerated_compositing_for_3d_transforms_enabled = true;
prefs->accelerated_compositing_for_plugins_enabled = true;
+ prefs->accelerated_compositing_for_video_enabled = true;
}
#if defined(USE_AURA)
@@ -1040,21 +1032,24 @@ void GpuDataManagerImplPrivate::InitializeImpl(
if (!gpu_blacklist_json.empty()) {
gpu_blacklist_.reset(gpu::GpuBlacklist::Create());
- gpu_blacklist_->LoadList(
+ bool success = gpu_blacklist_->LoadList(
browser_version_string, gpu_blacklist_json,
gpu::GpuControlList::kCurrentOsOnly);
+ DCHECK(success);
}
if (!gpu_switching_list_json.empty()) {
gpu_switching_list_.reset(gpu::GpuSwitchingList::Create());
- gpu_switching_list_->LoadList(
+ bool success = gpu_switching_list_->LoadList(
browser_version_string, gpu_switching_list_json,
gpu::GpuControlList::kCurrentOsOnly);
+ DCHECK(success);
}
if (!gpu_driver_bug_list_json.empty()) {
gpu_driver_bug_list_.reset(gpu::GpuDriverBugList::Create());
- gpu_driver_bug_list_->LoadList(
+ bool success = gpu_driver_bug_list_->LoadList(
browser_version_string, gpu_driver_bug_list_json,
gpu::GpuControlList::kCurrentOsOnly);
+ DCHECK(success);
}
gpu_info_ = gpu_info;
@@ -1250,4 +1245,3 @@ void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() {
}
} // namespace content
-
diff --git a/chromium/content/browser/gpu/gpu_data_manager_impl_private.h b/chromium/content/browser/gpu/gpu_data_manager_impl_private.h
index eb226e863dc..8d15296e4a9 100644
--- a/chromium/content/browser/gpu/gpu_data_manager_impl_private.h
+++ b/chromium/content/browser/gpu/gpu_data_manager_impl_private.h
@@ -28,6 +28,7 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate {
const std::string& gpu_blacklist_json,
const gpu::GPUInfo& gpu_info);
bool IsFeatureBlacklisted(int feature) const;
+ bool IsDriverBugWorkaroundActive(int feature) const;
gpu::GPUInfo GetGPUInfo() const;
void GetGpuProcessHandles(
const GpuDataManager::GetGpuProcessHandlesCallback& callback) const;
diff --git a/chromium/content/browser/gpu/gpu_functional_browsertest.cc b/chromium/content/browser/gpu/gpu_functional_browsertest.cc
index b3c2a57319f..4e95d2d5c11 100644
--- a/chromium/content/browser/gpu/gpu_functional_browsertest.cc
+++ b/chromium/content/browser/gpu/gpu_functional_browsertest.cc
@@ -10,7 +10,7 @@
#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
#include "content/public/test/browser_test_utils.h"
-#include "content/shell/shell.h"
+#include "content/shell/browser/shell.h"
#include "content/test/content_browser_test.h"
#include "content/test/content_browser_test_utils.h"
@@ -70,7 +70,6 @@ class GpuFunctionalTest : public ContentBrowserTest {
}
void VerifyGPUProcessOnPage(std::string filename, bool wait) {
- Shell::Initialize();
ASSERT_TRUE(test_server()->Start());
DOMMessageQueue message_queue;
diff --git a/chromium/content/browser/gpu/gpu_internals_ui.cc b/chromium/content/browser/gpu/gpu_internals_ui.cc
index 0e778c277b9..0340077147d 100644
--- a/chromium/content/browser/gpu/gpu_internals_ui.cc
+++ b/chromium/content/browser/gpu/gpu_internals_ui.cc
@@ -15,9 +15,9 @@
#include "base/sys_info.h"
#include "base/values.h"
#include "cc/base/switches.h"
+#include "content/browser/gpu/compositor_util.h"
#include "content/browser/gpu/gpu_data_manager_impl.h"
#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/compositor_util.h"
#include "content/public/browser/gpu_data_manager_observer.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
diff --git a/chromium/content/browser/gpu/gpu_memory_test.cc b/chromium/content/browser/gpu/gpu_memory_test.cc
index cb74a629299..7f9a3fee167 100644
--- a/chromium/content/browser/gpu/gpu_memory_test.cc
+++ b/chromium/content/browser/gpu/gpu_memory_test.cc
@@ -12,7 +12,7 @@
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
-#include "content/shell/shell.h"
+#include "content/shell/browser/shell.h"
#include "content/test/content_browser_test.h"
#include "content/test/content_browser_test_utils.h"
#include "gpu/command_buffer/service/gpu_switches.h"
@@ -76,7 +76,6 @@ class GpuMemoryTest : public ContentBrowserTest {
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
command_line->AppendSwitch(switches::kEnableLogging);
- command_line->AppendSwitch(switches::kForceCompositingMode);
command_line->AppendSwitchASCII(switches::kForceGpuMemAvailableMb,
kMemoryLimitMBSwitch);
// Only run this on GPU bots for now. These tests should work with
@@ -217,15 +216,18 @@ class GpuMemoryTest : public ContentBrowserTest {
#if defined(OS_LINUX) && !defined(NDEBUG)
// http://crbug.com/254724
-#define IF_NOT_DEBUG_LINUX(x) DISABLED_ ## x
+#define MAYBE(x) DISABLED_ ## x
+#elif defined(OS_WIN) && defined(USE_AURA)
+// http://crbug.com/292882
+#define MAYBE(x) DISABLED_ ## x
#else
-#define IF_NOT_DEBUG_LINUX(x) x
+#define MAYBE(x) x
#endif
// When trying to load something that doesn't fit into our total GPU memory
// limit, we shouldn't exceed that limit.
IN_PROC_BROWSER_TEST_F(GpuMemoryTest,
- IF_NOT_DEBUG_LINUX(SingleWindowDoesNotExceedLimit)) {
+ MAYBE(SingleWindowDoesNotExceedLimit)) {
if (!AllowTestsToRun())
return;
diff --git a/chromium/content/browser/gpu/gpu_pixel_browsertest.cc b/chromium/content/browser/gpu/gpu_pixel_browsertest.cc
index 5909321377f..d6b55e2c7ee 100644
--- a/chromium/content/browser/gpu/gpu_pixel_browsertest.cc
+++ b/chromium/content/browser/gpu/gpu_pixel_browsertest.cc
@@ -16,7 +16,7 @@
#include "content/public/common/content_paths.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
-#include "content/shell/shell.h"
+#include "content/shell/browser/shell.h"
#include "content/test/content_browser_test.h"
#include "content/test/content_browser_test_utils.h"
#include "gpu/config/gpu_test_config.h"
@@ -59,7 +59,7 @@ bool ReadPNGFile(const base::FilePath& file_path, SkBitmap* bitmap) {
return false;
std::string png_data;
- return file_util::ReadFileToString(abs_path, &png_data) &&
+ return base::ReadFileToString(abs_path, &png_data) &&
gfx::PNGCodec::Decode(reinterpret_cast<unsigned char*>(&png_data[0]),
png_data.length(),
bitmap);
@@ -461,7 +461,7 @@ IN_PROC_BROWSER_TEST_F(GpuPixelBrowserTest, MANUAL_WebGLGreenTriangle) {
IN_PROC_BROWSER_TEST_F(GpuPixelBrowserTest, MANUAL_CSS3DBlueBox) {
// If test baseline needs to be updated after a given revision, update the
// following number. If no revision requirement, then 0.
- const int64 ref_img_revision_update = 209827;
+ const int64 ref_img_revision_update = 223891;
const ReferencePixel ref_pixels[] = {
// x, y, r, g, b
@@ -484,7 +484,7 @@ IN_PROC_BROWSER_TEST_F(GpuPixelBrowserTest, MANUAL_CSS3DBlueBox) {
IN_PROC_BROWSER_TEST_F(GpuPixelBrowserTest, MANUAL_Canvas2DRedBoxHD) {
// If test baseline needs to be updated after a given revision, update the
// following number. If no revision requirement, then 0.
- const int64 ref_img_revision_update = 123489;
+ const int64 ref_img_revision_update = 224170;
const ReferencePixel ref_pixels[] = {
// x, y, r, g, b
@@ -513,7 +513,7 @@ class GpuPixelTestCanvas2DSD : public GpuPixelBrowserTest {
IN_PROC_BROWSER_TEST_F(GpuPixelTestCanvas2DSD, MANUAL_Canvas2DRedBoxSD) {
// If test baseline needs to be updated after a given revision, update the
// following number. If no revision requirement, then 0.
- const int64 ref_img_revision_update = 123489;
+ const int64 ref_img_revision_update = 224170;
const ReferencePixel ref_pixels[] = {
// x, y, r, g, b
diff --git a/chromium/content/browser/gpu/gpu_process_host.cc b/chromium/content/browser/gpu/gpu_process_host.cc
index 8cbb7aa1d82..0482b347e85 100644
--- a/chromium/content/browser/gpu/gpu_process_host.cc
+++ b/chromium/content/browser/gpu/gpu_process_host.cc
@@ -6,8 +6,9 @@
#include "base/base64.h"
#include "base/base_switches.h"
+#include "base/basictypes.h"
#include "base/bind.h"
-#include "base/bind_helpers.h"
+#include "base/callback_helpers.h"
#include "base/command_line.h"
#include "base/debug/trace_event.h"
#include "base/logging.h"
@@ -24,8 +25,6 @@
#include "content/common/child_process_host_impl.h"
#include "content/common/gpu/gpu_messages.h"
#include "content/common/view_messages.h"
-#include "content/gpu/gpu_child_thread.h"
-#include "content/gpu/gpu_process.h"
#include "content/port/browser/render_widget_host_view_frame_subscriber.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
@@ -37,7 +36,7 @@
#include "gpu/command_buffer/service/gpu_switches.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_switches.h"
-#include "ui/base/latency_info.h"
+#include "ui/events/latency_info.h"
#include "ui/gl/gl_switches.h"
@@ -81,9 +80,12 @@ void SendGpuProcessMessage(GpuProcessHost::GpuProcessKind kind,
}
}
-void AcceleratedSurfaceBuffersSwappedCompletedForGPU(int host_id,
- int route_id,
- bool alive) {
+void AcceleratedSurfaceBuffersSwappedCompletedForGPU(
+ int host_id,
+ int route_id,
+ bool alive,
+ base::TimeTicks vsync_timebase,
+ base::TimeDelta vsync_interval) {
if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
BrowserThread::PostTask(
BrowserThread::IO,
@@ -91,7 +93,9 @@ void AcceleratedSurfaceBuffersSwappedCompletedForGPU(int host_id,
base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU,
host_id,
route_id,
- alive));
+ alive,
+ vsync_timebase,
+ vsync_interval));
return;
}
@@ -100,6 +104,10 @@ void AcceleratedSurfaceBuffersSwappedCompletedForGPU(int host_id,
if (alive) {
AcceleratedSurfaceMsg_BufferPresented_Params ack_params;
ack_params.sync_point = 0;
+#if defined(OS_WIN)
+ ack_params.vsync_timebase = vsync_timebase;
+ ack_params.vsync_interval = vsync_interval;
+#endif
host->Send(
new AcceleratedSurfaceMsg_BufferPresented(route_id, ack_params));
} else {
@@ -151,10 +159,10 @@ void AcceleratedSurfaceBuffersSwappedCompleted(
base::TimeTicks timebase,
base::TimeDelta interval,
const ui::LatencyInfo& latency_info) {
- AcceleratedSurfaceBuffersSwappedCompletedForGPU(host_id, route_id,
- alive);
- AcceleratedSurfaceBuffersSwappedCompletedForRenderer(surface_id, timebase,
- interval, latency_info);
+ AcceleratedSurfaceBuffersSwappedCompletedForGPU(
+ host_id, route_id, alive, timebase, interval);
+ AcceleratedSurfaceBuffersSwappedCompletedForRenderer(
+ surface_id, timebase, interval, latency_info);
}
// NOTE: changes to this class need to be reviewed by the security team.
@@ -278,43 +286,6 @@ class GpuSandboxedProcessLauncherDelegate
} // anonymous namespace
-// Single process not supported in multiple dll mode currently.
-#if !defined(CHROME_MULTIPLE_DLL)
-// This class creates a GPU thread (instead of a GPU process), when running
-// with --in-process-gpu or --single-process.
-class GpuMainThread : public base::Thread {
- public:
- explicit GpuMainThread(const std::string& channel_id)
- : base::Thread("Chrome_InProcGpuThread"),
- channel_id_(channel_id),
- gpu_process_(NULL) {
- }
-
- virtual ~GpuMainThread() {
- Stop();
- }
-
- protected:
- virtual void Init() OVERRIDE {
- gpu_process_ = new GpuProcess();
- // The process object takes ownership of the thread object, so do not
- // save and delete the pointer.
- gpu_process_->set_main_thread(new GpuChildThread(channel_id_));
- }
-
- virtual void CleanUp() OVERRIDE {
- delete gpu_process_;
- }
-
- private:
- std::string channel_id_;
- // Deleted in CleanUp() on the gpu thread, so don't use smart pointers.
- GpuProcess* gpu_process_;
-
- DISALLOW_COPY_AND_ASSIGN(GpuMainThread);
-};
-#endif // !CHROME_MULTIPLE_DLL
-
// static
bool GpuProcessHost::ValidateHost(GpuProcessHost* host) {
if (!host)
@@ -401,6 +372,13 @@ void GpuProcessHost::SendOnIO(GpuProcessKind kind,
}
}
+GpuMainThreadFactoryFunction g_gpu_main_thread_factory = NULL;
+
+void GpuProcessHost::RegisterGpuMainThreadFactory(
+ GpuMainThreadFactoryFunction create) {
+ g_gpu_main_thread_factory = create;
+}
+
// static
GpuProcessHost* GpuProcessHost::FromID(int host_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
@@ -550,7 +528,8 @@ GpuProcessHost::~GpuProcessHost() {
std::string message;
if (!in_process_) {
int exit_code;
- base::TerminationStatus status = process_->GetTerminationStatus(&exit_code);
+ base::TerminationStatus status = process_->GetTerminationStatus(
+ false /* known_dead */, &exit_code);
UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessTerminationStatus",
status,
base::TERMINATION_STATUS_MAX_ENUM);
@@ -598,19 +577,15 @@ bool GpuProcessHost::Init() {
if (channel_id.empty())
return false;
- // Single process not supported in multiple dll mode currently.
-#if !defined(CHROME_MULTIPLE_DLL)
- if (in_process_) {
+ if (in_process_ && g_gpu_main_thread_factory) {
CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kDisableGpuWatchdog);
- in_process_gpu_thread_.reset(new GpuMainThread(channel_id));
+ in_process_gpu_thread_.reset(g_gpu_main_thread_factory(channel_id));
in_process_gpu_thread_->Start();
OnProcessLaunched(); // Fake a callback that the process is ready.
- } else
-#endif // !CHROME_MULTIPLE_DLL
- if (!LaunchGpuProcess(channel_id)) {
+ } else if (!LaunchGpuProcess(channel_id)) {
return false;
}
@@ -916,7 +891,7 @@ void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped(
base::ScopedClosureRunner scoped_completion_runner(
base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU,
host_id_, params.route_id,
- true /* alive */));
+ true /* alive */, base::TimeTicks(), base::TimeDelta()));
int render_process_id = 0;
int render_widget_id = 0;
@@ -933,7 +908,7 @@ void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped(
// if the browser is waiting for a new frame. Otherwise the RenderWidgetHelper
// will forward to the RenderWidgetHostView via RenderProcessHostImpl and
// RenderWidgetHostImpl.
- scoped_completion_runner.Release();
+ ignore_result(scoped_completion_runner.Release());
ViewHostMsg_CompositorSurfaceBuffersSwapped_Params view_params;
view_params.surface_id = params.surface_id;
@@ -969,7 +944,7 @@ void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped(
TRACE_EVENT1("gpu", "SurfaceIDNotFound_RoutingToUI",
"surface_id", params.surface_id);
// This is a content area swap, send it on to the UI thread.
- scoped_completion_runner.Release();
+ ignore_result(scoped_completion_runner.Release());
RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params));
return;
}
@@ -983,7 +958,7 @@ void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped(
"EarlyOut_NativeWindowNotFound",
"handle",
handle.handle);
- scoped_completion_runner.Release();
+ ignore_result(scoped_completion_runner.Release());
AcceleratedSurfaceBuffersSwappedCompleted(host_id_,
params.route_id,
params.surface_id,
@@ -994,7 +969,7 @@ void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped(
return;
}
- scoped_completion_runner.Release();
+ ignore_result(scoped_completion_runner.Release());
presenter->AsyncPresentAndAcknowledge(
params.size,
params.surface_handle,
@@ -1079,7 +1054,7 @@ void GpuProcessHost::OnProcessLaunched() {
void GpuProcessHost::OnProcessCrashed(int exit_code) {
SendOutstandingReplies();
GpuDataManagerImpl::GetInstance()->ProcessCrashed(
- process_->GetTerminationStatus(NULL));
+ process_->GetTerminationStatus(true /* known_dead */, NULL));
}
GpuProcessHost::GpuProcessKind GpuProcessHost::kind() {
@@ -1148,7 +1123,6 @@ bool GpuProcessHost::LaunchGpuProcess(const std::string& channel_id) {
switches::kDisableSeccompFilterSandbox,
switches::kEnableLogging,
switches::kEnableShareGroupAsyncTextureUpload,
- switches::kEnableVirtualGLContexts,
switches::kGpuStartupDialog,
switches::kGpuSandboxAllowSysVShm,
switches::kLoggingLevel,
@@ -1195,7 +1169,7 @@ bool GpuProcessHost::LaunchGpuProcess(const std::string& channel_id) {
new GpuSandboxedProcessLauncherDelegate(cmd_line),
#elif defined(OS_POSIX)
false,
- base::EnvironmentVector(),
+ base::EnvironmentMap(),
#endif
cmd_line);
process_launched_ = true;
diff --git a/chromium/content/browser/gpu/gpu_process_host.h b/chromium/content/browser/gpu/gpu_process_host.h
index 8908a1035db..32345b72800 100644
--- a/chromium/content/browser/gpu/gpu_process_host.h
+++ b/chromium/content/browser/gpu/gpu_process_host.h
@@ -44,6 +44,8 @@ class GpuMainThread;
class RenderWidgetHostViewFrameSubscriber;
class ShaderDiskCache;
+typedef base::Thread* (*GpuMainThreadFactoryFunction)(const std::string& id);
+
class GpuProcessHost : public BrowserChildProcessHostDelegate,
public IPC::Sender,
public base::NonThreadSafe {
@@ -82,6 +84,9 @@ class GpuProcessHost : public BrowserChildProcessHostDelegate,
CauseForGpuLaunch cause,
IPC::Message* message);
+ CONTENT_EXPORT static void RegisterGpuMainThreadFactory(
+ GpuMainThreadFactoryFunction create);
+
// Get the GPU process host for the GPU process with the given ID. Returns
// null if the process no longer exists.
static GpuProcessHost* FromID(int host_id);
@@ -214,9 +219,7 @@ class GpuProcessHost : public BrowserChildProcessHostDelegate,
bool swiftshader_rendering_;
GpuProcessKind kind_;
-#if !defined(CHROME_MULTIPLE_DLL)
- scoped_ptr<GpuMainThread> in_process_gpu_thread_;
-#endif
+ scoped_ptr<base::Thread> in_process_gpu_thread_;
// Whether we actually launched a GPU process.
bool process_launched_;
diff --git a/chromium/content/browser/gpu/webgl_conformance_test.cc b/chromium/content/browser/gpu/webgl_conformance_test.cc
index 79f30782830..e8fb8a59b92 100644
--- a/chromium/content/browser/gpu/webgl_conformance_test.cc
+++ b/chromium/content/browser/gpu/webgl_conformance_test.cc
@@ -10,7 +10,7 @@
#include "content/public/common/content_paths.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
-#include "content/shell/shell.h"
+#include "content/shell/browser/shell.h"
#include "content/test/content_browser_test.h"
#include "content/test/content_browser_test_utils.h"
#include "gpu/config/gpu_test_config.h"