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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue); | 133 scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue); |
134 res->SetInteger("renderer_pid", channel->renderer_pid()); | 134 res->SetInteger("renderer_pid", channel->renderer_pid()); |
135 res->SetDouble("used_bytes", channel->GetMemoryUsage()); | 135 res->SetDouble("used_bytes", channel->GetMemoryUsage()); |
136 res->SetDouble("limit_bytes", | 136 res->SetDouble("limit_bytes", |
137 channel->gpu_channel_manager() | 137 channel->gpu_channel_manager() |
138 ->gpu_memory_manager() | 138 ->gpu_memory_manager() |
139 ->GetMaximumClientAllocation()); | 139 ->GetMaximumClientAllocation()); |
140 return new DevToolsChannelData(res.release()); | 140 return new DevToolsChannelData(res.release()); |
141 } | 141 } |
142 | 142 |
143 bool IsSupportedImageFormat(const gpu::Capabilities& capabilities, | 143 bool IsSupportedImageFormat(const gpu::Capabilities& capabilities, |
reveman
2015/03/05 19:35:32
Hm, this name is confusing with support for multip
reveman
2015/03/05 19:35:32
Hm, this name is confusing with support for multip
emircan
2015/03/09 21:07:22
It was removed in the rebase.
| |
144 gfx::GpuMemoryBuffer::Format format) { | 144 gfx::GpuMemoryBuffer::Format format) { |
145 switch (format) { | 145 switch (format) { |
146 case gfx::GpuMemoryBuffer::ATC: | 146 case gfx::GpuMemoryBuffer::ATC: |
147 case gfx::GpuMemoryBuffer::ATCIA: | 147 case gfx::GpuMemoryBuffer::ATCIA: |
148 return capabilities.texture_format_atc; | 148 return capabilities.texture_format_atc; |
149 case gfx::GpuMemoryBuffer::BGRA_8888: | 149 case gfx::GpuMemoryBuffer::BGRA_8888: |
150 return capabilities.texture_format_bgra8888; | 150 return capabilities.texture_format_bgra8888; |
151 case gfx::GpuMemoryBuffer::DXT1: | 151 case gfx::GpuMemoryBuffer::DXT1: |
152 return capabilities.texture_format_dxt1; | 152 return capabilities.texture_format_dxt1; |
153 case gfx::GpuMemoryBuffer::DXT5: | 153 case gfx::GpuMemoryBuffer::DXT5: |
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
955 if (has_callback) { | 955 if (has_callback) { |
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( |
966 gfx::GpuMemoryBufferHandle handle, | 966 int32 id, |
967 gfx::Size size, | 967 std::vector<gfx::GpuMemoryBufferHandle> handles, |
968 gfx::GpuMemoryBuffer::Format format, | 968 gfx::Size size, |
969 uint32 internalformat) { | 969 std::vector<gfx::GpuMemoryBuffer::Format> formats, |
970 uint32 internalformat) { | |
970 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateImage"); | 971 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateImage"); |
971 | 972 |
972 if (!decoder_) | 973 if (!decoder_) |
973 return; | 974 return; |
974 | 975 |
975 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); | 976 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); |
976 DCHECK(image_manager); | 977 DCHECK(image_manager); |
977 if (image_manager->LookupImage(id)) { | 978 if (image_manager->LookupImage(id)) { |
978 LOG(ERROR) << "Image already exists with same ID."; | 979 LOG(ERROR) << "Image already exists with same ID."; |
979 return; | 980 return; |
980 } | 981 } |
981 | 982 |
982 if (!IsSupportedImageFormat(decoder_->GetCapabilities(), format)) { | 983 int num_buffers = handles.size(); |
983 LOG(ERROR) << "Image format is not supported."; | 984 |
984 return; | 985 for (int i = 0; i < num_buffers; ++i) { |
reveman
2015/03/05 19:35:32
for (auto format : formats) instead?
emircan
2015/03/09 21:07:22
I could have. But, now gpu::ImageFactory::IsImageF
| |
986 if (!IsSupportedImageFormat(decoder_->GetCapabilities(), formats[i])) { | |
reveman
2015/03/05 19:35:32
You have to be careful here. What if size of forma
emircan
2015/03/09 21:07:22
I see, it is possible to give those input through
| |
987 LOG(ERROR) << "Image format is not supported."; | |
988 return; | |
989 } | |
985 } | 990 } |
986 | 991 |
987 scoped_refptr<gfx::GLImage> image = channel()->CreateImageForGpuMemoryBuffer( | 992 scoped_refptr<gfx::GLImage> image = channel()->CreateImageForGpuMemoryBuffer( |
988 handle, size, format, internalformat); | 993 handles, size, formats, internalformat); |
989 if (!image.get()) | 994 if (!image.get()) |
990 return; | 995 return; |
991 | 996 |
992 image_manager->AddImage(image.get(), id); | 997 image_manager->AddImage(image.get(), id); |
993 } | 998 } |
994 | 999 |
995 void GpuCommandBufferStub::OnDestroyImage(int32 id) { | 1000 void GpuCommandBufferStub::OnDestroyImage(int32 id) { |
996 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyImage"); | 1001 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyImage"); |
997 | 1002 |
998 if (!decoder_) | 1003 if (!decoder_) |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1111 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info)); | 1116 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info)); |
1112 } | 1117 } |
1113 | 1118 |
1114 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, | 1119 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, |
1115 base::TimeDelta interval) { | 1120 base::TimeDelta interval) { |
1116 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, | 1121 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, |
1117 interval)); | 1122 interval)); |
1118 } | 1123 } |
1119 | 1124 |
1120 } // namespace content | 1125 } // namespace content |
OLD | NEW |