summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser_process_platform_part_aurawin.cc1
-rw-r--r--chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc1
-rw-r--r--chrome/browser/ui/toolbar/wrench_menu_model.cc7
-rw-r--r--chrome/browser/ui/window_sizer/window_sizer.cc1
-rw-r--r--chrome/common/chrome_switches.cc3
-rw-r--r--chrome/common/chrome_switches.h1
-rw-r--r--content/browser/gpu/gpu_data_manager_impl.cc5
-rw-r--r--content/browser/gpu/gpu_data_manager_impl.h1
-rw-r--r--content/browser/gpu/gpu_data_manager_impl_private.cc40
-rw-r--r--content/browser/gpu/gpu_data_manager_impl_private.h12
-rw-r--r--content/browser/gpu/gpu_data_manager_impl_private_unittest.cc20
-rw-r--r--content/browser/gpu/gpu_internals_ui.cc4
-rw-r--r--content/public/browser/gpu_data_manager.h4
-rw-r--r--ui/base/ui_base_switches.cc4
-rw-r--r--ui/base/ui_base_switches.h1
-rwxr-xr-xui/gl/generate_bindings.py6
-rw-r--r--ui/gl/gl_surface_egl.cc53
-rw-r--r--ui/gl/gl_surface_egl.h4
-rw-r--r--ui/gl/gl_surface_win.cc17
-rw-r--r--ui/gl/gl_switches.cc4
-rw-r--r--ui/gl/gl_switches.h1
-rw-r--r--win8/delegate_execute/command_execute_impl.cc4
-rw-r--r--win8/metro_driver/chrome_app_view_ash.cc2
23 files changed, 180 insertions, 16 deletions
diff --git a/chrome/browser/browser_process_platform_part_aurawin.cc b/chrome/browser/browser_process_platform_part_aurawin.cc
index 7bb344b..0298775 100644
--- a/chrome/browser/browser_process_platform_part_aurawin.cc
+++ b/chrome/browser/browser_process_platform_part_aurawin.cc
@@ -20,6 +20,7 @@
#include "content/public/browser/notification_service.h"
#include "ui/aura/remote_window_tree_host_win.h"
+#include "ui/base/ui_base_switches.h"
BrowserProcessPlatformPart::BrowserProcessPlatformPart() {
if (base::win::GetVersion() >= base::win::VERSION_WIN7) {
diff --git a/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc b/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc
index b9cbe2f..c0cd472 100644
--- a/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc
+++ b/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc
@@ -15,6 +15,7 @@
#include "chrome/grit/generated_resources.h"
#include "ui/aura/env.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/base/ui_base_switches.h"
#include "ui/gfx/screen.h"
#include "ui/views/widget/native_widget_aura.h"
diff --git a/chrome/browser/ui/toolbar/wrench_menu_model.cc b/chrome/browser/ui/toolbar/wrench_menu_model.cc
index 8aecdd0..93d3c91 100644
--- a/chrome/browser/ui/toolbar/wrench_menu_model.cc
+++ b/chrome/browser/ui/toolbar/wrench_menu_model.cc
@@ -560,8 +560,11 @@ void WrenchMenuModel::Build() {
}
#if defined(OS_WIN)
- if (base::win::GetVersion() >= base::win::VERSION_WIN7 &&
- content::GpuDataManager::GetInstance()->CanUseGpuBrowserCompositor()) {
+ // Windows 8 can support ASH mode using WARP, but Windows 7 requires a working
+ // GPU compositor.
+ if ((base::win::GetVersion() >= base::win::VERSION_WIN7 &&
+ content::GpuDataManager::GetInstance()->CanUseGpuBrowserCompositor()) ||
+ (base::win::GetVersion() >= base::win::VERSION_WIN8)) {
if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) {
// ASH/Metro mode, add the 'Relaunch Chrome in desktop mode'.
AddSeparator(ui::NORMAL_SEPARATOR);
diff --git a/chrome/browser/ui/window_sizer/window_sizer.cc b/chrome/browser/ui/window_sizer/window_sizer.cc
index 34b342b..f2b7af8 100644
--- a/chrome/browser/ui/window_sizer/window_sizer.cc
+++ b/chrome/browser/ui/window_sizer/window_sizer.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/ui/host_desktop.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
+#include "ui/base/ui_base_switches.h"
#include "ui/gfx/screen.h"
#if defined(USE_ASH)
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 61a9447..1971f5ba 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -1312,9 +1312,6 @@ const char kForceDesktop[] = "force-desktop";
// Relaunches metro Chrome on Windows 8 and higher using a given shortcut.
const char kRelaunchShortcut[] = "relaunch-shortcut";
-// Requests that Chrome connect to the running Metro viewer process.
-const char kViewerConnect[] = "viewer-connect";
-
// Requests that Chrome launch the Metro viewer process via the given appid
// (which is assumed to be registered as default browser) and synchronously
// connect to it.
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index d8af127..4ad34ff 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -374,7 +374,6 @@ extern const char kEnableProfileShortcutManager[];
extern const char kForceDesktop[];
extern const char kForceImmersive[];
extern const char kRelaunchShortcut[];
-extern const char kViewerConnect[];
extern const char kViewerLaunchViaAppId[];
extern const char kWaitForMutex[];
extern const char kWindows8Search[];
diff --git a/content/browser/gpu/gpu_data_manager_impl.cc b/content/browser/gpu/gpu_data_manager_impl.cc
index 93d15c7..b53f4a0 100644
--- a/content/browser/gpu/gpu_data_manager_impl.cc
+++ b/content/browser/gpu/gpu_data_manager_impl.cc
@@ -76,6 +76,11 @@ void GpuDataManagerImpl::RegisterSwiftShaderPath(
private_->RegisterSwiftShaderPath(path);
}
+bool GpuDataManagerImpl::ShouldUseWarp() const {
+ base::AutoLock auto_lock(lock_);
+ return private_->ShouldUseWarp();
+}
+
void GpuDataManagerImpl::AddObserver(
GpuDataManagerObserver* observer) {
base::AutoLock auto_lock(lock_);
diff --git a/content/browser/gpu/gpu_data_manager_impl.h b/content/browser/gpu/gpu_data_manager_impl.h
index c812165..e49b6b5 100644
--- a/content/browser/gpu/gpu_data_manager_impl.h
+++ b/content/browser/gpu/gpu_data_manager_impl.h
@@ -71,6 +71,7 @@ class CONTENT_EXPORT GpuDataManagerImpl
virtual void RequestVideoMemoryUsageStatsUpdate() const OVERRIDE;
virtual bool ShouldUseSwiftShader() const OVERRIDE;
virtual void RegisterSwiftShaderPath(const base::FilePath& path) OVERRIDE;
+ virtual bool ShouldUseWarp() const OVERRIDE;
virtual void AddObserver(GpuDataManagerObserver* observer) OVERRIDE;
virtual void RemoveObserver(GpuDataManagerObserver* observer) OVERRIDE;
virtual void UnblockDomainFrom3DAPIs(const GURL& url) OVERRIDE;
diff --git a/content/browser/gpu/gpu_data_manager_impl_private.cc b/content/browser/gpu/gpu_data_manager_impl_private.cc
index fd705c8..2f362d6 100644
--- a/content/browser/gpu/gpu_data_manager_impl_private.cc
+++ b/content/browser/gpu/gpu_data_manager_impl_private.cc
@@ -271,7 +271,7 @@ bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const {
return true;
}
#endif // OS_CHROMEOS
- if (use_swiftshader_) {
+ if (use_swiftshader_ || ShouldUseWarp()) {
// Skia's software rendering is probably more efficient than going through
// software emulation of the GPU, so use that.
if (feature == gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)
@@ -287,7 +287,7 @@ bool GpuDataManagerImplPrivate::IsDriverBugWorkaroundActive(int feature) const {
}
size_t GpuDataManagerImplPrivate::GetBlacklistedFeatureCount() const {
- if (use_swiftshader_)
+ if (use_swiftshader_ || ShouldUseWarp())
return 1;
return blacklisted_features_.size();
}
@@ -311,7 +311,7 @@ void GpuDataManagerImplPrivate::GetGpuProcessHandles(
bool GpuDataManagerImplPrivate::GpuAccessAllowed(
std::string* reason) const {
- if (use_swiftshader_)
+ if (use_swiftshader_ || ShouldUseWarp())
return true;
if (!gpu_process_accessible_) {
@@ -398,6 +398,11 @@ void GpuDataManagerImplPrivate::RegisterSwiftShaderPath(
EnableSwiftShaderIfNecessary();
}
+bool GpuDataManagerImplPrivate::ShouldUseWarp() const {
+ return use_warp_ ||
+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseWarp);
+}
+
void GpuDataManagerImplPrivate::AddObserver(GpuDataManagerObserver* observer) {
GpuDataManagerImpl::UnlockedSession session(owner_);
observer_list_->AddObserver(observer);
@@ -545,7 +550,7 @@ void GpuDataManagerImplPrivate::UpdateGpuInfoHelper() {
void GpuDataManagerImplPrivate::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) {
// No further update of gpu_info if falling back to SwiftShader.
- if (use_swiftshader_)
+ if (use_swiftshader_ || ShouldUseWarp())
return;
gpu::MergeGPUInfo(&gpu_info_, gpu_info);
@@ -645,6 +650,9 @@ void GpuDataManagerImplPrivate::AppendGpuCommandLine(
gpu_info_.driver_vendor);
command_line->AppendSwitchASCII(switches::kGpuDriverVersion,
gpu_info_.driver_version);
+
+ if (ShouldUseWarp())
+ command_line->AppendSwitch(switches::kUseWarp);
}
void GpuDataManagerImplPrivate::AppendPluginCommandLine(
@@ -707,6 +715,7 @@ void GpuDataManagerImplPrivate::DisableHardwareAcceleration() {
for (int i = 0; i < gpu::NUMBER_OF_GPU_FEATURE_TYPES; ++i)
blacklisted_features_.insert(i);
+ EnableWarpIfNecessary();
EnableSwiftShaderIfNecessary();
NotifyGpuInfoUpdate();
}
@@ -813,6 +822,8 @@ bool GpuDataManagerImplPrivate::UpdateActiveGpu(
}
bool GpuDataManagerImplPrivate::CanUseGpuBrowserCompositor() const {
+ if (ShouldUseWarp())
+ return true;
if (ShouldUseSwiftShader())
return false;
if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING))
@@ -859,6 +870,7 @@ GpuDataManagerImplPrivate::GpuDataManagerImplPrivate(
: complete_gpu_info_already_requested_(false),
observer_list_(new GpuDataManagerObserverList),
use_swiftshader_(false),
+ use_warp_(false),
card_blacklisted_(false),
update_histograms_(true),
window_count_(0),
@@ -932,6 +944,7 @@ void GpuDataManagerImplPrivate::UpdateBlacklistedFeatures(
blacklisted_features_.insert(gpu::GPU_FEATURE_TYPE_WEBGL);
}
+ EnableWarpIfNecessary();
EnableSwiftShaderIfNecessary();
}
@@ -957,6 +970,9 @@ void GpuDataManagerImplPrivate::NotifyGpuInfoUpdate() {
}
void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() {
+ if (ShouldUseWarp())
+ return;
+
if (!GpuAccessAllowed(NULL) ||
blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_WEBGL)) {
if (!swiftshader_path_.empty() &&
@@ -966,6 +982,22 @@ void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() {
}
}
+void GpuDataManagerImplPrivate::EnableWarpIfNecessary() {
+#if defined(OS_WIN)
+ if (use_warp_)
+ return;
+ // We should only use WARP if we are unable to use the regular GPU for
+ // compositing, and if we in Metro mode.
+ use_warp_ =
+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kViewerConnect) &&
+ !CanUseGpuBrowserCompositor();
+#endif
+}
+
+void GpuDataManagerImplPrivate::ForceWarpModeForTesting() {
+ use_warp_ = true;
+}
+
std::string GpuDataManagerImplPrivate::GetDomainFromURL(
const GURL& url) const {
// For the moment, we just use the host, or its IP address, as the
diff --git a/content/browser/gpu/gpu_data_manager_impl_private.h b/content/browser/gpu/gpu_data_manager_impl_private.h
index 8e5514f..61c1988 100644
--- a/content/browser/gpu/gpu_data_manager_impl_private.h
+++ b/content/browser/gpu/gpu_data_manager_impl_private.h
@@ -42,6 +42,7 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate {
void RequestVideoMemoryUsageStatsUpdate() const;
bool ShouldUseSwiftShader() const;
void RegisterSwiftShaderPath(const base::FilePath& path);
+ bool ShouldUseWarp() const;
void AddObserver(GpuDataManagerObserver* observer);
void RemoveObserver(GpuDataManagerObserver* observer);
void UnblockDomainFrom3DAPIs(const GURL& url);
@@ -127,6 +128,8 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate {
FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplPrivateTest,
SwiftShaderRendering2);
FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplPrivateTest,
+ WarpEnabledOverridesSwiftShader);
+ FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplPrivateTest,
GpuInfoUpdate);
FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplPrivateTest,
NoGpuInfoUpdateWithSwiftShader);
@@ -201,6 +204,13 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate {
// Try to switch to SwiftShader rendering, if possible and necessary.
void EnableSwiftShaderIfNecessary();
+ // Try to switch to WARP rendering if the GPU hardware is not supported or
+ // absent, and if we are trying to run in Windows Metro mode.
+ void EnableWarpIfNecessary();
+
+ // Use only for testing, forces |use_warp_| to true.
+ void ForceWarpModeForTesting();
+
// Helper to extract the domain from a given URL.
std::string GetDomainFromURL(const GURL& url) const;
@@ -231,6 +241,8 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate {
bool use_swiftshader_;
+ bool use_warp_;
+
base::FilePath swiftshader_path_;
// Current card force-blacklisted due to GPU crashes, or disabled through
diff --git a/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc b/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc
index 41458ed..661e506 100644
--- a/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc
+++ b/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc
@@ -14,6 +14,10 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
+#if defined(OS_WIN)
+#include "base/win/windows_version.h"
+#endif
+
#define LONG_STRING_CONST(...) #__VA_ARGS__
namespace content {
@@ -284,6 +288,22 @@ TEST_F(GpuDataManagerImplPrivateTest, SwiftShaderRendering2) {
gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS));
}
+TEST_F(GpuDataManagerImplPrivateTest, WarpEnabledOverridesSwiftShader) {
+ // If WARP fallback is enabled on Windows 8 it should not allow SwiftShader
+ // to be enabled.
+#if defined(OS_WIN)
+ if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
+ ScopedGpuDataManagerImplPrivate manager;
+ manager->ForceWarpModeForTesting();
+ const base::FilePath test_path(FILE_PATH_LITERAL("AnyPath"));
+ manager->RegisterSwiftShaderPath(test_path);
+ manager->DisableHardwareAcceleration();
+ EXPECT_TRUE(manager->ShouldUseWarp());
+ EXPECT_FALSE(manager->ShouldUseSwiftShader());
+ }
+#endif
+}
+
TEST_F(GpuDataManagerImplPrivateTest, GpuInfoUpdate) {
ScopedGpuDataManagerImpl manager;
diff --git a/content/browser/gpu/gpu_internals_ui.cc b/content/browser/gpu/gpu_internals_ui.cc
index c338e02..7425089 100644
--- a/content/browser/gpu/gpu_internals_ui.cc
+++ b/content/browser/gpu/gpu_internals_ui.cc
@@ -127,6 +127,10 @@ base::DictionaryValue* GpuInfoAsDictionaryValue() {
ui::win::IsAeroGlassEnabled() ? "Aero Glass" : "none";
basic_info->Append(
NewDescriptionValuePair("Desktop compositing", compositor));
+ if (GpuDataManagerImpl::GetInstance()->ShouldUseWarp()) {
+ basic_info->Append(NewDescriptionValuePair("Using WARP",
+ new base::FundamentalValue(true)));
+ }
#endif
basic_info->Append(
diff --git a/content/public/browser/gpu_data_manager.h b/content/public/browser/gpu_data_manager.h
index 7ffc9f1..82cc7ec 100644
--- a/content/public/browser/gpu_data_manager.h
+++ b/content/public/browser/gpu_data_manager.h
@@ -72,6 +72,10 @@ class GpuDataManager {
// Register a path to SwiftShader.
virtual void RegisterSwiftShaderPath(const base::FilePath& path) = 0;
+ // Returns current state about WARP, which may be due to command-line
+ // arguments or saved state.
+ virtual bool ShouldUseWarp() const = 0;
+
// Registers/unregister |observer|.
virtual void AddObserver(GpuDataManagerObserver* observer) = 0;
virtual void RemoveObserver(GpuDataManagerObserver* observer) = 0;
diff --git a/ui/base/ui_base_switches.cc b/ui/base/ui_base_switches.cc
index 32bb03c..3bf7de0 100644
--- a/ui/base/ui_base_switches.cc
+++ b/ui/base/ui_base_switches.cc
@@ -44,4 +44,8 @@ const char kLang[] = "lang";
// do not have a user interface.
const char kNoMessageBox[] = "no-message-box";
+// On Windows only: requests that Chrome connect to the running Metro viewer
+// process.
+const char kViewerConnect[] = "connect-to-metro-viewer";
+
} // namespace switches
diff --git a/ui/base/ui_base_switches.h b/ui/base/ui_base_switches.h
index c419f41..a23c920 100644
--- a/ui/base/ui_base_switches.h
+++ b/ui/base/ui_base_switches.h
@@ -26,6 +26,7 @@ UI_BASE_EXPORT extern const char kEnableTouchDragDrop[];
UI_BASE_EXPORT extern const char kEnableTouchEditing[];
UI_BASE_EXPORT extern const char kLang[];
UI_BASE_EXPORT extern const char kNoMessageBox[];
+UI_BASE_EXPORT extern const char kViewerConnect[];
} // namespace switches
diff --git a/ui/gl/generate_bindings.py b/ui/gl/generate_bindings.py
index b9e3ad0..16fd009 100755
--- a/ui/gl/generate_bindings.py
+++ b/ui/gl/generate_bindings.py
@@ -916,6 +916,12 @@ EGL_FUNCTIONS = [
{ 'return_type': 'EGLDisplay',
'names': ['eglGetDisplay'],
'arguments': 'EGLNativeDisplayType display_id', },
+{ 'return_type': 'EGLDisplay',
+ 'known_as': 'eglGetPlatformDisplayEXT',
+ 'versions': [{ 'name': 'eglGetPlatformDisplayEXT',
+ 'extensions': ['EGL_ANGLE_platform_angle'] }],
+ 'arguments': 'EGLenum platform, void* native_display, '
+ 'const EGLint* attrib_list', },
{ 'return_type': 'EGLBoolean',
'names': ['eglInitialize'],
'arguments': 'EGLDisplay dpy, EGLint* major, EGLint* minor', },
diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc
index 5a0538e..439401a 100644
--- a/ui/gl/gl_surface_egl.cc
+++ b/ui/gl/gl_surface_egl.cc
@@ -8,6 +8,7 @@
#include <android/native_window_jni.h>
#endif
+#include "base/command_line.h"
#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
@@ -36,6 +37,19 @@ extern "C" {
#define EGL_FIXED_SIZE_ANGLE 0x3201
#endif
+#if defined(OS_WIN)
+// From ANGLE's egl/eglext.h.
+#if !defined(EGL_PLATFORM_ANGLE_ANGLE)
+#define EGL_PLATFORM_ANGLE_ANGLE 0x3201
+#endif
+#if !defined(EGL_PLATFORM_ANGLE_TYPE_ANGLE)
+#define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3202
+#endif
+#if !defined(EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE)
+#define EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE 0x3206
+#endif
+#endif // defined(OS_WIN)
+
using ui::GetLastEGLErrorString;
namespace gfx {
@@ -98,7 +112,13 @@ bool GLSurfaceEGL::InitializeOneOff() {
return true;
g_native_display = GetPlatformDefaultEGLNativeDisplay();
+
+#if defined(OS_WIN)
+ g_display = GetPlatformDisplay(g_native_display);
+#else
g_display = eglGetDisplay(g_native_display);
+#endif
+
if (!g_display) {
LOG(ERROR) << "eglGetDisplay failed with error " << GetLastEGLErrorString();
return false;
@@ -228,6 +248,39 @@ bool GLSurfaceEGL::IsEGLSurfacelessContextSupported() {
GLSurfaceEGL::~GLSurfaceEGL() {}
+#if defined(OS_WIN)
+static const EGLint kDisplayAttribsWarp[] {
+ EGL_PLATFORM_ANGLE_TYPE_ANGLE,
+ EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE,
+ EGL_NONE
+};
+
+// static
+EGLDisplay GLSurfaceEGL::GetPlatformDisplay(
+ EGLNativeDisplayType native_display) {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseWarp)) {
+ // Check for availability of WARP via ANGLE extension.
+ bool supports_warp = false;
+ const char* no_display_extensions = eglQueryString(EGL_NO_DISPLAY,
+ EGL_EXTENSIONS);
+ // If EGL_EXT_client_extensions not supported this call to eglQueryString
+ // will return NULL.
+ if (no_display_extensions)
+ supports_warp =
+ ExtensionsContain(no_display_extensions, "ANGLE_platform_angle") &&
+ ExtensionsContain(no_display_extensions, "ANGLE_platform_angle_d3d");
+
+ if (!supports_warp)
+ return NULL;
+
+ return eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, native_display,
+ kDisplayAttribsWarp);
+ }
+
+ return eglGetDisplay(native_display);
+}
+#endif
+
NativeViewGLSurfaceEGL::NativeViewGLSurfaceEGL(EGLNativeWindowType window)
: window_(window),
surface_(NULL),
diff --git a/ui/gl/gl_surface_egl.h b/ui/gl/gl_surface_egl.h
index 2c0a046..e682f4b 100644
--- a/ui/gl/gl_surface_egl.h
+++ b/ui/gl/gl_surface_egl.h
@@ -47,6 +47,10 @@ class GL_EXPORT GLSurfaceEGL : public GLSurface {
virtual ~GLSurfaceEGL();
private:
+#if defined(OS_WIN)
+ static EGLDisplay GetPlatformDisplay(EGLNativeDisplayType native_display);
+#endif
+
DISALLOW_COPY_AND_ASSIGN(GLSurfaceEGL);
};
diff --git a/ui/gl/gl_surface_win.cc b/ui/gl/gl_surface_win.cc
index 0001103..3cde3ea 100644
--- a/ui/gl/gl_surface_win.cc
+++ b/ui/gl/gl_surface_win.cc
@@ -25,6 +25,15 @@
#define EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE \
reinterpret_cast<EGLNativeDisplayType>(-2)
#endif
+#if !defined(EGL_PLATFORM_ANGLE_ANGLE)
+#define EGL_PLATFORM_ANGLE_ANGLE 0x3201
+#endif
+#if !defined(EGL_PLATFORM_ANGLE_TYPE_ANGLE)
+#define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3202
+#endif
+#if !defined(EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE)
+#define EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE 0x3206
+#endif
namespace gfx {
@@ -294,10 +303,10 @@ scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface(
}
EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() {
- if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableD3D11))
- return EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE;
-
- return EGL_DEFAULT_DISPLAY;
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableD3D11) ||
+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseWarp))
+ return GetDC(NULL);
+ return EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE;
}
} // namespace gfx
diff --git a/ui/gl/gl_switches.cc b/ui/gl/gl_switches.cc
index 7eaa3d8..e5e9f25 100644
--- a/ui/gl/gl_switches.cc
+++ b/ui/gl/gl_switches.cc
@@ -56,6 +56,9 @@ const char kTestGLLib[] = "test-gl-lib";
// Use hardware gpu, if available, for tests.
const char kUseGpuInTests[] = "use-gpu-in-tests";
+// On Windows only: use the WARP software rasterizer in the GPU process.
+const char kUseWarp[] = "use-warp";
+
// Disables GL drawing operations which produce pixel output. With this
// the GL output will not be correct but tests will run faster.
const char kDisableGLDrawingForTests[] = "disable-gl-drawing-for-tests";
@@ -75,6 +78,7 @@ const char* kGLSwitchesCopiedFromGpuProcessHost[] = {
kGpuNoContextLost,
kDisableGLDrawingForTests,
kOverrideUseGLWithOSMesaForTests,
+ kUseWarp
};
const int kGLSwitchesCopiedFromGpuProcessHostNumSwitches =
arraysize(kGLSwitchesCopiedFromGpuProcessHost);
diff --git a/ui/gl/gl_switches.h b/ui/gl/gl_switches.h
index 2824cec..4e42431 100644
--- a/ui/gl/gl_switches.h
+++ b/ui/gl/gl_switches.h
@@ -36,6 +36,7 @@ GL_EXPORT extern const char kUseGL[];
GL_EXPORT extern const char kSwiftShaderPath[];
GL_EXPORT extern const char kTestGLLib[];
GL_EXPORT extern const char kUseGpuInTests[];
+GL_EXPORT extern const char kUseWarp[];
// These flags are used by the test harness code, not passed in by users.
GL_EXPORT extern const char kDisableGLDrawingForTests[];
diff --git a/win8/delegate_execute/command_execute_impl.cc b/win8/delegate_execute/command_execute_impl.cc
index b62319a..aea54f3 100644
--- a/win8/delegate_execute/command_execute_impl.cc
+++ b/win8/delegate_execute/command_execute_impl.cc
@@ -28,6 +28,7 @@
#include "chrome/installer/util/shell_util.h"
#include "chrome/installer/util/util_constants.h"
#include "ui/base/clipboard/clipboard_util_win.h"
+#include "ui/base/ui_base_switches.h"
#include "ui/gfx/win/dpi.h"
#include "win8/delegate_execute/chrome_util.h"
#include "win8/delegate_execute/delegate_execute_util.h"
@@ -154,7 +155,8 @@ bool CommandExecuteImpl::path_provider_initialized_ = false;
// c) If the activation returns E_APPLICATION_NOT_REGISTERED, then we fall
// back to launching chrome on the desktop via LaunchDestopChrome(). Note
// that this case can lead to strange behavior, because at this point we
-// have pre-launched the browser with --silent-launch --viewer-connect.
+// have pre-launched the browser with:
+// --silent-launch --connect-to-metro-viewer.
// E_APPLICATION_NOT_REGISTERED is always returned if Chrome is not the
// default browser (this case will have already been checked for by
// GetLaunchMode() and AHE_DESKTOP returned), but we don't know if it can
diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc
index 98e52b3..8955b29 100644
--- a/win8/metro_driver/chrome_app_view_ash.cc
+++ b/win8/metro_driver/chrome_app_view_ash.cc
@@ -346,7 +346,7 @@ bool LaunchChromeBrowserProcess(const wchar_t* additional_parameters,
if (!PathService::Get(base::FILE_EXE, &chrome_exe_path))
return false;
- base::string16 parameters = L"--silent-launch --viewer-connect ";
+ base::string16 parameters = L"--silent-launch --connect-to-metro-viewer ";
if (additional_parameters)
parameters += additional_parameters;