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/renderer/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <map> | 9 #include <map> |
10 #include <utility> | 10 #include <utility> |
(...skipping 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1941 if (command_line.HasSwitch(switches::kDisableGpuCompositing)) | 1941 if (command_line.HasSwitch(switches::kDisableGpuCompositing)) |
1942 use_software = true; | 1942 use_software = true; |
1943 | 1943 |
1944 #if defined(USE_AURA) | 1944 #if defined(USE_AURA) |
1945 if (GetServiceManagerConnection() && !use_software && | 1945 if (GetServiceManagerConnection() && !use_software && |
1946 command_line.HasSwitch(switches::kUseMusInRenderer)) { | 1946 command_line.HasSwitch(switches::kUseMusInRenderer)) { |
1947 RenderWidgetMusConnection* connection = | 1947 RenderWidgetMusConnection* connection = |
1948 RenderWidgetMusConnection::GetOrCreate(routing_id); | 1948 RenderWidgetMusConnection::GetOrCreate(routing_id); |
1949 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host = | 1949 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host = |
1950 EstablishGpuChannelSync(); | 1950 EstablishGpuChannelSync(); |
1951 return connection->CreateCompositorFrameSink(std::move(gpu_channel_host)); | 1951 return connection->CreateCompositorFrameSink(std::move(gpu_channel_host), |
| 1952 GetGpuMemoryBufferManager()); |
1952 } | 1953 } |
1953 #endif | 1954 #endif |
1954 | 1955 |
1955 uint32_t compositor_frame_sink_id = g_next_compositor_frame_sink_id++; | 1956 uint32_t compositor_frame_sink_id = g_next_compositor_frame_sink_id++; |
1956 | 1957 |
1957 if (command_line.HasSwitch(switches::kEnableVulkan)) { | 1958 if (command_line.HasSwitch(switches::kEnableVulkan)) { |
1958 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider = | 1959 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider = |
1959 cc::VulkanInProcessContextProvider::Create(); | 1960 cc::VulkanInProcessContextProvider::Create(); |
1960 if (vulkan_context_provider) { | 1961 if (vulkan_context_provider) { |
1961 DCHECK(!layout_test_mode()); | 1962 DCHECK(!layout_test_mode()); |
(...skipping 17 matching lines...) Expand all Loading... |
1979 // We may get a valid channel, but with a software renderer. In that case, | 1980 // We may get a valid channel, but with a software renderer. In that case, |
1980 // disable GPU compositing. | 1981 // disable GPU compositing. |
1981 if (gpu_channel_host->gpu_info().software_rendering) | 1982 if (gpu_channel_host->gpu_info().software_rendering) |
1982 use_software = true; | 1983 use_software = true; |
1983 } | 1984 } |
1984 | 1985 |
1985 if (use_software) { | 1986 if (use_software) { |
1986 DCHECK(!layout_test_mode()); | 1987 DCHECK(!layout_test_mode()); |
1987 return base::MakeUnique<RendererCompositorFrameSink>( | 1988 return base::MakeUnique<RendererCompositorFrameSink>( |
1988 routing_id, compositor_frame_sink_id, | 1989 routing_id, compositor_frame_sink_id, |
1989 CreateExternalBeginFrameSource(routing_id), nullptr, nullptr, | 1990 CreateExternalBeginFrameSource(routing_id), nullptr, nullptr, nullptr, |
1990 std::move(frame_swap_message_queue)); | 1991 shared_bitmap_manager(), std::move(frame_swap_message_queue)); |
1991 } | 1992 } |
1992 | 1993 |
1993 scoped_refptr<ContextProviderCommandBuffer> worker_context_provider = | 1994 scoped_refptr<ContextProviderCommandBuffer> worker_context_provider = |
1994 SharedCompositorWorkerContextProvider(); | 1995 SharedCompositorWorkerContextProvider(); |
1995 if (!worker_context_provider) { | 1996 if (!worker_context_provider) { |
1996 // Cause the compositor to wait and try again. | 1997 // Cause the compositor to wait and try again. |
1997 return nullptr; | 1998 return nullptr; |
1998 } | 1999 } |
1999 | 2000 |
2000 // The renderer compositor context doesn't do a lot of stuff, so we don't | 2001 // The renderer compositor context doesn't do a lot of stuff, so we don't |
(...skipping 24 matching lines...) Expand all Loading... |
2025 scoped_refptr<ContextProviderCommandBuffer> context_provider( | 2026 scoped_refptr<ContextProviderCommandBuffer> context_provider( |
2026 new ContextProviderCommandBuffer( | 2027 new ContextProviderCommandBuffer( |
2027 gpu_channel_host, gpu::GPU_STREAM_DEFAULT, | 2028 gpu_channel_host, gpu::GPU_STREAM_DEFAULT, |
2028 gpu::GpuStreamPriority::NORMAL, gpu::kNullSurfaceHandle, url, | 2029 gpu::GpuStreamPriority::NORMAL, gpu::kNullSurfaceHandle, url, |
2029 automatic_flushes, support_locking, limits, attributes, share_context, | 2030 automatic_flushes, support_locking, limits, attributes, share_context, |
2030 command_buffer_metrics::RENDER_COMPOSITOR_CONTEXT)); | 2031 command_buffer_metrics::RENDER_COMPOSITOR_CONTEXT)); |
2031 | 2032 |
2032 if (layout_test_deps_) { | 2033 if (layout_test_deps_) { |
2033 return layout_test_deps_->CreateCompositorFrameSink( | 2034 return layout_test_deps_->CreateCompositorFrameSink( |
2034 routing_id, std::move(gpu_channel_host), std::move(context_provider), | 2035 routing_id, std::move(gpu_channel_host), std::move(context_provider), |
2035 std::move(worker_context_provider), this); | 2036 std::move(worker_context_provider), GetGpuMemoryBufferManager(), |
| 2037 this); |
2036 } | 2038 } |
2037 | 2039 |
2038 #if defined(OS_ANDROID) | 2040 #if defined(OS_ANDROID) |
2039 if (sync_compositor_message_filter_) { | 2041 if (sync_compositor_message_filter_) { |
2040 return base::MakeUnique<SynchronousCompositorFrameSink>( | 2042 return base::MakeUnique<SynchronousCompositorFrameSink>( |
2041 std::move(context_provider), std::move(worker_context_provider), | 2043 std::move(context_provider), std::move(worker_context_provider), |
2042 routing_id, compositor_frame_sink_id, | 2044 GetGpuMemoryBufferManager(), routing_id, compositor_frame_sink_id, |
2043 CreateExternalBeginFrameSource(routing_id), | 2045 CreateExternalBeginFrameSource(routing_id), |
2044 sync_compositor_message_filter_.get(), | 2046 sync_compositor_message_filter_.get(), |
2045 std::move(frame_swap_message_queue)); | 2047 std::move(frame_swap_message_queue)); |
2046 } | 2048 } |
2047 #endif | 2049 #endif |
2048 return base::WrapUnique(new RendererCompositorFrameSink( | 2050 return base::WrapUnique(new RendererCompositorFrameSink( |
2049 routing_id, compositor_frame_sink_id, | 2051 routing_id, compositor_frame_sink_id, |
2050 CreateExternalBeginFrameSource(routing_id), std::move(context_provider), | 2052 CreateExternalBeginFrameSource(routing_id), std::move(context_provider), |
2051 std::move(worker_context_provider), std::move(frame_swap_message_queue))); | 2053 std::move(worker_context_provider), GetGpuMemoryBufferManager(), |
| 2054 nullptr, std::move(frame_swap_message_queue))); |
2052 } | 2055 } |
2053 | 2056 |
2054 AssociatedInterfaceRegistry* | 2057 AssociatedInterfaceRegistry* |
2055 RenderThreadImpl::GetAssociatedInterfaceRegistry() { | 2058 RenderThreadImpl::GetAssociatedInterfaceRegistry() { |
2056 return &associated_interfaces_; | 2059 return &associated_interfaces_; |
2057 } | 2060 } |
2058 | 2061 |
2059 std::unique_ptr<cc::SwapPromise> | 2062 std::unique_ptr<cc::SwapPromise> |
2060 RenderThreadImpl::RequestCopyOfOutputForLayoutTest( | 2063 RenderThreadImpl::RequestCopyOfOutputForLayoutTest( |
2061 int32_t routing_id, | 2064 int32_t routing_id, |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2479 } | 2482 } |
2480 } | 2483 } |
2481 | 2484 |
2482 void RenderThreadImpl::OnRendererInterfaceRequest( | 2485 void RenderThreadImpl::OnRendererInterfaceRequest( |
2483 mojom::RendererAssociatedRequest request) { | 2486 mojom::RendererAssociatedRequest request) { |
2484 DCHECK(!renderer_binding_.is_bound()); | 2487 DCHECK(!renderer_binding_.is_bound()); |
2485 renderer_binding_.Bind(std::move(request)); | 2488 renderer_binding_.Bind(std::move(request)); |
2486 } | 2489 } |
2487 | 2490 |
2488 } // namespace content | 2491 } // namespace content |
OLD | NEW |