| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/common/gpu/gpu_command_buffer_stub.h" | 5 #include "content/common/gpu/gpu_command_buffer_stub.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/hash.h" | 11 #include "base/hash.h" |
| 12 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/shared_memory.h" | 14 #include "base/memory/shared_memory.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "content/common/gpu/gpu_channel.h" | 18 #include "content/common/gpu/gpu_channel.h" |
| 19 #include "content/common/gpu/gpu_channel_manager.h" | 19 #include "content/common/gpu/gpu_channel_manager.h" |
| 20 #include "content/common/gpu/gpu_channel_manager_delegate.h" | 20 #include "content/common/gpu/gpu_channel_manager_delegate.h" |
| 21 #include "content/common/gpu/gpu_memory_manager.h" | 21 #include "content/common/gpu/gpu_memory_manager.h" |
| 22 #include "content/common/gpu/gpu_memory_tracking.h" | 22 #include "content/common/gpu/gpu_memory_tracking.h" |
| 23 #include "content/common/gpu/gpu_watchdog.h" | 23 #include "content/common/gpu/gpu_watchdog.h" |
| 24 #include "content/common/gpu/image_transport_surface.h" | 24 #include "content/common/gpu/image_transport_surface.h" |
| 25 #include "gpu/command_buffer/common/constants.h" | 25 #include "gpu/command_buffer/common/constants.h" |
| 26 #include "gpu/command_buffer/common/gpu_memory_buffer_support.h" |
| 26 #include "gpu/command_buffer/common/mailbox.h" | 27 #include "gpu/command_buffer/common/mailbox.h" |
| 27 #include "gpu/command_buffer/common/sync_token.h" | 28 #include "gpu/command_buffer/common/sync_token.h" |
| 28 #include "gpu/command_buffer/service/gl_context_virtual.h" | 29 #include "gpu/command_buffer/service/gl_context_virtual.h" |
| 29 #include "gpu/command_buffer/service/gl_state_restorer_impl.h" | 30 #include "gpu/command_buffer/service/gl_state_restorer_impl.h" |
| 30 #include "gpu/command_buffer/service/image_factory.h" | |
| 31 #include "gpu/command_buffer/service/image_manager.h" | 31 #include "gpu/command_buffer/service/image_manager.h" |
| 32 #include "gpu/command_buffer/service/logger.h" | 32 #include "gpu/command_buffer/service/logger.h" |
| 33 #include "gpu/command_buffer/service/mailbox_manager.h" | 33 #include "gpu/command_buffer/service/mailbox_manager.h" |
| 34 #include "gpu/command_buffer/service/memory_tracking.h" | 34 #include "gpu/command_buffer/service/memory_tracking.h" |
| 35 #include "gpu/command_buffer/service/query_manager.h" | 35 #include "gpu/command_buffer/service/query_manager.h" |
| 36 #include "gpu/command_buffer/service/sync_point_manager.h" | 36 #include "gpu/command_buffer/service/sync_point_manager.h" |
| 37 #include "gpu/command_buffer/service/transfer_buffer_manager.h" | 37 #include "gpu/command_buffer/service/transfer_buffer_manager.h" |
| 38 #include "gpu/command_buffer/service/valuebuffer_manager.h" | 38 #include "gpu/command_buffer/service/valuebuffer_manager.h" |
| 39 #include "gpu/ipc/common/gpu_messages.h" | 39 #include "gpu/ipc/common/gpu_messages.h" |
| 40 #include "ui/gl/gl_bindings.h" | 40 #include "ui/gl/gl_bindings.h" |
| (...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 if (!decoder_) | 996 if (!decoder_) |
| 997 return; | 997 return; |
| 998 | 998 |
| 999 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); | 999 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); |
| 1000 DCHECK(image_manager); | 1000 DCHECK(image_manager); |
| 1001 if (image_manager->LookupImage(id)) { | 1001 if (image_manager->LookupImage(id)) { |
| 1002 LOG(ERROR) << "Image already exists with same ID."; | 1002 LOG(ERROR) << "Image already exists with same ID."; |
| 1003 return; | 1003 return; |
| 1004 } | 1004 } |
| 1005 | 1005 |
| 1006 if (!gpu::ImageFactory::IsGpuMemoryBufferFormatSupported( | 1006 if (!gpu::IsGpuMemoryBufferFormatSupported(format, |
| 1007 format, decoder_->GetCapabilities())) { | 1007 decoder_->GetCapabilities())) { |
| 1008 LOG(ERROR) << "Format is not supported."; | 1008 LOG(ERROR) << "Format is not supported."; |
| 1009 return; | 1009 return; |
| 1010 } | 1010 } |
| 1011 | 1011 |
| 1012 if (!gpu::ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat(size, | 1012 if (!gpu::IsImageSizeValidForGpuMemoryBufferFormat(size, format)) { |
| 1013 format)) { | |
| 1014 LOG(ERROR) << "Invalid image size for format."; | 1013 LOG(ERROR) << "Invalid image size for format."; |
| 1015 return; | 1014 return; |
| 1016 } | 1015 } |
| 1017 | 1016 |
| 1018 if (!gpu::ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat( | 1017 if (!gpu::IsImageFormatCompatibleWithGpuMemoryBufferFormat(internalformat, |
| 1019 internalformat, format)) { | 1018 format)) { |
| 1020 LOG(ERROR) << "Incompatible image format."; | 1019 LOG(ERROR) << "Incompatible image format."; |
| 1021 return; | 1020 return; |
| 1022 } | 1021 } |
| 1023 | 1022 |
| 1024 scoped_refptr<gl::GLImage> image = channel()->CreateImageForGpuMemoryBuffer( | 1023 scoped_refptr<gl::GLImage> image = channel()->CreateImageForGpuMemoryBuffer( |
| 1025 handle, size, format, internalformat); | 1024 handle, size, format, internalformat); |
| 1026 if (!image.get()) | 1025 if (!image.get()) |
| 1027 return; | 1026 return; |
| 1028 | 1027 |
| 1029 image_manager->AddImage(image.get(), id); | 1028 image_manager->AddImage(image.get(), id); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1134 result)); | 1133 result)); |
| 1135 } | 1134 } |
| 1136 | 1135 |
| 1137 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, | 1136 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, |
| 1138 base::TimeDelta interval) { | 1137 base::TimeDelta interval) { |
| 1139 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, | 1138 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, |
| 1140 interval)); | 1139 interval)); |
| 1141 } | 1140 } |
| 1142 | 1141 |
| 1143 } // namespace content | 1142 } // namespace content |
| OLD | NEW |