OLD | NEW |
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 "content/common/gpu/gpu_channel.h" | 5 #include "gpu/ipc/service/gpu_channel.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <windows.h> | 10 #include <windows.h> |
11 #endif | 11 #endif |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 #include <deque> | 14 #include <deque> |
15 #include <set> | 15 #include <set> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "base/atomicops.h" | 18 #include "base/atomicops.h" |
19 #include "base/bind.h" | 19 #include "base/bind.h" |
20 #include "base/command_line.h" | 20 #include "base/command_line.h" |
21 #include "base/location.h" | 21 #include "base/location.h" |
22 #include "base/numerics/safe_conversions.h" | 22 #include "base/numerics/safe_conversions.h" |
23 #include "base/single_thread_task_runner.h" | 23 #include "base/single_thread_task_runner.h" |
24 #include "base/stl_util.h" | 24 #include "base/stl_util.h" |
25 #include "base/strings/string_util.h" | 25 #include "base/strings/string_util.h" |
26 #include "base/synchronization/lock.h" | 26 #include "base/synchronization/lock.h" |
27 #include "base/thread_task_runner_handle.h" | 27 #include "base/thread_task_runner_handle.h" |
28 #include "base/timer/timer.h" | 28 #include "base/timer/timer.h" |
29 #include "base/trace_event/memory_dump_manager.h" | 29 #include "base/trace_event/memory_dump_manager.h" |
30 #include "base/trace_event/process_memory_dump.h" | 30 #include "base/trace_event/process_memory_dump.h" |
31 #include "base/trace_event/trace_event.h" | 31 #include "base/trace_event/trace_event.h" |
32 #include "build/build_config.h" | 32 #include "build/build_config.h" |
33 #include "content/common/gpu/gpu_channel_manager.h" | |
34 #include "content/common/gpu/gpu_channel_manager_delegate.h" | |
35 #include "content/common/gpu/gpu_memory_buffer_factory.h" | |
36 #include "gpu/command_buffer/common/mailbox.h" | 33 #include "gpu/command_buffer/common/mailbox.h" |
37 #include "gpu/command_buffer/common/value_state.h" | 34 #include "gpu/command_buffer/common/value_state.h" |
38 #include "gpu/command_buffer/service/command_executor.h" | 35 #include "gpu/command_buffer/service/command_executor.h" |
39 #include "gpu/command_buffer/service/image_factory.h" | 36 #include "gpu/command_buffer/service/image_factory.h" |
40 #include "gpu/command_buffer/service/mailbox_manager.h" | 37 #include "gpu/command_buffer/service/mailbox_manager.h" |
41 #include "gpu/command_buffer/service/sync_point_manager.h" | 38 #include "gpu/command_buffer/service/sync_point_manager.h" |
42 #include "gpu/command_buffer/service/valuebuffer_manager.h" | 39 #include "gpu/command_buffer/service/valuebuffer_manager.h" |
43 #include "gpu/ipc/common/gpu_messages.h" | 40 #include "gpu/ipc/common/gpu_messages.h" |
| 41 #include "gpu/ipc/service/gpu_channel_manager.h" |
| 42 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" |
| 43 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" |
44 #include "ipc/ipc_channel.h" | 44 #include "ipc/ipc_channel.h" |
45 #include "ipc/message_filter.h" | 45 #include "ipc/message_filter.h" |
46 #include "ui/gl/gl_context.h" | 46 #include "ui/gl/gl_context.h" |
47 #include "ui/gl/gl_image_shared_memory.h" | 47 #include "ui/gl/gl_image_shared_memory.h" |
48 #include "ui/gl/gl_surface.h" | 48 #include "ui/gl/gl_surface.h" |
49 | 49 |
50 #if defined(OS_POSIX) | 50 #if defined(OS_POSIX) |
51 #include "ipc/ipc_channel_posix.h" | 51 #include "ipc/ipc_channel_posix.h" |
52 #endif | 52 #endif |
53 | 53 |
54 namespace content { | 54 namespace gpu { |
55 namespace { | 55 namespace { |
56 | 56 |
57 // Number of milliseconds between successive vsync. Many GL commands block | 57 // Number of milliseconds between successive vsync. Many GL commands block |
58 // on vsync, so thresholds for preemption should be multiples of this. | 58 // on vsync, so thresholds for preemption should be multiples of this. |
59 const int64_t kVsyncIntervalMs = 17; | 59 const int64_t kVsyncIntervalMs = 17; |
60 | 60 |
61 // Amount of time that we will wait for an IPC to be processed before | 61 // Amount of time that we will wait for an IPC to be processed before |
62 // preempting. After a preemption, we must wait this long before triggering | 62 // preempting. After a preemption, we must wait this long before triggering |
63 // another preemption. | 63 // another preemption. |
64 const int64_t kPreemptWaitTimeMs = 2 * kVsyncIntervalMs; | 64 const int64_t kPreemptWaitTimeMs = 2 * kVsyncIntervalMs; |
65 | 65 |
66 // Once we trigger a preemption, the maximum duration that we will wait | 66 // Once we trigger a preemption, the maximum duration that we will wait |
67 // before clearing the preemption. | 67 // before clearing the preemption. |
68 const int64_t kMaxPreemptTimeMs = kVsyncIntervalMs; | 68 const int64_t kMaxPreemptTimeMs = kVsyncIntervalMs; |
69 | 69 |
70 // Stop the preemption once the time for the longest pending IPC drops | 70 // Stop the preemption once the time for the longest pending IPC drops |
71 // below this threshold. | 71 // below this threshold. |
72 const int64_t kStopPreemptThresholdMs = kVsyncIntervalMs; | 72 const int64_t kStopPreemptThresholdMs = kVsyncIntervalMs; |
73 | 73 |
74 } // anonymous namespace | 74 } // anonymous namespace |
75 | 75 |
76 scoped_refptr<GpuChannelMessageQueue> GpuChannelMessageQueue::Create( | 76 scoped_refptr<GpuChannelMessageQueue> GpuChannelMessageQueue::Create( |
77 int32_t stream_id, | 77 int32_t stream_id, |
78 gpu::GpuStreamPriority stream_priority, | 78 GpuStreamPriority stream_priority, |
79 GpuChannel* channel, | 79 GpuChannel* channel, |
80 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, | 80 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, |
81 const scoped_refptr<gpu::PreemptionFlag>& preempting_flag, | 81 const scoped_refptr<PreemptionFlag>& preempting_flag, |
82 const scoped_refptr<gpu::PreemptionFlag>& preempted_flag, | 82 const scoped_refptr<PreemptionFlag>& preempted_flag, |
83 gpu::SyncPointManager* sync_point_manager) { | 83 SyncPointManager* sync_point_manager) { |
84 return new GpuChannelMessageQueue(stream_id, stream_priority, channel, | 84 return new GpuChannelMessageQueue(stream_id, stream_priority, channel, |
85 io_task_runner, preempting_flag, | 85 io_task_runner, preempting_flag, |
86 preempted_flag, sync_point_manager); | 86 preempted_flag, sync_point_manager); |
87 } | 87 } |
88 | 88 |
89 scoped_refptr<gpu::SyncPointOrderData> | 89 scoped_refptr<SyncPointOrderData> |
90 GpuChannelMessageQueue::GetSyncPointOrderData() { | 90 GpuChannelMessageQueue::GetSyncPointOrderData() { |
91 return sync_point_order_data_; | 91 return sync_point_order_data_; |
92 } | 92 } |
93 | 93 |
94 GpuChannelMessageQueue::GpuChannelMessageQueue( | 94 GpuChannelMessageQueue::GpuChannelMessageQueue( |
95 int32_t stream_id, | 95 int32_t stream_id, |
96 gpu::GpuStreamPriority stream_priority, | 96 GpuStreamPriority stream_priority, |
97 GpuChannel* channel, | 97 GpuChannel* channel, |
98 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, | 98 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, |
99 const scoped_refptr<gpu::PreemptionFlag>& preempting_flag, | 99 const scoped_refptr<PreemptionFlag>& preempting_flag, |
100 const scoped_refptr<gpu::PreemptionFlag>& preempted_flag, | 100 const scoped_refptr<PreemptionFlag>& preempted_flag, |
101 gpu::SyncPointManager* sync_point_manager) | 101 SyncPointManager* sync_point_manager) |
102 : stream_id_(stream_id), | 102 : stream_id_(stream_id), |
103 stream_priority_(stream_priority), | 103 stream_priority_(stream_priority), |
104 enabled_(true), | 104 enabled_(true), |
105 scheduled_(true), | 105 scheduled_(true), |
106 channel_(channel), | 106 channel_(channel), |
107 preemption_state_(IDLE), | 107 preemption_state_(IDLE), |
108 max_preemption_time_( | 108 max_preemption_time_( |
109 base::TimeDelta::FromMilliseconds(kMaxPreemptTimeMs)), | 109 base::TimeDelta::FromMilliseconds(kMaxPreemptTimeMs)), |
110 timer_(new base::OneShotTimer), | 110 timer_(new base::OneShotTimer), |
111 sync_point_order_data_(gpu::SyncPointOrderData::Create()), | 111 sync_point_order_data_(SyncPointOrderData::Create()), |
112 io_task_runner_(io_task_runner), | 112 io_task_runner_(io_task_runner), |
113 preempting_flag_(preempting_flag), | 113 preempting_flag_(preempting_flag), |
114 preempted_flag_(preempted_flag), | 114 preempted_flag_(preempted_flag), |
115 sync_point_manager_(sync_point_manager) { | 115 sync_point_manager_(sync_point_manager) { |
116 timer_->SetTaskRunner(io_task_runner); | 116 timer_->SetTaskRunner(io_task_runner); |
117 io_thread_checker_.DetachFromThread(); | 117 io_thread_checker_.DetachFromThread(); |
118 } | 118 } |
119 | 119 |
120 GpuChannelMessageQueue::~GpuChannelMessageQueue() { | 120 GpuChannelMessageQueue::~GpuChannelMessageQueue() { |
121 DCHECK(!enabled_); | 121 DCHECK(!enabled_); |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 DLOG(ERROR) << error_msg; | 571 DLOG(ERROR) << error_msg; |
572 if (message.is_sync()) { | 572 if (message.is_sync()) { |
573 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&message); | 573 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&message); |
574 reply->set_reply_error(); | 574 reply->set_reply_error(); |
575 Send(reply); | 575 Send(reply); |
576 } | 576 } |
577 return true; | 577 return true; |
578 } | 578 } |
579 | 579 |
580 GpuChannel::GpuChannel(GpuChannelManager* gpu_channel_manager, | 580 GpuChannel::GpuChannel(GpuChannelManager* gpu_channel_manager, |
581 gpu::SyncPointManager* sync_point_manager, | 581 SyncPointManager* sync_point_manager, |
582 GpuWatchdog* watchdog, | 582 GpuWatchdog* watchdog, |
583 gfx::GLShareGroup* share_group, | 583 gfx::GLShareGroup* share_group, |
584 gpu::gles2::MailboxManager* mailbox, | 584 gles2::MailboxManager* mailbox, |
585 gpu::PreemptionFlag* preempting_flag, | 585 PreemptionFlag* preempting_flag, |
586 gpu::PreemptionFlag* preempted_flag, | 586 PreemptionFlag* preempted_flag, |
587 base::SingleThreadTaskRunner* task_runner, | 587 base::SingleThreadTaskRunner* task_runner, |
588 base::SingleThreadTaskRunner* io_task_runner, | 588 base::SingleThreadTaskRunner* io_task_runner, |
589 int32_t client_id, | 589 int32_t client_id, |
590 uint64_t client_tracing_id, | 590 uint64_t client_tracing_id, |
591 bool allow_view_command_buffers, | 591 bool allow_view_command_buffers, |
592 bool allow_real_time_streams) | 592 bool allow_real_time_streams) |
593 : gpu_channel_manager_(gpu_channel_manager), | 593 : gpu_channel_manager_(gpu_channel_manager), |
594 sync_point_manager_(sync_point_manager), | 594 sync_point_manager_(sync_point_manager), |
595 unhandled_message_listener_(nullptr), | 595 unhandled_message_listener_(nullptr), |
596 channel_id_(IPC::Channel::GenerateVerifiedChannelID("gpu")), | 596 channel_id_(IPC::Channel::GenerateVerifiedChannelID("gpu")), |
597 preempting_flag_(preempting_flag), | 597 preempting_flag_(preempting_flag), |
598 preempted_flag_(preempted_flag), | 598 preempted_flag_(preempted_flag), |
599 client_id_(client_id), | 599 client_id_(client_id), |
600 client_tracing_id_(client_tracing_id), | 600 client_tracing_id_(client_tracing_id), |
601 task_runner_(task_runner), | 601 task_runner_(task_runner), |
602 io_task_runner_(io_task_runner), | 602 io_task_runner_(io_task_runner), |
603 share_group_(share_group), | 603 share_group_(share_group), |
604 mailbox_manager_(mailbox), | 604 mailbox_manager_(mailbox), |
605 subscription_ref_set_(new gpu::gles2::SubscriptionRefSet), | 605 subscription_ref_set_(new gles2::SubscriptionRefSet), |
606 pending_valuebuffer_state_(new gpu::ValueStateMap), | 606 pending_valuebuffer_state_(new ValueStateMap), |
607 watchdog_(watchdog), | 607 watchdog_(watchdog), |
608 allow_view_command_buffers_(allow_view_command_buffers), | 608 allow_view_command_buffers_(allow_view_command_buffers), |
609 allow_real_time_streams_(allow_real_time_streams), | 609 allow_real_time_streams_(allow_real_time_streams), |
610 weak_factory_(this) { | 610 weak_factory_(this) { |
611 DCHECK(gpu_channel_manager); | 611 DCHECK(gpu_channel_manager); |
612 DCHECK(client_id); | 612 DCHECK(client_id); |
613 | 613 |
614 filter_ = new GpuChannelMessageFilter(); | 614 filter_ = new GpuChannelMessageFilter(); |
615 | 615 |
616 scoped_refptr<GpuChannelMessageQueue> control_queue = | 616 scoped_refptr<GpuChannelMessageQueue> control_queue = |
617 CreateStream(gpu::GPU_STREAM_DEFAULT, gpu::GpuStreamPriority::HIGH); | 617 CreateStream(GPU_STREAM_DEFAULT, GpuStreamPriority::HIGH); |
618 AddRouteToStream(MSG_ROUTING_CONTROL, gpu::GPU_STREAM_DEFAULT); | 618 AddRouteToStream(MSG_ROUTING_CONTROL, GPU_STREAM_DEFAULT); |
619 | 619 |
620 subscription_ref_set_->AddObserver(this); | 620 subscription_ref_set_->AddObserver(this); |
621 } | 621 } |
622 | 622 |
623 GpuChannel::~GpuChannel() { | 623 GpuChannel::~GpuChannel() { |
624 // Clear stubs first because of dependencies. | 624 // Clear stubs first because of dependencies. |
625 stubs_.clear(); | 625 stubs_.clear(); |
626 | 626 |
627 for (auto& kv : streams_) | 627 for (auto& kv : streams_) |
628 kv.second->Disable(); | 628 kv.second->Disable(); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg) | 758 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg) |
759 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateCommandBuffer, | 759 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateCommandBuffer, |
760 OnCreateCommandBuffer) | 760 OnCreateCommandBuffer) |
761 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer, | 761 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer, |
762 OnDestroyCommandBuffer) | 762 OnDestroyCommandBuffer) |
763 IPC_MESSAGE_UNHANDLED(handled = false) | 763 IPC_MESSAGE_UNHANDLED(handled = false) |
764 IPC_END_MESSAGE_MAP() | 764 IPC_END_MESSAGE_MAP() |
765 return handled; | 765 return handled; |
766 } | 766 } |
767 | 767 |
768 scoped_refptr<gpu::SyncPointOrderData> GpuChannel::GetSyncPointOrderData( | 768 scoped_refptr<SyncPointOrderData> GpuChannel::GetSyncPointOrderData( |
769 int32_t stream_id) { | 769 int32_t stream_id) { |
770 auto it = streams_.find(stream_id); | 770 auto it = streams_.find(stream_id); |
771 DCHECK(it != streams_.end()); | 771 DCHECK(it != streams_.end()); |
772 DCHECK(it->second); | 772 DCHECK(it->second); |
773 return it->second->GetSyncPointOrderData(); | 773 return it->second->GetSyncPointOrderData(); |
774 } | 774 } |
775 | 775 |
776 void GpuChannel::PostHandleMessage( | 776 void GpuChannel::PostHandleMessage( |
777 const scoped_refptr<GpuChannelMessageQueue>& queue) { | 777 const scoped_refptr<GpuChannelMessageQueue>& queue) { |
778 task_runner_->PostTask(FROM_HERE, | 778 task_runner_->PostTask(FROM_HERE, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 void GpuChannel::HandleOutOfOrderMessage(const IPC::Message& msg) { | 837 void GpuChannel::HandleOutOfOrderMessage(const IPC::Message& msg) { |
838 HandleMessageHelper(msg); | 838 HandleMessageHelper(msg); |
839 } | 839 } |
840 | 840 |
841 void GpuChannel::HandleMessageForTesting(const IPC::Message& msg) { | 841 void GpuChannel::HandleMessageForTesting(const IPC::Message& msg) { |
842 HandleMessageHelper(msg); | 842 HandleMessageHelper(msg); |
843 } | 843 } |
844 | 844 |
845 scoped_refptr<GpuChannelMessageQueue> GpuChannel::CreateStream( | 845 scoped_refptr<GpuChannelMessageQueue> GpuChannel::CreateStream( |
846 int32_t stream_id, | 846 int32_t stream_id, |
847 gpu::GpuStreamPriority stream_priority) { | 847 GpuStreamPriority stream_priority) { |
848 DCHECK(streams_.find(stream_id) == streams_.end()); | 848 DCHECK(streams_.find(stream_id) == streams_.end()); |
849 scoped_refptr<GpuChannelMessageQueue> queue = GpuChannelMessageQueue::Create( | 849 scoped_refptr<GpuChannelMessageQueue> queue = GpuChannelMessageQueue::Create( |
850 stream_id, stream_priority, this, io_task_runner_, | 850 stream_id, stream_priority, this, io_task_runner_, |
851 (stream_id == gpu::GPU_STREAM_DEFAULT) ? preempting_flag_ : nullptr, | 851 (stream_id == GPU_STREAM_DEFAULT) ? preempting_flag_ : nullptr, |
852 preempted_flag_, sync_point_manager_); | 852 preempted_flag_, sync_point_manager_); |
853 streams_.insert(std::make_pair(stream_id, queue)); | 853 streams_.insert(std::make_pair(stream_id, queue)); |
854 streams_to_num_routes_.insert(std::make_pair(stream_id, 0)); | 854 streams_to_num_routes_.insert(std::make_pair(stream_id, 0)); |
855 return queue; | 855 return queue; |
856 } | 856 } |
857 | 857 |
858 scoped_refptr<GpuChannelMessageQueue> GpuChannel::LookupStream( | 858 scoped_refptr<GpuChannelMessageQueue> GpuChannel::LookupStream( |
859 int32_t stream_id) { | 859 int32_t stream_id) { |
860 auto stream_it = streams_.find(stream_id); | 860 auto stream_it = streams_.find(stream_id); |
861 if (stream_it != streams_.end()) | 861 if (stream_it != streams_.end()) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 for (const auto& kv : stubs_) { | 896 for (const auto& kv : stubs_) { |
897 const GpuCommandBufferStub* stub = kv.second; | 897 const GpuCommandBufferStub* stub = kv.second; |
898 if (stub->decoder() && !stub->decoder()->WasContextLost()) | 898 if (stub->decoder() && !stub->decoder()->WasContextLost()) |
899 return stub; | 899 return stub; |
900 } | 900 } |
901 return nullptr; | 901 return nullptr; |
902 } | 902 } |
903 #endif | 903 #endif |
904 | 904 |
905 void GpuChannel::OnCreateCommandBuffer( | 905 void GpuChannel::OnCreateCommandBuffer( |
906 gpu::SurfaceHandle surface_handle, | 906 SurfaceHandle surface_handle, |
907 const gfx::Size& size, | 907 const gfx::Size& size, |
908 const GPUCreateCommandBufferConfig& init_params, | 908 const GPUCreateCommandBufferConfig& init_params, |
909 int32_t route_id, | 909 int32_t route_id, |
910 bool* succeeded) { | 910 bool* succeeded) { |
911 TRACE_EVENT2("gpu", "GpuChannel::OnCreateCommandBuffer", "route_id", route_id, | 911 TRACE_EVENT2("gpu", "GpuChannel::OnCreateCommandBuffer", "route_id", route_id, |
912 "offscreen", (surface_handle == gpu::kNullSurfaceHandle)); | 912 "offscreen", (surface_handle == kNullSurfaceHandle)); |
913 *succeeded = false; | 913 *succeeded = false; |
914 if (surface_handle != gpu::kNullSurfaceHandle && | 914 if (surface_handle != kNullSurfaceHandle && |
915 !allow_view_command_buffers_) { | 915 !allow_view_command_buffers_) { |
916 DLOG(ERROR) << "GpuChannel::CreateCommandBuffer(): attempt to create a " | 916 DLOG(ERROR) << "GpuChannel::CreateCommandBuffer(): attempt to create a " |
917 "view context on a non-priviledged channel"; | 917 "view context on a non-priviledged channel"; |
918 return; | 918 return; |
919 } | 919 } |
920 | 920 |
921 int32_t share_group_id = init_params.share_group_id; | 921 int32_t share_group_id = init_params.share_group_id; |
922 GpuCommandBufferStub* share_group = stubs_.get(share_group_id); | 922 GpuCommandBufferStub* share_group = stubs_.get(share_group_id); |
923 | 923 |
924 if (!share_group && share_group_id != MSG_ROUTING_NONE) { | 924 if (!share_group && share_group_id != MSG_ROUTING_NONE) { |
925 DLOG(ERROR) | 925 DLOG(ERROR) |
926 << "GpuChannel::OnCreateCommandBuffer(): invalid share group id"; | 926 << "GpuChannel::OnCreateCommandBuffer(): invalid share group id"; |
927 return; | 927 return; |
928 } | 928 } |
929 | 929 |
930 int32_t stream_id = init_params.stream_id; | 930 int32_t stream_id = init_params.stream_id; |
931 if (share_group && stream_id != share_group->stream_id()) { | 931 if (share_group && stream_id != share_group->stream_id()) { |
932 DLOG(ERROR) << "GpuChannel::OnCreateCommandBuffer(): stream id does not " | 932 DLOG(ERROR) << "GpuChannel::OnCreateCommandBuffer(): stream id does not " |
933 "match share group stream id"; | 933 "match share group stream id"; |
934 return; | 934 return; |
935 } | 935 } |
936 | 936 |
937 gpu::GpuStreamPriority stream_priority = init_params.stream_priority; | 937 GpuStreamPriority stream_priority = init_params.stream_priority; |
938 if (!allow_real_time_streams_ && | 938 if (!allow_real_time_streams_ && |
939 stream_priority == gpu::GpuStreamPriority::REAL_TIME) { | 939 stream_priority == GpuStreamPriority::REAL_TIME) { |
940 DLOG(ERROR) << "GpuChannel::OnCreateCommandBuffer(): real time stream " | 940 DLOG(ERROR) << "GpuChannel::OnCreateCommandBuffer(): real time stream " |
941 "priority not allowed"; | 941 "priority not allowed"; |
942 return; | 942 return; |
943 } | 943 } |
944 | 944 |
945 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( | 945 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( |
946 this, sync_point_manager_, task_runner_.get(), share_group, | 946 this, sync_point_manager_, task_runner_.get(), share_group, |
947 surface_handle, mailbox_manager_.get(), preempted_flag_.get(), | 947 surface_handle, mailbox_manager_.get(), preempted_flag_.get(), |
948 subscription_ref_set_.get(), pending_valuebuffer_state_.get(), size, | 948 subscription_ref_set_.get(), pending_valuebuffer_state_.get(), size, |
949 disallowed_features_, init_params.attribs, init_params.gpu_preference, | 949 disallowed_features_, init_params.attribs, init_params.gpu_preference, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 } | 990 } |
991 | 991 |
992 void GpuChannel::RemoveFilter(IPC::MessageFilter* filter) { | 992 void GpuChannel::RemoveFilter(IPC::MessageFilter* filter) { |
993 io_task_runner_->PostTask( | 993 io_task_runner_->PostTask( |
994 FROM_HERE, base::Bind(&GpuChannelMessageFilter::RemoveChannelFilter, | 994 FROM_HERE, base::Bind(&GpuChannelMessageFilter::RemoveChannelFilter, |
995 filter_, make_scoped_refptr(filter))); | 995 filter_, make_scoped_refptr(filter))); |
996 } | 996 } |
997 | 997 |
998 uint64_t GpuChannel::GetMemoryUsage() { | 998 uint64_t GpuChannel::GetMemoryUsage() { |
999 // Collect the unique memory trackers in use by the |stubs_|. | 999 // Collect the unique memory trackers in use by the |stubs_|. |
1000 std::set<gpu::gles2::MemoryTracker*> unique_memory_trackers; | 1000 std::set<gles2::MemoryTracker*> unique_memory_trackers; |
1001 for (auto& kv : stubs_) | 1001 for (auto& kv : stubs_) |
1002 unique_memory_trackers.insert(kv.second->GetMemoryTracker()); | 1002 unique_memory_trackers.insert(kv.second->GetMemoryTracker()); |
1003 | 1003 |
1004 // Sum the memory usage for all unique memory trackers. | 1004 // Sum the memory usage for all unique memory trackers. |
1005 uint64_t size = 0; | 1005 uint64_t size = 0; |
1006 for (auto* tracker : unique_memory_trackers) { | 1006 for (auto* tracker : unique_memory_trackers) { |
1007 size += gpu_channel_manager()->gpu_memory_manager()->GetTrackerMemoryUsage( | 1007 size += gpu_channel_manager()->gpu_memory_manager()->GetTrackerMemoryUsage( |
1008 tracker); | 1008 tracker); |
1009 } | 1009 } |
1010 | 1010 |
(...skipping 28 matching lines...) Expand all Loading... |
1039 ->CreateImageForGpuMemoryBuffer(handle, | 1039 ->CreateImageForGpuMemoryBuffer(handle, |
1040 size, | 1040 size, |
1041 format, | 1041 format, |
1042 internalformat, | 1042 internalformat, |
1043 client_id_); | 1043 client_id_); |
1044 } | 1044 } |
1045 } | 1045 } |
1046 } | 1046 } |
1047 | 1047 |
1048 void GpuChannel::HandleUpdateValueState( | 1048 void GpuChannel::HandleUpdateValueState( |
1049 unsigned int target, const gpu::ValueState& state) { | 1049 unsigned int target, const ValueState& state) { |
1050 pending_valuebuffer_state_->UpdateState(target, state); | 1050 pending_valuebuffer_state_->UpdateState(target, state); |
1051 } | 1051 } |
1052 | 1052 |
1053 } // namespace content | 1053 } // namespace gpu |
OLD | NEW |