Chromium Code Reviews| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/hash.h" | 8 #include "base/hash.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 956 if (!memory_manager_client_state_) { | 956 if (!memory_manager_client_state_) { |
| 957 memory_manager_client_state_.reset(GetMemoryManager()->CreateClientState( | 957 memory_manager_client_state_.reset(GetMemoryManager()->CreateClientState( |
| 958 this, surface_id_ != 0, true)); | 958 this, surface_id_ != 0, true)); |
| 959 } | 959 } |
| 960 } else { | 960 } else { |
| 961 memory_manager_client_state_.reset(); | 961 memory_manager_client_state_.reset(); |
| 962 } | 962 } |
| 963 } | 963 } |
| 964 | 964 |
| 965 void GpuCommandBufferStub::OnCreateImage(int32 id, | 965 void GpuCommandBufferStub::OnCreateImage(int32 id, |
| 966 gfx::GpuMemoryBufferHandle handle, | 966 gfx::GpuMemoryBufferHandle* handles, |
|
reveman
2015/03/04 05:56:00
Receiving pointers over IPC doesn't work.
| |
| 967 gfx::Size size, | 967 gfx::Size size, |
| 968 gfx::GpuMemoryBuffer::Format format, | 968 gfx::GpuMemoryBuffer::Format* formats, |
|
reveman
2015/03/04 05:56:00
ditto
| |
| 969 uint32 internalformat) { | 969 uint32 internalformat) { |
| 970 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateImage"); | 970 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateImage"); |
| 971 | 971 |
| 972 if (!decoder_) | 972 if (!decoder_) |
| 973 return; | 973 return; |
| 974 | 974 |
| 975 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); | 975 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); |
| 976 DCHECK(image_manager); | 976 DCHECK(image_manager); |
| 977 if (image_manager->LookupImage(id)) { | 977 if (image_manager->LookupImage(id)) { |
| 978 LOG(ERROR) << "Image already exists with same ID."; | 978 LOG(ERROR) << "Image already exists with same ID."; |
| 979 return; | 979 return; |
| 980 } | 980 } |
| 981 | 981 |
| 982 if (!IsSupportedImageFormat(decoder_->GetCapabilities(), format)) { | 982 int num_buffers = |
| 983 LOG(ERROR) << "Image format is not supported."; | 983 gpu::ImageFactory::GpuMemoryBufferCountForImageFormat(internalformat); |
| 984 return; | 984 |
| 985 for (int i = 0; i < num_buffers; ++i) { | |
| 986 if (!IsSupportedImageFormat(decoder_->GetCapabilities(), formats[i])) { | |
| 987 LOG(ERROR) << "Image format is not supported."; | |
| 988 return; | |
| 989 } | |
| 985 } | 990 } |
| 986 | 991 |
| 992 // TODO(emircan): See http://crbug.com/439520; support passing multiple | |
| 993 // buffers when new multi-planar formats are added. | |
| 987 scoped_refptr<gfx::GLImage> image = channel()->CreateImageForGpuMemoryBuffer( | 994 scoped_refptr<gfx::GLImage> image = channel()->CreateImageForGpuMemoryBuffer( |
| 988 handle, size, format, internalformat); | 995 handles[0], size, formats[0], internalformat); |
|
reveman
2015/03/04 05:56:00
Don't stop here :)
emircan
2015/03/04 23:31:50
Went ahead, until the modification of gfx::GLImage
| |
| 989 if (!image.get()) | 996 if (!image.get()) |
| 990 return; | 997 return; |
| 991 | 998 |
| 992 image_manager->AddImage(image.get(), id); | 999 image_manager->AddImage(image.get(), id); |
| 993 } | 1000 } |
| 994 | 1001 |
| 995 void GpuCommandBufferStub::OnDestroyImage(int32 id) { | 1002 void GpuCommandBufferStub::OnDestroyImage(int32 id) { |
| 996 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyImage"); | 1003 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyImage"); |
| 997 | 1004 |
| 998 if (!decoder_) | 1005 if (!decoder_) |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1111 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info)); | 1118 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info)); |
| 1112 } | 1119 } |
| 1113 | 1120 |
| 1114 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, | 1121 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, |
| 1115 base::TimeDelta interval) { | 1122 base::TimeDelta interval) { |
| 1116 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, | 1123 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, |
| 1117 interval)); | 1124 interval)); |
| 1118 } | 1125 } |
| 1119 | 1126 |
| 1120 } // namespace content | 1127 } // namespace content |
| OLD | NEW |