OLD | NEW |
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/gles2_conform_support/egl/display.h" | 5 #include "gpu/gles2_conform_support/egl/display.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "gpu/command_buffer/client/gles2_implementation.h" | 10 #include "gpu/command_buffer/client/gles2_implementation.h" |
11 #include "gpu/command_buffer/client/gles2_lib.h" | 11 #include "gpu/command_buffer/client/gles2_lib.h" |
12 #include "gpu/command_buffer/client/transfer_buffer.h" | 12 #include "gpu/command_buffer/client/transfer_buffer.h" |
13 #include "gpu/command_buffer/service/context_group.h" | 13 #include "gpu/command_buffer/service/context_group.h" |
14 #include "gpu/command_buffer/service/gpu_control_service.h" | |
15 #include "gpu/command_buffer/service/transfer_buffer_manager.h" | 14 #include "gpu/command_buffer/service/transfer_buffer_manager.h" |
16 #include "gpu/gles2_conform_support/egl/config.h" | 15 #include "gpu/gles2_conform_support/egl/config.h" |
17 #include "gpu/gles2_conform_support/egl/surface.h" | 16 #include "gpu/gles2_conform_support/egl/surface.h" |
18 | 17 |
19 namespace { | 18 namespace { |
20 const int32 kCommandBufferSize = 1024 * 1024; | 19 const int32 kCommandBufferSize = 1024 * 1024; |
21 const int32 kTransferBufferSize = 512 * 1024; | 20 const int32 kTransferBufferSize = 512 * 1024; |
22 } | 21 } |
23 | 22 |
24 namespace egl { | 23 namespace egl { |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 162 |
164 if (!decoder_->Initialize(gl_surface_.get(), | 163 if (!decoder_->Initialize(gl_surface_.get(), |
165 gl_context_.get(), | 164 gl_context_.get(), |
166 gl_surface_->IsOffscreen(), | 165 gl_surface_->IsOffscreen(), |
167 size, | 166 size, |
168 gpu::gles2::DisallowedFeatures(), | 167 gpu::gles2::DisallowedFeatures(), |
169 attribs)) { | 168 attribs)) { |
170 return EGL_NO_SURFACE; | 169 return EGL_NO_SURFACE; |
171 } | 170 } |
172 | 171 |
173 gpu_control_.reset(new gpu::GpuControlService( | 172 gpu_control_service_.reset(new gpu::GpuControlService(NULL, NULL)); |
174 NULL, NULL, group->mailbox_manager(), NULL, decoder_->GetCapabilities())); | |
175 | 173 |
176 command_buffer->SetPutOffsetChangeCallback( | 174 command_buffer->SetPutOffsetChangeCallback( |
177 base::Bind(&gpu::GpuScheduler::PutChanged, | 175 base::Bind(&gpu::GpuScheduler::PutChanged, |
178 base::Unretained(gpu_scheduler_.get()))); | 176 base::Unretained(gpu_scheduler_.get()))); |
179 command_buffer->SetGetBufferChangeCallback( | 177 command_buffer->SetGetBufferChangeCallback( |
180 base::Bind(&gpu::GpuScheduler::SetGetBuffer, | 178 base::Bind(&gpu::GpuScheduler::SetGetBuffer, |
181 base::Unretained(gpu_scheduler_.get()))); | 179 base::Unretained(gpu_scheduler_.get()))); |
182 | 180 |
183 scoped_ptr<gpu::gles2::GLES2CmdHelper> cmd_helper( | 181 scoped_ptr<gpu::gles2::GLES2CmdHelper> cmd_helper( |
184 new gpu::gles2::GLES2CmdHelper(command_buffer.get())); | 182 new gpu::gles2::GLES2CmdHelper(command_buffer.get())); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 228 |
231 bool bind_generates_resources = true; | 229 bool bind_generates_resources = true; |
232 bool lose_context_when_out_of_memory = false; | 230 bool lose_context_when_out_of_memory = false; |
233 | 231 |
234 context_.reset( | 232 context_.reset( |
235 new gpu::gles2::GLES2Implementation(gles2_cmd_helper_.get(), | 233 new gpu::gles2::GLES2Implementation(gles2_cmd_helper_.get(), |
236 NULL, | 234 NULL, |
237 transfer_buffer_.get(), | 235 transfer_buffer_.get(), |
238 bind_generates_resources, | 236 bind_generates_resources, |
239 lose_context_when_out_of_memory, | 237 lose_context_when_out_of_memory, |
240 gpu_control_.get())); | 238 this)); |
241 | 239 |
242 if (!context_->Initialize( | 240 if (!context_->Initialize( |
243 kTransferBufferSize, | 241 kTransferBufferSize, |
244 kTransferBufferSize / 2, | 242 kTransferBufferSize / 2, |
245 kTransferBufferSize * 2, | 243 kTransferBufferSize * 2, |
246 gpu::gles2::GLES2Implementation::kNoLimit)) { | 244 gpu::gles2::GLES2Implementation::kNoLimit)) { |
247 return EGL_NO_CONTEXT; | 245 return EGL_NO_CONTEXT; |
248 } | 246 } |
249 | 247 |
250 context_->EnableFeatureCHROMIUM("pepper3d_allow_buffers_on_multiple_targets"); | 248 context_->EnableFeatureCHROMIUM("pepper3d_allow_buffers_on_multiple_targets"); |
(...skipping 13 matching lines...) Expand all Loading... |
264 gles2::SetGLContext(NULL); | 262 gles2::SetGLContext(NULL); |
265 } else { | 263 } else { |
266 DCHECK(IsValidSurface(draw)); | 264 DCHECK(IsValidSurface(draw)); |
267 DCHECK(IsValidSurface(read)); | 265 DCHECK(IsValidSurface(read)); |
268 DCHECK(IsValidContext(ctx)); | 266 DCHECK(IsValidContext(ctx)); |
269 gles2::SetGLContext(context_.get()); | 267 gles2::SetGLContext(context_.get()); |
270 } | 268 } |
271 return true; | 269 return true; |
272 } | 270 } |
273 | 271 |
| 272 gpu::Capabilities Display::GetCapabilities() { |
| 273 return decoder_->GetCapabilities(); |
| 274 } |
| 275 |
| 276 gfx::GpuMemoryBuffer* Display::CreateGpuMemoryBuffer( |
| 277 size_t width, |
| 278 size_t height, |
| 279 unsigned internalformat, |
| 280 int32* id) { |
| 281 NOTIMPLEMENTED(); |
| 282 return NULL; |
| 283 } |
| 284 |
| 285 void Display::DestroyGpuMemoryBuffer(int32 id) { |
| 286 NOTIMPLEMENTED(); |
| 287 } |
| 288 |
| 289 uint32 Display::InsertSyncPoint() { |
| 290 NOTIMPLEMENTED(); |
| 291 return 0u; |
| 292 } |
| 293 |
| 294 void Display::SignalSyncPoint(uint32 sync_point, |
| 295 const base::Closure& callback) { |
| 296 NOTIMPLEMENTED(); |
| 297 } |
| 298 |
| 299 void Display::SignalQuery(uint32 query, const base::Closure& callback) { |
| 300 NOTIMPLEMENTED(); |
| 301 } |
| 302 |
| 303 void Display::SetSurfaceVisible(bool visible) { |
| 304 NOTIMPLEMENTED(); |
| 305 } |
| 306 |
| 307 void Display::SendManagedMemoryStats(const gpu::ManagedMemoryStats& stats) { |
| 308 NOTIMPLEMENTED(); |
| 309 } |
| 310 |
| 311 void Display::Echo(const base::Closure& callback) { |
| 312 NOTIMPLEMENTED(); |
| 313 } |
| 314 |
| 315 uint32 Display::CreateStreamTexture(uint32 texture_id) { |
| 316 NOTIMPLEMENTED(); |
| 317 return 0; |
| 318 } |
| 319 |
274 } // namespace egl | 320 } // namespace egl |
OLD | NEW |