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 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor_ozone.h" | 57 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor_ozone.h" |
58 #include "content/browser/compositor/software_output_device_ozone.h" | 58 #include "content/browser/compositor/software_output_device_ozone.h" |
59 #include "ui/ozone/public/overlay_candidates_ozone.h" | 59 #include "ui/ozone/public/overlay_candidates_ozone.h" |
60 #include "ui/ozone/public/overlay_manager_ozone.h" | 60 #include "ui/ozone/public/overlay_manager_ozone.h" |
61 #include "ui/ozone/public/ozone_platform.h" | 61 #include "ui/ozone/public/ozone_platform.h" |
62 #include "ui/ozone/public/ozone_switches.h" | 62 #include "ui/ozone/public/ozone_switches.h" |
63 #elif defined(USE_X11) | 63 #elif defined(USE_X11) |
64 #include "content/browser/compositor/software_output_device_x11.h" | 64 #include "content/browser/compositor/software_output_device_x11.h" |
65 #elif defined(OS_MACOSX) | 65 #elif defined(OS_MACOSX) |
66 #include "content/browser/compositor/software_output_device_mac.h" | 66 #include "content/browser/compositor/software_output_device_mac.h" |
| 67 #include "ui/base/cocoa/remote_layer_api.h" |
67 #endif | 68 #endif |
68 | 69 |
69 using cc::ContextProvider; | 70 using cc::ContextProvider; |
70 using gpu::gles2::GLES2Interface; | 71 using gpu::gles2::GLES2Interface; |
71 | 72 |
72 static const int kNumRetriesBeforeSoftwareFallback = 4; | 73 static const int kNumRetriesBeforeSoftwareFallback = 4; |
73 | 74 |
74 namespace content { | 75 namespace content { |
75 namespace { | 76 namespace { |
76 | 77 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 ->GetOverlayManager() | 281 ->GetOverlayManager() |
281 ->CanShowPrimaryPlaneAsOverlay()) { | 282 ->CanShowPrimaryPlaneAsOverlay()) { |
282 surface = | 283 surface = |
283 make_scoped_ptr(new GpuSurfacelessBrowserCompositorOutputSurface( | 284 make_scoped_ptr(new GpuSurfacelessBrowserCompositorOutputSurface( |
284 context_provider, data->surface_id, compositor->vsync_manager(), | 285 context_provider, data->surface_id, compositor->vsync_manager(), |
285 CreateOverlayCandidateValidator(compositor->widget()), | 286 CreateOverlayCandidateValidator(compositor->widget()), |
286 GL_TEXTURE_2D, GL_RGB, BrowserGpuMemoryBufferManager::current())); | 287 GL_TEXTURE_2D, GL_RGB, BrowserGpuMemoryBufferManager::current())); |
287 } else | 288 } else |
288 #endif | 289 #endif |
289 { | 290 { |
290 surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface( | 291 #if defined(OS_MACOSX) |
291 context_provider, compositor->vsync_manager(), | 292 if (ui::RemoteLayerAPISupported()) { |
292 CreateOverlayCandidateValidator(compositor->widget()))); | 293 surface = |
| 294 make_scoped_ptr(new GpuSurfacelessBrowserCompositorOutputSurface( |
| 295 context_provider, data->surface_id, compositor->vsync_manager(), |
| 296 CreateOverlayCandidateValidator(compositor->widget()), |
| 297 GL_TEXTURE_RECTANGLE_ARB, GL_BGRA_EXT, |
| 298 BrowserGpuMemoryBufferManager::current())); |
| 299 } |
| 300 #endif |
| 301 if (!surface) { |
| 302 surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface( |
| 303 context_provider, compositor->vsync_manager(), |
| 304 CreateOverlayCandidateValidator(compositor->widget()))); |
| 305 } |
293 } | 306 } |
294 } | 307 } |
295 | 308 |
296 // TODO(piman): Use GpuSurfaceTracker to map ids to surfaces instead of an | 309 // TODO(piman): Use GpuSurfaceTracker to map ids to surfaces instead of an |
297 // output_surface_map_ here. | 310 // output_surface_map_ here. |
298 output_surface_map_.AddWithID(surface.get(), data->surface_id); | 311 output_surface_map_.AddWithID(surface.get(), data->surface_id); |
299 data->surface = surface.get(); | 312 data->surface = surface.get(); |
300 if (data->reflector) | 313 if (data->reflector) |
301 data->reflector->OnSourceSurfaceReady(data->surface); | 314 data->reflector->OnSourceSurfaceReady(data->surface); |
302 | 315 |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 604 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
592 observer_list_, | 605 observer_list_, |
593 OnLostResources()); | 606 OnLostResources()); |
594 | 607 |
595 // Kill things that use the shared context before killing the shared context. | 608 // Kill things that use the shared context before killing the shared context. |
596 lost_gl_helper.reset(); | 609 lost_gl_helper.reset(); |
597 lost_shared_main_thread_contexts = NULL; | 610 lost_shared_main_thread_contexts = NULL; |
598 } | 611 } |
599 | 612 |
600 } // namespace content | 613 } // namespace content |
OLD | NEW |