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/ipc/service/gpu_command_buffer_stub.h" | 5 #include "gpu/ipc/service/gpu_command_buffer_stub.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 use_virtualized_gl_context_ = true; | 580 use_virtualized_gl_context_ = true; |
581 #endif | 581 #endif |
582 | 582 |
583 use_virtualized_gl_context_ |= | 583 use_virtualized_gl_context_ |= |
584 context_group_->feature_info()->workarounds().use_virtualized_gl_contexts; | 584 context_group_->feature_info()->workarounds().use_virtualized_gl_contexts; |
585 | 585 |
586 // MailboxManagerSync synchronization correctness currently depends on having | 586 // MailboxManagerSync synchronization correctness currently depends on having |
587 // only a single context. See crbug.com/510243 for details. | 587 // only a single context. See crbug.com/510243 for details. |
588 use_virtualized_gl_context_ |= channel_->mailbox_manager()->UsesSync(); | 588 use_virtualized_gl_context_ |= channel_->mailbox_manager()->UsesSync(); |
589 | 589 |
590 gl::GLSurface::Format surface_format = gl::GLSurface::SURFACE_DEFAULT; | 590 gl::GLSurfaceFormat surface_format = gl::GLSurfaceFormat(); |
591 bool offscreen = (surface_handle_ == kNullSurfaceHandle); | 591 bool offscreen = (surface_handle_ == kNullSurfaceHandle); |
592 gl::GLSurface* default_surface = manager->GetDefaultOffscreenSurface(); | 592 gl::GLSurface* default_surface = manager->GetDefaultOffscreenSurface(); |
593 if (!default_surface) { | 593 if (!default_surface) { |
594 DLOG(ERROR) << "Failed to create default offscreen surface."; | 594 DLOG(ERROR) << "Failed to create default offscreen surface."; |
595 return false; | 595 return false; |
596 } | 596 } |
597 #if defined(OS_ANDROID) | 597 #if defined(OS_ANDROID) |
598 if (init_params.attribs.red_size <= 5 && | 598 if (init_params.attribs.red_size <= 5 && |
599 init_params.attribs.green_size <= 6 && | 599 init_params.attribs.green_size <= 6 && |
600 init_params.attribs.blue_size <= 5 && | 600 init_params.attribs.blue_size <= 5 && |
601 init_params.attribs.alpha_size == 0) | 601 init_params.attribs.alpha_size == 0) |
602 surface_format = gl::GLSurface::SURFACE_RGB565; | 602 surface_format.SetRGB565(); |
| 603 // TODO(klausw): explicitly copy rgba sizes? |
| 604 |
603 // We can only use virtualized contexts for onscreen command buffers if their | 605 // We can only use virtualized contexts for onscreen command buffers if their |
604 // config is compatible with the offscreen ones - otherwise MakeCurrent fails. | 606 // config is compatible with the offscreen ones - otherwise MakeCurrent fails. |
605 if (surface_format != default_surface->GetFormat() && !offscreen) | 607 if (!surface_format.IsCompatible(default_surface->GetFormat()) && !offscreen) |
606 use_virtualized_gl_context_ = false; | 608 use_virtualized_gl_context_ = false; |
607 #endif | 609 #endif |
608 | 610 |
609 command_buffer_.reset(new CommandBufferService( | 611 command_buffer_.reset(new CommandBufferService( |
610 context_group_->transfer_buffer_manager())); | 612 context_group_->transfer_buffer_manager())); |
611 | 613 |
612 decoder_.reset(gles2::GLES2Decoder::Create(context_group_.get())); | 614 decoder_.reset(gles2::GLES2Decoder::Create(context_group_.get())); |
613 executor_.reset(new CommandExecutor(command_buffer_.get(), decoder_.get(), | 615 executor_.reset(new CommandExecutor(command_buffer_.get(), decoder_.get(), |
614 decoder_.get())); | 616 decoder_.get())); |
615 sync_point_client_ = channel_->sync_point_manager()->CreateSyncPointClient( | 617 sync_point_client_ = channel_->sync_point_manager()->CreateSyncPointClient( |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 command_buffer_->GetLastState().error == error::kLostContext) | 1202 command_buffer_->GetLastState().error == error::kLostContext) |
1201 return; | 1203 return; |
1202 | 1204 |
1203 command_buffer_->SetContextLostReason(error::kUnknown); | 1205 command_buffer_->SetContextLostReason(error::kUnknown); |
1204 if (decoder_) | 1206 if (decoder_) |
1205 decoder_->MarkContextLost(error::kUnknown); | 1207 decoder_->MarkContextLost(error::kUnknown); |
1206 command_buffer_->SetParseError(error::kLostContext); | 1208 command_buffer_->SetParseError(error::kLostContext); |
1207 } | 1209 } |
1208 | 1210 |
1209 } // namespace gpu | 1211 } // namespace gpu |
OLD | NEW |