| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 bool CommandBufferLocal::DestroyTransferBufferOnGpuThread(int32_t id) { | 502 bool CommandBufferLocal::DestroyTransferBufferOnGpuThread(int32_t id) { |
| 505 DCHECK(driver_->IsScheduled()); | 503 DCHECK(driver_->IsScheduled()); |
| 506 driver_->DestroyTransferBuffer(id); | 504 driver_->DestroyTransferBuffer(id); |
| 507 return true; | 505 return true; |
| 508 } | 506 } |
| 509 | 507 |
| 510 bool CommandBufferLocal::CreateImageOnGpuThread( | 508 bool CommandBufferLocal::CreateImageOnGpuThread( |
| 511 int32_t id, | 509 int32_t id, |
| 512 mojo::ScopedHandle memory_handle, | 510 mojo::ScopedHandle memory_handle, |
| 513 int32_t type, | 511 int32_t type, |
| 514 mojo::SizePtr size, | 512 const gfx::Size& size, |
| 515 int32_t format, | 513 int32_t format, |
| 516 int32_t internal_format) { | 514 int32_t internal_format) { |
| 517 DCHECK(driver_->IsScheduled()); | 515 DCHECK(driver_->IsScheduled()); |
| 518 driver_->CreateImage(id, std::move(memory_handle), type, std::move(size), | 516 driver_->CreateImage(id, std::move(memory_handle), type, std::move(size), |
| 519 format, internal_format); | 517 format, internal_format); |
| 520 return true; | 518 return true; |
| 521 } | 519 } |
| 522 | 520 |
| 523 bool CommandBufferLocal::CreateImageNativeOzoneOnGpuThread( | 521 bool CommandBufferLocal::CreateImageNativeOzoneOnGpuThread( |
| 524 int32_t id, | 522 int32_t id, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 client_->UpdateVSyncParameters(timebase, interval); | 573 client_->UpdateVSyncParameters(timebase, interval); |
| 576 } | 574 } |
| 577 | 575 |
| 578 void CommandBufferLocal::OnGpuCompletedSwapBuffersOnClientThread( | 576 void CommandBufferLocal::OnGpuCompletedSwapBuffersOnClientThread( |
| 579 gfx::SwapResult result) { | 577 gfx::SwapResult result) { |
| 580 if (client_) | 578 if (client_) |
| 581 client_->GpuCompletedSwapBuffers(result); | 579 client_->GpuCompletedSwapBuffers(result); |
| 582 } | 580 } |
| 583 | 581 |
| 584 } // namespace mus | 582 } // namespace mus |
| OLD | NEW |