| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/ui/surfaces/direct_output_surface_ozone.h" | 5 #include "services/ui/surfaces/direct_output_surface_ozone.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 scoped_refptr<SurfacesContextProvider> context_provider, | 28 scoped_refptr<SurfacesContextProvider> context_provider, |
| 29 gfx::AcceleratedWidget widget, | 29 gfx::AcceleratedWidget widget, |
| 30 cc::SyntheticBeginFrameSource* synthetic_begin_frame_source, | 30 cc::SyntheticBeginFrameSource* synthetic_begin_frame_source, |
| 31 uint32_t target, | 31 uint32_t target, |
| 32 uint32_t internalformat) | 32 uint32_t internalformat) |
| 33 : cc::OutputSurface(context_provider, nullptr, nullptr), | 33 : cc::OutputSurface(context_provider, nullptr, nullptr), |
| 34 gl_helper_(context_provider->ContextGL(), | 34 gl_helper_(context_provider->ContextGL(), |
| 35 context_provider->ContextSupport()), | 35 context_provider->ContextSupport()), |
| 36 synthetic_begin_frame_source_(synthetic_begin_frame_source), | 36 synthetic_begin_frame_source_(synthetic_begin_frame_source), |
| 37 weak_ptr_factory_(this) { | 37 weak_ptr_factory_(this) { |
| 38 if (!GpuService::UseChromeGpuCommandBuffer()) { | 38 buffer_queue_.reset(new BufferQueue( |
| 39 ozone_gpu_memory_buffer_manager_.reset(new OzoneGpuMemoryBufferManager()); | 39 context_provider->ContextGL(), target, internalformat, &gl_helper_, |
| 40 buffer_queue_.reset(new BufferQueue( | 40 MusGpuMemoryBufferManager::current(), widget)); |
| 41 context_provider->ContextGL(), target, internalformat, &gl_helper_, | |
| 42 ozone_gpu_memory_buffer_manager_.get(), widget)); | |
| 43 } else { | |
| 44 buffer_queue_.reset(new BufferQueue( | |
| 45 context_provider->ContextGL(), target, internalformat, &gl_helper_, | |
| 46 MusGpuMemoryBufferManager::current(), widget)); | |
| 47 } | |
| 48 | 41 |
| 49 capabilities_.uses_default_gl_framebuffer = false; | 42 capabilities_.uses_default_gl_framebuffer = false; |
| 50 capabilities_.flipped_output_surface = true; | 43 capabilities_.flipped_output_surface = true; |
| 51 // Set |max_frames_pending| to 2 for surfaceless, which aligns scheduling | 44 // Set |max_frames_pending| to 2 for surfaceless, which aligns scheduling |
| 52 // more closely with the previous surfaced behavior. | 45 // more closely with the previous surfaced behavior. |
| 53 // With a surface, swap buffer ack used to return early, before actually | 46 // With a surface, swap buffer ack used to return early, before actually |
| 54 // presenting the back buffer, enabling the browser compositor to run ahead. | 47 // presenting the back buffer, enabling the browser compositor to run ahead. |
| 55 // Surfaceless implementation acks at the time of actual buffer swap, which | 48 // Surfaceless implementation acks at the time of actual buffer swap, which |
| 56 // shifts the start of the new frame forward relative to the old | 49 // shifts the start of the new frame forward relative to the old |
| 57 // implementation. | 50 // implementation. |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 void DirectOutputSurfaceOzone::Reshape(const gfx::Size& size, | 148 void DirectOutputSurfaceOzone::Reshape(const gfx::Size& size, |
| 156 float scale_factor, | 149 float scale_factor, |
| 157 const gfx::ColorSpace& color_space, | 150 const gfx::ColorSpace& color_space, |
| 158 bool alpha) { | 151 bool alpha) { |
| 159 OutputSurface::Reshape(size, scale_factor, color_space, alpha); | 152 OutputSurface::Reshape(size, scale_factor, color_space, alpha); |
| 160 DCHECK(buffer_queue_); | 153 DCHECK(buffer_queue_); |
| 161 buffer_queue_->Reshape(SurfaceSize(), scale_factor, color_space); | 154 buffer_queue_->Reshape(SurfaceSize(), scale_factor, color_space); |
| 162 } | 155 } |
| 163 | 156 |
| 164 } // namespace ui | 157 } // namespace ui |
| OLD | NEW |