Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(860)

Side by Side Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 948323002: Revert of Add support for compressed GPU memory buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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,
144 gfx::GpuMemoryBuffer::Format format) {
145 switch (format) {
146 case gfx::GpuMemoryBuffer::ATC:
147 case gfx::GpuMemoryBuffer::ATCIA:
148 return capabilities.texture_format_atc;
149 case gfx::GpuMemoryBuffer::BGRA_8888:
150 return capabilities.texture_format_bgra8888;
151 case gfx::GpuMemoryBuffer::DXT1:
152 return capabilities.texture_format_dxt1;
153 case gfx::GpuMemoryBuffer::DXT5:
154 return capabilities.texture_format_dxt5;
155 case gfx::GpuMemoryBuffer::ETC1:
156 return capabilities.texture_format_etc1;
157 case gfx::GpuMemoryBuffer::RGBA_8888:
158 case gfx::GpuMemoryBuffer::RGBX_8888:
159 return true;
160 }
161
162 NOTREACHED();
163 return false;
164 }
165
166 } // namespace 143 } // namespace
167 144
168 GpuCommandBufferStub::GpuCommandBufferStub( 145 GpuCommandBufferStub::GpuCommandBufferStub(
169 GpuChannel* channel, 146 GpuChannel* channel,
170 GpuCommandBufferStub* share_group, 147 GpuCommandBufferStub* share_group,
171 const gfx::GLSurfaceHandle& handle, 148 const gfx::GLSurfaceHandle& handle,
172 gpu::gles2::MailboxManager* mailbox_manager, 149 gpu::gles2::MailboxManager* mailbox_manager,
173 gpu::gles2::SubscriptionRefSet* subscription_ref_set, 150 gpu::gles2::SubscriptionRefSet* subscription_ref_set,
174 gpu::ValueStateMap* pending_valuebuffer_state, 151 gpu::ValueStateMap* pending_valuebuffer_state,
175 const gfx::Size& size, 152 const gfx::Size& size,
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 if (!decoder_) 949 if (!decoder_)
973 return; 950 return;
974 951
975 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); 952 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager();
976 DCHECK(image_manager); 953 DCHECK(image_manager);
977 if (image_manager->LookupImage(id)) { 954 if (image_manager->LookupImage(id)) {
978 LOG(ERROR) << "Image already exists with same ID."; 955 LOG(ERROR) << "Image already exists with same ID.";
979 return; 956 return;
980 } 957 }
981 958
982 if (!IsSupportedImageFormat(decoder_->GetCapabilities(), format)) {
983 LOG(ERROR) << "Image format is not supported.";
984 return;
985 }
986
987 scoped_refptr<gfx::GLImage> image = channel()->CreateImageForGpuMemoryBuffer( 959 scoped_refptr<gfx::GLImage> image = channel()->CreateImageForGpuMemoryBuffer(
988 handle, size, format, internalformat); 960 handle, size, format, internalformat);
989 if (!image.get()) 961 if (!image.get())
990 return; 962 return;
991 963
992 image_manager->AddImage(image.get(), id); 964 image_manager->AddImage(image.get(), id);
993 } 965 }
994 966
995 void GpuCommandBufferStub::OnDestroyImage(int32 id) { 967 void GpuCommandBufferStub::OnDestroyImage(int32 id) {
996 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyImage"); 968 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyImage");
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info)); 1083 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info));
1112 } 1084 }
1113 1085
1114 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, 1086 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase,
1115 base::TimeDelta interval) { 1087 base::TimeDelta interval) {
1116 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, 1088 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase,
1117 interval)); 1089 interval));
1118 } 1090 }
1119 1091
1120 } // namespace content 1092 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698