Commit 032b23bd authored by ccameron@chromium.org's avatar ccameron@chromium.org

Fall back to software mode if Aura can't create a GL context

Wire up fallback from Compositor::CreateOutputSurface to
ContextFactory::CreateOutputSurface, so that we force using
the software compositor after failing to create a GL context
enough times.

BUG=319267

Review URL: https://codereview.chromium.org/93593002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238382 0039d316-1c4b-4281-b951-d872f2087c98
parent 5bdca91f
......@@ -179,7 +179,7 @@ scoped_ptr<cc::SoftwareOutputDevice> CreateSoftwareOutputDevice(
}
scoped_ptr<cc::OutputSurface> GpuProcessTransportFactory::CreateOutputSurface(
ui::Compositor* compositor) {
ui::Compositor* compositor, bool software_fallback) {
PerCompositorData* data = per_compositor_data_[compositor];
if (!data)
data = CreatePerCompositorData(compositor);
......@@ -187,7 +187,8 @@ scoped_ptr<cc::OutputSurface> GpuProcessTransportFactory::CreateOutputSurface(
scoped_refptr<ContextProviderCommandBuffer> context_provider;
CommandLine* command_line = CommandLine::ForCurrentProcess();
if (!command_line->HasSwitch(switches::kUIEnableSoftwareCompositing)) {
if (!command_line->HasSwitch(switches::kUIEnableSoftwareCompositing) &&
!software_fallback) {
context_provider = ContextProviderCommandBuffer::Create(
GpuProcessTransportFactory::CreateContextCommon(data->surface_id),
"Compositor");
......
......@@ -36,7 +36,7 @@ class GpuProcessTransportFactory
// ui::ContextFactory implementation.
virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(
ui::Compositor* compositor) OVERRIDE;
ui::Compositor* compositor, bool software_fallback) OVERRIDE;
virtual scoped_refptr<ui::Reflector> CreateReflector(
ui::Compositor* source,
ui::Layer* target) OVERRIDE;
......
......@@ -508,7 +508,7 @@ void Compositor::Layout() {
}
scoped_ptr<cc::OutputSurface> Compositor::CreateOutputSurface(bool fallback) {
return ContextFactory::GetInstance()->CreateOutputSurface(this);
return ContextFactory::GetInstance()->CreateOutputSurface(this, fallback);
}
void Compositor::DidCommit() {
......
......@@ -86,7 +86,7 @@ class COMPOSITOR_EXPORT ContextFactory {
// per-compositor data (e.g. a shared context), that needs to be cleaned up
// by calling RemoveCompositor when the compositor gets destroyed.
virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(
Compositor* compositor) = 0;
Compositor* compositor, bool software_fallback) = 0;
// Creates a reflector that copies the content of the |mirrored_compositor|
// onto |mirroing_layer|.
......
......@@ -30,7 +30,8 @@ bool DefaultContextFactory::Initialize() {
}
scoped_ptr<cc::OutputSurface> DefaultContextFactory::CreateOutputSurface(
Compositor* compositor) {
Compositor* compositor, bool software_fallback) {
DCHECK(!software_fallback);
blink::WebGraphicsContext3D::Attributes attrs;
attrs.depth = false;
attrs.stencil = false;
......
......@@ -23,7 +23,7 @@ class DefaultContextFactory : public ContextFactory {
// ContextFactory implementation
virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(
Compositor* compositor) OVERRIDE;
Compositor* compositor, bool software_fallback) OVERRIDE;
virtual scoped_refptr<Reflector> CreateReflector(
Compositor* compositor,
......
......@@ -15,7 +15,8 @@ TestContextFactory::TestContextFactory() {}
TestContextFactory::~TestContextFactory() {}
scoped_ptr<cc::OutputSurface> TestContextFactory::CreateOutputSurface(
Compositor* compositor) {
Compositor* compositor, bool software_fallback) {
DCHECK(!software_fallback);
return make_scoped_ptr(
new cc::OutputSurface(cc::TestContextProvider::Create()));
}
......
......@@ -19,7 +19,7 @@ class TestContextFactory : public ContextFactory {
// ContextFactory implementation
virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(
Compositor* compositor) OVERRIDE;
Compositor* compositor, bool software_fallback) OVERRIDE;
virtual scoped_refptr<Reflector> CreateReflector(
Compositor* mirrored_compositor,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment