OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/service/in_process_command_buffer.h" | 5 #include "gpu/command_buffer/service/in_process_command_buffer.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
336 bool InProcessCommandBuffer::Initialize( | 336 bool InProcessCommandBuffer::Initialize( |
337 scoped_refptr<gfx::GLSurface> surface, | 337 scoped_refptr<gfx::GLSurface> surface, |
338 bool is_offscreen, | 338 bool is_offscreen, |
339 gfx::AcceleratedWidget window, | 339 gfx::AcceleratedWidget window, |
340 const gfx::Size& size, | 340 const gfx::Size& size, |
341 const std::vector<int32>& attribs, | 341 const std::vector<int32>& attribs, |
342 gfx::GpuPreference gpu_preference, | 342 gfx::GpuPreference gpu_preference, |
343 const base::Closure& context_lost_callback, | 343 const base::Closure& context_lost_callback, |
344 InProcessCommandBuffer* share_group, | 344 InProcessCommandBuffer* share_group, |
345 GpuMemoryBufferManager* gpu_memory_buffer_manager, | 345 GpuMemoryBufferManager* gpu_memory_buffer_manager, |
346 ImageFactory* image_factory) { | 346 ImageFactory* image_factory, |
347 gfx::SurfaceConfiguration requested_configuration) { | |
abarth-chromium
2015/06/09 00:30:21
gfx::SurfaceConfiguration -> const gfx::SurfaceCon
iansf
2015/06/09 01:52:04
Done.
| |
347 DCHECK(!share_group || service_.get() == share_group->service_.get()); | 348 DCHECK(!share_group || service_.get() == share_group->service_.get()); |
348 context_lost_callback_ = WrapCallback(context_lost_callback); | 349 context_lost_callback_ = WrapCallback(context_lost_callback); |
349 | 350 |
350 if (surface.get()) { | 351 if (surface.get()) { |
351 // GPU thread must be the same as client thread due to GLSurface not being | 352 // GPU thread must be the same as client thread due to GLSurface not being |
352 // thread safe. | 353 // thread safe. |
353 sequence_checker_.reset(new base::SequenceChecker); | 354 sequence_checker_.reset(new base::SequenceChecker); |
354 surface_ = surface; | 355 surface_ = surface; |
355 } | 356 } |
356 | 357 |
357 gpu::Capabilities capabilities; | 358 gpu::Capabilities capabilities; |
358 InitializeOnGpuThreadParams params(is_offscreen, | 359 InitializeOnGpuThreadParams params(is_offscreen, |
359 window, | 360 window, |
360 size, | 361 size, |
361 attribs, | 362 attribs, |
362 gpu_preference, | 363 gpu_preference, |
363 &capabilities, | 364 &capabilities, |
364 share_group, | 365 share_group, |
365 image_factory); | 366 image_factory, |
367 requested_configuration); | |
366 | 368 |
367 base::Callback<bool(void)> init_task = | 369 base::Callback<bool(void)> init_task = |
368 base::Bind(&InProcessCommandBuffer::InitializeOnGpuThread, | 370 base::Bind(&InProcessCommandBuffer::InitializeOnGpuThread, |
369 base::Unretained(this), | 371 base::Unretained(this), |
370 params); | 372 params); |
371 | 373 |
372 base::WaitableEvent completion(true, false); | 374 base::WaitableEvent completion(true, false); |
373 bool result = false; | 375 bool result = false; |
374 QueueTask( | 376 QueueTask( |
375 base::Bind(&RunTaskWithResult<bool>, init_task, &result, &completion)); | 377 base::Bind(&RunTaskWithResult<bool>, init_task, &result, &completion)); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
432 gpu_scheduler_.reset( | 434 gpu_scheduler_.reset( |
433 new GpuScheduler(command_buffer.get(), decoder_.get(), decoder_.get())); | 435 new GpuScheduler(command_buffer.get(), decoder_.get(), decoder_.get())); |
434 command_buffer->SetGetBufferChangeCallback(base::Bind( | 436 command_buffer->SetGetBufferChangeCallback(base::Bind( |
435 &GpuScheduler::SetGetBuffer, base::Unretained(gpu_scheduler_.get()))); | 437 &GpuScheduler::SetGetBuffer, base::Unretained(gpu_scheduler_.get()))); |
436 command_buffer_ = command_buffer.Pass(); | 438 command_buffer_ = command_buffer.Pass(); |
437 | 439 |
438 decoder_->set_engine(gpu_scheduler_.get()); | 440 decoder_->set_engine(gpu_scheduler_.get()); |
439 | 441 |
440 if (!surface_.get()) { | 442 if (!surface_.get()) { |
441 if (params.is_offscreen) | 443 if (params.is_offscreen) |
442 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(params.size); | 444 surface_ = gfx::GLSurface::CreateOffscreenGLSurface( |
445 params.size, params.requested_configuration); | |
443 else | 446 else |
444 surface_ = gfx::GLSurface::CreateViewGLSurface(params.window); | 447 surface_ = gfx::GLSurface::CreateViewGLSurface( |
448 params.window, params.requested_configuration); | |
445 } | 449 } |
446 | 450 |
447 if (!surface_.get()) { | 451 if (!surface_.get()) { |
448 LOG(ERROR) << "Could not create GLSurface."; | 452 LOG(ERROR) << "Could not create GLSurface."; |
449 DestroyOnGpuThread(); | 453 DestroyOnGpuThread(); |
450 return false; | 454 return false; |
451 } | 455 } |
452 | 456 |
453 if (service_->UseVirtualizedGLContexts() || | 457 if (service_->UseVirtualizedGLContexts() || |
454 decoder_->GetContextGroup() | 458 decoder_->GetContextGroup() |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
961 | 965 |
962 #if defined(OS_ANDROID) | 966 #if defined(OS_ANDROID) |
963 scoped_refptr<gfx::SurfaceTexture> | 967 scoped_refptr<gfx::SurfaceTexture> |
964 InProcessCommandBuffer::GetSurfaceTexture(uint32 stream_id) { | 968 InProcessCommandBuffer::GetSurfaceTexture(uint32 stream_id) { |
965 DCHECK(stream_texture_manager_); | 969 DCHECK(stream_texture_manager_); |
966 return stream_texture_manager_->GetSurfaceTexture(stream_id); | 970 return stream_texture_manager_->GetSurfaceTexture(stream_id); |
967 } | 971 } |
968 #endif | 972 #endif |
969 | 973 |
970 } // namespace gpu | 974 } // namespace gpu |
OLD | NEW |