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

Side by Side Diff: content/common/gpu/client/gpu_channel_host.cc

Issue 896723008: Add OrderingBarrierCHROMIUM API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed nits. Created 5 years, 10 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 | « content/common/gpu/client/gpu_channel_host.h ('k') | gpu/GLES2/gl2chromium_autogen.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/client/gpu_channel_host.h" 5 #include "content/common/gpu/client/gpu_channel_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 12 matching lines...) Expand all
23 23
24 using base::AutoLock; 24 using base::AutoLock;
25 using base::MessageLoopProxy; 25 using base::MessageLoopProxy;
26 26
27 namespace content { 27 namespace content {
28 28
29 GpuListenerInfo::GpuListenerInfo() {} 29 GpuListenerInfo::GpuListenerInfo() {}
30 30
31 GpuListenerInfo::~GpuListenerInfo() {} 31 GpuListenerInfo::~GpuListenerInfo() {}
32 32
33 ProxyFlushInfo::ProxyFlushInfo()
34 : flush_pending(false),
35 route_id(MSG_ROUTING_NONE),
36 put_offset(0),
37 flush_count(0) {
38 }
39
40 ProxyFlushInfo::~ProxyFlushInfo() {
41 }
42
33 // static 43 // static
34 scoped_refptr<GpuChannelHost> GpuChannelHost::Create( 44 scoped_refptr<GpuChannelHost> GpuChannelHost::Create(
35 GpuChannelHostFactory* factory, 45 GpuChannelHostFactory* factory,
36 const gpu::GPUInfo& gpu_info, 46 const gpu::GPUInfo& gpu_info,
37 const IPC::ChannelHandle& channel_handle, 47 const IPC::ChannelHandle& channel_handle,
38 base::WaitableEvent* shutdown_event, 48 base::WaitableEvent* shutdown_event,
39 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) { 49 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) {
40 DCHECK(factory->IsMainThread()); 50 DCHECK(factory->IsMainThread());
41 scoped_refptr<GpuChannelHost> host = 51 scoped_refptr<GpuChannelHost> host =
42 new GpuChannelHost(factory, gpu_info, gpu_memory_buffer_manager); 52 new GpuChannelHost(factory, gpu_info, gpu_memory_buffer_manager);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } else if (base::MessageLoop::current()) { 115 } else if (base::MessageLoop::current()) {
106 bool result = sync_filter_->Send(message.release()); 116 bool result = sync_filter_->Send(message.release());
107 if (!result) 117 if (!result)
108 DVLOG(1) << "GpuChannelHost::Send failed: SyncMessageFilter::Send failed"; 118 DVLOG(1) << "GpuChannelHost::Send failed: SyncMessageFilter::Send failed";
109 return result; 119 return result;
110 } 120 }
111 121
112 return false; 122 return false;
113 } 123 }
114 124
125 void GpuChannelHost::OrderingBarrier(
126 int route_id,
127 int32 put_offset,
128 unsigned int flush_count,
129 const std::vector<ui::LatencyInfo>& latency_info,
130 bool put_offset_changed,
131 bool do_flush) {
132 AutoLock lock(context_lock_);
133 if (flush_info_.flush_pending && flush_info_.route_id != route_id)
134 InternalFlush();
135
136 if (put_offset_changed) {
137 flush_info_.flush_pending = true;
138 flush_info_.route_id = route_id;
139 flush_info_.put_offset = put_offset;
140 flush_info_.flush_count = flush_count;
141 flush_info_.latency_info.insert(flush_info_.latency_info.end(),
142 latency_info.begin(), latency_info.end());
143
144 if (do_flush)
145 InternalFlush();
146 }
147 }
148
149 void GpuChannelHost::InternalFlush() {
150 DCHECK(flush_info_.flush_pending);
151 Send(new GpuCommandBufferMsg_AsyncFlush(
152 flush_info_.route_id, flush_info_.put_offset, flush_info_.flush_count,
153 flush_info_.latency_info));
154 flush_info_.latency_info.clear();
155 flush_info_.flush_pending = false;
156 }
157
115 CommandBufferProxyImpl* GpuChannelHost::CreateViewCommandBuffer( 158 CommandBufferProxyImpl* GpuChannelHost::CreateViewCommandBuffer(
116 int32 surface_id, 159 int32 surface_id,
117 CommandBufferProxyImpl* share_group, 160 CommandBufferProxyImpl* share_group,
118 const std::vector<int32>& attribs, 161 const std::vector<int32>& attribs,
119 const GURL& active_url, 162 const GURL& active_url,
120 gfx::GpuPreference gpu_preference) { 163 gfx::GpuPreference gpu_preference) {
121 TRACE_EVENT1("gpu", 164 TRACE_EVENT1("gpu",
122 "GpuChannelHost::CreateViewCommandBuffer", 165 "GpuChannelHost::CreateViewCommandBuffer",
123 "surface_id", 166 "surface_id",
124 surface_id); 167 surface_id);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 TRACE_EVENT0("gpu", "GpuChannelHost::CreateOffscreenCommandBuffer"); 214 TRACE_EVENT0("gpu", "GpuChannelHost::CreateOffscreenCommandBuffer");
172 215
173 GPUCreateCommandBufferConfig init_params; 216 GPUCreateCommandBufferConfig init_params;
174 init_params.share_group_id = 217 init_params.share_group_id =
175 share_group ? share_group->GetRouteID() : MSG_ROUTING_NONE; 218 share_group ? share_group->GetRouteID() : MSG_ROUTING_NONE;
176 init_params.attribs = attribs; 219 init_params.attribs = attribs;
177 init_params.active_url = active_url; 220 init_params.active_url = active_url;
178 init_params.gpu_preference = gpu_preference; 221 init_params.gpu_preference = gpu_preference;
179 int32 route_id = GenerateRouteID(); 222 int32 route_id = GenerateRouteID();
180 bool succeeded = false; 223 bool succeeded = false;
181 if (!Send(new GpuChannelMsg_CreateOffscreenCommandBuffer(size, 224 if (!Send(new GpuChannelMsg_CreateOffscreenCommandBuffer(
182 init_params, 225 size, init_params, route_id, &succeeded))) {
183 route_id,
184 &succeeded))) {
185 LOG(ERROR) << "Failed to send GpuChannelMsg_CreateOffscreenCommandBuffer."; 226 LOG(ERROR) << "Failed to send GpuChannelMsg_CreateOffscreenCommandBuffer.";
186 return NULL; 227 return NULL;
187 } 228 }
188 229
189 if (!succeeded) { 230 if (!succeeded) {
190 LOG(ERROR) 231 LOG(ERROR)
191 << "GpuChannelMsg_CreateOffscreenCommandBuffer returned failure."; 232 << "GpuChannelMsg_CreateOffscreenCommandBuffer returned failure.";
192 return NULL; 233 return NULL;
193 } 234 }
194 235
(...skipping 27 matching lines...) Expand all
222 void GpuChannelHost::DestroyCommandBuffer( 263 void GpuChannelHost::DestroyCommandBuffer(
223 CommandBufferProxyImpl* command_buffer) { 264 CommandBufferProxyImpl* command_buffer) {
224 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer"); 265 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer");
225 266
226 int route_id = command_buffer->GetRouteID(); 267 int route_id = command_buffer->GetRouteID();
227 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); 268 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id));
228 RemoveRoute(route_id); 269 RemoveRoute(route_id);
229 270
230 AutoLock lock(context_lock_); 271 AutoLock lock(context_lock_);
231 proxies_.erase(route_id); 272 proxies_.erase(route_id);
273 if (flush_info_.flush_pending && flush_info_.route_id == route_id)
274 flush_info_.flush_pending = false;
275
232 delete command_buffer; 276 delete command_buffer;
233 } 277 }
234 278
235 void GpuChannelHost::DestroyChannel() { 279 void GpuChannelHost::DestroyChannel() {
236 // channel_ must be destroyed on the main thread. 280 // channel_ must be destroyed on the main thread.
237 if (channel_.get() && !factory_->IsMainThread()) 281 if (channel_.get() && !factory_->IsMainThread())
238 factory_->GetMainLoop()->DeleteSoon(FROM_HERE, channel_.release()); 282 factory_->GetMainLoop()->DeleteSoon(FROM_HERE, channel_.release());
239 channel_.reset(); 283 channel_.reset();
240 } 284 }
241 285
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 430
387 listeners_.clear(); 431 listeners_.clear();
388 } 432 }
389 433
390 bool GpuChannelHost::MessageFilter::IsLost() const { 434 bool GpuChannelHost::MessageFilter::IsLost() const {
391 AutoLock lock(lock_); 435 AutoLock lock(lock_);
392 return lost_; 436 return lost_;
393 } 437 }
394 438
395 } // namespace content 439 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/gpu_channel_host.h ('k') | gpu/GLES2/gl2chromium_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698