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/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 DCHECK(CalledOnValidThread()); | 226 DCHECK(CalledOnValidThread()); |
227 return capabilities_; | 227 return capabilities_; |
228 } | 228 } |
229 | 229 |
230 int32_t CommandBufferLocal::CreateImage(ClientBuffer buffer, | 230 int32_t CommandBufferLocal::CreateImage(ClientBuffer buffer, |
231 size_t width, | 231 size_t width, |
232 size_t height, | 232 size_t height, |
233 unsigned internal_format) { | 233 unsigned internal_format) { |
234 DCHECK(CalledOnValidThread()); | 234 DCHECK(CalledOnValidThread()); |
235 int32_t new_id = ++next_image_id_; | 235 int32_t new_id = ++next_image_id_; |
236 mojo::SizePtr size = mojo::Size::New(); | 236 gfx::Size size(static_cast<int32_t>(width), static_cast<int32_t>(height)); |
237 size->width = static_cast<int32_t>(width); | |
238 size->height = static_cast<int32_t>(height); | |
239 | 237 |
240 mus::MojoGpuMemoryBufferImpl* gpu_memory_buffer = | 238 mus::MojoGpuMemoryBufferImpl* gpu_memory_buffer = |
241 mus::MojoGpuMemoryBufferImpl::FromClientBuffer(buffer); | 239 mus::MojoGpuMemoryBufferImpl::FromClientBuffer(buffer); |
242 | 240 |
243 bool requires_sync_point = false; | 241 bool requires_sync_point = false; |
244 | 242 |
245 if (gpu_memory_buffer->GetBufferType() == gfx::SHARED_MEMORY_BUFFER) { | 243 if (gpu_memory_buffer->GetBufferType() == gfx::SHARED_MEMORY_BUFFER) { |
246 gfx::GpuMemoryBufferHandle handle = gpu_memory_buffer->GetHandle(); | 244 gfx::GpuMemoryBufferHandle handle = gpu_memory_buffer->GetHandle(); |
247 // TODO(rjkroege): Verify that this is required and update appropriately. | 245 // TODO(rjkroege): Verify that this is required and update appropriately. |
248 base::SharedMemoryHandle dupd_handle = | 246 base::SharedMemoryHandle dupd_handle = |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 bool CommandBufferLocal::DestroyTransferBufferOnGpuThread(int32_t id) { | 494 bool CommandBufferLocal::DestroyTransferBufferOnGpuThread(int32_t id) { |
497 DCHECK(driver_->IsScheduled()); | 495 DCHECK(driver_->IsScheduled()); |
498 driver_->DestroyTransferBuffer(id); | 496 driver_->DestroyTransferBuffer(id); |
499 return true; | 497 return true; |
500 } | 498 } |
501 | 499 |
502 bool CommandBufferLocal::CreateImageOnGpuThread( | 500 bool CommandBufferLocal::CreateImageOnGpuThread( |
503 int32_t id, | 501 int32_t id, |
504 mojo::ScopedHandle memory_handle, | 502 mojo::ScopedHandle memory_handle, |
505 int32_t type, | 503 int32_t type, |
506 mojo::SizePtr size, | 504 const gfx::Size& size, |
507 int32_t format, | 505 int32_t format, |
508 int32_t internal_format) { | 506 int32_t internal_format) { |
509 DCHECK(driver_->IsScheduled()); | 507 DCHECK(driver_->IsScheduled()); |
510 driver_->CreateImage(id, std::move(memory_handle), type, std::move(size), | 508 driver_->CreateImage(id, std::move(memory_handle), type, std::move(size), |
511 format, internal_format); | 509 format, internal_format); |
512 return true; | 510 return true; |
513 } | 511 } |
514 | 512 |
515 bool CommandBufferLocal::CreateImageNativeOzoneOnGpuThread( | 513 bool CommandBufferLocal::CreateImageNativeOzoneOnGpuThread( |
516 int32_t id, | 514 int32_t id, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 client_->UpdateVSyncParameters(timebase, interval); | 565 client_->UpdateVSyncParameters(timebase, interval); |
568 } | 566 } |
569 | 567 |
570 void CommandBufferLocal::OnGpuCompletedSwapBuffersOnClientThread( | 568 void CommandBufferLocal::OnGpuCompletedSwapBuffersOnClientThread( |
571 gfx::SwapResult result) { | 569 gfx::SwapResult result) { |
572 if (client_) | 570 if (client_) |
573 client_->GpuCompletedSwapBuffers(result); | 571 client_->GpuCompletedSwapBuffers(result); |
574 } | 572 } |
575 | 573 |
576 } // namespace mus | 574 } // namespace mus |
OLD | NEW |