summaryrefslogtreecommitdiffstats
path: root/content/browser/compositor
diff options
context:
space:
mode:
Diffstat (limited to 'content/browser/compositor')
-rw-r--r--content/browser/compositor/browser_compositor_output_surface.cc8
-rw-r--r--content/browser/compositor/browser_compositor_output_surface.h1
-rw-r--r--content/browser/compositor/gpu_browser_compositor_output_surface.cc2
-rw-r--r--content/browser/compositor/gpu_browser_compositor_output_surface.h1
-rw-r--r--content/browser/compositor/gpu_process_transport_factory.cc35
-rw-r--r--content/browser/compositor/gpu_process_transport_factory.h1
-rw-r--r--content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc2
-rw-r--r--content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.h1
-rw-r--r--content/browser/compositor/offscreen_browser_compositor_output_surface.cc2
-rw-r--r--content/browser/compositor/offscreen_browser_compositor_output_surface.h1
-rw-r--r--content/browser/compositor/reflector_impl_unittest.cc1
11 files changed, 46 insertions, 9 deletions
diff --git a/content/browser/compositor/browser_compositor_output_surface.cc b/content/browser/compositor/browser_compositor_output_surface.cc
index 0e014c9..bdf3a1b 100644
--- a/content/browser/compositor/browser_compositor_output_surface.cc
+++ b/content/browser/compositor/browser_compositor_output_surface.cc
@@ -17,14 +17,16 @@ namespace content {
BrowserCompositorOutputSurface::BrowserCompositorOutputSurface(
const scoped_refptr<cc::ContextProvider>& context_provider,
+ const scoped_refptr<cc::ContextProvider>& worker_context_provider,
const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager,
scoped_ptr<BrowserCompositorOverlayCandidateValidator>
overlay_candidate_validator)
- : OutputSurface(context_provider),
+ : OutputSurface(context_provider, worker_context_provider),
vsync_manager_(vsync_manager),
reflector_(nullptr),
- use_begin_frame_scheduling_(base::CommandLine::ForCurrentProcess()->
- HasSwitch(cc::switches::kEnableBeginFrameScheduling)) {
+ use_begin_frame_scheduling_(
+ base::CommandLine::ForCurrentProcess()
+ ->HasSwitch(cc::switches::kEnableBeginFrameScheduling)) {
overlay_candidate_validator_ = overlay_candidate_validator.Pass();
Initialize();
}
diff --git a/content/browser/compositor/browser_compositor_output_surface.h b/content/browser/compositor/browser_compositor_output_surface.h
index f582776..f5da02d 100644
--- a/content/browser/compositor/browser_compositor_output_surface.h
+++ b/content/browser/compositor/browser_compositor_output_surface.h
@@ -56,6 +56,7 @@ class CONTENT_EXPORT BrowserCompositorOutputSurface
// Constructor used by the accelerated implementation.
BrowserCompositorOutputSurface(
const scoped_refptr<cc::ContextProvider>& context,
+ const scoped_refptr<cc::ContextProvider>& worker_context,
const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager,
scoped_ptr<BrowserCompositorOverlayCandidateValidator>
overlay_candidate_validator);
diff --git a/content/browser/compositor/gpu_browser_compositor_output_surface.cc b/content/browser/compositor/gpu_browser_compositor_output_surface.cc
index 81da36d..70725a2 100644
--- a/content/browser/compositor/gpu_browser_compositor_output_surface.cc
+++ b/content/browser/compositor/gpu_browser_compositor_output_surface.cc
@@ -17,10 +17,12 @@ namespace content {
GpuBrowserCompositorOutputSurface::GpuBrowserCompositorOutputSurface(
const scoped_refptr<ContextProviderCommandBuffer>& context,
+ const scoped_refptr<ContextProviderCommandBuffer>& worker_context,
const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager,
scoped_ptr<BrowserCompositorOverlayCandidateValidator>
overlay_candidate_validator)
: BrowserCompositorOutputSurface(context,
+ worker_context,
vsync_manager,
overlay_candidate_validator.Pass()),
#if defined(OS_MACOSX)
diff --git a/content/browser/compositor/gpu_browser_compositor_output_surface.h b/content/browser/compositor/gpu_browser_compositor_output_surface.h
index 3bc2a3a..7b4f242 100644
--- a/content/browser/compositor/gpu_browser_compositor_output_surface.h
+++ b/content/browser/compositor/gpu_browser_compositor_output_surface.h
@@ -26,6 +26,7 @@ class GpuBrowserCompositorOutputSurface
public:
GpuBrowserCompositorOutputSurface(
const scoped_refptr<ContextProviderCommandBuffer>& context,
+ const scoped_refptr<ContextProviderCommandBuffer>& worker_context,
const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager,
scoped_ptr<BrowserCompositorOverlayCandidateValidator>
overlay_candidate_validator);
diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc
index fcb0a3e..f03eb9e 100644
--- a/content/browser/compositor/gpu_process_transport_factory.cc
+++ b/content/browser/compositor/gpu_process_transport_factory.cc
@@ -237,6 +237,13 @@ void GpuProcessTransportFactory::EstablishedGpuChannel(
scoped_refptr<ContextProviderCommandBuffer> context_provider;
if (create_gpu_output_surface) {
+ // Try to reuse existing worker context provider.
+ if (shared_worker_context_provider_) {
+ base::AutoLock lock(*shared_worker_context_provider_->GetLock());
+ if (shared_worker_context_provider_->ContextGL()
+ ->GetGraphicsResetStatusKHR() != GL_NO_ERROR)
+ shared_worker_context_provider_ = nullptr;
+ }
scoped_refptr<GpuChannelHost> gpu_channel_host =
BrowserGpuChannelHostFactory::instance()->GetGpuChannel();
if (gpu_channel_host.get()) {
@@ -246,12 +253,24 @@ void GpuProcessTransportFactory::EstablishedGpuChannel(
BROWSER_COMPOSITOR_ONSCREEN_CONTEXT);
if (context_provider && !context_provider->BindToCurrentThread())
context_provider = nullptr;
+ if (!shared_worker_context_provider_) {
+ shared_worker_context_provider_ = ContextProviderCommandBuffer::Create(
+ GpuProcessTransportFactory::CreateContextCommon(gpu_channel_host,
+ 0),
+ BROWSER_WORKER_CONTEXT);
+ if (shared_worker_context_provider_ &&
+ !shared_worker_context_provider_->BindToCurrentThread())
+ shared_worker_context_provider_ = nullptr;
+ }
}
+ bool created_gpu_browser_compositor =
+ !!context_provider && !!shared_worker_context_provider_;
+
UMA_HISTOGRAM_BOOLEAN("Aura.CreatedGpuBrowserCompositor",
- !!context_provider.get());
+ created_gpu_browser_compositor);
- if (!context_provider) {
+ if (!created_gpu_browser_compositor) {
// Try again.
CauseForGpuLaunch cause =
CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE;
@@ -274,7 +293,8 @@ void GpuProcessTransportFactory::EstablishedGpuChannel(
context_provider->ContextCapabilities();
if (!data->surface_id) {
surface = make_scoped_ptr(new OffscreenBrowserCompositorOutputSurface(
- context_provider, compositor->vsync_manager(),
+ context_provider, shared_worker_context_provider_,
+ compositor->vsync_manager(),
scoped_ptr<BrowserCompositorOverlayCandidateValidator>()));
} else if (capabilities.gpu.surfaceless) {
GLenum target = GL_TEXTURE_2D;
@@ -285,13 +305,15 @@ void GpuProcessTransportFactory::EstablishedGpuChannel(
#endif
surface =
make_scoped_ptr(new GpuSurfacelessBrowserCompositorOutputSurface(
- context_provider, data->surface_id, compositor->vsync_manager(),
+ context_provider, shared_worker_context_provider_,
+ data->surface_id, compositor->vsync_manager(),
CreateOverlayCandidateValidator(compositor->widget()), target,
format, BrowserGpuMemoryBufferManager::current()));
} else {
if (!surface) {
surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface(
- context_provider, compositor->vsync_manager(),
+ context_provider, shared_worker_context_provider_,
+ compositor->vsync_manager(),
CreateOverlayCandidateValidator(compositor->widget())));
}
}
@@ -322,7 +344,8 @@ void GpuProcessTransportFactory::EstablishedGpuChannel(
scoped_ptr<cc::SurfaceDisplayOutputSurface> output_surface(
new cc::SurfaceDisplayOutputSurface(
- manager, compositor->surface_id_allocator(), context_provider));
+ manager, compositor->surface_id_allocator(), context_provider,
+ shared_worker_context_provider_));
display_client->set_surface_output_surface(output_surface.get());
output_surface->set_display_client(display_client.get());
display_client->display()->Resize(compositor->size());
diff --git a/content/browser/compositor/gpu_process_transport_factory.h b/content/browser/compositor/gpu_process_transport_factory.h
index c16b36e..564b3cd 100644
--- a/content/browser/compositor/gpu_process_transport_factory.h
+++ b/content/browser/compositor/gpu_process_transport_factory.h
@@ -102,6 +102,7 @@ class GpuProcessTransportFactory
uint32_t next_surface_id_namespace_;
scoped_ptr<cc::TaskGraphRunner> task_graph_runner_;
scoped_ptr<base::SimpleThread> raster_thread_;
+ scoped_refptr<ContextProviderCommandBuffer> shared_worker_context_provider_;
#if defined(OS_WIN)
scoped_ptr<OutputDeviceBacking> software_backing_;
diff --git a/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc b/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc
index 9507cc3..d28e264 100644
--- a/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc
+++ b/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc
@@ -19,6 +19,7 @@ namespace content {
GpuSurfacelessBrowserCompositorOutputSurface::
GpuSurfacelessBrowserCompositorOutputSurface(
const scoped_refptr<ContextProviderCommandBuffer>& context,
+ const scoped_refptr<ContextProviderCommandBuffer>& worker_context,
int surface_id,
const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager,
scoped_ptr<BrowserCompositorOverlayCandidateValidator>
@@ -27,6 +28,7 @@ GpuSurfacelessBrowserCompositorOutputSurface::
unsigned int internalformat,
BrowserGpuMemoryBufferManager* gpu_memory_buffer_manager)
: GpuBrowserCompositorOutputSurface(context,
+ worker_context,
vsync_manager,
overlay_candidate_validator.Pass()),
internalformat_(internalformat),
diff --git a/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.h b/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.h
index 27bb335..ed5618d 100644
--- a/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.h
+++ b/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.h
@@ -18,6 +18,7 @@ class GpuSurfacelessBrowserCompositorOutputSurface
public:
GpuSurfacelessBrowserCompositorOutputSurface(
const scoped_refptr<ContextProviderCommandBuffer>& context,
+ const scoped_refptr<ContextProviderCommandBuffer>& worker_context,
int surface_id,
const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager,
scoped_ptr<BrowserCompositorOverlayCandidateValidator>
diff --git a/content/browser/compositor/offscreen_browser_compositor_output_surface.cc b/content/browser/compositor/offscreen_browser_compositor_output_surface.cc
index 3a98015..606b9fa 100644
--- a/content/browser/compositor/offscreen_browser_compositor_output_surface.cc
+++ b/content/browser/compositor/offscreen_browser_compositor_output_surface.cc
@@ -30,10 +30,12 @@ namespace content {
OffscreenBrowserCompositorOutputSurface::
OffscreenBrowserCompositorOutputSurface(
const scoped_refptr<ContextProviderCommandBuffer>& context,
+ const scoped_refptr<ContextProviderCommandBuffer>& worker_context,
const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager,
scoped_ptr<BrowserCompositorOverlayCandidateValidator>
overlay_candidate_validator)
: BrowserCompositorOutputSurface(context,
+ worker_context,
vsync_manager,
overlay_candidate_validator.Pass()),
fbo_(0),
diff --git a/content/browser/compositor/offscreen_browser_compositor_output_surface.h b/content/browser/compositor/offscreen_browser_compositor_output_surface.h
index 67fc224..c9e32e7 100644
--- a/content/browser/compositor/offscreen_browser_compositor_output_surface.h
+++ b/content/browser/compositor/offscreen_browser_compositor_output_surface.h
@@ -23,6 +23,7 @@ class OffscreenBrowserCompositorOutputSurface
public:
OffscreenBrowserCompositorOutputSurface(
const scoped_refptr<ContextProviderCommandBuffer>& context,
+ const scoped_refptr<ContextProviderCommandBuffer>& worker_context,
const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager,
scoped_ptr<BrowserCompositorOverlayCandidateValidator>
overlay_candidate_validator);
diff --git a/content/browser/compositor/reflector_impl_unittest.cc b/content/browser/compositor/reflector_impl_unittest.cc
index ce9fbb9..3377b8a 100644
--- a/content/browser/compositor/reflector_impl_unittest.cc
+++ b/content/browser/compositor/reflector_impl_unittest.cc
@@ -74,6 +74,7 @@ class TestOutputSurface : public BrowserCompositorOutputSurface {
const scoped_refptr<cc::ContextProvider>& context_provider,
const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager)
: BrowserCompositorOutputSurface(context_provider,
+ nullptr,
vsync_manager,
CreateTestValidatorOzone().Pass()) {}