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

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

Issue 1845563005: Refactor content/common/gpu into gpu/ipc/service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Drop ref to deleted content_tests_gypi_values.content_unittests_ozone_sources 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
« no previous file with comments | « gpu/ipc/service/gpu_channel.h ('k') | gpu/ipc/service/gpu_channel_manager.h » ('j') | 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 "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
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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 OnCreateCommandBuffer) 760 OnCreateCommandBuffer)
761 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer, 761 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer,
762 OnDestroyCommandBuffer) 762 OnDestroyCommandBuffer)
763 IPC_MESSAGE_HANDLER(GpuChannelMsg_GetDriverBugWorkArounds, 763 IPC_MESSAGE_HANDLER(GpuChannelMsg_GetDriverBugWorkArounds,
764 OnGetDriverBugWorkArounds) 764 OnGetDriverBugWorkArounds)
765 IPC_MESSAGE_UNHANDLED(handled = false) 765 IPC_MESSAGE_UNHANDLED(handled = false)
766 IPC_END_MESSAGE_MAP() 766 IPC_END_MESSAGE_MAP()
767 return handled; 767 return handled;
768 } 768 }
769 769
770 scoped_refptr<gpu::SyncPointOrderData> GpuChannel::GetSyncPointOrderData( 770 scoped_refptr<SyncPointOrderData> GpuChannel::GetSyncPointOrderData(
771 int32_t stream_id) { 771 int32_t stream_id) {
772 auto it = streams_.find(stream_id); 772 auto it = streams_.find(stream_id);
773 DCHECK(it != streams_.end()); 773 DCHECK(it != streams_.end());
774 DCHECK(it->second); 774 DCHECK(it->second);
775 return it->second->GetSyncPointOrderData(); 775 return it->second->GetSyncPointOrderData();
776 } 776 }
777 777
778 void GpuChannel::PostHandleMessage( 778 void GpuChannel::PostHandleMessage(
779 const scoped_refptr<GpuChannelMessageQueue>& queue) { 779 const scoped_refptr<GpuChannelMessageQueue>& queue) {
780 task_runner_->PostTask(FROM_HERE, 780 task_runner_->PostTask(FROM_HERE,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 void GpuChannel::HandleOutOfOrderMessage(const IPC::Message& msg) { 839 void GpuChannel::HandleOutOfOrderMessage(const IPC::Message& msg) {
840 HandleMessageHelper(msg); 840 HandleMessageHelper(msg);
841 } 841 }
842 842
843 void GpuChannel::HandleMessageForTesting(const IPC::Message& msg) { 843 void GpuChannel::HandleMessageForTesting(const IPC::Message& msg) {
844 HandleMessageHelper(msg); 844 HandleMessageHelper(msg);
845 } 845 }
846 846
847 scoped_refptr<GpuChannelMessageQueue> GpuChannel::CreateStream( 847 scoped_refptr<GpuChannelMessageQueue> GpuChannel::CreateStream(
848 int32_t stream_id, 848 int32_t stream_id,
849 gpu::GpuStreamPriority stream_priority) { 849 GpuStreamPriority stream_priority) {
850 DCHECK(streams_.find(stream_id) == streams_.end()); 850 DCHECK(streams_.find(stream_id) == streams_.end());
851 scoped_refptr<GpuChannelMessageQueue> queue = GpuChannelMessageQueue::Create( 851 scoped_refptr<GpuChannelMessageQueue> queue = GpuChannelMessageQueue::Create(
852 stream_id, stream_priority, this, io_task_runner_, 852 stream_id, stream_priority, this, io_task_runner_,
853 (stream_id == gpu::GPU_STREAM_DEFAULT) ? preempting_flag_ : nullptr, 853 (stream_id == GPU_STREAM_DEFAULT) ? preempting_flag_ : nullptr,
854 preempted_flag_, sync_point_manager_); 854 preempted_flag_, sync_point_manager_);
855 streams_.insert(std::make_pair(stream_id, queue)); 855 streams_.insert(std::make_pair(stream_id, queue));
856 streams_to_num_routes_.insert(std::make_pair(stream_id, 0)); 856 streams_to_num_routes_.insert(std::make_pair(stream_id, 0));
857 return queue; 857 return queue;
858 } 858 }
859 859
860 scoped_refptr<GpuChannelMessageQueue> GpuChannel::LookupStream( 860 scoped_refptr<GpuChannelMessageQueue> GpuChannel::LookupStream(
861 int32_t stream_id) { 861 int32_t stream_id) {
862 auto stream_it = streams_.find(stream_id); 862 auto stream_it = streams_.find(stream_id);
863 if (stream_it != streams_.end()) 863 if (stream_it != streams_.end())
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 for (const auto& kv : stubs_) { 898 for (const auto& kv : stubs_) {
899 const GpuCommandBufferStub* stub = kv.second; 899 const GpuCommandBufferStub* stub = kv.second;
900 if (stub->decoder() && !stub->decoder()->WasContextLost()) 900 if (stub->decoder() && !stub->decoder()->WasContextLost())
901 return stub; 901 return stub;
902 } 902 }
903 return nullptr; 903 return nullptr;
904 } 904 }
905 #endif 905 #endif
906 906
907 void GpuChannel::OnCreateCommandBuffer( 907 void GpuChannel::OnCreateCommandBuffer(
908 gpu::SurfaceHandle surface_handle, 908 SurfaceHandle surface_handle,
909 const gfx::Size& size, 909 const gfx::Size& size,
910 const GPUCreateCommandBufferConfig& init_params, 910 const GPUCreateCommandBufferConfig& init_params,
911 int32_t route_id, 911 int32_t route_id,
912 bool* succeeded) { 912 bool* succeeded) {
913 TRACE_EVENT2("gpu", "GpuChannel::OnCreateCommandBuffer", "route_id", route_id, 913 TRACE_EVENT2("gpu", "GpuChannel::OnCreateCommandBuffer", "route_id", route_id,
914 "offscreen", (surface_handle == gpu::kNullSurfaceHandle)); 914 "offscreen", (surface_handle == kNullSurfaceHandle));
915 *succeeded = false; 915 *succeeded = false;
916 if (surface_handle != gpu::kNullSurfaceHandle && 916 if (surface_handle != kNullSurfaceHandle &&
917 !allow_view_command_buffers_) { 917 !allow_view_command_buffers_) {
918 DLOG(ERROR) << "GpuChannel::CreateCommandBuffer(): attempt to create a " 918 DLOG(ERROR) << "GpuChannel::CreateCommandBuffer(): attempt to create a "
919 "view context on a non-priviledged channel"; 919 "view context on a non-priviledged channel";
920 return; 920 return;
921 } 921 }
922 922
923 int32_t share_group_id = init_params.share_group_id; 923 int32_t share_group_id = init_params.share_group_id;
924 GpuCommandBufferStub* share_group = stubs_.get(share_group_id); 924 GpuCommandBufferStub* share_group = stubs_.get(share_group_id);
925 925
926 if (!share_group && share_group_id != MSG_ROUTING_NONE) { 926 if (!share_group && share_group_id != MSG_ROUTING_NONE) {
927 DLOG(ERROR) 927 DLOG(ERROR)
928 << "GpuChannel::OnCreateCommandBuffer(): invalid share group id"; 928 << "GpuChannel::OnCreateCommandBuffer(): invalid share group id";
929 return; 929 return;
930 } 930 }
931 931
932 int32_t stream_id = init_params.stream_id; 932 int32_t stream_id = init_params.stream_id;
933 if (share_group && stream_id != share_group->stream_id()) { 933 if (share_group && stream_id != share_group->stream_id()) {
934 DLOG(ERROR) << "GpuChannel::OnCreateCommandBuffer(): stream id does not " 934 DLOG(ERROR) << "GpuChannel::OnCreateCommandBuffer(): stream id does not "
935 "match share group stream id"; 935 "match share group stream id";
936 return; 936 return;
937 } 937 }
938 938
939 gpu::GpuStreamPriority stream_priority = init_params.stream_priority; 939 GpuStreamPriority stream_priority = init_params.stream_priority;
940 if (!allow_real_time_streams_ && 940 if (!allow_real_time_streams_ &&
941 stream_priority == gpu::GpuStreamPriority::REAL_TIME) { 941 stream_priority == GpuStreamPriority::REAL_TIME) {
942 DLOG(ERROR) << "GpuChannel::OnCreateCommandBuffer(): real time stream " 942 DLOG(ERROR) << "GpuChannel::OnCreateCommandBuffer(): real time stream "
943 "priority not allowed"; 943 "priority not allowed";
944 return; 944 return;
945 } 945 }
946 946
947 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( 947 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub(
948 this, sync_point_manager_, task_runner_.get(), share_group, 948 this, sync_point_manager_, task_runner_.get(), share_group,
949 surface_handle, mailbox_manager_.get(), preempted_flag_.get(), 949 surface_handle, mailbox_manager_.get(), preempted_flag_.get(),
950 subscription_ref_set_.get(), pending_valuebuffer_state_.get(), size, 950 subscription_ref_set_.get(), pending_valuebuffer_state_.get(), size,
951 disallowed_features_, init_params.attribs, init_params.gpu_preference, 951 disallowed_features_, init_params.attribs, init_params.gpu_preference,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 } 1009 }
1010 1010
1011 void GpuChannel::RemoveFilter(IPC::MessageFilter* filter) { 1011 void GpuChannel::RemoveFilter(IPC::MessageFilter* filter) {
1012 io_task_runner_->PostTask( 1012 io_task_runner_->PostTask(
1013 FROM_HERE, base::Bind(&GpuChannelMessageFilter::RemoveChannelFilter, 1013 FROM_HERE, base::Bind(&GpuChannelMessageFilter::RemoveChannelFilter,
1014 filter_, make_scoped_refptr(filter))); 1014 filter_, make_scoped_refptr(filter)));
1015 } 1015 }
1016 1016
1017 uint64_t GpuChannel::GetMemoryUsage() { 1017 uint64_t GpuChannel::GetMemoryUsage() {
1018 // Collect the unique memory trackers in use by the |stubs_|. 1018 // Collect the unique memory trackers in use by the |stubs_|.
1019 std::set<gpu::gles2::MemoryTracker*> unique_memory_trackers; 1019 std::set<gles2::MemoryTracker*> unique_memory_trackers;
1020 for (auto& kv : stubs_) 1020 for (auto& kv : stubs_)
1021 unique_memory_trackers.insert(kv.second->GetMemoryTracker()); 1021 unique_memory_trackers.insert(kv.second->GetMemoryTracker());
1022 1022
1023 // Sum the memory usage for all unique memory trackers. 1023 // Sum the memory usage for all unique memory trackers.
1024 uint64_t size = 0; 1024 uint64_t size = 0;
1025 for (auto* tracker : unique_memory_trackers) { 1025 for (auto* tracker : unique_memory_trackers) {
1026 size += gpu_channel_manager()->gpu_memory_manager()->GetTrackerMemoryUsage( 1026 size += gpu_channel_manager()->gpu_memory_manager()->GetTrackerMemoryUsage(
1027 tracker); 1027 tracker);
1028 } 1028 }
1029 1029
(...skipping 28 matching lines...) Expand all
1058 ->CreateImageForGpuMemoryBuffer(handle, 1058 ->CreateImageForGpuMemoryBuffer(handle,
1059 size, 1059 size,
1060 format, 1060 format,
1061 internalformat, 1061 internalformat,
1062 client_id_); 1062 client_id_);
1063 } 1063 }
1064 } 1064 }
1065 } 1065 }
1066 1066
1067 void GpuChannel::HandleUpdateValueState( 1067 void GpuChannel::HandleUpdateValueState(
1068 unsigned int target, const gpu::ValueState& state) { 1068 unsigned int target, const ValueState& state) {
1069 pending_valuebuffer_state_->UpdateState(target, state); 1069 pending_valuebuffer_state_->UpdateState(target, state);
1070 } 1070 }
1071 1071
1072 } // namespace content 1072 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/service/gpu_channel.h ('k') | gpu/ipc/service/gpu_channel_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698