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

Side by Side 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: nits and use best_resource_format for now Created 5 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/compositor/gpu_process_transport_factory.h" 5 #include "content/browser/compositor/gpu_process_transport_factory.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 CauseForGpuLaunch cause = 256 CauseForGpuLaunch cause =
257 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; 257 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE;
258 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannel( 258 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannel(
259 cause, base::Bind(&GpuProcessTransportFactory::EstablishedGpuChannel, 259 cause, base::Bind(&GpuProcessTransportFactory::EstablishedGpuChannel,
260 callback_factory_.GetWeakPtr(), compositor, 260 callback_factory_.GetWeakPtr(), compositor,
261 create_gpu_output_surface, num_attempts + 1)); 261 create_gpu_output_surface, num_attempts + 1));
262 return; 262 return;
263 } 263 }
264 } 264 }
265 265
266 scoped_refptr<ContextProviderCommandBuffer> worker_context_provider(
267 ContextProviderCommandBuffer::Create(
268 GpuProcessTransportFactory::CreateOffscreenCommandBufferContext(),
269 BROWSER_WORKER_CONTEXT));
piman 2015/07/23 20:44:52 Can you move this into the else block below, so th
reveman 2015/07/24 17:49:15 Done. Added a shared worker context provider to la
270
266 scoped_ptr<BrowserCompositorOutputSurface> surface; 271 scoped_ptr<BrowserCompositorOutputSurface> surface;
267 if (!create_gpu_output_surface) { 272 if (!create_gpu_output_surface) {
268 surface = make_scoped_ptr(new SoftwareBrowserCompositorOutputSurface( 273 surface = make_scoped_ptr(new SoftwareBrowserCompositorOutputSurface(
269 CreateSoftwareOutputDevice(compositor.get()), 274 CreateSoftwareOutputDevice(compositor.get()),
270 compositor->vsync_manager())); 275 compositor->vsync_manager()));
271 } else { 276 } else {
272 DCHECK(context_provider); 277 DCHECK(context_provider);
273 ContextProvider::Capabilities capabilities = 278 ContextProvider::Capabilities capabilities =
274 context_provider->ContextCapabilities(); 279 context_provider->ContextCapabilities();
275 if (!data->surface_id) { 280 if (!data->surface_id) {
276 surface = make_scoped_ptr(new OffscreenBrowserCompositorOutputSurface( 281 surface = make_scoped_ptr(new OffscreenBrowserCompositorOutputSurface(
277 context_provider, compositor->vsync_manager(), 282 context_provider, compositor->vsync_manager(),
278 scoped_ptr<BrowserCompositorOverlayCandidateValidator>())); 283 scoped_ptr<BrowserCompositorOverlayCandidateValidator>()));
279 } else if (capabilities.gpu.surfaceless) { 284 } else if (capabilities.gpu.surfaceless) {
280 surface = 285 surface =
281 make_scoped_ptr(new GpuSurfacelessBrowserCompositorOutputSurface( 286 make_scoped_ptr(new GpuSurfacelessBrowserCompositorOutputSurface(
282 context_provider, data->surface_id, compositor->vsync_manager(), 287 context_provider, worker_context_provider, data->surface_id,
288 compositor->vsync_manager(),
283 CreateOverlayCandidateValidator(compositor->widget()), 289 CreateOverlayCandidateValidator(compositor->widget()),
284 GL_TEXTURE_2D, GL_RGB, BrowserGpuMemoryBufferManager::current())); 290 GL_TEXTURE_2D, GL_RGB, BrowserGpuMemoryBufferManager::current()));
285 } else { 291 } else {
286 surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface( 292 surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface(
287 context_provider, compositor->vsync_manager(), 293 context_provider, worker_context_provider,
294 compositor->vsync_manager(),
288 CreateOverlayCandidateValidator(compositor->widget()))); 295 CreateOverlayCandidateValidator(compositor->widget())));
289 } 296 }
290 } 297 }
291 298
292 // TODO(piman): Use GpuSurfaceTracker to map ids to surfaces instead of an 299 // TODO(piman): Use GpuSurfaceTracker to map ids to surfaces instead of an
293 // output_surface_map_ here. 300 // output_surface_map_ here.
294 output_surface_map_.AddWithID(surface.get(), data->surface_id); 301 output_surface_map_.AddWithID(surface.get(), data->surface_id);
295 data->surface = surface.get(); 302 data->surface = surface.get();
296 if (data->reflector) 303 if (data->reflector)
297 data->reflector->OnSourceSurfaceReady(data->surface); 304 data->reflector->OnSourceSurfaceReady(data->surface);
298 305
299 if (!UseSurfacesEnabled()) { 306 if (!UseSurfacesEnabled()) {
300 compositor->SetOutputSurface(surface.Pass()); 307 compositor->SetOutputSurface(surface.Pass());
301 return; 308 return;
302 } 309 }
303 310
304 // This gets a bit confusing. Here we have a ContextProvider in the |surface| 311 // This gets a bit confusing. Here we have a ContextProvider in the |surface|
305 // configured to render directly to this widget. We need to make an 312 // configured to render directly to this widget. We need to make an
306 // OnscreenDisplayClient associated with that context, then return a 313 // OnscreenDisplayClient associated with that context, then return a
307 // SurfaceDisplayOutputSurface set up to draw to the display's surface. 314 // SurfaceDisplayOutputSurface set up to draw to the display's surface.
308 cc::SurfaceManager* manager = surface_manager_.get(); 315 cc::SurfaceManager* manager = surface_manager_.get();
309 scoped_ptr<cc::OnscreenDisplayClient> display_client( 316 scoped_ptr<cc::OnscreenDisplayClient> display_client(
310 new cc::OnscreenDisplayClient( 317 new cc::OnscreenDisplayClient(
311 surface.Pass(), manager, HostSharedBitmapManager::current(), 318 surface.Pass(), manager, HostSharedBitmapManager::current(),
312 BrowserGpuMemoryBufferManager::current(), 319 BrowserGpuMemoryBufferManager::current(),
313 compositor->GetRendererSettings(), compositor->task_runner())); 320 compositor->GetRendererSettings(), compositor->task_runner()));
314 321
315 scoped_ptr<cc::SurfaceDisplayOutputSurface> output_surface( 322 scoped_ptr<cc::SurfaceDisplayOutputSurface> output_surface(
316 new cc::SurfaceDisplayOutputSurface( 323 new cc::SurfaceDisplayOutputSurface(
317 manager, compositor->surface_id_allocator(), context_provider)); 324 manager, compositor->surface_id_allocator(), context_provider,
325 worker_context_provider));
318 display_client->set_surface_output_surface(output_surface.get()); 326 display_client->set_surface_output_surface(output_surface.get());
319 output_surface->set_display_client(display_client.get()); 327 output_surface->set_display_client(display_client.get());
320 display_client->display()->Resize(compositor->size()); 328 display_client->display()->Resize(compositor->size());
321 data->display_client = display_client.Pass(); 329 data->display_client = display_client.Pass();
322 compositor->SetOutputSurface(output_surface.Pass()); 330 compositor->SetOutputSurface(output_surface.Pass());
323 } 331 }
324 332
325 scoped_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( 333 scoped_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector(
326 ui::Compositor* source_compositor, 334 ui::Compositor* source_compositor,
327 ui::Layer* target_layer) { 335 ui::Layer* target_layer) {
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, 595 FOR_EACH_OBSERVER(ImageTransportFactoryObserver,
588 observer_list_, 596 observer_list_,
589 OnLostResources()); 597 OnLostResources());
590 598
591 // Kill things that use the shared context before killing the shared context. 599 // Kill things that use the shared context before killing the shared context.
592 lost_gl_helper.reset(); 600 lost_gl_helper.reset();
593 lost_shared_main_thread_contexts = NULL; 601 lost_shared_main_thread_contexts = NULL;
594 } 602 }
595 603
596 } // namespace content 604 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698