| 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 GpuSurfacelessBrowserCompositorOutputSurface:: | 21 GpuSurfacelessBrowserCompositorOutputSurface:: |
| 22 GpuSurfacelessBrowserCompositorOutputSurface( | 22 GpuSurfacelessBrowserCompositorOutputSurface( |
| 23 scoped_refptr<ContextProviderCommandBuffer> context, | 23 scoped_refptr<ContextProviderCommandBuffer> context, |
| 24 gpu::SurfaceHandle surface_handle, | 24 gpu::SurfaceHandle surface_handle, |
| 25 scoped_refptr<ui::CompositorVSyncManager> vsync_manager, | 25 scoped_refptr<ui::CompositorVSyncManager> vsync_manager, |
| 26 cc::SyntheticBeginFrameSource* begin_frame_source, | 26 cc::SyntheticBeginFrameSource* begin_frame_source, |
| 27 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> | 27 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> |
| 28 overlay_candidate_validator, | 28 overlay_candidate_validator, |
| 29 unsigned int target, | 29 unsigned int target, |
| 30 unsigned int internalformat, | 30 unsigned int internalformat, |
| 31 gfx::BufferFormat format, |
| 31 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) | 32 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) |
| 32 : GpuBrowserCompositorOutputSurface(std::move(context), | 33 : GpuBrowserCompositorOutputSurface(std::move(context), |
| 33 std::move(vsync_manager), | 34 std::move(vsync_manager), |
| 34 begin_frame_source, | 35 begin_frame_source, |
| 35 std::move(overlay_candidate_validator)), | 36 std::move(overlay_candidate_validator)), |
| 36 internalformat_(internalformat), | |
| 37 gpu_memory_buffer_manager_(gpu_memory_buffer_manager) { | 37 gpu_memory_buffer_manager_(gpu_memory_buffer_manager) { |
| 38 capabilities_.uses_default_gl_framebuffer = false; | 38 capabilities_.uses_default_gl_framebuffer = false; |
| 39 capabilities_.flipped_output_surface = true; | 39 capabilities_.flipped_output_surface = true; |
| 40 // Set |max_frames_pending| to 2 for surfaceless, which aligns scheduling | 40 // Set |max_frames_pending| to 2 for surfaceless, which aligns scheduling |
| 41 // more closely with the previous surfaced behavior. | 41 // more closely with the previous surfaced behavior. |
| 42 // With a surface, swap buffer ack used to return early, before actually | 42 // With a surface, swap buffer ack used to return early, before actually |
| 43 // presenting the back buffer, enabling the browser compositor to run ahead. | 43 // presenting the back buffer, enabling the browser compositor to run ahead. |
| 44 // Surfaceless implementation acks at the time of actual buffer swap, which | 44 // Surfaceless implementation acks at the time of actual buffer swap, which |
| 45 // shifts the start of the new frame forward relative to the old | 45 // shifts the start of the new frame forward relative to the old |
| 46 // implementation. | 46 // implementation. |
| 47 capabilities_.max_frames_pending = 2; | 47 capabilities_.max_frames_pending = 2; |
| 48 | 48 |
| 49 gl_helper_.reset(new display_compositor::GLHelper( | 49 gl_helper_.reset(new display_compositor::GLHelper( |
| 50 context_provider_->ContextGL(), context_provider_->ContextSupport())); | 50 context_provider_->ContextGL(), context_provider_->ContextSupport())); |
| 51 buffer_queue_.reset(new display_compositor::BufferQueue( | 51 buffer_queue_.reset(new display_compositor::BufferQueue( |
| 52 context_provider_->ContextGL(), target, internalformat_, gl_helper_.get(), | 52 context_provider_->ContextGL(), target, internalformat, format, |
| 53 gpu_memory_buffer_manager_, surface_handle)); | 53 gl_helper_.get(), gpu_memory_buffer_manager_, surface_handle)); |
| 54 buffer_queue_->Initialize(); | 54 buffer_queue_->Initialize(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 GpuSurfacelessBrowserCompositorOutputSurface:: | 57 GpuSurfacelessBrowserCompositorOutputSurface:: |
| 58 ~GpuSurfacelessBrowserCompositorOutputSurface() { | 58 ~GpuSurfacelessBrowserCompositorOutputSurface() { |
| 59 } | 59 } |
| 60 | 60 |
| 61 bool GpuSurfacelessBrowserCompositorOutputSurface::IsDisplayedAsOverlayPlane() | 61 bool GpuSurfacelessBrowserCompositorOutputSurface::IsDisplayedAsOverlayPlane() |
| 62 const { | 62 const { |
| 63 return true; | 63 return true; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 buffer_queue_->RecreateBuffers(); | 114 buffer_queue_->RecreateBuffers(); |
| 115 force_swap = true; | 115 force_swap = true; |
| 116 } | 116 } |
| 117 GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( | 117 GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( |
| 118 latency_info, result, params_mac); | 118 latency_info, result, params_mac); |
| 119 if (force_swap) | 119 if (force_swap) |
| 120 client_->SetNeedsRedrawRect(gfx::Rect(SurfaceSize())); | 120 client_->SetNeedsRedrawRect(gfx::Rect(SurfaceSize())); |
| 121 } | 121 } |
| 122 | 122 |
| 123 } // namespace content | 123 } // namespace content |
| OLD | NEW |