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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <queue> | 10 #include <queue> |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // delete the ThreadTaskRunnerHandle before the GPU thread's message loop, | 145 // delete the ThreadTaskRunnerHandle before the GPU thread's message loop, |
146 // and when the message loop is shutdown, it will recreate | 146 // and when the message loop is shutdown, it will recreate |
147 // ThreadTaskRunnerHandle, which will re-add a new task to the, AtExitManager, | 147 // ThreadTaskRunnerHandle, which will re-add a new task to the, AtExitManager, |
148 // which causes a deadlock because it's already locked. | 148 // which causes a deadlock because it's already locked. |
149 base::ThreadTaskRunnerHandle::IsSet(); | 149 base::ThreadTaskRunnerHandle::IsSet(); |
150 return g_default_service.Get().gpu_thread; | 150 return g_default_service.Get().gpu_thread; |
151 } | 151 } |
152 | 152 |
153 } // anonyous namespace | 153 } // anonyous namespace |
154 | 154 |
155 InProcessCommandBuffer::Service::Service() | 155 InProcessCommandBuffer::Service::Service() {} |
156 : gpu_driver_bug_workarounds_(base::CommandLine::ForCurrentProcess()) {} | |
157 | 156 |
158 InProcessCommandBuffer::Service::Service(const GpuPreferences& gpu_preferences) | 157 InProcessCommandBuffer::Service::Service(const GpuPreferences& gpu_preferences) |
159 : gpu_preferences_(gpu_preferences), | 158 : gpu_preferences_(gpu_preferences) {} |
160 gpu_driver_bug_workarounds_(base::CommandLine::ForCurrentProcess()) {} | |
161 | 159 |
162 InProcessCommandBuffer::Service::~Service() {} | 160 InProcessCommandBuffer::Service::~Service() {} |
163 | 161 |
164 const gpu::GpuPreferences& | 162 const gpu::GpuPreferences& |
165 InProcessCommandBuffer::Service::gpu_preferences() { | 163 InProcessCommandBuffer::Service::gpu_preferences() { |
166 return gpu_preferences_; | 164 return gpu_preferences_; |
167 } | 165 } |
168 | 166 |
169 const gpu::GpuDriverBugWorkarounds& | |
170 InProcessCommandBuffer::Service::gpu_driver_bug_workarounds() { | |
171 return gpu_driver_bug_workarounds_; | |
172 } | |
173 | |
174 scoped_refptr<gfx::GLShareGroup> | 167 scoped_refptr<gfx::GLShareGroup> |
175 InProcessCommandBuffer::Service::share_group() { | 168 InProcessCommandBuffer::Service::share_group() { |
176 if (!share_group_.get()) | 169 if (!share_group_.get()) |
177 share_group_ = new gfx::GLShareGroup; | 170 share_group_ = new gfx::GLShareGroup; |
178 return share_group_; | 171 return share_group_; |
179 } | 172 } |
180 | 173 |
181 scoped_refptr<gles2::MailboxManager> | 174 scoped_refptr<gles2::MailboxManager> |
182 InProcessCommandBuffer::Service::mailbox_manager() { | 175 InProcessCommandBuffer::Service::mailbox_manager() { |
183 if (!mailbox_manager_.get()) { | 176 if (!mailbox_manager_.get()) { |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 | 340 |
348 gl_share_group_ = params.context_group | 341 gl_share_group_ = params.context_group |
349 ? params.context_group->gl_share_group_ | 342 ? params.context_group->gl_share_group_ |
350 : service_->share_group(); | 343 : service_->share_group(); |
351 | 344 |
352 #if defined(OS_ANDROID) | 345 #if defined(OS_ANDROID) |
353 stream_texture_manager_.reset(new StreamTextureManagerInProcess); | 346 stream_texture_manager_.reset(new StreamTextureManagerInProcess); |
354 #endif | 347 #endif |
355 | 348 |
356 bool bind_generates_resource = false; | 349 bool bind_generates_resource = false; |
357 scoped_refptr<gles2::FeatureInfo> feature_info = | |
358 new gles2::FeatureInfo(service_->gpu_driver_bug_workarounds()); | |
359 decoder_.reset(gles2::GLES2Decoder::Create( | 350 decoder_.reset(gles2::GLES2Decoder::Create( |
360 params.context_group | 351 params.context_group |
361 ? params.context_group->decoder_->GetContextGroup() | 352 ? params.context_group->decoder_->GetContextGroup() |
362 : new gles2::ContextGroup( | 353 : new gles2::ContextGroup(service_->gpu_preferences(), |
363 service_->gpu_preferences(), service_->mailbox_manager(), NULL, | 354 service_->mailbox_manager(), NULL, |
364 service_->shader_translator_cache(), | 355 service_->shader_translator_cache(), |
365 service_->framebuffer_completeness_cache(), feature_info, | 356 service_->framebuffer_completeness_cache(), |
366 service_->subscription_ref_set(), | 357 NULL, service_->subscription_ref_set(), |
367 service_->pending_valuebuffer_state(), | 358 service_->pending_valuebuffer_state(), |
368 bind_generates_resource))); | 359 bind_generates_resource))); |
369 | 360 |
370 executor_.reset(new CommandExecutor(command_buffer.get(), decoder_.get(), | 361 executor_.reset(new CommandExecutor(command_buffer.get(), decoder_.get(), |
371 decoder_.get())); | 362 decoder_.get())); |
372 command_buffer->SetGetBufferChangeCallback(base::Bind( | 363 command_buffer->SetGetBufferChangeCallback(base::Bind( |
373 &CommandExecutor::SetGetBuffer, base::Unretained(executor_.get()))); | 364 &CommandExecutor::SetGetBuffer, base::Unretained(executor_.get()))); |
374 command_buffer_ = std::move(command_buffer); | 365 command_buffer_ = std::move(command_buffer); |
375 | 366 |
376 decoder_->set_engine(executor_.get()); | 367 decoder_->set_engine(executor_.get()); |
377 | 368 |
378 if (!surface_.get()) { | 369 if (!surface_.get()) { |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 framebuffer_completeness_cache_ = | 1114 framebuffer_completeness_cache_ = |
1124 new gpu::gles2::FramebufferCompletenessCache; | 1115 new gpu::gles2::FramebufferCompletenessCache; |
1125 return framebuffer_completeness_cache_; | 1116 return framebuffer_completeness_cache_; |
1126 } | 1117 } |
1127 | 1118 |
1128 SyncPointManager* GpuInProcessThread::sync_point_manager() { | 1119 SyncPointManager* GpuInProcessThread::sync_point_manager() { |
1129 return sync_point_manager_; | 1120 return sync_point_manager_; |
1130 } | 1121 } |
1131 | 1122 |
1132 } // namespace gpu | 1123 } // namespace gpu |
OLD | NEW |