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

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

Issue 1864373002: Remove unused features for in-process GL contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: inproclost: callback 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 gpu_preferences().gpu_program_cache_size, 202 gpu_preferences().gpu_program_cache_size,
203 gpu_preferences().disable_gpu_shader_disk_cache)); 203 gpu_preferences().disable_gpu_shader_disk_cache));
204 } 204 }
205 return program_cache_.get(); 205 return program_cache_.get();
206 } 206 }
207 207
208 InProcessCommandBuffer::InProcessCommandBuffer( 208 InProcessCommandBuffer::InProcessCommandBuffer(
209 const scoped_refptr<Service>& service) 209 const scoped_refptr<Service>& service)
210 : command_buffer_id_( 210 : command_buffer_id_(
211 CommandBufferId::FromUnsafeValue(g_next_command_buffer_id.GetNext())), 211 CommandBufferId::FromUnsafeValue(g_next_command_buffer_id.GetNext())),
212 context_lost_(false),
213 delayed_work_pending_(false), 212 delayed_work_pending_(false),
214 image_factory_(nullptr), 213 image_factory_(nullptr),
215 last_put_offset_(-1), 214 last_put_offset_(-1),
216 gpu_memory_buffer_manager_(nullptr), 215 gpu_memory_buffer_manager_(nullptr),
217 next_fence_sync_release_(1), 216 next_fence_sync_release_(1),
218 flushed_fence_sync_release_(0), 217 flushed_fence_sync_release_(0),
219 flush_event_(false, false), 218 flush_event_(false, false),
220 service_(GetInitialService(service)), 219 service_(GetInitialService(service)),
221 fence_sync_wait_event_(false, false), 220 fence_sync_wait_event_(false, false),
222 gpu_thread_weak_ptr_factory_(this) { 221 gpu_thread_weak_ptr_factory_(this) {
223 DCHECK(service_.get()); 222 DCHECK(service_.get());
224 next_image_id_.GetNext(); 223 next_image_id_.GetNext();
225 } 224 }
226 225
227 InProcessCommandBuffer::~InProcessCommandBuffer() { 226 InProcessCommandBuffer::~InProcessCommandBuffer() {
228 Destroy(); 227 Destroy();
229 } 228 }
230 229
231 bool InProcessCommandBuffer::MakeCurrent() { 230 bool InProcessCommandBuffer::MakeCurrent() {
232 CheckSequencedThread(); 231 CheckSequencedThread();
233 command_buffer_lock_.AssertAcquired(); 232 command_buffer_lock_.AssertAcquired();
234 233
235 if (!context_lost_ && decoder_->MakeCurrent()) 234 if (error::IsError(command_buffer_->GetLastState().error)) {
236 return true; 235 DLOG(ERROR) << "MakeCurrent failed because context lost.";
237 DLOG(ERROR) << "Context lost because MakeCurrent failed."; 236 return false;
238 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason()); 237 }
239 command_buffer_->SetParseError(gpu::error::kLostContext); 238 if (!decoder_->MakeCurrent()) {
240 return false; 239 DLOG(ERROR) << "Context lost because MakeCurrent failed.";
240 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason());
241 command_buffer_->SetParseError(gpu::error::kLostContext);
242 return false;
243 }
244 return true;
241 } 245 }
242 246
243 void InProcessCommandBuffer::PumpCommands() { 247 void InProcessCommandBuffer::PumpCommands() {
244 CheckSequencedThread(); 248 CheckSequencedThread();
245 command_buffer_lock_.AssertAcquired(); 249 command_buffer_lock_.AssertAcquired();
246 250
247 if (!MakeCurrent()) 251 if (!MakeCurrent())
248 return; 252 return;
249 253
250 executor_->PutChanged(); 254 executor_->PutChanged();
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 DCHECK(!sequence_checker_ || 493 DCHECK(!sequence_checker_ ||
490 sequence_checker_->CalledOnValidSequencedThread()); 494 sequence_checker_->CalledOnValidSequencedThread());
491 } 495 }
492 496
493 void InProcessCommandBuffer::OnContextLost() { 497 void InProcessCommandBuffer::OnContextLost() {
494 CheckSequencedThread(); 498 CheckSequencedThread();
495 if (!context_lost_callback_.is_null()) { 499 if (!context_lost_callback_.is_null()) {
496 context_lost_callback_.Run(); 500 context_lost_callback_.Run();
497 context_lost_callback_.Reset(); 501 context_lost_callback_.Reset();
498 } 502 }
499
500 context_lost_ = true;
501 } 503 }
502 504
503 CommandBuffer::State InProcessCommandBuffer::GetStateFast() { 505 CommandBuffer::State InProcessCommandBuffer::GetStateFast() {
504 CheckSequencedThread(); 506 CheckSequencedThread();
505 base::AutoLock lock(state_after_last_flush_lock_); 507 base::AutoLock lock(state_after_last_flush_lock_);
506 if (state_after_last_flush_.generation - last_state_.generation < 0x80000000U) 508 if (state_after_last_flush_.generation - last_state_.generation < 0x80000000U)
507 last_state_ = state_after_last_flush_; 509 last_state_ = state_after_last_flush_;
508 return last_state_; 510 return last_state_;
509 } 511 }
510 512
(...skipping 16 matching lines...) Expand all
527 529
528 { 530 {
529 ScopedOrderNumberProcessor scoped_order_num(sync_point_order_data_.get(), 531 ScopedOrderNumberProcessor scoped_order_num(sync_point_order_data_.get(),
530 order_num); 532 order_num);
531 command_buffer_->Flush(put_offset); 533 command_buffer_->Flush(put_offset);
532 { 534 {
533 // Update state before signaling the flush event. 535 // Update state before signaling the flush event.
534 base::AutoLock lock(state_after_last_flush_lock_); 536 base::AutoLock lock(state_after_last_flush_lock_);
535 state_after_last_flush_ = command_buffer_->GetLastState(); 537 state_after_last_flush_ = command_buffer_->GetLastState();
536 } 538 }
537 DCHECK((!error::IsError(state_after_last_flush_.error) && !context_lost_) ||
538 (error::IsError(state_after_last_flush_.error) && context_lost_));
539 539
540 // Currently the in process command buffer does not support being 540 // Currently the in process command buffer does not support being
541 // descheduled, if it does we would need to back off on calling the finish 541 // descheduled, if it does we would need to back off on calling the finish
542 // processing number function until the message is rescheduled and finished 542 // processing number function until the message is rescheduled and finished
543 // processing. This DCHECK is to enforce this. 543 // processing. This DCHECK is to enforce this.
544 DCHECK(context_lost_ || put_offset == state_after_last_flush_.get_offset); 544 DCHECK(error::IsError(state_after_last_flush_.error) ||
545 put_offset == state_after_last_flush_.get_offset);
545 } 546 }
546 547
547 // If we've processed all pending commands but still have pending queries, 548 // If we've processed all pending commands but still have pending queries,
548 // pump idle work until the query is passed. 549 // pump idle work until the query is passed.
549 if (put_offset == state_after_last_flush_.get_offset && 550 if (put_offset == state_after_last_flush_.get_offset &&
550 (executor_->HasMoreIdleWork() || executor_->HasPendingQueries())) { 551 (executor_->HasMoreIdleWork() || executor_->HasPendingQueries())) {
551 ScheduleDelayedWorkOnGpuThread(); 552 ScheduleDelayedWorkOnGpuThread();
552 } 553 }
553 } 554 }
554 555
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 DCHECK(query_manager_); 910 DCHECK(query_manager_);
910 911
911 gles2::QueryManager::Query* query = query_manager_->GetQuery(query_id); 912 gles2::QueryManager::Query* query = query_manager_->GetQuery(query_id);
912 if (!query) 913 if (!query)
913 callback.Run(); 914 callback.Run();
914 else 915 else
915 query->AddCallback(callback); 916 query->AddCallback(callback);
916 } 917 }
917 918
918 void InProcessCommandBuffer::SetLock(base::Lock*) { 919 void InProcessCommandBuffer::SetLock(base::Lock*) {
920 // No support for using on multiple threads.
921 NOTREACHED();
919 } 922 }
920 923
921 bool InProcessCommandBuffer::IsGpuChannelLost() { 924 bool InProcessCommandBuffer::IsGpuChannelLost() {
922 // There is no such channel to lose for in-process contexts. This only 925 // There is no such channel to lose for in-process contexts. This only
923 // makes sense for out-of-process command buffers. 926 // makes sense for out-of-process command buffers.
924 return false; 927 return false;
925 } 928 }
926 929
927 void InProcessCommandBuffer::EnsureWorkVisible() { 930 void InProcessCommandBuffer::EnsureWorkVisible() {
928 // This is only relevant for out-of-process command buffers. 931 // This is only relevant for out-of-process command buffers.
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 framebuffer_completeness_cache_ = 1094 framebuffer_completeness_cache_ =
1092 new gpu::gles2::FramebufferCompletenessCache; 1095 new gpu::gles2::FramebufferCompletenessCache;
1093 return framebuffer_completeness_cache_; 1096 return framebuffer_completeness_cache_;
1094 } 1097 }
1095 1098
1096 SyncPointManager* GpuInProcessThread::sync_point_manager() { 1099 SyncPointManager* GpuInProcessThread::sync_point_manager() {
1097 return sync_point_manager_; 1100 return sync_point_manager_;
1098 } 1101 }
1099 1102
1100 } // namespace gpu 1103 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698