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

Side by Side Diff: components/mus/gles2/command_buffer_impl.cc

Issue 1460833002: gpu: Implement the new fence syncs in mojo command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 5 years 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 | « components/mus/gles2/command_buffer_impl.h ('k') | components/mus/gles2/command_buffer_local.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/mus/gles2/command_buffer_impl.h" 5 #include "components/mus/gles2/command_buffer_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "components/mus/gles2/command_buffer_driver.h" 9 #include "components/mus/gles2/command_buffer_driver.h"
10 #include "components/mus/gles2/command_buffer_impl_observer.h" 10 #include "components/mus/gles2/command_buffer_impl_observer.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 78
79 void CommandBufferImpl::SetGetBuffer(int32_t buffer) { 79 void CommandBufferImpl::SetGetBuffer(int32_t buffer) {
80 gpu_state_->command_buffer_task_runner()->PostTask( 80 gpu_state_->command_buffer_task_runner()->PostTask(
81 driver_.get(), 81 driver_.get(),
82 base::Bind(&CommandBufferImpl::SetGetBufferHelper, 82 base::Bind(&CommandBufferImpl::SetGetBufferHelper,
83 base::Unretained(this), buffer)); 83 base::Unretained(this), buffer));
84 } 84 }
85 85
86 void CommandBufferImpl::Flush(int32_t put_offset) { 86 void CommandBufferImpl::Flush(int32_t put_offset) {
87 gpu::SyncPointManager* sync_point_manager = gpu_state_->sync_point_manager();
88 const uint32_t order_num = driver_->sync_point_order_data()
89 ->GenerateUnprocessedOrderNumber(sync_point_manager);
87 gpu_state_->command_buffer_task_runner()->PostTask( 90 gpu_state_->command_buffer_task_runner()->PostTask(
88 driver_.get(), 91 driver_.get(),
89 base::Bind(&CommandBufferImpl::FlushHelper, 92 base::Bind(&CommandBufferImpl::FlushHelper,
90 base::Unretained(this), put_offset)); 93 base::Unretained(this), put_offset, order_num));
91 } 94 }
92 95
93 void CommandBufferImpl::MakeProgress(int32_t last_get_offset) { 96 void CommandBufferImpl::MakeProgress(int32_t last_get_offset) {
94 gpu_state_->command_buffer_task_runner()->PostTask( 97 gpu_state_->command_buffer_task_runner()->PostTask(
95 driver_.get(), 98 driver_.get(),
96 base::Bind(&CommandBufferImpl::MakeProgressHelper, 99 base::Bind(&CommandBufferImpl::MakeProgressHelper,
97 base::Unretained(this), last_get_offset)); 100 base::Unretained(this), last_get_offset));
98 } 101 }
99 102
100 void CommandBufferImpl::RegisterTransferBuffer( 103 void CommandBufferImpl::RegisterTransferBuffer(
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 attribs.Pass()); 187 attribs.Pass());
185 return true; 188 return true;
186 } 189 }
187 190
188 bool CommandBufferImpl::SetGetBufferHelper(int32_t buffer) { 191 bool CommandBufferImpl::SetGetBufferHelper(int32_t buffer) {
189 DCHECK(driver_->IsScheduled()); 192 DCHECK(driver_->IsScheduled());
190 driver_->SetGetBuffer(buffer); 193 driver_->SetGetBuffer(buffer);
191 return true; 194 return true;
192 } 195 }
193 196
194 bool CommandBufferImpl::FlushHelper(int32_t put_offset) { 197 bool CommandBufferImpl::FlushHelper(int32_t put_offset,
198 uint32_t order_num) {
195 DCHECK(driver_->IsScheduled()); 199 DCHECK(driver_->IsScheduled());
200 driver_->sync_point_order_data()->BeginProcessingOrderNumber(order_num);
196 driver_->Flush(put_offset); 201 driver_->Flush(put_offset);
197 202
198 // Return false if the Flush is not finished, so the CommandBufferTaskRunner 203 // Return false if the Flush is not finished, so the CommandBufferTaskRunner
199 // will not remove this task from the task queue. 204 // will not remove this task from the task queue.
200 return !driver_->HasUnprocessedCommands(); 205 const bool complete = !driver_->HasUnprocessedCommands();
206 if (complete)
207 driver_->sync_point_order_data()->FinishProcessingOrderNumber(order_num);
208 return complete;
201 } 209 }
202 210
203 bool CommandBufferImpl::MakeProgressHelper(int32_t last_get_offset) { 211 bool CommandBufferImpl::MakeProgressHelper(int32_t last_get_offset) {
204 DCHECK(driver_->IsScheduled()); 212 DCHECK(driver_->IsScheduled());
205 driver_->MakeProgress(last_get_offset); 213 driver_->MakeProgress(last_get_offset);
206 return true; 214 return true;
207 } 215 }
208 216
209 bool CommandBufferImpl::RegisterTransferBufferHelper( 217 bool CommandBufferImpl::RegisterTransferBufferHelper(
210 int32_t id, 218 int32_t id,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 driver_.get(), 279 driver_.get(),
272 base::Bind(&CommandBufferImpl::DeleteHelper, base::Unretained(this))); 280 base::Bind(&CommandBufferImpl::DeleteHelper, base::Unretained(this)));
273 } 281 }
274 282
275 bool CommandBufferImpl::DeleteHelper() { 283 bool CommandBufferImpl::DeleteHelper() {
276 delete this; 284 delete this;
277 return true; 285 return true;
278 } 286 }
279 287
280 } // namespace mus 288 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/gles2/command_buffer_impl.h ('k') | components/mus/gles2/command_buffer_local.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698