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

Side by Side Diff: content/browser/renderer_host/compositing_iosurface_mac.mm

Issue 123563002: Remove gpu side LatencyInfo merging (Closed) Base URL: http://git.chromium.org/chromium/src.git@gpu-per-event-latency-6-small
Patch Set: fix mac_rel compiler error. Move kMaxLatencyInfoNumber to .cc file Created 6 years, 11 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 "content/browser/renderer_host/compositing_iosurface_mac.h" 5 #include "content/browser/renderer_host/compositing_iosurface_mac.h"
6 6
7 #include <OpenGL/CGLRenderers.h> 7 #include <OpenGL/CGLRenderers.h>
8 #include <OpenGL/OpenGL.h> 8 #include <OpenGL/OpenGL.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 DestroyAllCopyContextsWithinContext(); 325 DestroyAllCopyContextsWithinContext();
326 UnrefIOSurfaceWithContextCurrent(); 326 UnrefIOSurfaceWithContextCurrent();
327 CGLSetCurrentContext(0); 327 CGLSetCurrentContext(0);
328 offscreen_context_ = NULL; 328 offscreen_context_ = NULL;
329 } 329 }
330 330
331 bool CompositingIOSurfaceMac::SetIOSurface( 331 bool CompositingIOSurfaceMac::SetIOSurface(
332 uint64 io_surface_handle, 332 uint64 io_surface_handle,
333 const gfx::Size& size, 333 const gfx::Size& size,
334 float scale_factor, 334 float scale_factor,
335 const ui::LatencyInfo& latency_info) { 335 const std::vector<ui::LatencyInfo>& latency_info) {
336 pixel_io_surface_size_ = size; 336 pixel_io_surface_size_ = size;
337 scale_factor_ = scale_factor; 337 scale_factor_ = scale_factor;
338 dip_io_surface_size_ = gfx::ToFlooredSize( 338 dip_io_surface_size_ = gfx::ToFlooredSize(
339 gfx::ScaleSize(pixel_io_surface_size_, 1.0 / scale_factor_)); 339 gfx::ScaleSize(pixel_io_surface_size_, 1.0 / scale_factor_));
340 340
341 CGLError cgl_error = CGLSetCurrentContext(offscreen_context_->cgl_context()); 341 CGLError cgl_error = CGLSetCurrentContext(offscreen_context_->cgl_context());
342 if (cgl_error != kCGLNoError) { 342 if (cgl_error != kCGLNoError) {
343 LOG(ERROR) << "CGLSetCurrentContext error in SetIOSurface: " << cgl_error; 343 LOG(ERROR) << "CGLSetCurrentContext error in SetIOSurface: " << cgl_error;
344 return false; 344 return false;
345 } 345 }
346 bool result = MapIOSurfaceToTexture(io_surface_handle); 346 bool result = MapIOSurfaceToTexture(io_surface_handle);
347 CGLSetCurrentContext(0); 347 CGLSetCurrentContext(0);
348 latency_info_.MergeWith(latency_info); 348 for (size_t i = 0; i < latency_info.size(); i++) {
349 latency_info_.push_back(latency_info[i]);
350 }
349 return result; 351 return result;
350 } 352 }
351 353
352 int CompositingIOSurfaceMac::GetRendererID() { 354 int CompositingIOSurfaceMac::GetRendererID() {
353 GLint current_renderer_id = -1; 355 GLint current_renderer_id = -1;
354 if (CGLGetParameter(offscreen_context_->cgl_context(), 356 if (CGLGetParameter(offscreen_context_->cgl_context(),
355 kCGLCPCurrentRendererID, 357 kCGLCPCurrentRendererID,
356 &current_renderer_id) == kCGLNoError) 358 &current_renderer_id) == kCGLNoError)
357 return current_renderer_id & kCGLRendererIDMatchingMask; 359 return current_renderer_id & kCGLRendererIDMatchingMask;
358 return -1; 360 return -1;
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 } 490 }
489 } 491 }
490 492
491 // Check if any of the drawing calls result in an error. 493 // Check if any of the drawing calls result in an error.
492 GetAndSaveGLError(); 494 GetAndSaveGLError();
493 if (gl_error_ != GL_NO_ERROR) { 495 if (gl_error_ != GL_NO_ERROR) {
494 LOG(ERROR) << "GL error in DrawIOSurface: " << gl_error_; 496 LOG(ERROR) << "GL error in DrawIOSurface: " << gl_error_;
495 result = false; 497 result = false;
496 } 498 }
497 499
498 latency_info_.AddLatencyNumber( 500 for (size_t i = 0; i < latency_info_.size(); i++) {
499 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); 501 latency_info_[i].AddLatencyNumber(
502 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0);
503 }
500 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info_); 504 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info_);
501 latency_info_.Clear(); 505 latency_info_.clear();
502 506
503 // Try to finish previous copy requests after flush to get better pipelining. 507 // Try to finish previous copy requests after flush to get better pipelining.
504 CheckIfAllCopiesAreFinished(false); 508 CheckIfAllCopiesAreFinished(false);
505 509
506 StartOrContinueDisplayLink(); 510 StartOrContinueDisplayLink();
507 511
508 return result; 512 return result;
509 } 513 }
510 514
511 void CompositingIOSurfaceMac::CopyTo( 515 void CompositingIOSurfaceMac::CopyTo(
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 } 1043 }
1040 1044
1041 GLenum CompositingIOSurfaceMac::GetAndSaveGLError() { 1045 GLenum CompositingIOSurfaceMac::GetAndSaveGLError() {
1042 GLenum gl_error = glGetError(); 1046 GLenum gl_error = glGetError();
1043 if (gl_error_ == GL_NO_ERROR) 1047 if (gl_error_ == GL_NO_ERROR)
1044 gl_error_ = gl_error; 1048 gl_error_ = gl_error;
1045 return gl_error; 1049 return gl_error;
1046 } 1050 }
1047 1051
1048 } // namespace content 1052 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/compositing_iosurface_mac.h ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698