| 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 "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
| 8 #include "content/browser/compositor/buffer_queue.h" | 8 #include "content/browser/compositor/buffer_queue.h" |
| 9 #include "content/browser/compositor/reflector_impl.h" | 9 #include "content/browser/compositor/reflector_impl.h" |
| 10 #include "content/browser/gpu/gpu_surface_tracker.h" | 10 #include "content/browser/gpu/gpu_surface_tracker.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 scoped_ptr<cc::OverlayCandidateValidator> overlay_candidate_validator, | 23 scoped_ptr<cc::OverlayCandidateValidator> overlay_candidate_validator, |
| 24 unsigned internalformat, | 24 unsigned internalformat, |
| 25 BrowserGpuMemoryBufferManager* gpu_memory_buffer_manager) | 25 BrowserGpuMemoryBufferManager* gpu_memory_buffer_manager) |
| 26 : GpuBrowserCompositorOutputSurface(context, | 26 : GpuBrowserCompositorOutputSurface(context, |
| 27 vsync_manager, | 27 vsync_manager, |
| 28 overlay_candidate_validator.Pass()), | 28 overlay_candidate_validator.Pass()), |
| 29 internalformat_(internalformat), | 29 internalformat_(internalformat), |
| 30 gpu_memory_buffer_manager_(gpu_memory_buffer_manager) { | 30 gpu_memory_buffer_manager_(gpu_memory_buffer_manager) { |
| 31 capabilities_.uses_default_gl_framebuffer = false; | 31 capabilities_.uses_default_gl_framebuffer = false; |
| 32 capabilities_.flipped_output_surface = true; | 32 capabilities_.flipped_output_surface = true; |
| 33 // TODO(alexst): Can't enable this on ARM since it hangs the device | 33 // Set |max_frames_pending| to 2 for surfaceless, which aligns scheduling |
| 34 // (crbug.com/470185). Alternatively remove this entirely once the compositor | 34 // more closely with the previous surfaced behavior. |
| 35 // scheduling is optimized enough to work well with surfaceless. | 35 // With a surface, swap buffer ack used to return early, before actually |
| 36 #if defined(ARCH_CPU_X86_FAMILY) | 36 // presenting the back buffer, enabling the browser compositor to run ahead. |
| 37 // Surfaceless implementation acks at the time of actual buffer swap, which |
| 38 // shifts the start of the new frame forward relative to the old |
| 39 // implementation. |
| 37 capabilities_.max_frames_pending = 2; | 40 capabilities_.max_frames_pending = 2; |
| 38 #endif | |
| 39 | 41 |
| 40 gl_helper_.reset(new GLHelper(context_provider_->ContextGL(), | 42 gl_helper_.reset(new GLHelper(context_provider_->ContextGL(), |
| 41 context_provider_->ContextSupport())); | 43 context_provider_->ContextSupport())); |
| 42 output_surface_.reset( | 44 output_surface_.reset( |
| 43 new BufferQueue(context_provider_, internalformat_, gl_helper_.get(), | 45 new BufferQueue(context_provider_, internalformat_, gl_helper_.get(), |
| 44 gpu_memory_buffer_manager_, surface_id)); | 46 gpu_memory_buffer_manager_, surface_id)); |
| 45 output_surface_->Initialize(); | 47 output_surface_->Initialize(); |
| 46 } | 48 } |
| 47 | 49 |
| 48 GpuSurfacelessBrowserCompositorOutputSurface:: | 50 GpuSurfacelessBrowserCompositorOutputSurface:: |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 86 |
| 85 void GpuSurfacelessBrowserCompositorOutputSurface::Reshape( | 87 void GpuSurfacelessBrowserCompositorOutputSurface::Reshape( |
| 86 const gfx::Size& size, | 88 const gfx::Size& size, |
| 87 float scale_factor) { | 89 float scale_factor) { |
| 88 GpuBrowserCompositorOutputSurface::Reshape(size, scale_factor); | 90 GpuBrowserCompositorOutputSurface::Reshape(size, scale_factor); |
| 89 DCHECK(output_surface_); | 91 DCHECK(output_surface_); |
| 90 output_surface_->Reshape(SurfaceSize(), scale_factor); | 92 output_surface_->Reshape(SurfaceSize(), scale_factor); |
| 91 } | 93 } |
| 92 | 94 |
| 93 } // namespace content | 95 } // namespace content |
| OLD | NEW |