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 "gpu/ipc/client/gpu_channel_host.h" | 5 #include "gpu/ipc/client/gpu_channel_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/atomic_sequence_num.h" | 10 #include "base/atomic_sequence_num.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 bool result = sync_filter_->Send(message.release()); | 127 bool result = sync_filter_->Send(message.release()); |
128 return result; | 128 return result; |
129 } | 129 } |
130 | 130 |
131 uint32_t GpuChannelHost::OrderingBarrier( | 131 uint32_t GpuChannelHost::OrderingBarrier( |
132 int32_t route_id, | 132 int32_t route_id, |
133 int32_t stream_id, | 133 int32_t stream_id, |
134 int32_t put_offset, | 134 int32_t put_offset, |
135 uint32_t flush_count, | 135 uint32_t flush_count, |
136 const std::vector<ui::LatencyInfo>& latency_info, | 136 const std::vector<ui::LatencyInfo>& latency_info, |
| 137 const std::vector<SyncToken>& sync_token_fences, |
137 bool put_offset_changed, | 138 bool put_offset_changed, |
138 bool do_flush, | 139 bool do_flush, |
139 uint32_t* highest_verified_flush_id) { | 140 uint32_t* highest_verified_flush_id) { |
140 AutoLock lock(context_lock_); | 141 AutoLock lock(context_lock_); |
141 StreamFlushInfo& flush_info = stream_flush_info_[stream_id]; | 142 StreamFlushInfo& flush_info = stream_flush_info_[stream_id]; |
142 if (flush_info.flush_pending && flush_info.route_id != route_id) | 143 if (flush_info.flush_pending && flush_info.route_id != route_id) |
143 InternalFlush(&flush_info); | 144 InternalFlush(&flush_info); |
144 | 145 |
145 *highest_verified_flush_id = flush_info.verified_stream_flush_id; | 146 *highest_verified_flush_id = flush_info.verified_stream_flush_id; |
146 | 147 |
147 if (put_offset_changed) { | 148 if (put_offset_changed) { |
148 const uint32_t flush_id = flush_info.next_stream_flush_id++; | 149 const uint32_t flush_id = flush_info.next_stream_flush_id++; |
149 flush_info.flush_pending = true; | 150 flush_info.flush_pending = true; |
150 flush_info.route_id = route_id; | 151 flush_info.route_id = route_id; |
151 flush_info.put_offset = put_offset; | 152 flush_info.put_offset = put_offset; |
152 flush_info.flush_count = flush_count; | 153 flush_info.flush_count = flush_count; |
153 flush_info.flush_id = flush_id; | 154 flush_info.flush_id = flush_id; |
154 flush_info.latency_info.insert(flush_info.latency_info.end(), | 155 flush_info.latency_info.insert(flush_info.latency_info.end(), |
155 latency_info.begin(), latency_info.end()); | 156 latency_info.begin(), latency_info.end()); |
| 157 flush_info.sync_token_fences.insert(flush_info.sync_token_fences.end(), |
| 158 sync_token_fences.begin(), |
| 159 sync_token_fences.end()); |
156 | 160 |
157 if (do_flush) | 161 if (do_flush) |
158 InternalFlush(&flush_info); | 162 InternalFlush(&flush_info); |
159 | 163 |
160 return flush_id; | 164 return flush_id; |
161 } | 165 } |
162 return 0; | 166 return 0; |
163 } | 167 } |
164 | 168 |
165 void GpuChannelHost::FlushPendingStream(int32_t stream_id) { | 169 void GpuChannelHost::FlushPendingStream(int32_t stream_id) { |
166 AutoLock lock(context_lock_); | 170 AutoLock lock(context_lock_); |
167 auto flush_info_iter = stream_flush_info_.find(stream_id); | 171 auto flush_info_iter = stream_flush_info_.find(stream_id); |
168 if (flush_info_iter == stream_flush_info_.end()) | 172 if (flush_info_iter == stream_flush_info_.end()) |
169 return; | 173 return; |
170 | 174 |
171 StreamFlushInfo& flush_info = flush_info_iter->second; | 175 StreamFlushInfo& flush_info = flush_info_iter->second; |
172 if (flush_info.flush_pending) | 176 if (flush_info.flush_pending) |
173 InternalFlush(&flush_info); | 177 InternalFlush(&flush_info); |
174 } | 178 } |
175 | 179 |
176 void GpuChannelHost::InternalFlush(StreamFlushInfo* flush_info) { | 180 void GpuChannelHost::InternalFlush(StreamFlushInfo* flush_info) { |
177 context_lock_.AssertAcquired(); | 181 context_lock_.AssertAcquired(); |
178 DCHECK(flush_info); | 182 DCHECK(flush_info); |
179 DCHECK(flush_info->flush_pending); | 183 DCHECK(flush_info->flush_pending); |
180 DCHECK_LT(flush_info->flushed_stream_flush_id, flush_info->flush_id); | 184 DCHECK_LT(flush_info->flushed_stream_flush_id, flush_info->flush_id); |
181 Send(new GpuCommandBufferMsg_AsyncFlush( | 185 Send(new GpuCommandBufferMsg_AsyncFlush( |
182 flush_info->route_id, flush_info->put_offset, flush_info->flush_count, | 186 flush_info->route_id, flush_info->put_offset, flush_info->flush_count, |
183 flush_info->latency_info)); | 187 flush_info->latency_info, flush_info->sync_token_fences)); |
184 flush_info->latency_info.clear(); | 188 flush_info->latency_info.clear(); |
| 189 flush_info->sync_token_fences.clear(); |
185 flush_info->flush_pending = false; | 190 flush_info->flush_pending = false; |
186 | 191 |
187 flush_info->flushed_stream_flush_id = flush_info->flush_id; | 192 flush_info->flushed_stream_flush_id = flush_info->flush_id; |
188 } | 193 } |
189 | 194 |
190 void GpuChannelHost::DestroyChannel() { | 195 void GpuChannelHost::DestroyChannel() { |
191 DCHECK(factory_->IsMainThread()); | 196 DCHECK(factory_->IsMainThread()); |
192 AutoLock lock(context_lock_); | 197 AutoLock lock(context_lock_); |
193 channel_.reset(); | 198 channel_.reset(); |
194 } | 199 } |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 381 |
377 listeners_.clear(); | 382 listeners_.clear(); |
378 } | 383 } |
379 | 384 |
380 bool GpuChannelHost::MessageFilter::IsLost() const { | 385 bool GpuChannelHost::MessageFilter::IsLost() const { |
381 AutoLock lock(lock_); | 386 AutoLock lock(lock_); |
382 return lost_; | 387 return lost_; |
383 } | 388 } |
384 | 389 |
385 } // namespace gpu | 390 } // namespace gpu |
OLD | NEW |