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

Side by Side Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 23503038: Make using virtual contexts a workaround flag rather than cmdline (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comment Created 7 years, 3 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 | « content/browser/gpu/gpu_process_host.cc ('k') | content/public/common/content_switches.h » ('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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/hash.h" 9 #include "base/hash.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "content/common/gpu/gpu_channel.h" 13 #include "content/common/gpu/gpu_channel.h"
14 #include "content/common/gpu/gpu_channel_manager.h" 14 #include "content/common/gpu/gpu_channel_manager.h"
15 #include "content/common/gpu/gpu_command_buffer_stub.h" 15 #include "content/common/gpu/gpu_command_buffer_stub.h"
16 #include "content/common/gpu/gpu_memory_manager.h" 16 #include "content/common/gpu/gpu_memory_manager.h"
17 #include "content/common/gpu/gpu_memory_tracking.h" 17 #include "content/common/gpu/gpu_memory_tracking.h"
18 #include "content/common/gpu/gpu_messages.h" 18 #include "content/common/gpu/gpu_messages.h"
19 #include "content/common/gpu/gpu_watchdog.h" 19 #include "content/common/gpu/gpu_watchdog.h"
20 #include "content/common/gpu/image_transport_surface.h" 20 #include "content/common/gpu/image_transport_surface.h"
21 #include "content/common/gpu/media/gl_surface_capturer.h" 21 #include "content/common/gpu/media/gl_surface_capturer.h"
22 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" 22 #include "content/common/gpu/media/gpu_video_decode_accelerator.h"
23 #include "content/common/gpu/sync_point_manager.h" 23 #include "content/common/gpu/sync_point_manager.h"
24 #include "content/public/common/content_client.h" 24 #include "content/public/common/content_client.h"
25 #include "content/public/common/content_switches.h"
26 #include "gpu/command_buffer/common/constants.h" 25 #include "gpu/command_buffer/common/constants.h"
27 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 26 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
28 #include "gpu/command_buffer/common/mailbox.h" 27 #include "gpu/command_buffer/common/mailbox.h"
29 #include "gpu/command_buffer/service/gl_context_virtual.h" 28 #include "gpu/command_buffer/service/gl_context_virtual.h"
30 #include "gpu/command_buffer/service/gl_state_restorer_impl.h" 29 #include "gpu/command_buffer/service/gl_state_restorer_impl.h"
31 #include "gpu/command_buffer/service/logger.h" 30 #include "gpu/command_buffer/service/logger.h"
32 #include "gpu/command_buffer/service/memory_tracking.h" 31 #include "gpu/command_buffer/service/memory_tracking.h"
33 #include "gpu/command_buffer/service/query_manager.h" 32 #include "gpu/command_buffer/service/query_manager.h"
34 #include "ui/gl/gl_bindings.h" 33 #include "ui/gl/gl_bindings.h"
35 #include "ui/gl/gl_switches.h" 34 #include "ui/gl/gl_switches.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 #if defined(OS_ANDROID) 143 #if defined(OS_ANDROID)
145 stream_texture_manager = channel_->stream_texture_manager(); 144 stream_texture_manager = channel_->stream_texture_manager();
146 #endif 145 #endif
147 context_group_ = new gpu::gles2::ContextGroup( 146 context_group_ = new gpu::gles2::ContextGroup(
148 mailbox_manager, 147 mailbox_manager,
149 image_manager, 148 image_manager,
150 new GpuCommandBufferMemoryTracker(channel), 149 new GpuCommandBufferMemoryTracker(channel),
151 stream_texture_manager, 150 stream_texture_manager,
152 true); 151 true);
153 } 152 }
153
154 use_virtualized_gl_context_ |=
155 context_group_->feature_info()->workarounds().use_virtualized_gl_contexts;
154 } 156 }
155 157
156 GpuCommandBufferStub::~GpuCommandBufferStub() { 158 GpuCommandBufferStub::~GpuCommandBufferStub() {
157 Destroy(); 159 Destroy();
158 160
159 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); 161 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager();
160 gpu_channel_manager->Send(new GpuHostMsg_DestroyCommandBuffer(surface_id())); 162 gpu_channel_manager->Send(new GpuHostMsg_DestroyCommandBuffer(surface_id()));
161 } 163 }
162 164
163 GpuMemoryManager* GpuCommandBufferStub::GetMemoryManager() { 165 GpuMemoryManager* GpuCommandBufferStub::GetMemoryManager() {
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 surface_ = manager->GetDefaultOffscreenSurface(); 434 surface_ = manager->GetDefaultOffscreenSurface();
433 } 435 }
434 436
435 if (!surface_.get()) { 437 if (!surface_.get()) {
436 DLOG(ERROR) << "Failed to create surface.\n"; 438 DLOG(ERROR) << "Failed to create surface.\n";
437 OnInitializeFailed(reply_message); 439 OnInitializeFailed(reply_message);
438 return; 440 return;
439 } 441 }
440 442
441 scoped_refptr<gfx::GLContext> context; 443 scoped_refptr<gfx::GLContext> context;
442 if ((CommandLine::ForCurrentProcess()->HasSwitch( 444 if (use_virtualized_gl_context_ && channel_->share_group()) {
443 switches::kEnableVirtualGLContexts) || use_virtualized_gl_context_) &&
444 channel_->share_group()) {
445 context = channel_->share_group()->GetSharedContext(); 445 context = channel_->share_group()->GetSharedContext();
446 if (!context.get()) { 446 if (!context.get()) {
447 context = gfx::GLContext::CreateGLContext( 447 context = gfx::GLContext::CreateGLContext(
448 channel_->share_group(), 448 channel_->share_group(),
449 channel_->gpu_channel_manager()->GetDefaultOffscreenSurface(), 449 channel_->gpu_channel_manager()->GetDefaultOffscreenSurface(),
450 gpu_preference_); 450 gpu_preference_);
451 channel_->share_group()->SetSharedContext(context.get()); 451 channel_->share_group()->SetSharedContext(context.get());
452 } 452 }
453 // This should be a non-virtual GL context. 453 // This should be a non-virtual GL context.
454 DCHECK(context->GetHandle()); 454 DCHECK(context->GetHandle());
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 command_buffer_->GetState().error == gpu::error::kLostContext) 953 command_buffer_->GetState().error == gpu::error::kLostContext)
954 return; 954 return;
955 955
956 command_buffer_->SetContextLostReason(gpu::error::kUnknown); 956 command_buffer_->SetContextLostReason(gpu::error::kUnknown);
957 if (decoder_) 957 if (decoder_)
958 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); 958 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB);
959 command_buffer_->SetParseError(gpu::error::kLostContext); 959 command_buffer_->SetParseError(gpu::error::kLostContext);
960 } 960 }
961 961
962 } // namespace content 962 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.cc ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698