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_surfaceless_browser_compositor_output_s
urface.h" | 5 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s
urface.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
8 #include "cc/output/output_surface_client.h" | 10 #include "cc/output/output_surface_client.h" |
9 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor.h" | 11 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor.h" |
10 #include "content/browser/compositor/buffer_queue.h" | 12 #include "content/browser/compositor/buffer_queue.h" |
11 #include "content/browser/compositor/reflector_impl.h" | 13 #include "content/browser/compositor/reflector_impl.h" |
12 #include "content/browser/gpu/gpu_surface_tracker.h" | 14 #include "content/browser/gpu/gpu_surface_tracker.h" |
13 #include "content/common/gpu/client/context_provider_command_buffer.h" | 15 #include "content/common/gpu/client/context_provider_command_buffer.h" |
14 #include "content/common/gpu/client/gl_helper.h" | 16 #include "content/common/gpu/client/gl_helper.h" |
15 #include "gpu/GLES2/gl2extchromium.h" | 17 #include "gpu/GLES2/gl2extchromium.h" |
16 #include "gpu/command_buffer/client/gles2_interface.h" | 18 #include "gpu/command_buffer/client/gles2_interface.h" |
17 | 19 |
18 namespace content { | 20 namespace content { |
19 | 21 |
20 GpuSurfacelessBrowserCompositorOutputSurface:: | 22 GpuSurfacelessBrowserCompositorOutputSurface:: |
21 GpuSurfacelessBrowserCompositorOutputSurface( | 23 GpuSurfacelessBrowserCompositorOutputSurface( |
22 const scoped_refptr<ContextProviderCommandBuffer>& context, | 24 const scoped_refptr<ContextProviderCommandBuffer>& context, |
23 const scoped_refptr<ContextProviderCommandBuffer>& worker_context, | 25 const scoped_refptr<ContextProviderCommandBuffer>& worker_context, |
24 int surface_id, | 26 int surface_id, |
25 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager, | 27 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager, |
26 scoped_ptr<BrowserCompositorOverlayCandidateValidator> | 28 scoped_ptr<BrowserCompositorOverlayCandidateValidator> |
27 overlay_candidate_validator, | 29 overlay_candidate_validator, |
28 unsigned int target, | 30 unsigned int target, |
29 unsigned int internalformat, | 31 unsigned int internalformat, |
30 BrowserGpuMemoryBufferManager* gpu_memory_buffer_manager) | 32 BrowserGpuMemoryBufferManager* gpu_memory_buffer_manager) |
31 : GpuBrowserCompositorOutputSurface(context, | 33 : GpuBrowserCompositorOutputSurface(context, |
32 worker_context, | 34 worker_context, |
33 vsync_manager, | 35 vsync_manager, |
34 overlay_candidate_validator.Pass()), | 36 std::move(overlay_candidate_validator)), |
35 internalformat_(internalformat), | 37 internalformat_(internalformat), |
36 gpu_memory_buffer_manager_(gpu_memory_buffer_manager) { | 38 gpu_memory_buffer_manager_(gpu_memory_buffer_manager) { |
37 capabilities_.uses_default_gl_framebuffer = false; | 39 capabilities_.uses_default_gl_framebuffer = false; |
38 capabilities_.flipped_output_surface = true; | 40 capabilities_.flipped_output_surface = true; |
39 // Set |max_frames_pending| to 2 for surfaceless, which aligns scheduling | 41 // Set |max_frames_pending| to 2 for surfaceless, which aligns scheduling |
40 // more closely with the previous surfaced behavior. | 42 // more closely with the previous surfaced behavior. |
41 // With a surface, swap buffer ack used to return early, before actually | 43 // With a surface, swap buffer ack used to return early, before actually |
42 // presenting the back buffer, enabling the browser compositor to run ahead. | 44 // presenting the back buffer, enabling the browser compositor to run ahead. |
43 // Surfaceless implementation acks at the time of actual buffer swap, which | 45 // Surfaceless implementation acks at the time of actual buffer swap, which |
44 // shifts the start of the new frame forward relative to the old | 46 // shifts the start of the new frame forward relative to the old |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 output_surface_->RecreateBuffers(); | 107 output_surface_->RecreateBuffers(); |
106 force_swap = true; | 108 force_swap = true; |
107 } | 109 } |
108 GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted(latency_info, | 110 GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted(latency_info, |
109 result); | 111 result); |
110 if (force_swap) | 112 if (force_swap) |
111 client_->SetNeedsRedrawRect(gfx::Rect(SurfaceSize())); | 113 client_->SetNeedsRedrawRect(gfx::Rect(SurfaceSize())); |
112 } | 114 } |
113 | 115 |
114 } // namespace content | 116 } // namespace content |
OLD | NEW |