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

Side by Side Diff: gpu/ipc/service/gpu_command_buffer_stub.cc

Issue 2763753002: gpu: Add callback for yielding command buffer execution. (Closed)
Patch Set: no need to !!pause Created 3 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
« no previous file with comments | « gpu/ipc/service/gpu_command_buffer_stub.h ('k') | no next file » | 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 "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"
11 #include "base/hash.h" 11 #include "base/hash.h"
12 #include "base/json/json_writer.h" 12 #include "base/json/json_writer.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/memory_pressure_listener.h" 14 #include "base/memory/memory_pressure_listener.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "base/memory/shared_memory.h" 16 #include "base/memory/shared_memory.h"
17 #include "base/metrics/histogram_macros.h" 17 #include "base/metrics/histogram_macros.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "base/trace_event/trace_event.h" 19 #include "base/trace_event/trace_event.h"
20 #include "build/build_config.h" 20 #include "build/build_config.h"
21 #include "gpu/command_buffer/common/constants.h" 21 #include "gpu/command_buffer/common/constants.h"
22 #include "gpu/command_buffer/common/gpu_memory_buffer_support.h" 22 #include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
23 #include "gpu/command_buffer/common/mailbox.h" 23 #include "gpu/command_buffer/common/mailbox.h"
24 #include "gpu/command_buffer/common/sync_token.h" 24 #include "gpu/command_buffer/common/sync_token.h"
25 #include "gpu/command_buffer/service/command_executor.h"
25 #include "gpu/command_buffer/service/gl_context_virtual.h" 26 #include "gpu/command_buffer/service/gl_context_virtual.h"
26 #include "gpu/command_buffer/service/gl_state_restorer_impl.h" 27 #include "gpu/command_buffer/service/gl_state_restorer_impl.h"
27 #include "gpu/command_buffer/service/image_manager.h" 28 #include "gpu/command_buffer/service/image_manager.h"
28 #include "gpu/command_buffer/service/logger.h" 29 #include "gpu/command_buffer/service/logger.h"
29 #include "gpu/command_buffer/service/mailbox_manager.h" 30 #include "gpu/command_buffer/service/mailbox_manager.h"
30 #include "gpu/command_buffer/service/memory_tracking.h" 31 #include "gpu/command_buffer/service/memory_tracking.h"
32 #include "gpu/command_buffer/service/preemption_flag.h"
31 #include "gpu/command_buffer/service/query_manager.h" 33 #include "gpu/command_buffer/service/query_manager.h"
32 #include "gpu/command_buffer/service/service_utils.h" 34 #include "gpu/command_buffer/service/service_utils.h"
33 #include "gpu/command_buffer/service/sync_point_manager.h" 35 #include "gpu/command_buffer/service/sync_point_manager.h"
34 #include "gpu/command_buffer/service/transfer_buffer_manager.h" 36 #include "gpu/command_buffer/service/transfer_buffer_manager.h"
35 #include "gpu/ipc/common/gpu_messages.h" 37 #include "gpu/ipc/common/gpu_messages.h"
36 #include "gpu/ipc/service/gpu_channel.h" 38 #include "gpu/ipc/service/gpu_channel.h"
37 #include "gpu/ipc/service/gpu_channel_manager.h" 39 #include "gpu/ipc/service/gpu_channel_manager.h"
38 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" 40 #include "gpu/ipc/service/gpu_channel_manager_delegate.h"
39 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" 41 #include "gpu/ipc/service/gpu_memory_buffer_factory.h"
40 #include "gpu/ipc/service/gpu_memory_manager.h" 42 #include "gpu/ipc/service/gpu_memory_manager.h"
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 new CommandBufferService(context_group_->transfer_buffer_manager())); 645 new CommandBufferService(context_group_->transfer_buffer_manager()));
644 646
645 decoder_.reset(gles2::GLES2Decoder::Create(context_group_.get())); 647 decoder_.reset(gles2::GLES2Decoder::Create(context_group_.get()));
646 executor_.reset(new CommandExecutor(command_buffer_.get(), decoder_.get(), 648 executor_.reset(new CommandExecutor(command_buffer_.get(), decoder_.get(),
647 decoder_.get())); 649 decoder_.get()));
648 650
649 sync_point_client_state_ = 651 sync_point_client_state_ =
650 channel_->sync_point_manager()->CreateSyncPointClientState( 652 channel_->sync_point_manager()->CreateSyncPointClientState(
651 CommandBufferNamespace::GPU_IO, command_buffer_id_, sequence_id_); 653 CommandBufferNamespace::GPU_IO, command_buffer_id_, sequence_id_);
652 654
653 executor_->SetPreemptByFlag(channel_->preempted_flag()); 655 // TODO(sunnyps): Hook callback to gpu scheduler.
656 if (channel_->preempted_flag()) {
657 executor_->SetPauseExecutionCallback(
658 base::Bind(&PreemptionFlag::IsSet, channel_->preempted_flag()));
659 }
654 660
655 decoder_->set_engine(executor_.get()); 661 decoder_->set_engine(executor_.get());
656 662
657 if (offscreen) { 663 if (offscreen) {
658 // Do we want to create an offscreen rendering context suitable 664 // Do we want to create an offscreen rendering context suitable
659 // for directly drawing to a separately supplied surface? In that 665 // for directly drawing to a separately supplied surface? In that
660 // case, we must ensure that the surface used for context creation 666 // case, we must ensure that the surface used for context creation
661 // is compatible with the requested attributes. This is explicitly 667 // is compatible with the requested attributes. This is explicitly
662 // opt-in since some context such as for NaCl request custom 668 // opt-in since some context such as for NaCl request custom
663 // attributes but don't expect to get their own surface, and not 669 // attributes but don't expect to get their own surface, and not
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 command_buffer_->GetLastState().error == error::kLostContext) 1238 command_buffer_->GetLastState().error == error::kLostContext)
1233 return; 1239 return;
1234 1240
1235 command_buffer_->SetContextLostReason(error::kUnknown); 1241 command_buffer_->SetContextLostReason(error::kUnknown);
1236 if (decoder_) 1242 if (decoder_)
1237 decoder_->MarkContextLost(error::kUnknown); 1243 decoder_->MarkContextLost(error::kUnknown);
1238 command_buffer_->SetParseError(error::kLostContext); 1244 command_buffer_->SetParseError(error::kLostContext);
1239 } 1245 }
1240 1246
1241 } // namespace gpu 1247 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/service/gpu_command_buffer_stub.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698