| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 #include "content/browser/compositor/software_output_device_ozone.h" | 67 #include "content/browser/compositor/software_output_device_ozone.h" |
| 68 #include "ui/ozone/public/overlay_candidates_ozone.h" | 68 #include "ui/ozone/public/overlay_candidates_ozone.h" |
| 69 #include "ui/ozone/public/overlay_manager_ozone.h" | 69 #include "ui/ozone/public/overlay_manager_ozone.h" |
| 70 #include "ui/ozone/public/ozone_platform.h" | 70 #include "ui/ozone/public/ozone_platform.h" |
| 71 #include "ui/ozone/public/ozone_switches.h" | 71 #include "ui/ozone/public/ozone_switches.h" |
| 72 #elif defined(USE_X11) | 72 #elif defined(USE_X11) |
| 73 #include "content/browser/compositor/software_output_device_x11.h" | 73 #include "content/browser/compositor/software_output_device_x11.h" |
| 74 #elif defined(OS_MACOSX) | 74 #elif defined(OS_MACOSX) |
| 75 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor_mac.h" | 75 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor_mac.h" |
| 76 #include "content/browser/compositor/software_output_device_mac.h" | 76 #include "content/browser/compositor/software_output_device_mac.h" |
| 77 #include "gpu/config/gpu_driver_bug_workaround_type.h" |
| 77 #include "ui/base/cocoa/remote_layer_api.h" | 78 #include "ui/base/cocoa/remote_layer_api.h" |
| 79 #include "ui/base/ui_base_switches.h" |
| 78 #elif defined(OS_ANDROID) | 80 #elif defined(OS_ANDROID) |
| 79 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor_android.h" | 81 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor_android.h" |
| 80 #endif | 82 #endif |
| 81 #if !defined(GPU_SURFACE_HANDLE_IS_ACCELERATED_WINDOW) | 83 #if !defined(GPU_SURFACE_HANDLE_IS_ACCELERATED_WINDOW) |
| 82 #include "content/browser/gpu/gpu_surface_tracker.h" | 84 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 83 #endif | 85 #endif |
| 84 | 86 |
| 85 #if defined(ENABLE_VULKAN) | 87 #if defined(ENABLE_VULKAN) |
| 86 #include "content/browser/compositor/vulkan_browser_compositor_output_surface.h" | 88 #include "content/browser/compositor/vulkan_browser_compositor_output_surface.h" |
| 87 #endif | 89 #endif |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 126 |
| 125 bool automatic_flushes = false; | 127 bool automatic_flushes = false; |
| 126 | 128 |
| 127 GURL url("chrome://gpu/GpuProcessTransportFactory::CreateContextCommon"); | 129 GURL url("chrome://gpu/GpuProcessTransportFactory::CreateContextCommon"); |
| 128 return base::WrapUnique(new content::WebGraphicsContext3DCommandBufferImpl( | 130 return base::WrapUnique(new content::WebGraphicsContext3DCommandBufferImpl( |
| 129 surface_handle, url, gpu_channel_host.get(), attributes, | 131 surface_handle, url, gpu_channel_host.get(), attributes, |
| 130 gfx::PreferIntegratedGpu, share_resources, automatic_flushes, | 132 gfx::PreferIntegratedGpu, share_resources, automatic_flushes, |
| 131 nullptr)); | 133 nullptr)); |
| 132 } | 134 } |
| 133 | 135 |
| 136 #if defined(OS_MACOSX) |
| 137 bool IsCALayersDisabledFromCommandLine() { |
| 138 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 139 return command_line->HasSwitch(switches::kDisableMacOverlays); |
| 140 } |
| 141 #endif |
| 142 |
| 134 } // namespace | 143 } // namespace |
| 135 | 144 |
| 136 namespace content { | 145 namespace content { |
| 137 | 146 |
| 138 struct GpuProcessTransportFactory::PerCompositorData { | 147 struct GpuProcessTransportFactory::PerCompositorData { |
| 139 gpu::SurfaceHandle surface_handle; | 148 gpu::SurfaceHandle surface_handle; |
| 140 BrowserCompositorOutputSurface* surface; | 149 BrowserCompositorOutputSurface* surface; |
| 141 ReflectorImpl* reflector; | 150 ReflectorImpl* reflector; |
| 142 std::unique_ptr<cc::OnscreenDisplayClient> display_client; | 151 std::unique_ptr<cc::OnscreenDisplayClient> display_client; |
| 143 | 152 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 218 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 210 if (overlay_candidates && | 219 if (overlay_candidates && |
| 211 (command_line->HasSwitch(switches::kEnableHardwareOverlays) || | 220 (command_line->HasSwitch(switches::kEnableHardwareOverlays) || |
| 212 command_line->HasSwitch(switches::kOzoneTestSingleOverlaySupport))) { | 221 command_line->HasSwitch(switches::kOzoneTestSingleOverlaySupport))) { |
| 213 validator.reset(new BrowserCompositorOverlayCandidateValidatorOzone( | 222 validator.reset(new BrowserCompositorOverlayCandidateValidatorOzone( |
| 214 std::move(overlay_candidates))); | 223 std::move(overlay_candidates))); |
| 215 } | 224 } |
| 216 #elif defined(OS_MACOSX) | 225 #elif defined(OS_MACOSX) |
| 217 // Overlays are only supported through the remote layer API. | 226 // Overlays are only supported through the remote layer API. |
| 218 if (ui::RemoteLayerAPISupported()) { | 227 if (ui::RemoteLayerAPISupported()) { |
| 219 validator.reset(new BrowserCompositorOverlayCandidateValidatorMac()); | 228 static bool overlays_disabled_at_command_line = |
| 229 IsCALayersDisabledFromCommandLine(); |
| 230 const bool ca_layers_disabled = |
| 231 overlays_disabled_at_command_line || |
| 232 GpuDataManagerImpl::GetInstance()->IsDriverBugWorkaroundActive( |
| 233 gpu::DISABLE_OVERLAY_CA_LAYERS); |
| 234 validator.reset( |
| 235 new BrowserCompositorOverlayCandidateValidatorMac(ca_layers_disabled)); |
| 220 } | 236 } |
| 221 #elif defined(OS_ANDROID) | 237 #elif defined(OS_ANDROID) |
| 222 validator.reset(new BrowserCompositorOverlayCandidateValidatorAndroid()); | 238 validator.reset(new BrowserCompositorOverlayCandidateValidatorAndroid()); |
| 223 #endif | 239 #endif |
| 224 | 240 |
| 225 return validator; | 241 return validator; |
| 226 } | 242 } |
| 227 | 243 |
| 228 static bool ShouldCreateGpuOutputSurface(ui::Compositor* compositor) { | 244 static bool ShouldCreateGpuOutputSurface(ui::Compositor* compositor) { |
| 229 #if defined(MOJO_RUNNER_CLIENT) | 245 #if defined(MOJO_RUNNER_CLIENT) |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 shared_vulkan_context_provider_ = | 758 shared_vulkan_context_provider_ = |
| 743 cc::VulkanInProcessContextProvider::Create(); | 759 cc::VulkanInProcessContextProvider::Create(); |
| 744 } | 760 } |
| 745 | 761 |
| 746 shared_vulkan_context_provider_initialized_ = true; | 762 shared_vulkan_context_provider_initialized_ = true; |
| 747 } | 763 } |
| 748 return shared_vulkan_context_provider_; | 764 return shared_vulkan_context_provider_; |
| 749 } | 765 } |
| 750 | 766 |
| 751 } // namespace content | 767 } // namespace content |
| OLD | NEW |