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

Side by Side Diff: gpu/command_buffer/service/in_process_command_buffer.cc

Issue 1871613002: Compute GpuDriverBugWorkarounds only one time in the GPU process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 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
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <queue> 10 #include <queue>
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // delete the ThreadTaskRunnerHandle before the GPU thread's message loop, 140 // delete the ThreadTaskRunnerHandle before the GPU thread's message loop,
141 // and when the message loop is shutdown, it will recreate 141 // and when the message loop is shutdown, it will recreate
142 // ThreadTaskRunnerHandle, which will re-add a new task to the, AtExitManager, 142 // ThreadTaskRunnerHandle, which will re-add a new task to the, AtExitManager,
143 // which causes a deadlock because it's already locked. 143 // which causes a deadlock because it's already locked.
144 base::ThreadTaskRunnerHandle::IsSet(); 144 base::ThreadTaskRunnerHandle::IsSet();
145 return g_default_service.Get().gpu_thread; 145 return g_default_service.Get().gpu_thread;
146 } 146 }
147 147
148 } // anonyous namespace 148 } // anonyous namespace
149 149
150 InProcessCommandBuffer::Service::Service() {} 150 InProcessCommandBuffer::Service::Service()
151 : gpu_driver_bug_workarounds_(base::CommandLine::ForCurrentProcess()) {}
151 152
152 InProcessCommandBuffer::Service::Service(const GpuPreferences& gpu_preferences) 153 InProcessCommandBuffer::Service::Service(const GpuPreferences& gpu_preferences)
153 : gpu_preferences_(gpu_preferences) {} 154 : gpu_preferences_(gpu_preferences),
155 gpu_driver_bug_workarounds_(base::CommandLine::ForCurrentProcess()) {}
154 156
155 InProcessCommandBuffer::Service::~Service() {} 157 InProcessCommandBuffer::Service::~Service() {}
156 158
157 const gpu::GpuPreferences& 159 const gpu::GpuPreferences&
158 InProcessCommandBuffer::Service::gpu_preferences() { 160 InProcessCommandBuffer::Service::gpu_preferences() {
159 return gpu_preferences_; 161 return gpu_preferences_;
160 } 162 }
161 163
164 const gpu::GpuDriverBugWorkarounds&
165 InProcessCommandBuffer::Service::gpu_driver_bug_workarounds() {
166 return gpu_driver_bug_workarounds_;
167 }
168
162 scoped_refptr<gfx::GLShareGroup> 169 scoped_refptr<gfx::GLShareGroup>
163 InProcessCommandBuffer::Service::share_group() { 170 InProcessCommandBuffer::Service::share_group() {
164 if (!share_group_.get()) 171 if (!share_group_.get())
165 share_group_ = new gfx::GLShareGroup; 172 share_group_ = new gfx::GLShareGroup;
166 return share_group_; 173 return share_group_;
167 } 174 }
168 175
169 scoped_refptr<gles2::MailboxManager> 176 scoped_refptr<gles2::MailboxManager>
170 InProcessCommandBuffer::Service::mailbox_manager() { 177 InProcessCommandBuffer::Service::mailbox_manager() {
171 if (!mailbox_manager_.get()) { 178 if (!mailbox_manager_.get()) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 LOG(ERROR) << "Could not initialize command buffer."; 338 LOG(ERROR) << "Could not initialize command buffer.";
332 DestroyOnGpuThread(); 339 DestroyOnGpuThread();
333 return false; 340 return false;
334 } 341 }
335 342
336 gl_share_group_ = params.context_group 343 gl_share_group_ = params.context_group
337 ? params.context_group->gl_share_group_ 344 ? params.context_group->gl_share_group_
338 : service_->share_group(); 345 : service_->share_group();
339 346
340 bool bind_generates_resource = false; 347 bool bind_generates_resource = false;
348 scoped_refptr<gles2::FeatureInfo> feature_info =
349 new gles2::FeatureInfo(service_->gpu_driver_bug_workarounds());
341 decoder_.reset(gles2::GLES2Decoder::Create( 350 decoder_.reset(gles2::GLES2Decoder::Create(
342 params.context_group 351 params.context_group
343 ? params.context_group->decoder_->GetContextGroup() 352 ? params.context_group->decoder_->GetContextGroup()
344 : new gles2::ContextGroup(service_->gpu_preferences(), 353 : new gles2::ContextGroup(
345 service_->mailbox_manager(), NULL, 354 service_->gpu_preferences(), service_->mailbox_manager(), NULL,
346 service_->shader_translator_cache(), 355 service_->shader_translator_cache(),
347 service_->framebuffer_completeness_cache(), 356 service_->framebuffer_completeness_cache(), feature_info,
348 NULL, service_->subscription_ref_set(), 357 service_->subscription_ref_set(),
349 service_->pending_valuebuffer_state(), 358 service_->pending_valuebuffer_state(),
350 bind_generates_resource))); 359 bind_generates_resource)));
351 360
352 executor_.reset(new CommandExecutor(command_buffer.get(), decoder_.get(), 361 executor_.reset(new CommandExecutor(command_buffer.get(), decoder_.get(),
353 decoder_.get())); 362 decoder_.get()));
354 command_buffer->SetGetBufferChangeCallback(base::Bind( 363 command_buffer->SetGetBufferChangeCallback(base::Bind(
355 &CommandExecutor::SetGetBuffer, base::Unretained(executor_.get()))); 364 &CommandExecutor::SetGetBuffer, base::Unretained(executor_.get())));
356 command_buffer_ = std::move(command_buffer); 365 command_buffer_ = std::move(command_buffer);
357 366
358 decoder_->set_engine(executor_.get()); 367 decoder_->set_engine(executor_.get());
359 368
360 if (!surface_.get()) { 369 if (!surface_.get()) {
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 framebuffer_completeness_cache_ = 1081 framebuffer_completeness_cache_ =
1073 new gpu::gles2::FramebufferCompletenessCache; 1082 new gpu::gles2::FramebufferCompletenessCache;
1074 return framebuffer_completeness_cache_; 1083 return framebuffer_completeness_cache_;
1075 } 1084 }
1076 1085
1077 SyncPointManager* GpuInProcessThread::sync_point_manager() { 1086 SyncPointManager* GpuInProcessThread::sync_point_manager() {
1078 return sync_point_manager_; 1087 return sync_point_manager_;
1079 } 1088 }
1080 1089
1081 } // namespace gpu 1090 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/in_process_command_buffer.h ('k') | gpu/command_buffer/service/texture_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698