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

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

Issue 1331843005: Implemented new fence syncs which replaces the old sync points. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Forgot to remove cmd buffer helper functios and replace with gpu control ones Created 5 years, 2 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_local.h" 5 #include "components/mus/gles2/command_buffer_local.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "components/mus/gles2/command_buffer_local_client.h" 8 #include "components/mus/gles2/command_buffer_local_client.h"
9 #include "components/mus/gles2/gpu_memory_tracker.h" 9 #include "components/mus/gles2/gpu_memory_tracker.h"
10 #include "components/mus/gles2/mojo_gpu_memory_buffer.h" 10 #include "components/mus/gles2/mojo_gpu_memory_buffer.h"
(...skipping 14 matching lines...) Expand all
25 namespace mus { 25 namespace mus {
26 26
27 const unsigned int GL_MAP_CHROMIUM = 0x78F1; 27 const unsigned int GL_MAP_CHROMIUM = 0x78F1;
28 28
29 CommandBufferLocal::CommandBufferLocal(CommandBufferLocalClient* client, 29 CommandBufferLocal::CommandBufferLocal(CommandBufferLocalClient* client,
30 gfx::AcceleratedWidget widget, 30 gfx::AcceleratedWidget widget,
31 const scoped_refptr<GpuState>& gpu_state) 31 const scoped_refptr<GpuState>& gpu_state)
32 : widget_(widget), 32 : widget_(widget),
33 gpu_state_(gpu_state), 33 gpu_state_(gpu_state),
34 client_(client), 34 client_(client),
35 next_fence_sync_release_(1),
35 weak_factory_(this) {} 36 weak_factory_(this) {}
36 37
37 CommandBufferLocal::~CommandBufferLocal() { 38 CommandBufferLocal::~CommandBufferLocal() {
38 command_buffer_.reset(); 39 command_buffer_.reset();
39 if (decoder_.get()) { 40 if (decoder_.get()) {
40 bool have_context = decoder_->GetGLContext()->MakeCurrent(surface_.get()); 41 bool have_context = decoder_->GetGLContext()->MakeCurrent(surface_.get());
41 decoder_->Destroy(have_context); 42 decoder_->Destroy(have_context);
42 decoder_.reset(); 43 decoder_.reset();
43 } 44 }
44 } 45 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 gpu::CommandBufferNamespace CommandBufferLocal::GetNamespaceID() const { 214 gpu::CommandBufferNamespace CommandBufferLocal::GetNamespaceID() const {
214 NOTIMPLEMENTED(); 215 NOTIMPLEMENTED();
215 return gpu::CommandBufferNamespace::INVALID; 216 return gpu::CommandBufferNamespace::INVALID;
216 } 217 }
217 218
218 uint64_t CommandBufferLocal::GetCommandBufferID() const { 219 uint64_t CommandBufferLocal::GetCommandBufferID() const {
219 NOTIMPLEMENTED(); 220 NOTIMPLEMENTED();
220 return 0; 221 return 0;
221 } 222 }
222 223
224 uint32_t CommandBufferLocal::GenerateFenceSyncRelease() {
225 return next_fence_sync_release_++;
226 }
227
228 bool CommandBufferLocal::IsFenceSyncRelease(uint32_t release) {
229 return release > 0 && release < next_fence_sync_release_;
230 }
231
232 bool CommandBufferLocal::IsFenceSyncFlushed(uint32_t release) {
233 return IsFenceSyncRelease(release);
234 }
235
223 void CommandBufferLocal::PumpCommands() { 236 void CommandBufferLocal::PumpCommands() {
224 if (!decoder_->MakeCurrent()) { 237 if (!decoder_->MakeCurrent()) {
225 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason()); 238 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason());
226 command_buffer_->SetParseError(::gpu::error::kLostContext); 239 command_buffer_->SetParseError(::gpu::error::kLostContext);
227 return; 240 return;
228 } 241 }
229 scheduler_->PutChanged(); 242 scheduler_->PutChanged();
230 } 243 }
231 244
232 void CommandBufferLocal::OnResize(gfx::Size size, float scale_factor) { 245 void CommandBufferLocal::OnResize(gfx::Size size, float scale_factor) {
(...skipping 28 matching lines...) Expand all
261 void CommandBufferLocal::OnContextLost(uint32_t reason) { 274 void CommandBufferLocal::OnContextLost(uint32_t reason) {
262 if (client_) 275 if (client_)
263 client_->DidLoseContext(); 276 client_->DidLoseContext();
264 } 277 }
265 278
266 void CommandBufferLocal::OnSyncPointRetired() { 279 void CommandBufferLocal::OnSyncPointRetired() {
267 scheduler_->SetScheduled(true); 280 scheduler_->SetScheduled(true);
268 } 281 }
269 282
270 } // namespace mus 283 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698