Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: components/mus/surfaces/direct_output_surface_ozone.cc

Issue 2049083002: Implement MusGpuMemoryBufferManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update the mojom document Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "components/mus/surfaces/direct_output_surface_ozone.h" 5 #include "components/mus/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 "cc/output/compositor_frame.h" 10 #include "cc/output/compositor_frame.h"
11 #include "cc/output/context_provider.h" 11 #include "cc/output/context_provider.h"
12 #include "cc/output/output_surface_client.h" 12 #include "cc/output/output_surface_client.h"
13 #include "components/display_compositor/buffer_queue.h" 13 #include "components/display_compositor/buffer_queue.h"
14 #include "components/mus/common/gpu_service.h"
14 #include "components/mus/common/mojo_gpu_memory_buffer_manager.h" 15 #include "components/mus/common/mojo_gpu_memory_buffer_manager.h"
16 #include "components/mus/gpu/mus_gpu_memory_buffer_manager.h"
15 #include "components/mus/surfaces/surfaces_context_provider.h" 17 #include "components/mus/surfaces/surfaces_context_provider.h"
16 #include "gpu/command_buffer/client/context_support.h" 18 #include "gpu/command_buffer/client/context_support.h"
17 #include "gpu/command_buffer/client/gles2_interface.h" 19 #include "gpu/command_buffer/client/gles2_interface.h"
18 20
19 using display_compositor::BufferQueue; 21 using display_compositor::BufferQueue;
20 22
21 namespace mus { 23 namespace mus {
22 24
23 DirectOutputSurfaceOzone::DirectOutputSurfaceOzone( 25 DirectOutputSurfaceOzone::DirectOutputSurfaceOzone(
24 scoped_refptr<SurfacesContextProvider> context_provider, 26 scoped_refptr<SurfacesContextProvider> context_provider,
25 gfx::AcceleratedWidget widget, 27 gfx::AcceleratedWidget widget,
26 base::SingleThreadTaskRunner* task_runner, 28 base::SingleThreadTaskRunner* task_runner,
27 uint32_t target, 29 uint32_t target,
28 uint32_t internalformat) 30 uint32_t internalformat)
29 : cc::OutputSurface(context_provider, nullptr, nullptr), 31 : cc::OutputSurface(context_provider, nullptr, nullptr),
30 gl_helper_(context_provider->ContextGL(), 32 gl_helper_(context_provider->ContextGL(),
31 context_provider->ContextSupport()), 33 context_provider->ContextSupport()),
32 buffer_queue_(new BufferQueue(context_provider->ContextGL(),
33 target,
34 internalformat,
35 &gl_helper_,
36 &gpu_memory_buffer_manager_,
37 widget)),
38 synthetic_begin_frame_source_(new cc::SyntheticBeginFrameSource( 34 synthetic_begin_frame_source_(new cc::SyntheticBeginFrameSource(
39 task_runner, 35 task_runner,
40 cc::BeginFrameArgs::DefaultInterval())), 36 cc::BeginFrameArgs::DefaultInterval())),
41 weak_ptr_factory_(this) { 37 weak_ptr_factory_(this) {
38 if (!GpuService::UseChromeGpuCommandBuffer()) {
39 ozone_gpu_memory_buffer_manager_.reset(new OzoneGpuMemoryBufferManager());
40 buffer_queue_.reset(new BufferQueue(
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
42 capabilities_.uses_default_gl_framebuffer = false; 49 capabilities_.uses_default_gl_framebuffer = false;
43 capabilities_.flipped_output_surface = true; 50 capabilities_.flipped_output_surface = true;
44 // Set |max_frames_pending| to 2 for surfaceless, which aligns scheduling 51 // Set |max_frames_pending| to 2 for surfaceless, which aligns scheduling
45 // more closely with the previous surfaced behavior. 52 // more closely with the previous surfaced behavior.
46 // With a surface, swap buffer ack used to return early, before actually 53 // With a surface, swap buffer ack used to return early, before actually
47 // presenting the back buffer, enabling the browser compositor to run ahead. 54 // presenting the back buffer, enabling the browser compositor to run ahead.
48 // Surfaceless implementation acks at the time of actual buffer swap, which 55 // Surfaceless implementation acks at the time of actual buffer swap, which
49 // shifts the start of the new frame forward relative to the old 56 // shifts the start of the new frame forward relative to the old
50 // implementation. 57 // implementation.
51 capabilities_.max_frames_pending = 2; 58 capabilities_.max_frames_pending = 2;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // must create the native window in the size that the hardware reports. 154 // must create the native window in the size that the hardware reports.
148 void DirectOutputSurfaceOzone::Reshape(const gfx::Size& size, 155 void DirectOutputSurfaceOzone::Reshape(const gfx::Size& size,
149 float scale_factor, 156 float scale_factor,
150 bool alpha) { 157 bool alpha) {
151 OutputSurface::Reshape(size, scale_factor, alpha); 158 OutputSurface::Reshape(size, scale_factor, alpha);
152 DCHECK(buffer_queue_); 159 DCHECK(buffer_queue_);
153 buffer_queue_->Reshape(SurfaceSize(), scale_factor); 160 buffer_queue_->Reshape(SurfaceSize(), scale_factor);
154 } 161 }
155 162
156 } // namespace mus 163 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/surfaces/direct_output_surface_ozone.h ('k') | components/mus/surfaces/surfaces_context_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698