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 "gpu/vulkan/features.h" | 51 #include "gpu/vulkan/features.h" |
52 #include "services/service_manager/runner/common/client_util.h" | 52 #include "services/service_manager/runner/common/client_util.h" |
53 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" | 53 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 gfx::RenderingWindowManager::GetInstance()->DoSetParentOnChild( | 574 gfx::RenderingWindowManager::GetInstance()->DoSetParentOnChild( |
575 compositor->widget()); | 575 compositor->widget()); |
576 #endif | 576 #endif |
577 | 577 |
578 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( | 578 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( |
579 compositor->task_runner().get(), | 579 compositor->task_runner().get(), |
580 display_output_surface->capabilities().max_frames_pending)); | 580 display_output_surface->capabilities().max_frames_pending)); |
581 | 581 |
582 // The Display owns and uses the |display_output_surface| created above. | 582 // The Display owns and uses the |display_output_surface| created above. |
583 data->display = base::MakeUnique<cc::Display>( | 583 data->display = base::MakeUnique<cc::Display>( |
584 HostSharedBitmapManager::current(), GetGpuMemoryBufferManager(), | 584 display_compositor::HostSharedBitmapManager::current(), |
585 compositor->GetRendererSettings(), compositor->frame_sink_id(), | 585 GetGpuMemoryBufferManager(), compositor->GetRendererSettings(), |
586 begin_frame_source, std::move(display_output_surface), | 586 compositor->frame_sink_id(), begin_frame_source, |
587 std::move(scheduler), base::MakeUnique<cc::TextureMailboxDeleter>( | 587 std::move(display_output_surface), std::move(scheduler), |
588 compositor->task_runner().get())); | 588 base::MakeUnique<cc::TextureMailboxDeleter>( |
| 589 compositor->task_runner().get())); |
589 // Note that we are careful not to destroy prior BeginFrameSource objects | 590 // Note that we are careful not to destroy prior BeginFrameSource objects |
590 // until we have reset |data->display|. | 591 // until we have reset |data->display|. |
591 data->synthetic_begin_frame_source = std::move(synthetic_begin_frame_source); | 592 data->synthetic_begin_frame_source = std::move(synthetic_begin_frame_source); |
592 data->gpu_vsync_begin_frame_source = std::move(gpu_vsync_begin_frame_source); | 593 data->gpu_vsync_begin_frame_source = std::move(gpu_vsync_begin_frame_source); |
593 | 594 |
594 // The |delegated_output_surface| is given back to the compositor, it | 595 // The |delegated_output_surface| is given back to the compositor, it |
595 // delegates to the Display as its root surface. Importantly, it shares the | 596 // delegates to the Display as its root surface. Importantly, it shares the |
596 // same ContextProvider as the Display's output surface. | 597 // same ContextProvider as the Display's output surface. |
597 auto compositor_frame_sink = | 598 auto compositor_frame_sink = |
598 vulkan_context_provider | 599 vulkan_context_provider |
599 ? base::MakeUnique<cc::DirectCompositorFrameSink>( | 600 ? base::MakeUnique<cc::DirectCompositorFrameSink>( |
600 compositor->frame_sink_id(), surface_manager_.get(), | 601 compositor->frame_sink_id(), surface_manager_.get(), |
601 data->display.get(), | 602 data->display.get(), |
602 static_cast<scoped_refptr<cc::VulkanContextProvider>>( | 603 static_cast<scoped_refptr<cc::VulkanContextProvider>>( |
603 vulkan_context_provider)) | 604 vulkan_context_provider)) |
604 : base::MakeUnique<cc::DirectCompositorFrameSink>( | 605 : base::MakeUnique<cc::DirectCompositorFrameSink>( |
605 compositor->frame_sink_id(), surface_manager_.get(), | 606 compositor->frame_sink_id(), surface_manager_.get(), |
606 data->display.get(), context_provider, | 607 data->display.get(), context_provider, |
607 shared_worker_context_provider_, GetGpuMemoryBufferManager(), | 608 shared_worker_context_provider_, GetGpuMemoryBufferManager(), |
608 HostSharedBitmapManager::current()); | 609 display_compositor::HostSharedBitmapManager::current()); |
609 data->display->Resize(compositor->size()); | 610 data->display->Resize(compositor->size()); |
610 data->display->SetOutputIsSecure(data->output_is_secure); | 611 data->display->SetOutputIsSecure(data->output_is_secure); |
611 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); | 612 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); |
612 } | 613 } |
613 | 614 |
614 std::unique_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( | 615 std::unique_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( |
615 ui::Compositor* source_compositor, | 616 ui::Compositor* source_compositor, |
616 ui::Layer* target_layer) { | 617 ui::Layer* target_layer) { |
617 PerCompositorData* source_data = | 618 PerCompositorData* source_data = |
618 per_compositor_data_[source_compositor].get(); | 619 per_compositor_data_[source_compositor].get(); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 shared_vulkan_context_provider_ = | 924 shared_vulkan_context_provider_ = |
924 cc::VulkanInProcessContextProvider::Create(); | 925 cc::VulkanInProcessContextProvider::Create(); |
925 } | 926 } |
926 | 927 |
927 shared_vulkan_context_provider_initialized_ = true; | 928 shared_vulkan_context_provider_initialized_ = true; |
928 } | 929 } |
929 return shared_vulkan_context_provider_; | 930 return shared_vulkan_context_provider_; |
930 } | 931 } |
931 | 932 |
932 } // namespace content | 933 } // namespace content |
OLD | NEW |