Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(993)

Unified Diff: content/browser/compositor/gpu_process_transport_factory.cc

Issue 1230203007: Re-land: cc: Use worker context for one-copy tile initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/compositor/gpu_process_transport_factory.cc
diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc
index 86853c8cec3da75753036dda5efe99ca4a16bfc7..4c0b3630df7eaa3c2565da02b28c9161b2467e5a 100644
--- a/content/browser/compositor/gpu_process_transport_factory.cc
+++ b/content/browser/compositor/gpu_process_transport_factory.cc
@@ -241,6 +241,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()) {
@@ -250,12 +257,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;
@@ -278,7 +297,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;
@@ -289,13 +309,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())));
}
}
@@ -326,7 +348,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());

Powered by Google App Engine
This is Rietveld 408576698