Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/metrics/field_trial.h" | |
| 14 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
| 15 #include "base/profiler/scoped_tracker.h" | 16 #include "base/profiler/scoped_tracker.h" |
| 16 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 17 #include "base/threading/simple_thread.h" | 18 #include "base/threading/simple_thread.h" |
| 18 #include "base/threading/thread.h" | 19 #include "base/threading/thread.h" |
| 19 #include "base/threading/thread_task_runner_handle.h" | 20 #include "base/threading/thread_task_runner_handle.h" |
| 20 #include "build/build_config.h" | 21 #include "build/build_config.h" |
| 21 #include "cc/base/histograms.h" | 22 #include "cc/base/histograms.h" |
| 22 #include "cc/output/texture_mailbox_deleter.h" | 23 #include "cc/output/texture_mailbox_deleter.h" |
| 23 #include "cc/output/vulkan_in_process_context_provider.h" | 24 #include "cc/output/vulkan_in_process_context_provider.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 51 #include "services/service_manager/runner/common/client_util.h" | 52 #include "services/service_manager/runner/common/client_util.h" |
| 52 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" | 53 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" |
| 53 #include "third_party/khronos/GLES2/gl2.h" | 54 #include "third_party/khronos/GLES2/gl2.h" |
| 54 #include "ui/compositor/compositor.h" | 55 #include "ui/compositor/compositor.h" |
| 55 #include "ui/compositor/compositor_constants.h" | 56 #include "ui/compositor/compositor_constants.h" |
| 56 #include "ui/compositor/compositor_switches.h" | 57 #include "ui/compositor/compositor_switches.h" |
| 57 #include "ui/compositor/layer.h" | 58 #include "ui/compositor/layer.h" |
| 58 #include "ui/display/types/display_snapshot.h" | 59 #include "ui/display/types/display_snapshot.h" |
| 59 #include "ui/gfx/geometry/size.h" | 60 #include "ui/gfx/geometry/size.h" |
| 60 #include "ui/gfx/switches.h" | 61 #include "ui/gfx/switches.h" |
| 62 #include "ui/gl/gl_switches.h" | |
| 61 | 63 |
| 62 #if defined(USE_AURA) | 64 #if defined(USE_AURA) |
| 63 #include "content/browser/compositor/mus_browser_compositor_output_surface.h" | 65 #include "content/browser/compositor/mus_browser_compositor_output_surface.h" |
| 64 #include "content/public/common/service_manager_connection.h" | 66 #include "content/public/common/service_manager_connection.h" |
| 65 #include "ui/aura/window_tree_host.h" | 67 #include "ui/aura/window_tree_host.h" |
| 66 #endif | 68 #endif |
| 67 | 69 |
| 68 #if defined(OS_WIN) | 70 #if defined(OS_WIN) |
| 69 #include "components/display_compositor/compositor_overlay_candidate_validator_w in.h" | 71 #include "components/display_compositor/compositor_overlay_candidate_validator_w in.h" |
| 70 #include "content/browser/compositor/software_output_device_win.h" | 72 #include "content/browser/compositor/software_output_device_win.h" |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 101 using gpu::gles2::GLES2Interface; | 103 using gpu::gles2::GLES2Interface; |
| 102 | 104 |
| 103 namespace { | 105 namespace { |
| 104 | 106 |
| 105 const int kNumRetriesBeforeSoftwareFallback = 4; | 107 const int kNumRetriesBeforeSoftwareFallback = 4; |
| 106 | 108 |
| 107 bool IsUsingMus() { | 109 bool IsUsingMus() { |
| 108 return service_manager::ServiceManagerIsRemote(); | 110 return service_manager::ServiceManagerIsRemote(); |
| 109 } | 111 } |
| 110 | 112 |
| 113 bool IsGpuVSyncSignalSupported() { | |
| 114 #if defined(OS_WIN) | |
| 115 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
|
sunnyps
2017/01/25 01:36:41
This belongs in content/browser/gpu/compositor_uti
stanisc
2017/01/26 02:14:12
This is a temporary switch which I hope to get rid
| |
| 116 if (command_line->HasSwitch(switches::kUseD3DVSync)) | |
| 117 return true; | |
| 118 | |
| 119 const std::string group_name = | |
| 120 base::FieldTrialList::FindFullName("UseD3DVSync"); | |
| 121 return group_name == "Enabled"; | |
| 122 #else | |
| 123 return false; | |
| 124 #endif // defined(OS_WIN) | |
| 125 } | |
| 126 | |
| 111 scoped_refptr<ui::ContextProviderCommandBuffer> CreateContextCommon( | 127 scoped_refptr<ui::ContextProviderCommandBuffer> CreateContextCommon( |
| 112 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, | 128 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, |
| 113 gpu::SurfaceHandle surface_handle, | 129 gpu::SurfaceHandle surface_handle, |
| 114 bool need_alpha_channel, | 130 bool need_alpha_channel, |
| 115 bool need_stencil_bits, | 131 bool need_stencil_bits, |
| 116 bool support_locking, | 132 bool support_locking, |
| 117 ui::ContextProviderCommandBuffer* shared_context_provider, | 133 ui::ContextProviderCommandBuffer* shared_context_provider, |
| 118 ui::command_buffer_metrics::ContextType type) { | 134 ui::command_buffer_metrics::ContextType type) { |
| 119 DCHECK( | 135 DCHECK( |
| 120 content::GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor()); | 136 content::GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor()); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 } | 177 } |
| 162 #endif | 178 #endif |
| 163 | 179 |
| 164 } // namespace | 180 } // namespace |
| 165 | 181 |
| 166 namespace content { | 182 namespace content { |
| 167 | 183 |
| 168 struct GpuProcessTransportFactory::PerCompositorData { | 184 struct GpuProcessTransportFactory::PerCompositorData { |
| 169 gpu::SurfaceHandle surface_handle = gpu::kNullSurfaceHandle; | 185 gpu::SurfaceHandle surface_handle = gpu::kNullSurfaceHandle; |
| 170 BrowserCompositorOutputSurface* display_output_surface = nullptr; | 186 BrowserCompositorOutputSurface* display_output_surface = nullptr; |
| 171 std::unique_ptr<cc::SyntheticBeginFrameSource> begin_frame_source; | 187 // Either |synthetic_begin_frame_source| or |gpu_vsync_begin_frame_source| is |
| 188 // valid but not both at the same time. | |
| 189 std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source; | |
| 190 std::unique_ptr<GpuVSyncBeginFrameSource> gpu_vsync_begin_frame_source; | |
| 172 ReflectorImpl* reflector = nullptr; | 191 ReflectorImpl* reflector = nullptr; |
| 173 std::unique_ptr<cc::Display> display; | 192 std::unique_ptr<cc::Display> display; |
| 174 bool output_is_secure = false; | 193 bool output_is_secure = false; |
| 175 }; | 194 }; |
| 176 | 195 |
| 177 GpuProcessTransportFactory::GpuProcessTransportFactory() | 196 GpuProcessTransportFactory::GpuProcessTransportFactory() |
| 178 : task_graph_runner_(new cc::SingleThreadTaskGraphRunner), | 197 : task_graph_runner_(new cc::SingleThreadTaskGraphRunner), |
| 179 callback_factory_(this) { | 198 callback_factory_(this) { |
| 180 cc::SetClientNameForMetrics("Browser"); | 199 cc::SetClientNameForMetrics("Browser"); |
| 181 | 200 |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 454 gpu::GpuChannelEstablishedCallback callback( | 473 gpu::GpuChannelEstablishedCallback callback( |
| 455 base::Bind(&GpuProcessTransportFactory::EstablishedGpuChannel, | 474 base::Bind(&GpuProcessTransportFactory::EstablishedGpuChannel, |
| 456 callback_factory_.GetWeakPtr(), compositor, | 475 callback_factory_.GetWeakPtr(), compositor, |
| 457 create_gpu_output_surface, num_attempts + 1)); | 476 create_gpu_output_surface, num_attempts + 1)); |
| 458 DCHECK(gpu_channel_factory_); | 477 DCHECK(gpu_channel_factory_); |
| 459 gpu_channel_factory_->EstablishGpuChannel(callback); | 478 gpu_channel_factory_->EstablishGpuChannel(callback); |
| 460 return; | 479 return; |
| 461 } | 480 } |
| 462 } | 481 } |
| 463 | 482 |
| 464 std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source; | |
| 465 if (!compositor->GetRendererSettings().disable_display_vsync) { | |
| 466 synthetic_begin_frame_source.reset(new cc::DelayBasedBeginFrameSource( | |
| 467 base::MakeUnique<cc::DelayBasedTimeSource>( | |
| 468 compositor->task_runner().get()))); | |
| 469 } else { | |
| 470 synthetic_begin_frame_source.reset(new cc::BackToBackBeginFrameSource( | |
| 471 base::MakeUnique<cc::DelayBasedTimeSource>( | |
| 472 compositor->task_runner().get()))); | |
| 473 } | |
| 474 cc::BeginFrameSource* begin_frame_source = synthetic_begin_frame_source.get(); | |
| 475 | |
| 476 BrowserCompositorOutputSurface::UpdateVSyncParametersCallback vsync_callback = | 483 BrowserCompositorOutputSurface::UpdateVSyncParametersCallback vsync_callback = |
| 477 base::Bind(&ui::Compositor::SetDisplayVSyncParameters, compositor); | 484 base::Bind(&ui::Compositor::SetDisplayVSyncParameters, compositor); |
| 485 cc::BeginFrameSource* begin_frame_source = nullptr; | |
| 486 GpuVSyncControl* gpu_vsync_control = nullptr; | |
| 478 | 487 |
| 479 std::unique_ptr<BrowserCompositorOutputSurface> display_output_surface; | 488 std::unique_ptr<BrowserCompositorOutputSurface> display_output_surface; |
| 480 #if defined(ENABLE_VULKAN) | 489 #if defined(ENABLE_VULKAN) |
| 481 std::unique_ptr<VulkanBrowserCompositorOutputSurface> vulkan_surface; | 490 std::unique_ptr<VulkanBrowserCompositorOutputSurface> vulkan_surface; |
| 482 if (vulkan_context_provider) { | 491 if (vulkan_context_provider) { |
| 483 vulkan_surface.reset(new VulkanBrowserCompositorOutputSurface( | 492 vulkan_surface.reset(new VulkanBrowserCompositorOutputSurface( |
| 484 vulkan_context_provider, vsync_callback)); | 493 vulkan_context_provider, vsync_callback)); |
| 485 if (!vulkan_surface->Initialize(compositor.get()->widget())) { | 494 if (!vulkan_surface->Initialize(compositor.get()->widget())) { |
| 486 vulkan_surface->Destroy(); | 495 vulkan_surface->Destroy(); |
| 487 vulkan_surface.reset(); | 496 vulkan_surface.reset(); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 507 std::unique_ptr< | 516 std::unique_ptr< |
| 508 display_compositor::CompositorOverlayCandidateValidator>()); | 517 display_compositor::CompositorOverlayCandidateValidator>()); |
| 509 } else if (capabilities.surfaceless) { | 518 } else if (capabilities.surfaceless) { |
| 510 #if defined(OS_MACOSX) | 519 #if defined(OS_MACOSX) |
| 511 display_output_surface = base::MakeUnique<GpuOutputSurfaceMac>( | 520 display_output_surface = base::MakeUnique<GpuOutputSurfaceMac>( |
| 512 compositor->widget(), context_provider, data->surface_handle, | 521 compositor->widget(), context_provider, data->surface_handle, |
| 513 vsync_callback, | 522 vsync_callback, |
| 514 CreateOverlayCandidateValidator(compositor->widget()), | 523 CreateOverlayCandidateValidator(compositor->widget()), |
| 515 GetGpuMemoryBufferManager()); | 524 GetGpuMemoryBufferManager()); |
| 516 #else | 525 #else |
| 517 display_output_surface = | 526 auto gpu_output_surface = |
| 518 base::MakeUnique<GpuSurfacelessBrowserCompositorOutputSurface>( | 527 base::MakeUnique<GpuSurfacelessBrowserCompositorOutputSurface>( |
| 519 context_provider, data->surface_handle, vsync_callback, | 528 context_provider, data->surface_handle, vsync_callback, |
| 520 CreateOverlayCandidateValidator(compositor->widget()), | 529 CreateOverlayCandidateValidator(compositor->widget()), |
| 521 GL_TEXTURE_2D, GL_RGB, | 530 GL_TEXTURE_2D, GL_RGB, |
| 522 display::DisplaySnapshot::PrimaryFormat(), | 531 display::DisplaySnapshot::PrimaryFormat(), |
| 523 GetGpuMemoryBufferManager()); | 532 GetGpuMemoryBufferManager()); |
| 533 gpu_vsync_control = gpu_output_surface.get(); | |
| 534 display_output_surface = std::move(gpu_output_surface); | |
| 524 #endif | 535 #endif |
| 525 } else { | 536 } else { |
| 526 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> | 537 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> |
| 527 validator; | 538 validator; |
| 528 const bool use_mus = IsUsingMus(); | 539 const bool use_mus = IsUsingMus(); |
| 529 #if !defined(OS_MACOSX) | 540 #if !defined(OS_MACOSX) |
| 530 // Overlays are only supported on surfaceless output surfaces on Mac. | 541 // Overlays are only supported on surfaceless output surfaces on Mac. |
| 531 if (!use_mus) | 542 if (!use_mus) |
| 532 validator = CreateOverlayCandidateValidator(compositor->widget()); | 543 validator = CreateOverlayCandidateValidator(compositor->widget()); |
| 533 #endif | 544 #endif |
| 534 if (!use_mus) { | 545 if (!use_mus) { |
| 535 display_output_surface = | 546 auto gpu_output_surface = |
| 536 base::MakeUnique<GpuBrowserCompositorOutputSurface>( | 547 base::MakeUnique<GpuBrowserCompositorOutputSurface>( |
| 537 context_provider, vsync_callback, std::move(validator), | 548 context_provider, vsync_callback, std::move(validator), |
| 538 support_stencil); | 549 support_stencil); |
| 550 gpu_vsync_control = gpu_output_surface.get(); | |
| 551 display_output_surface = std::move(gpu_output_surface); | |
| 539 } else { | 552 } else { |
| 540 #if defined(USE_AURA) | 553 #if defined(USE_AURA) |
| 541 std::unique_ptr<MusBrowserCompositorOutputSurface> mus_output_surface; | |
| 542 aura::WindowTreeHost* host = | 554 aura::WindowTreeHost* host = |
| 543 aura::WindowTreeHost::GetForAcceleratedWidget( | 555 aura::WindowTreeHost::GetForAcceleratedWidget( |
| 544 compositor->widget()); | 556 compositor->widget()); |
| 545 mus_output_surface = | 557 auto mus_output_surface = |
| 546 base::MakeUnique<MusBrowserCompositorOutputSurface>( | 558 base::MakeUnique<MusBrowserCompositorOutputSurface>( |
| 547 host->window(), context_provider, GetGpuMemoryBufferManager(), | 559 host->window(), context_provider, GetGpuMemoryBufferManager(), |
| 548 vsync_callback, std::move(validator)); | 560 vsync_callback, std::move(validator)); |
| 549 // We use the ExternalBeginFrameSource provided by the output surface | 561 // We use the ExternalBeginFrameSource provided by the output surface |
| 550 // instead of our own synthetic one. | 562 // instead of our own synthetic one. |
| 551 synthetic_begin_frame_source.reset(); | |
| 552 begin_frame_source = mus_output_surface->GetBeginFrameSource(); | 563 begin_frame_source = mus_output_surface->GetBeginFrameSource(); |
| 553 DCHECK(begin_frame_source); | 564 DCHECK(begin_frame_source); |
| 554 display_output_surface = std::move(mus_output_surface); | 565 display_output_surface = std::move(mus_output_surface); |
| 555 #else | 566 #else |
| 556 NOTREACHED(); | 567 NOTREACHED(); |
| 557 #endif | 568 #endif |
| 558 } | 569 } |
| 559 } | 570 } |
| 560 } | 571 } |
| 561 } | 572 } |
| 562 | 573 |
| 563 data->display_output_surface = display_output_surface.get(); | 574 std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source; |
| 575 std::unique_ptr<GpuVSyncBeginFrameSource> gpu_vsync_begin_frame_source; | |
| 576 | |
| 577 if (!begin_frame_source) { | |
| 578 if (!compositor->GetRendererSettings().disable_display_vsync) { | |
| 579 if (gpu_vsync_control && IsGpuVSyncSignalSupported()) { | |
| 580 gpu_vsync_begin_frame_source.reset( | |
| 581 new GpuVSyncBeginFrameSource(gpu_vsync_control)); | |
| 582 begin_frame_source = gpu_vsync_begin_frame_source.get(); | |
| 583 } else { | |
| 584 synthetic_begin_frame_source.reset(new cc::DelayBasedBeginFrameSource( | |
| 585 base::MakeUnique<cc::DelayBasedTimeSource>( | |
| 586 compositor->task_runner().get()))); | |
| 587 begin_frame_source = synthetic_begin_frame_source.get(); | |
| 588 } | |
| 589 } else { | |
| 590 synthetic_begin_frame_source.reset(new cc::BackToBackBeginFrameSource( | |
| 591 base::MakeUnique<cc::DelayBasedTimeSource>( | |
| 592 compositor->task_runner().get()))); | |
| 593 begin_frame_source = synthetic_begin_frame_source.get(); | |
| 594 } | |
| 595 } | |
| 596 | |
| 564 if (data->reflector) | 597 if (data->reflector) |
| 565 data->reflector->OnSourceSurfaceReady(data->display_output_surface); | 598 data->reflector->OnSourceSurfaceReady(data->display_output_surface); |
| 566 | 599 |
| 567 #if defined(OS_WIN) | 600 #if defined(OS_WIN) |
| 568 gfx::RenderingWindowManager::GetInstance()->DoSetParentOnChild( | 601 gfx::RenderingWindowManager::GetInstance()->DoSetParentOnChild( |
| 569 compositor->widget()); | 602 compositor->widget()); |
| 570 #endif | 603 #endif |
| 571 | 604 |
| 572 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( | 605 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( |
| 573 compositor->task_runner().get(), | 606 compositor->task_runner().get(), |
| 574 display_output_surface->capabilities().max_frames_pending)); | 607 display_output_surface->capabilities().max_frames_pending)); |
| 575 | 608 |
| 576 // The Display owns and uses the |display_output_surface| created above. | 609 // The Display owns and uses the |display_output_surface| created above. |
| 577 data->display = base::MakeUnique<cc::Display>( | 610 data->display = base::MakeUnique<cc::Display>( |
| 578 HostSharedBitmapManager::current(), GetGpuMemoryBufferManager(), | 611 HostSharedBitmapManager::current(), GetGpuMemoryBufferManager(), |
| 579 compositor->GetRendererSettings(), compositor->frame_sink_id(), | 612 compositor->GetRendererSettings(), compositor->frame_sink_id(), |
| 580 begin_frame_source, std::move(display_output_surface), | 613 begin_frame_source, std::move(display_output_surface), |
| 581 std::move(scheduler), base::MakeUnique<cc::TextureMailboxDeleter>( | 614 std::move(scheduler), base::MakeUnique<cc::TextureMailboxDeleter>( |
| 582 compositor->task_runner().get())); | 615 compositor->task_runner().get())); |
| 583 // Note that we are careful not to destroy a prior |data->begin_frame_source| | 616 // Note that we are careful not to destroy prior begin frame sources |
| 584 // until we have reset |data->display|. | 617 // until we have reset |data->display|. |
| 585 data->begin_frame_source = std::move(synthetic_begin_frame_source); | 618 data->synthetic_begin_frame_source = std::move(synthetic_begin_frame_source); |
| 619 data->gpu_vsync_begin_frame_source = std::move(gpu_vsync_begin_frame_source); | |
| 586 | 620 |
| 587 // The |delegated_output_surface| is given back to the compositor, it | 621 // The |delegated_output_surface| is given back to the compositor, it |
| 588 // delegates to the Display as its root surface. Importantly, it shares the | 622 // delegates to the Display as its root surface. Importantly, it shares the |
| 589 // same ContextProvider as the Display's output surface. | 623 // same ContextProvider as the Display's output surface. |
| 590 auto compositor_frame_sink = | 624 auto compositor_frame_sink = |
| 591 vulkan_context_provider | 625 vulkan_context_provider |
| 592 ? base::MakeUnique<cc::DirectCompositorFrameSink>( | 626 ? base::MakeUnique<cc::DirectCompositorFrameSink>( |
| 593 compositor->frame_sink_id(), surface_manager_.get(), | 627 compositor->frame_sink_id(), surface_manager_.get(), |
| 594 data->display.get(), | 628 data->display.get(), |
| 595 static_cast<scoped_refptr<cc::VulkanContextProvider>>( | 629 static_cast<scoped_refptr<cc::VulkanContextProvider>>( |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 733 } | 767 } |
| 734 | 768 |
| 735 void GpuProcessTransportFactory::SetAuthoritativeVSyncInterval( | 769 void GpuProcessTransportFactory::SetAuthoritativeVSyncInterval( |
| 736 ui::Compositor* compositor, | 770 ui::Compositor* compositor, |
| 737 base::TimeDelta interval) { | 771 base::TimeDelta interval) { |
| 738 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); | 772 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); |
| 739 if (it == per_compositor_data_.end()) | 773 if (it == per_compositor_data_.end()) |
| 740 return; | 774 return; |
| 741 PerCompositorData* data = it->second.get(); | 775 PerCompositorData* data = it->second.get(); |
| 742 DCHECK(data); | 776 DCHECK(data); |
| 743 if (data->begin_frame_source) | 777 if (data->synthetic_begin_frame_source) |
| 744 data->begin_frame_source->SetAuthoritativeVSyncInterval(interval); | 778 data->synthetic_begin_frame_source->SetAuthoritativeVSyncInterval(interval); |
| 745 } | 779 } |
| 746 | 780 |
| 747 void GpuProcessTransportFactory::SetDisplayVSyncParameters( | 781 void GpuProcessTransportFactory::SetDisplayVSyncParameters( |
| 748 ui::Compositor* compositor, | 782 ui::Compositor* compositor, |
| 749 base::TimeTicks timebase, | 783 base::TimeTicks timebase, |
| 750 base::TimeDelta interval) { | 784 base::TimeDelta interval) { |
| 751 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); | 785 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); |
| 752 if (it == per_compositor_data_.end()) | 786 if (it == per_compositor_data_.end()) |
| 753 return; | 787 return; |
| 754 PerCompositorData* data = it->second.get(); | 788 PerCompositorData* data = it->second.get(); |
| 755 DCHECK(data); | 789 DCHECK(data); |
| 756 if (data->begin_frame_source) | 790 if (data->synthetic_begin_frame_source) |
|
sunnyps
2017/01/25 01:36:41
nit: braces
stanisc
2017/01/26 02:14:12
Done.
| |
| 757 data->begin_frame_source->OnUpdateVSyncParameters(timebase, interval); | 791 data->synthetic_begin_frame_source->OnUpdateVSyncParameters( |
| 792 timebase, interval); | |
| 793 else if (data->gpu_vsync_begin_frame_source) | |
| 794 data->gpu_vsync_begin_frame_source->OnVSync(timebase, interval); | |
| 758 } | 795 } |
| 759 | 796 |
| 760 void GpuProcessTransportFactory::SetOutputIsSecure(ui::Compositor* compositor, | 797 void GpuProcessTransportFactory::SetOutputIsSecure(ui::Compositor* compositor, |
| 761 bool secure) { | 798 bool secure) { |
| 762 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); | 799 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); |
| 763 if (it == per_compositor_data_.end()) | 800 if (it == per_compositor_data_.end()) |
| 764 return; | 801 return; |
| 765 PerCompositorData* data = it->second.get(); | 802 PerCompositorData* data = it->second.get(); |
| 766 DCHECK(data); | 803 DCHECK(data); |
| 767 data->output_is_secure = secure; | 804 data->output_is_secure = secure; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 911 shared_vulkan_context_provider_ = | 948 shared_vulkan_context_provider_ = |
| 912 cc::VulkanInProcessContextProvider::Create(); | 949 cc::VulkanInProcessContextProvider::Create(); |
| 913 } | 950 } |
| 914 | 951 |
| 915 shared_vulkan_context_provider_initialized_ = true; | 952 shared_vulkan_context_provider_initialized_ = true; |
| 916 } | 953 } |
| 917 return shared_vulkan_context_provider_; | 954 return shared_vulkan_context_provider_; |
| 918 } | 955 } |
| 919 | 956 |
| 920 } // namespace content | 957 } // namespace content |
| OLD | NEW |