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

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

Issue 11293121: Add latency measurement system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor input event changes Created 8 years 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 // resources we allocated in the stub's context. 198 // resources we allocated in the stub's context.
199 if (fbo_id_) { 199 if (fbo_id_) {
200 glDeleteFramebuffersEXT(1, &fbo_id_); 200 glDeleteFramebuffersEXT(1, &fbo_id_);
201 CHECK_GL_ERROR(); 201 CHECK_GL_ERROR();
202 fbo_id_ = 0; 202 fbo_id_ = 0;
203 } 203 }
204 204
205 stub_destroyed_ = true; 205 stub_destroyed_ = true;
206 } 206 }
207 207
208 void TextureImageTransportSurface::SetLatencyInfo(
209 const WebKit::WebLatencyInfoImpl& latency_info) {
210 if (latency_info_.rendererImplFrameNumber !=
211 latency_info.rendererImplFrameNumber) {
212 TRACE_EVENT_ASYNC_BEGIN2("frame", "Renderer Frame", this,
213 "frame_number",
214 latency_info.rendererImplFrameNumber,
215 "input_number", latency_info.inputNumber);
216 }
217
218 latency_info_ = latency_info;
219 }
220
208 bool TextureImageTransportSurface::SwapBuffers() { 221 bool TextureImageTransportSurface::SwapBuffers() {
209 DCHECK(backbuffer_suggested_allocation_); 222 DCHECK(backbuffer_suggested_allocation_);
223 TRACE_EVENT_ASYNC_END2("frame", "Renderer Frame", this,
224 "frame_number", latency_info_.rendererImplFrameNumber,
225 "input_number", latency_info_.inputNumber);
226
210 if (!frontbuffer_suggested_allocation_) 227 if (!frontbuffer_suggested_allocation_)
211 return true; 228 return true;
212 229
213 glFlush(); 230 glFlush();
214 ProduceTexture(backbuffer_); 231 ProduceTexture(backbuffer_);
215 232
216 // Do not allow destruction while we are still waiting for a swap ACK, 233 // Do not allow destruction while we are still waiting for a swap ACK,
217 // so we do not leak a texture in the mailbox. 234 // so we do not leak a texture in the mailbox.
218 AddRef(); 235 AddRef();
219 236
220 DCHECK(backbuffer_.size == current_size_); 237 DCHECK(backbuffer_.size == current_size_);
221 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; 238 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params;
222 params.surface_handle = backbuffer_.surface_handle; 239 params.surface_handle = backbuffer_.surface_handle;
223 params.size = backbuffer_.size; 240 params.size = backbuffer_.size;
241 params.latency_info = latency_info_;
224 helper_->SendAcceleratedSurfaceBuffersSwapped(params); 242 helper_->SendAcceleratedSurfaceBuffersSwapped(params);
225 243
226 DCHECK(!is_swap_buffers_pending_); 244 DCHECK(!is_swap_buffers_pending_);
227 is_swap_buffers_pending_ = true; 245 is_swap_buffers_pending_ = true;
228 return true; 246 return true;
229 } 247 }
230 248
231 bool TextureImageTransportSurface::PostSubBuffer( 249 bool TextureImageTransportSurface::PostSubBuffer(
232 int x, int y, int width, int height) { 250 int x, int y, int width, int height) {
233 DCHECK(backbuffer_suggested_allocation_); 251 DCHECK(backbuffer_suggested_allocation_);
252 TRACE_EVENT_ASYNC_END2("frame", "Renderer Frame", this,
253 "frame_number", latency_info_.rendererImplFrameNumber,
254 "input_number", latency_info_.inputNumber);
234 if (!frontbuffer_suggested_allocation_) 255 if (!frontbuffer_suggested_allocation_)
235 return true; 256 return true;
236 const gfx::Rect new_damage_rect(x, y, width, height); 257 const gfx::Rect new_damage_rect(x, y, width, height);
237 DCHECK(gfx::Rect(gfx::Point(), current_size_).Contains(new_damage_rect)); 258 DCHECK(gfx::Rect(gfx::Point(), current_size_).Contains(new_damage_rect));
238 259
239 // An empty damage rect is a successful no-op. 260 // An empty damage rect is a successful no-op.
240 if (new_damage_rect.IsEmpty()) 261 if (new_damage_rect.IsEmpty())
241 return true; 262 return true;
242 263
243 glFlush(); 264 glFlush();
244 ProduceTexture(backbuffer_); 265 ProduceTexture(backbuffer_);
245 266
246 // Do not allow destruction while we are still waiting for a swap ACK, 267 // Do not allow destruction while we are still waiting for a swap ACK,
247 // so we do not leak a texture in the mailbox. 268 // so we do not leak a texture in the mailbox.
248 AddRef(); 269 AddRef();
249 270
250 DCHECK(current_size_ == backbuffer_.size); 271 DCHECK(current_size_ == backbuffer_.size);
251 272
252 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params; 273 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params;
253 params.surface_handle = backbuffer_.surface_handle; 274 params.surface_handle = backbuffer_.surface_handle;
254 params.surface_size = backbuffer_.size; 275 params.surface_size = backbuffer_.size;
255 params.x = x; 276 params.x = x;
256 params.y = y; 277 params.y = y;
257 params.width = width; 278 params.width = width;
258 params.height = height; 279 params.height = height;
280 params.latency_info = latency_info_;
259 helper_->SendAcceleratedSurfacePostSubBuffer(params); 281 helper_->SendAcceleratedSurfacePostSubBuffer(params);
260 282
261 DCHECK(!is_swap_buffers_pending_); 283 DCHECK(!is_swap_buffers_pending_);
262 is_swap_buffers_pending_ = true; 284 is_swap_buffers_pending_ = true;
263 return true; 285 return true;
264 } 286 }
265 287
266 std::string TextureImageTransportSurface::GetExtensions() { 288 std::string TextureImageTransportSurface::GetExtensions() {
267 std::string extensions = gfx::GLSurface::GetExtensions(); 289 std::string extensions = gfx::GLSurface::GetExtensions();
268 extensions += extensions.empty() ? "" : " "; 290 extensions += extensions.empty() ? "" : " ";
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 // at which point we consume the correct texture back. 493 // at which point we consume the correct texture back.
472 mailbox_manager_->ProduceTexture( 494 mailbox_manager_->ProduceTexture(
473 GL_TEXTURE_2D, 495 GL_TEXTURE_2D,
474 mailbox_name(texture.surface_handle), 496 mailbox_name(texture.surface_handle),
475 definition.release(), 497 definition.release(),
476 NULL); 498 NULL);
477 texture.service_id = 0; 499 texture.service_id = 0;
478 } 500 }
479 501
480 } // namespace content 502 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698