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

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

Issue 12614013: Plumb cc::LatencyInfo through command buffer and output surface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
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 "content/common/gpu/texture_image_transport_surface.h" 5 #include "content/common/gpu/texture_image_transport_surface.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 // resources we allocated in the stub's context. 194 // resources we allocated in the stub's context.
195 if (fbo_id_) { 195 if (fbo_id_) {
196 glDeleteFramebuffersEXT(1, &fbo_id_); 196 glDeleteFramebuffersEXT(1, &fbo_id_);
197 CHECK_GL_ERROR(); 197 CHECK_GL_ERROR();
198 fbo_id_ = 0; 198 fbo_id_ = 0;
199 } 199 }
200 200
201 stub_destroyed_ = true; 201 stub_destroyed_ = true;
202 } 202 }
203 203
204 void TextureImageTransportSurface::SetLatencyInfo(
205 const cc::LatencyInfo& latency_info) {
206 latency_info_ = latency_info;
207 }
208
204 bool TextureImageTransportSurface::SwapBuffers() { 209 bool TextureImageTransportSurface::SwapBuffers() {
205 DCHECK(backbuffer_suggested_allocation_); 210 DCHECK(backbuffer_suggested_allocation_);
211
206 if (!frontbuffer_suggested_allocation_) 212 if (!frontbuffer_suggested_allocation_)
207 return true; 213 return true;
208 214
209 if (!backbuffer_.service_id) { 215 if (!backbuffer_.service_id) {
210 LOG(ERROR) << "Swap without valid backing."; 216 LOG(ERROR) << "Swap without valid backing.";
211 return true; 217 return true;
212 } 218 }
213 219
214 DCHECK(backbuffer_.size == current_size_); 220 DCHECK(backbuffer_.size == current_size_);
215 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; 221 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params;
216 params.size = backbuffer_.size; 222 params.size = backbuffer_.size;
217 const MailboxName& name = backbuffer_.mailbox_name; 223 const MailboxName& name = backbuffer_.mailbox_name;
218 params.mailbox_name.assign( 224 params.mailbox_name.assign(
219 reinterpret_cast<const char*>(&name), sizeof(name)); 225 reinterpret_cast<const char*>(&name), sizeof(name));
220 226
221 glFlush(); 227 glFlush();
222 ProduceTexture(&backbuffer_); 228 ProduceTexture(&backbuffer_);
223 229
224 // Do not allow destruction while we are still waiting for a swap ACK, 230 // Do not allow destruction while we are still waiting for a swap ACK,
225 // so we do not leak a texture in the mailbox. 231 // so we do not leak a texture in the mailbox.
226 AddRef(); 232 AddRef();
227 233
234 params.latency_info = latency_info_;
228 helper_->SendAcceleratedSurfaceBuffersSwapped(params); 235 helper_->SendAcceleratedSurfaceBuffersSwapped(params);
229 236
230 DCHECK(!is_swap_buffers_pending_); 237 DCHECK(!is_swap_buffers_pending_);
231 is_swap_buffers_pending_ = true; 238 is_swap_buffers_pending_ = true;
232 return true; 239 return true;
233 } 240 }
234 241
235 bool TextureImageTransportSurface::PostSubBuffer( 242 bool TextureImageTransportSurface::PostSubBuffer(
236 int x, int y, int width, int height) { 243 int x, int y, int width, int height) {
237 DCHECK(backbuffer_suggested_allocation_); 244 DCHECK(backbuffer_suggested_allocation_);
(...skipping 22 matching lines...) Expand all
260 params.mailbox_name.assign( 267 params.mailbox_name.assign(
261 reinterpret_cast<const char*>(&name), sizeof(name)); 268 reinterpret_cast<const char*>(&name), sizeof(name));
262 269
263 glFlush(); 270 glFlush();
264 ProduceTexture(&backbuffer_); 271 ProduceTexture(&backbuffer_);
265 272
266 // Do not allow destruction while we are still waiting for a swap ACK, 273 // Do not allow destruction while we are still waiting for a swap ACK,
267 // so we do not leak a texture in the mailbox. 274 // so we do not leak a texture in the mailbox.
268 AddRef(); 275 AddRef();
269 276
277 params.latency_info = latency_info_;
270 helper_->SendAcceleratedSurfacePostSubBuffer(params); 278 helper_->SendAcceleratedSurfacePostSubBuffer(params);
271 279
272 DCHECK(!is_swap_buffers_pending_); 280 DCHECK(!is_swap_buffers_pending_);
273 is_swap_buffers_pending_ = true; 281 is_swap_buffers_pending_ = true;
274 return true; 282 return true;
275 } 283 }
276 284
277 std::string TextureImageTransportSurface::GetExtensions() { 285 std::string TextureImageTransportSurface::GetExtensions() {
278 std::string extensions = gfx::GLSurface::GetExtensions(); 286 std::string extensions = gfx::GLSurface::GetExtensions();
279 extensions += extensions.empty() ? "" : " "; 287 extensions += extensions.empty() ? "" : " ";
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 GL_TEXTURE_2D, 499 GL_TEXTURE_2D,
492 texture->mailbox_name, 500 texture->mailbox_name,
493 definition.release(), 501 definition.release(),
494 NULL); 502 NULL);
495 DCHECK(success); 503 DCHECK(success);
496 texture->service_id = 0; 504 texture->service_id = 0;
497 texture->mailbox_name = MailboxName(); 505 texture->mailbox_name = MailboxName();
498 } 506 }
499 507
500 } // namespace content 508 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698