OLD | NEW |
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 "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
9 #include "components/mus/gles2/command_buffer_local_client.h" | 9 #include "components/mus/gles2/command_buffer_local_client.h" |
10 #include "components/mus/gles2/gpu_memory_tracker.h" | 10 #include "components/mus/gles2/gpu_memory_tracker.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 command_buffer_.reset( | 84 command_buffer_.reset( |
85 new gpu::CommandBufferService(context_group->transfer_buffer_manager())); | 85 new gpu::CommandBufferService(context_group->transfer_buffer_manager())); |
86 bool result = command_buffer_->Initialize(); | 86 bool result = command_buffer_->Initialize(); |
87 DCHECK(result); | 87 DCHECK(result); |
88 | 88 |
89 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group.get())); | 89 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group.get())); |
90 scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(), decoder_.get(), | 90 scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(), decoder_.get(), |
91 decoder_.get())); | 91 decoder_.get())); |
92 decoder_->set_engine(scheduler_.get()); | 92 decoder_->set_engine(scheduler_.get()); |
93 decoder_->SetResizeCallback( | |
94 base::Bind(&CommandBufferLocal::OnResize, base::Unretained(this))); | |
95 decoder_->SetWaitSyncPointCallback( | 93 decoder_->SetWaitSyncPointCallback( |
96 base::Bind(&CommandBufferLocal::OnWaitSyncPoint, base::Unretained(this))); | 94 base::Bind(&CommandBufferLocal::OnWaitSyncPoint, base::Unretained(this))); |
97 decoder_->SetFenceSyncReleaseCallback(base::Bind( | 95 decoder_->SetFenceSyncReleaseCallback(base::Bind( |
98 &CommandBufferLocal::OnFenceSyncRelease, base::Unretained(this))); | 96 &CommandBufferLocal::OnFenceSyncRelease, base::Unretained(this))); |
99 decoder_->SetWaitFenceSyncCallback( | 97 decoder_->SetWaitFenceSyncCallback( |
100 base::Bind(&CommandBufferLocal::OnWaitFenceSync, base::Unretained(this))); | 98 base::Bind(&CommandBufferLocal::OnWaitFenceSync, base::Unretained(this))); |
101 | 99 |
102 gpu::gles2::DisallowedFeatures disallowed_features; | 100 gpu::gles2::DisallowedFeatures disallowed_features; |
103 | 101 |
104 // TODO(piman): attributes. | 102 // TODO(piman): attributes. |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 254 |
257 void CommandBufferLocal::PumpCommands() { | 255 void CommandBufferLocal::PumpCommands() { |
258 if (!decoder_->MakeCurrent()) { | 256 if (!decoder_->MakeCurrent()) { |
259 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason()); | 257 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason()); |
260 command_buffer_->SetParseError(::gpu::error::kLostContext); | 258 command_buffer_->SetParseError(::gpu::error::kLostContext); |
261 return; | 259 return; |
262 } | 260 } |
263 scheduler_->PutChanged(); | 261 scheduler_->PutChanged(); |
264 } | 262 } |
265 | 263 |
266 void CommandBufferLocal::OnResize(gfx::Size size, float scale_factor) { | |
267 surface_->Resize(size); | |
268 } | |
269 | |
270 void CommandBufferLocal::OnUpdateVSyncParameters( | 264 void CommandBufferLocal::OnUpdateVSyncParameters( |
271 const base::TimeTicks timebase, | 265 const base::TimeTicks timebase, |
272 const base::TimeDelta interval) { | 266 const base::TimeDelta interval) { |
273 if (client_) | 267 if (client_) |
274 client_->UpdateVSyncParameters(timebase.ToInternalValue(), | 268 client_->UpdateVSyncParameters(timebase.ToInternalValue(), |
275 interval.ToInternalValue()); | 269 interval.ToInternalValue()); |
276 } | 270 } |
277 | 271 |
278 bool CommandBufferLocal::OnWaitSyncPoint(uint32_t sync_point) { | 272 bool CommandBufferLocal::OnWaitSyncPoint(uint32_t sync_point) { |
279 if (!sync_point) | 273 if (!sync_point) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 void CommandBufferLocal::OnContextLost(uint32_t reason) { | 328 void CommandBufferLocal::OnContextLost(uint32_t reason) { |
335 if (client_) | 329 if (client_) |
336 client_->DidLoseContext(); | 330 client_->DidLoseContext(); |
337 } | 331 } |
338 | 332 |
339 void CommandBufferLocal::OnSyncPointRetired() { | 333 void CommandBufferLocal::OnSyncPointRetired() { |
340 scheduler_->SetScheduled(true); | 334 scheduler_->SetScheduled(true); |
341 } | 335 } |
342 | 336 |
343 } // namespace mus | 337 } // namespace mus |
OLD | NEW |