| OLD | NEW |
| 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 "mojo/gles2/command_buffer_client_impl.h" | 5 #include "mojo/gles2/command_buffer_client_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/process/process_handle.h" | 14 #include "base/process/process_handle.h" |
| 15 #include "base/threading/thread_restrictions.h" | 15 #include "base/threading/thread_restrictions.h" |
| 16 #include "components/mus/gles2/command_buffer_type_conversions.h" | 16 #include "components/mus/gles2/command_buffer_type_conversions.h" |
| 17 #include "components/mus/gles2/mojo_buffer_backing.h" | 17 #include "components/mus/gles2/mojo_buffer_backing.h" |
| 18 #include "components/mus/gles2/mojo_gpu_memory_buffer.h" | 18 #include "components/mus/gles2/mojo_gpu_memory_buffer.h" |
| 19 #include "gpu/command_buffer/common/command_buffer_id.h" | 19 #include "gpu/command_buffer/common/command_buffer_id.h" |
| 20 #include "gpu/command_buffer/common/gpu_memory_buffer_support.h" |
| 20 #include "gpu/command_buffer/common/sync_token.h" | 21 #include "gpu/command_buffer/common/sync_token.h" |
| 21 #include "gpu/command_buffer/service/image_factory.h" | |
| 22 #include "mojo/platform_handle/platform_handle_functions.h" | 22 #include "mojo/platform_handle/platform_handle_functions.h" |
| 23 | 23 |
| 24 namespace gles2 { | 24 namespace gles2 { |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 bool CreateMapAndDupSharedBuffer(size_t size, | 28 bool CreateMapAndDupSharedBuffer(size_t size, |
| 29 void** memory, | 29 void** memory, |
| 30 mojo::ScopedSharedBufferHandle* handle, | 30 mojo::ScopedSharedBufferHandle* handle, |
| 31 mojo::ScopedSharedBufferHandle* duped) { | 31 mojo::ScopedSharedBufferHandle* duped) { |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 command_buffer_->DestroyImage(id); | 263 command_buffer_->DestroyImage(id); |
| 264 } | 264 } |
| 265 | 265 |
| 266 int32_t CommandBufferClientImpl::CreateGpuMemoryBufferImage( | 266 int32_t CommandBufferClientImpl::CreateGpuMemoryBufferImage( |
| 267 size_t width, | 267 size_t width, |
| 268 size_t height, | 268 size_t height, |
| 269 unsigned internalformat, | 269 unsigned internalformat, |
| 270 unsigned usage) { | 270 unsigned usage) { |
| 271 scoped_ptr<gfx::GpuMemoryBuffer> buffer(mus::MojoGpuMemoryBufferImpl::Create( | 271 scoped_ptr<gfx::GpuMemoryBuffer> buffer(mus::MojoGpuMemoryBufferImpl::Create( |
| 272 gfx::Size(static_cast<int>(width), static_cast<int>(height)), | 272 gfx::Size(static_cast<int>(width), static_cast<int>(height)), |
| 273 gpu::ImageFactory::DefaultBufferFormatForImageFormat(internalformat), | 273 gpu::DefaultBufferFormatForImageFormat(internalformat), |
| 274 gfx::BufferUsage::SCANOUT)); | 274 gfx::BufferUsage::SCANOUT)); |
| 275 if (!buffer) | 275 if (!buffer) |
| 276 return -1; | 276 return -1; |
| 277 | 277 |
| 278 return CreateImage(buffer->AsClientBuffer(), width, height, internalformat); | 278 return CreateImage(buffer->AsClientBuffer(), width, height, internalformat); |
| 279 } | 279 } |
| 280 | 280 |
| 281 void CommandBufferClientImpl::SignalQuery(uint32_t query, | 281 void CommandBufferClientImpl::SignalQuery(uint32_t query, |
| 282 const base::Closure& callback) { | 282 const base::Closure& callback) { |
| 283 // TODO(piman) | 283 // TODO(piman) |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 383 |
| 384 // It is also safe to wait on the same context. | 384 // It is also safe to wait on the same context. |
| 385 if (sync_token->namespace_id() == gpu::CommandBufferNamespace::MOJO && | 385 if (sync_token->namespace_id() == gpu::CommandBufferNamespace::MOJO && |
| 386 sync_token->command_buffer_id() == GetCommandBufferID()) | 386 sync_token->command_buffer_id() == GetCommandBufferID()) |
| 387 return true; | 387 return true; |
| 388 | 388 |
| 389 return false; | 389 return false; |
| 390 } | 390 } |
| 391 | 391 |
| 392 } // namespace gles2 | 392 } // namespace gles2 |
| OLD | NEW |