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" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "cc/raster/single_thread_task_graph_runner.h" | 24 #include "cc/raster/single_thread_task_graph_runner.h" |
25 #include "cc/raster/task_graph_runner.h" | 25 #include "cc/raster/task_graph_runner.h" |
26 #include "cc/scheduler/begin_frame_source.h" | 26 #include "cc/scheduler/begin_frame_source.h" |
27 #include "cc/scheduler/delay_based_time_source.h" | 27 #include "cc/scheduler/delay_based_time_source.h" |
28 #include "cc/surfaces/direct_compositor_frame_sink.h" | 28 #include "cc/surfaces/direct_compositor_frame_sink.h" |
29 #include "cc/surfaces/display.h" | 29 #include "cc/surfaces/display.h" |
30 #include "cc/surfaces/display_scheduler.h" | 30 #include "cc/surfaces/display_scheduler.h" |
31 #include "cc/surfaces/surface_manager.h" | 31 #include "cc/surfaces/surface_manager.h" |
32 #include "components/display_compositor/compositor_overlay_candidate_validator.h
" | 32 #include "components/display_compositor/compositor_overlay_candidate_validator.h
" |
33 #include "components/display_compositor/gl_helper.h" | 33 #include "components/display_compositor/gl_helper.h" |
| 34 #include "components/display_compositor/host_shared_bitmap_manager.h" |
34 #include "content/browser/compositor/browser_compositor_output_surface.h" | 35 #include "content/browser/compositor/browser_compositor_output_surface.h" |
35 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" | 36 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" |
36 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s
urface.h" | 37 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s
urface.h" |
37 #include "content/browser/compositor/offscreen_browser_compositor_output_surface
.h" | 38 #include "content/browser/compositor/offscreen_browser_compositor_output_surface
.h" |
38 #include "content/browser/compositor/reflector_impl.h" | 39 #include "content/browser/compositor/reflector_impl.h" |
39 #include "content/browser/compositor/software_browser_compositor_output_surface.
h" | 40 #include "content/browser/compositor/software_browser_compositor_output_surface.
h" |
40 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 41 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
41 #include "content/browser/gpu/gpu_data_manager_impl.h" | 42 #include "content/browser/gpu/gpu_data_manager_impl.h" |
42 #include "content/browser/renderer_host/render_widget_host_impl.h" | 43 #include "content/browser/renderer_host/render_widget_host_impl.h" |
43 #include "content/common/host_shared_bitmap_manager.h" | |
44 #include "content/public/common/content_switches.h" | 44 #include "content/public/common/content_switches.h" |
45 #include "gpu/GLES2/gl2extchromium.h" | 45 #include "gpu/GLES2/gl2extchromium.h" |
46 #include "gpu/command_buffer/client/gles2_interface.h" | 46 #include "gpu/command_buffer/client/gles2_interface.h" |
47 #include "gpu/command_buffer/client/shared_memory_limits.h" | 47 #include "gpu/command_buffer/client/shared_memory_limits.h" |
48 #include "gpu/command_buffer/common/mailbox.h" | 48 #include "gpu/command_buffer/common/mailbox.h" |
49 #include "gpu/ipc/client/gpu_channel_host.h" | 49 #include "gpu/ipc/client/gpu_channel_host.h" |
50 #include "gpu/ipc/host/gpu_memory_buffer_support.h" | 50 #include "gpu/ipc/host/gpu_memory_buffer_support.h" |
51 #include "services/service_manager/runner/common/client_util.h" | 51 #include "services/service_manager/runner/common/client_util.h" |
52 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" | 52 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" |
53 #include "third_party/khronos/GLES2/gl2.h" | 53 #include "third_party/khronos/GLES2/gl2.h" |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 gfx::RenderingWindowManager::GetInstance()->DoSetParentOnChild( | 602 gfx::RenderingWindowManager::GetInstance()->DoSetParentOnChild( |
603 compositor->widget()); | 603 compositor->widget()); |
604 #endif | 604 #endif |
605 | 605 |
606 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( | 606 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( |
607 compositor->task_runner().get(), | 607 compositor->task_runner().get(), |
608 display_output_surface->capabilities().max_frames_pending)); | 608 display_output_surface->capabilities().max_frames_pending)); |
609 | 609 |
610 // The Display owns and uses the |display_output_surface| created above. | 610 // The Display owns and uses the |display_output_surface| created above. |
611 data->display = base::MakeUnique<cc::Display>( | 611 data->display = base::MakeUnique<cc::Display>( |
612 HostSharedBitmapManager::current(), GetGpuMemoryBufferManager(), | 612 display_compositor::HostSharedBitmapManager::current(), |
613 compositor->GetRendererSettings(), compositor->frame_sink_id(), | 613 GetGpuMemoryBufferManager(), compositor->GetRendererSettings(), |
614 begin_frame_source, std::move(display_output_surface), | 614 compositor->frame_sink_id(), begin_frame_source, |
615 std::move(scheduler), base::MakeUnique<cc::TextureMailboxDeleter>( | 615 std::move(display_output_surface), std::move(scheduler), |
616 compositor->task_runner().get())); | 616 base::MakeUnique<cc::TextureMailboxDeleter>( |
| 617 compositor->task_runner().get())); |
617 // Note that we are careful not to destroy prior BeginFrameSource objects | 618 // Note that we are careful not to destroy prior BeginFrameSource objects |
618 // until we have reset |data->display|. | 619 // until we have reset |data->display|. |
619 data->synthetic_begin_frame_source = std::move(synthetic_begin_frame_source); | 620 data->synthetic_begin_frame_source = std::move(synthetic_begin_frame_source); |
620 data->gpu_vsync_begin_frame_source = std::move(gpu_vsync_begin_frame_source); | 621 data->gpu_vsync_begin_frame_source = std::move(gpu_vsync_begin_frame_source); |
621 | 622 |
622 // The |delegated_output_surface| is given back to the compositor, it | 623 // The |delegated_output_surface| is given back to the compositor, it |
623 // delegates to the Display as its root surface. Importantly, it shares the | 624 // delegates to the Display as its root surface. Importantly, it shares the |
624 // same ContextProvider as the Display's output surface. | 625 // same ContextProvider as the Display's output surface. |
625 auto compositor_frame_sink = | 626 auto compositor_frame_sink = |
626 vulkan_context_provider | 627 vulkan_context_provider |
627 ? base::MakeUnique<cc::DirectCompositorFrameSink>( | 628 ? base::MakeUnique<cc::DirectCompositorFrameSink>( |
628 compositor->frame_sink_id(), surface_manager_.get(), | 629 compositor->frame_sink_id(), surface_manager_.get(), |
629 data->display.get(), | 630 data->display.get(), |
630 static_cast<scoped_refptr<cc::VulkanContextProvider>>( | 631 static_cast<scoped_refptr<cc::VulkanContextProvider>>( |
631 vulkan_context_provider)) | 632 vulkan_context_provider)) |
632 : base::MakeUnique<cc::DirectCompositorFrameSink>( | 633 : base::MakeUnique<cc::DirectCompositorFrameSink>( |
633 compositor->frame_sink_id(), surface_manager_.get(), | 634 compositor->frame_sink_id(), surface_manager_.get(), |
634 data->display.get(), context_provider, | 635 data->display.get(), context_provider, |
635 shared_worker_context_provider_, GetGpuMemoryBufferManager(), | 636 shared_worker_context_provider_, GetGpuMemoryBufferManager(), |
636 HostSharedBitmapManager::current()); | 637 display_compositor::HostSharedBitmapManager::current()); |
637 data->display->Resize(compositor->size()); | 638 data->display->Resize(compositor->size()); |
638 data->display->SetOutputIsSecure(data->output_is_secure); | 639 data->display->SetOutputIsSecure(data->output_is_secure); |
639 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); | 640 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); |
640 } | 641 } |
641 | 642 |
642 std::unique_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( | 643 std::unique_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( |
643 ui::Compositor* source_compositor, | 644 ui::Compositor* source_compositor, |
644 ui::Layer* target_layer) { | 645 ui::Layer* target_layer) { |
645 PerCompositorData* source_data = | 646 PerCompositorData* source_data = |
646 per_compositor_data_[source_compositor].get(); | 647 per_compositor_data_[source_compositor].get(); |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 shared_vulkan_context_provider_ = | 951 shared_vulkan_context_provider_ = |
951 cc::VulkanInProcessContextProvider::Create(); | 952 cc::VulkanInProcessContextProvider::Create(); |
952 } | 953 } |
953 | 954 |
954 shared_vulkan_context_provider_initialized_ = true; | 955 shared_vulkan_context_provider_initialized_ = true; |
955 } | 956 } |
956 return shared_vulkan_context_provider_; | 957 return shared_vulkan_context_provider_; |
957 } | 958 } |
958 | 959 |
959 } // namespace content | 960 } // namespace content |
OLD | NEW |