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

Side by Side Diff: gpu/command_buffer/tests/gl_manager.cc

Issue 20017005: gpu: Refactor GpuMemoryBuffer framework for multi-process support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « gpu/command_buffer/tests/gl_manager.h ('k') | gpu/command_buffer_common.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "gpu/command_buffer/tests/gl_manager.h" 5 #include "gpu/command_buffer/tests/gl_manager.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "gpu/command_buffer/client/gles2_implementation.h" 11 #include "gpu/command_buffer/client/gles2_implementation.h"
12 #include "gpu/command_buffer/client/gles2_lib.h" 12 #include "gpu/command_buffer/client/gles2_lib.h"
13 #include "gpu/command_buffer/client/transfer_buffer.h" 13 #include "gpu/command_buffer/client/transfer_buffer.h"
14 #include "gpu/command_buffer/common/constants.h" 14 #include "gpu/command_buffer/common/constants.h"
15 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 15 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
16 #include "gpu/command_buffer/service/command_buffer_service.h" 16 #include "gpu/command_buffer/service/command_buffer_service.h"
17 #include "gpu/command_buffer/service/context_group.h" 17 #include "gpu/command_buffer/service/context_group.h"
18 #include "gpu/command_buffer/service/gl_context_virtual.h" 18 #include "gpu/command_buffer/service/gl_context_virtual.h"
19 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 19 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
20 #include "gpu/command_buffer/service/gpu_control_service.h"
20 #include "gpu/command_buffer/service/gpu_scheduler.h" 21 #include "gpu/command_buffer/service/gpu_scheduler.h"
21 #include "gpu/command_buffer/service/image_manager.h" 22 #include "gpu/command_buffer/service/image_manager.h"
22 #include "gpu/command_buffer/service/mailbox_manager.h" 23 #include "gpu/command_buffer/service/mailbox_manager.h"
23 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
24 #include "ui/gl/gl_context.h" 25 #include "ui/gl/gl_context.h"
25 #include "ui/gl/gl_share_group.h" 26 #include "ui/gl/gl_share_group.h"
26 #include "ui/gl/gl_surface.h" 27 #include "ui/gl/gl_surface.h"
27 28
28 namespace gpu { 29 namespace gpu {
29 30
30 int GLManager::use_count_; 31 int GLManager::use_count_;
31 scoped_refptr<gfx::GLShareGroup>* GLManager::base_share_group_; 32 scoped_refptr<gfx::GLShareGroup>* GLManager::base_share_group_;
32 scoped_refptr<gfx::GLSurface>* GLManager::base_surface_; 33 scoped_refptr<gfx::GLSurface>* GLManager::base_surface_;
33 scoped_refptr<gfx::GLContext>* GLManager::base_context_; 34 scoped_refptr<gfx::GLContext>* GLManager::base_context_;
34 35
35 GLManager::Options::Options() 36 GLManager::Options::Options()
36 : size(4, 4), 37 : size(4, 4),
37 share_group_manager(NULL), 38 share_group_manager(NULL),
38 share_mailbox_manager(NULL), 39 share_mailbox_manager(NULL),
39 virtual_manager(NULL), 40 virtual_manager(NULL),
40 bind_generates_resource(false), 41 bind_generates_resource(false),
41 context_lost_allowed(false), 42 context_lost_allowed(false),
42 image_manager(NULL), 43 image_manager(NULL) {
43 image_factory(NULL) {
44 } 44 }
45 45
46 GLManager::GLManager() 46 GLManager::GLManager()
47 : context_lost_allowed_(false) { 47 : context_lost_allowed_(false) {
48 SetupBaseContext(); 48 SetupBaseContext();
49 } 49 }
50 50
51 GLManager::~GLManager() { 51 GLManager::~GLManager() {
52 --use_count_; 52 --use_count_;
53 if (!use_count_) { 53 if (!use_count_) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 options.bind_generates_resource); 125 options.bind_generates_resource);
126 } 126 }
127 127
128 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group)); 128 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group));
129 129
130 command_buffer_.reset(new CommandBufferService( 130 command_buffer_.reset(new CommandBufferService(
131 decoder_->GetContextGroup()->transfer_buffer_manager())); 131 decoder_->GetContextGroup()->transfer_buffer_manager()));
132 ASSERT_TRUE(command_buffer_->Initialize()) 132 ASSERT_TRUE(command_buffer_->Initialize())
133 << "could not create command buffer service"; 133 << "could not create command buffer service";
134 134
135 gpu_control_.reset(
136 new GpuControlService(decoder_->GetContextGroup()->image_manager(),
137 options.gpu_memory_buffer_factory));
138
135 gpu_scheduler_.reset(new GpuScheduler(command_buffer_.get(), 139 gpu_scheduler_.reset(new GpuScheduler(command_buffer_.get(),
136 decoder_.get(), 140 decoder_.get(),
137 decoder_.get())); 141 decoder_.get()));
138 142
139 decoder_->set_engine(gpu_scheduler_.get()); 143 decoder_->set_engine(gpu_scheduler_.get());
140 144
141 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(options.size); 145 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(options.size);
142 ASSERT_TRUE(surface_.get() != NULL) << "could not create offscreen surface"; 146 ASSERT_TRUE(surface_.get() != NULL) << "could not create offscreen surface";
143 147
144 if (real_gl_context) { 148 if (real_gl_context) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 186
183 // Create a transfer buffer. 187 // Create a transfer buffer.
184 transfer_buffer_.reset(new TransferBuffer(gles2_helper_.get())); 188 transfer_buffer_.reset(new TransferBuffer(gles2_helper_.get()));
185 189
186 // Create the object exposing the OpenGL API. 190 // Create the object exposing the OpenGL API.
187 gles2_implementation_.reset(new gles2::GLES2Implementation( 191 gles2_implementation_.reset(new gles2::GLES2Implementation(
188 gles2_helper_.get(), 192 gles2_helper_.get(),
189 client_share_group, 193 client_share_group,
190 transfer_buffer_.get(), 194 transfer_buffer_.get(),
191 options.bind_generates_resource, 195 options.bind_generates_resource,
192 options.image_factory)); 196 gpu_control_.get()));
193 197
194 ASSERT_TRUE(gles2_implementation_->Initialize( 198 ASSERT_TRUE(gles2_implementation_->Initialize(
195 kStartTransferBufferSize, 199 kStartTransferBufferSize,
196 kMinTransferBufferSize, 200 kMinTransferBufferSize,
197 kMaxTransferBufferSize)) << "Could not init GLES2Implementation"; 201 kMaxTransferBufferSize)) << "Could not init GLES2Implementation";
198 202
199 MakeCurrent(); 203 MakeCurrent();
200 } 204 }
201 205
202 void GLManager::SetupBaseContext() { 206 void GLManager::SetupBaseContext() {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 if (!context_lost_allowed_) { 257 if (!context_lost_allowed_) {
254 ASSERT_EQ(::gpu::error::kNoError, state.error); 258 ASSERT_EQ(::gpu::error::kNoError, state.error);
255 } 259 }
256 } 260 }
257 261
258 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) { 262 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) {
259 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id); 263 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id);
260 } 264 }
261 265
262 } // namespace gpu 266 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/tests/gl_manager.h ('k') | gpu/command_buffer_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698