OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_driver.h" | 5 #include "components/mus/gles2/command_buffer_driver.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/memory/shared_memory.h" | 11 #include "base/memory/shared_memory.h" |
12 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "components/mus/gles2/gpu_memory_tracker.h" | 14 #include "components/mus/gles2/gpu_memory_tracker.h" |
15 #include "components/mus/gles2/gpu_state.h" | 15 #include "components/mus/gles2/gpu_state.h" |
16 #include "components/mus/gles2/mojo_buffer_backing.h" | 16 #include "components/mus/gles2/mojo_buffer_backing.h" |
| 17 #include "gpu/command_buffer/common/gpu_memory_buffer_support.h" |
17 #include "gpu/command_buffer/service/command_buffer_service.h" | 18 #include "gpu/command_buffer/service/command_buffer_service.h" |
18 #include "gpu/command_buffer/service/command_executor.h" | 19 #include "gpu/command_buffer/service/command_executor.h" |
19 #include "gpu/command_buffer/service/context_group.h" | 20 #include "gpu/command_buffer/service/context_group.h" |
20 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 21 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
21 #include "gpu/command_buffer/service/image_factory.h" | |
22 #include "gpu/command_buffer/service/image_manager.h" | 22 #include "gpu/command_buffer/service/image_manager.h" |
23 #include "gpu/command_buffer/service/mailbox_manager.h" | 23 #include "gpu/command_buffer/service/mailbox_manager.h" |
24 #include "gpu/command_buffer/service/query_manager.h" | 24 #include "gpu/command_buffer/service/query_manager.h" |
25 #include "gpu/command_buffer/service/sync_point_manager.h" | 25 #include "gpu/command_buffer/service/sync_point_manager.h" |
26 #include "gpu/command_buffer/service/transfer_buffer_manager.h" | 26 #include "gpu/command_buffer/service/transfer_buffer_manager.h" |
27 #include "gpu/command_buffer/service/valuebuffer_manager.h" | 27 #include "gpu/command_buffer/service/valuebuffer_manager.h" |
28 #include "mojo/converters/geometry/geometry_type_converters.h" | 28 #include "mojo/converters/geometry/geometry_type_converters.h" |
29 #include "mojo/platform_handle/platform_handle_functions.h" | 29 #include "mojo/platform_handle/platform_handle_functions.h" |
30 #include "ui/gfx/buffer_format_util.h" | 30 #include "ui/gfx/buffer_format_util.h" |
31 #include "ui/gfx/gpu_memory_buffer.h" | 31 #include "ui/gfx/gpu_memory_buffer.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 if (!MakeCurrent()) | 207 if (!MakeCurrent()) |
208 return; | 208 return; |
209 | 209 |
210 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); | 210 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); |
211 if (image_manager->LookupImage(id)) { | 211 if (image_manager->LookupImage(id)) { |
212 LOG(ERROR) << "Image already exists with same ID."; | 212 LOG(ERROR) << "Image already exists with same ID."; |
213 return; | 213 return; |
214 } | 214 } |
215 | 215 |
216 gfx::BufferFormat gpu_format = static_cast<gfx::BufferFormat>(format); | 216 gfx::BufferFormat gpu_format = static_cast<gfx::BufferFormat>(format); |
217 if (!gpu::ImageFactory::IsGpuMemoryBufferFormatSupported( | 217 if (!gpu::IsGpuMemoryBufferFormatSupported(gpu_format, |
218 gpu_format, decoder_->GetCapabilities())) { | 218 decoder_->GetCapabilities())) { |
219 LOG(ERROR) << "Format is not supported."; | 219 LOG(ERROR) << "Format is not supported."; |
220 return; | 220 return; |
221 } | 221 } |
222 | 222 |
223 gfx::Size gfx_size = size.To<gfx::Size>(); | 223 gfx::Size gfx_size = size.To<gfx::Size>(); |
224 if (!gpu::ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat( | 224 if (!gpu::IsImageSizeValidForGpuMemoryBufferFormat(gfx_size, gpu_format)) { |
225 gfx_size, gpu_format)) { | |
226 LOG(ERROR) << "Invalid image size for format."; | 225 LOG(ERROR) << "Invalid image size for format."; |
227 return; | 226 return; |
228 } | 227 } |
229 | 228 |
230 if (!gpu::ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat( | 229 if (!gpu::IsImageFormatCompatibleWithGpuMemoryBufferFormat(internal_format, |
231 internal_format, gpu_format)) { | 230 gpu_format)) { |
232 LOG(ERROR) << "Incompatible image format."; | 231 LOG(ERROR) << "Incompatible image format."; |
233 return; | 232 return; |
234 } | 233 } |
235 | 234 |
236 if (type != gfx::SHARED_MEMORY_BUFFER) { | 235 if (type != gfx::SHARED_MEMORY_BUFFER) { |
237 NOTIMPLEMENTED(); | 236 NOTIMPLEMENTED(); |
238 return; | 237 return; |
239 } | 238 } |
240 | 239 |
241 MojoPlatformHandle platform_handle; | 240 MojoPlatformHandle platform_handle; |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 | 489 |
491 gpu::gles2::QueryManager* query_manager = decoder_->GetQueryManager(); | 490 gpu::gles2::QueryManager* query_manager = decoder_->GetQueryManager(); |
492 gpu::gles2::QueryManager::Query* query = query_manager->GetQuery(query_id); | 491 gpu::gles2::QueryManager::Query* query = query_manager->GetQuery(query_id); |
493 if (query) | 492 if (query) |
494 query->AddCallback(callback); | 493 query->AddCallback(callback); |
495 else | 494 else |
496 callback.Run(); | 495 callback.Run(); |
497 } | 496 } |
498 | 497 |
499 } // namespace mus | 498 } // namespace mus |
OLD | NEW |