| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer_host/compositor_impl_android.h" | 5 #include "content/browser/renderer_host/compositor_impl_android.h" |
| 6 | 6 |
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <unordered_set> | 10 #include <unordered_set> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "cc/resources/ui_resource_manager.h" | 42 #include "cc/resources/ui_resource_manager.h" |
| 43 #include "cc/surfaces/direct_compositor_frame_sink.h" | 43 #include "cc/surfaces/direct_compositor_frame_sink.h" |
| 44 #include "cc/surfaces/display.h" | 44 #include "cc/surfaces/display.h" |
| 45 #include "cc/surfaces/display_scheduler.h" | 45 #include "cc/surfaces/display_scheduler.h" |
| 46 #include "cc/surfaces/frame_sink_id_allocator.h" | 46 #include "cc/surfaces/frame_sink_id_allocator.h" |
| 47 #include "cc/trees/layer_tree_host.h" | 47 #include "cc/trees/layer_tree_host.h" |
| 48 #include "cc/trees/layer_tree_settings.h" | 48 #include "cc/trees/layer_tree_settings.h" |
| 49 #include "components/display_compositor/compositor_overlay_candidate_validator_a
ndroid.h" | 49 #include "components/display_compositor/compositor_overlay_candidate_validator_a
ndroid.h" |
| 50 #include "components/display_compositor/gl_helper.h" | 50 #include "components/display_compositor/gl_helper.h" |
| 51 #include "components/display_compositor/host_shared_bitmap_manager.h" | 51 #include "components/display_compositor/host_shared_bitmap_manager.h" |
| 52 #include "content/browser/compositor/frame_sink_manager_host.h" |
| 52 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 53 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| 53 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 54 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
| 54 #include "content/browser/gpu/compositor_util.h" | 55 #include "content/browser/gpu/compositor_util.h" |
| 55 #include "content/browser/renderer_host/render_widget_host_impl.h" | 56 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 56 #include "content/public/browser/android/compositor.h" | 57 #include "content/public/browser/android/compositor.h" |
| 57 #include "content/public/browser/android/compositor_client.h" | 58 #include "content/public/browser/android/compositor_client.h" |
| 58 #include "content/public/common/content_switches.h" | 59 #include "content/public/common/content_switches.h" |
| 59 #include "gpu/command_buffer/client/context_support.h" | 60 #include "gpu/command_buffer/client/context_support.h" |
| 60 #include "gpu/command_buffer/client/gles2_interface.h" | 61 #include "gpu/command_buffer/client/gles2_interface.h" |
| 61 #include "gpu/ipc/client/command_buffer_proxy_impl.h" | 62 #include "gpu/ipc/client/command_buffer_proxy_impl.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 90 Start("CompositorTileWorker1", base::SimpleThread::Options()); | 91 Start("CompositorTileWorker1", base::SimpleThread::Options()); |
| 91 } | 92 } |
| 92 | 93 |
| 93 ~SingleThreadTaskGraphRunner() override { Shutdown(); } | 94 ~SingleThreadTaskGraphRunner() override { Shutdown(); } |
| 94 }; | 95 }; |
| 95 | 96 |
| 96 struct CompositorDependencies { | 97 struct CompositorDependencies { |
| 97 CompositorDependencies() : frame_sink_id_allocator(kDefaultClientId) {} | 98 CompositorDependencies() : frame_sink_id_allocator(kDefaultClientId) {} |
| 98 | 99 |
| 99 SingleThreadTaskGraphRunner task_graph_runner; | 100 SingleThreadTaskGraphRunner task_graph_runner; |
| 100 cc::SurfaceManager surface_manager; | 101 FrameSinkManagerHost frame_sink_manager_host; |
| 101 cc::FrameSinkIdAllocator frame_sink_id_allocator; | 102 cc::FrameSinkIdAllocator frame_sink_id_allocator; |
| 102 | 103 |
| 103 #if BUILDFLAG(ENABLE_VULKAN) | 104 #if BUILDFLAG(ENABLE_VULKAN) |
| 104 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider; | 105 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider; |
| 105 #endif | 106 #endif |
| 106 }; | 107 }; |
| 107 | 108 |
| 108 base::LazyInstance<CompositorDependencies>::DestructorAtExit | 109 base::LazyInstance<CompositorDependencies>::DestructorAtExit |
| 109 g_compositor_dependencies = LAZY_INSTANCE_INITIALIZER; | 110 g_compositor_dependencies = LAZY_INSTANCE_INITIALIZER; |
| 110 | 111 |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 gpu::gles2::ContextCreationAttribHelper attributes, | 390 gpu::gles2::ContextCreationAttribHelper attributes, |
| 390 gpu::SharedMemoryLimits shared_memory_limits, | 391 gpu::SharedMemoryLimits shared_memory_limits, |
| 391 ContextProviderCallback callback) { | 392 ContextProviderCallback callback) { |
| 392 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannel( | 393 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannel( |
| 393 base::Bind(&CreateContextProviderAfterGpuChannelEstablished, handle, | 394 base::Bind(&CreateContextProviderAfterGpuChannelEstablished, handle, |
| 394 attributes, shared_memory_limits, callback)); | 395 attributes, shared_memory_limits, callback)); |
| 395 } | 396 } |
| 396 | 397 |
| 397 // static | 398 // static |
| 398 cc::SurfaceManager* CompositorImpl::GetSurfaceManager() { | 399 cc::SurfaceManager* CompositorImpl::GetSurfaceManager() { |
| 399 return &g_compositor_dependencies.Get().surface_manager; | 400 return g_compositor_dependencies.Get() |
| 401 .frame_sink_manager_host.surface_manager(); |
| 400 } | 402 } |
| 401 | 403 |
| 402 // static | 404 // static |
| 405 FrameSinkManagerHost* CompositorImpl::GetFrameSinkManagerHost() { |
| 406 return &g_compositor_dependencies.Get().frame_sink_manager_host; |
| 407 } |
| 408 |
| 409 // static |
| 403 cc::FrameSinkId CompositorImpl::AllocateFrameSinkId() { | 410 cc::FrameSinkId CompositorImpl::AllocateFrameSinkId() { |
| 404 return g_compositor_dependencies.Get() | 411 return g_compositor_dependencies.Get() |
| 405 .frame_sink_id_allocator.NextFrameSinkId(); | 412 .frame_sink_id_allocator.NextFrameSinkId(); |
| 406 } | 413 } |
| 407 | 414 |
| 408 // static | 415 // static |
| 409 bool CompositorImpl::IsInitialized() { | 416 bool CompositorImpl::IsInitialized() { |
| 410 return g_initialized; | 417 return g_initialized; |
| 411 } | 418 } |
| 412 | 419 |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 } | 869 } |
| 863 GetSurfaceManager()->UnregisterFrameSinkHierarchy(frame_sink_id_, | 870 GetSurfaceManager()->UnregisterFrameSinkHierarchy(frame_sink_id_, |
| 864 frame_sink_id); | 871 frame_sink_id); |
| 865 } | 872 } |
| 866 | 873 |
| 867 bool CompositorImpl::HavePendingReadbacks() { | 874 bool CompositorImpl::HavePendingReadbacks() { |
| 868 return !readback_layer_tree_->children().empty(); | 875 return !readback_layer_tree_->children().empty(); |
| 869 } | 876 } |
| 870 | 877 |
| 871 } // namespace content | 878 } // namespace content |
| OLD | NEW |