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> | 7 #include <utility> |
8 | 8 |
9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
10 #include "cc/output/output_surface_client.h" | 10 #include "cc/output/output_surface_client.h" |
11 #include "components/display_compositor/buffer_queue.h" | |
12 #include "components/display_compositor/gl_helper.h" | |
13 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor.h" | 11 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor.h" |
| 12 #include "content/browser/compositor/buffer_queue.h" |
| 13 #include "content/browser/compositor/gl_helper.h" |
14 #include "content/browser/compositor/reflector_impl.h" | 14 #include "content/browser/compositor/reflector_impl.h" |
15 #include "content/browser/gpu/gpu_surface_tracker.h" | 15 #include "content/browser/gpu/gpu_surface_tracker.h" |
16 #include "content/common/gpu/client/context_provider_command_buffer.h" | 16 #include "content/common/gpu/client/context_provider_command_buffer.h" |
17 #include "gpu/GLES2/gl2extchromium.h" | 17 #include "gpu/GLES2/gl2extchromium.h" |
18 #include "gpu/command_buffer/client/gles2_interface.h" | 18 #include "gpu/command_buffer/client/gles2_interface.h" |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 | 21 |
22 GpuSurfacelessBrowserCompositorOutputSurface:: | 22 GpuSurfacelessBrowserCompositorOutputSurface:: |
23 GpuSurfacelessBrowserCompositorOutputSurface( | 23 GpuSurfacelessBrowserCompositorOutputSurface( |
(...skipping 18 matching lines...) Expand all Loading... |
42 capabilities_.flipped_output_surface = true; | 42 capabilities_.flipped_output_surface = true; |
43 // Set |max_frames_pending| to 2 for surfaceless, which aligns scheduling | 43 // Set |max_frames_pending| to 2 for surfaceless, which aligns scheduling |
44 // more closely with the previous surfaced behavior. | 44 // more closely with the previous surfaced behavior. |
45 // With a surface, swap buffer ack used to return early, before actually | 45 // With a surface, swap buffer ack used to return early, before actually |
46 // presenting the back buffer, enabling the browser compositor to run ahead. | 46 // presenting the back buffer, enabling the browser compositor to run ahead. |
47 // Surfaceless implementation acks at the time of actual buffer swap, which | 47 // Surfaceless implementation acks at the time of actual buffer swap, which |
48 // shifts the start of the new frame forward relative to the old | 48 // shifts the start of the new frame forward relative to the old |
49 // implementation. | 49 // implementation. |
50 capabilities_.max_frames_pending = 2; | 50 capabilities_.max_frames_pending = 2; |
51 | 51 |
52 gl_helper_.reset(new display_compositor::GLHelper( | 52 gl_helper_.reset(new GLHelper(context_provider_->ContextGL(), |
53 context_provider_->ContextGL(), context_provider_->ContextSupport())); | 53 context_provider_->ContextSupport())); |
54 output_surface_.reset(new display_compositor::BufferQueue( | 54 output_surface_.reset(new BufferQueue( |
55 context_provider_, target, internalformat_, gl_helper_.get(), | 55 context_provider_, target, internalformat_, gl_helper_.get(), |
56 gpu_memory_buffer_manager_, surface_id)); | 56 gpu_memory_buffer_manager_, surface_id)); |
57 output_surface_->Initialize(); | 57 output_surface_->Initialize(); |
58 } | 58 } |
59 | 59 |
60 GpuSurfacelessBrowserCompositorOutputSurface:: | 60 GpuSurfacelessBrowserCompositorOutputSurface:: |
61 ~GpuSurfacelessBrowserCompositorOutputSurface() { | 61 ~GpuSurfacelessBrowserCompositorOutputSurface() { |
62 } | 62 } |
63 | 63 |
64 bool GpuSurfacelessBrowserCompositorOutputSurface::IsDisplayedAsOverlayPlane() | 64 bool GpuSurfacelessBrowserCompositorOutputSurface::IsDisplayedAsOverlayPlane() |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 output_surface_->RecreateBuffers(); | 109 output_surface_->RecreateBuffers(); |
110 force_swap = true; | 110 force_swap = true; |
111 } | 111 } |
112 GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted(latency_info, | 112 GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted(latency_info, |
113 result); | 113 result); |
114 if (force_swap) | 114 if (force_swap) |
115 client_->SetNeedsRedrawRect(gfx::Rect(SurfaceSize())); | 115 client_->SetNeedsRedrawRect(gfx::Rect(SurfaceSize())); |
116 } | 116 } |
117 | 117 |
118 } // namespace content | 118 } // namespace content |
OLD | NEW |