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

Side by Side Diff: content/common/gpu/image_transport_surface_overlay_mac.mm

Issue 1711533002: Decouple browser-specific GPU IPC messages from GPU service IPCs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restored if guards on GpuChannelManager Created 4 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
« no previous file with comments | « content/common/gpu/image_transport_surface_overlay_mac.h ('k') | content/content_common.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/image_transport_surface_overlay_mac.h" 5 #include "content/common/gpu/image_transport_surface_overlay_mac.h"
6 6
7 #include <CoreGraphics/CoreGraphics.h> 7 #include <CoreGraphics/CoreGraphics.h>
8 #include <IOSurface/IOSurface.h> 8 #include <IOSurface/IOSurface.h>
9 #include <OpenGL/CGLRenderers.h> 9 #include <OpenGL/CGLRenderers.h>
10 #include <OpenGL/CGLTypes.h> 10 #include <OpenGL/CGLTypes.h>
11 #include <OpenGL/gl.h> 11 #include <OpenGL/gl.h>
12 #include <stddef.h> 12 #include <stddef.h>
13 13
14 #include <algorithm> 14 #include <algorithm>
15 15
16 // This type consistently causes problem on Mac, and needs to be dealt with 16 // This type consistently causes problem on Mac, and needs to be dealt with
17 // in a systemic way. 17 // in a systemic way.
18 // http://crbug.com/517208 18 // http://crbug.com/517208
19 #ifndef GL_OES_EGL_image 19 #ifndef GL_OES_EGL_image
20 typedef void* GLeglImageOES; 20 typedef void* GLeglImageOES;
21 #endif 21 #endif
22 22
23 #include "base/mac/scoped_cftyperef.h" 23 #include "base/mac/scoped_cftyperef.h"
24 #include "base/trace_event/trace_event.h" 24 #include "base/trace_event/trace_event.h"
25 #include "content/common/gpu/accelerated_surface_buffers_swapped_params_mac.h"
26 #include "content/common/gpu/buffer_presented_params_mac.h"
25 #include "content/common/gpu/ca_layer_partial_damage_tree_mac.h" 27 #include "content/common/gpu/ca_layer_partial_damage_tree_mac.h"
26 #include "content/common/gpu/ca_layer_tree_mac.h" 28 #include "content/common/gpu/ca_layer_tree_mac.h"
27 #include "content/common/gpu/gpu_messages.h"
28 #include "ui/accelerated_widget_mac/io_surface_context.h" 29 #include "ui/accelerated_widget_mac/io_surface_context.h"
29 #include "ui/base/cocoa/animation_utils.h" 30 #include "ui/base/cocoa/animation_utils.h"
30 #include "ui/base/cocoa/remote_layer_api.h" 31 #include "ui/base/cocoa/remote_layer_api.h"
31 #include "ui/gfx/geometry/rect_conversions.h" 32 #include "ui/gfx/geometry/rect_conversions.h"
32 #include "ui/gfx/transform.h" 33 #include "ui/gfx/transform.h"
33 #include "ui/gl/gl_context.h" 34 #include "ui/gl/gl_context.h"
34 #include "ui/gl/gl_fence.h" 35 #include "ui/gl/gl_fence.h"
35 #include "ui/gl/gl_image_io_surface.h" 36 #include "ui/gl/gl_image_io_surface.h"
36 #include "ui/gl/gpu_switching_manager.h" 37 #include "ui/gl/gpu_switching_manager.h"
37 #include "ui/gl/scoped_api.h" 38 #include "ui/gl/scoped_api.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 base::TimeTicks swap_time = base::TimeTicks::Now(); 303 base::TimeTicks swap_time = base::TimeTicks::Now();
303 for (auto latency_info : swap->latency_info) { 304 for (auto latency_info : swap->latency_info) {
304 latency_info.AddLatencyNumberWithTimestamp( 305 latency_info.AddLatencyNumberWithTimestamp(
305 ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0, swap_time, 1); 306 ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0, swap_time, 1);
306 latency_info.AddLatencyNumberWithTimestamp( 307 latency_info.AddLatencyNumberWithTimestamp(
307 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0, 308 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0,
308 swap_time, 1); 309 swap_time, 1);
309 } 310 }
310 311
311 // Send acknowledgement to the browser. 312 // Send acknowledgement to the browser.
312 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; 313 AcceleratedSurfaceBuffersSwappedParams params;
313 if (use_remote_layer_api_) { 314 if (use_remote_layer_api_) {
314 params.ca_context_id = [ca_context_ contextId]; 315 params.ca_context_id = [ca_context_ contextId];
315 } else if (current_partial_damage_tree_) { 316 } else if (current_partial_damage_tree_) {
316 params.io_surface.reset(IOSurfaceCreateMachPort( 317 params.io_surface.reset(IOSurfaceCreateMachPort(
317 current_partial_damage_tree_->RootLayerIOSurface())); 318 current_partial_damage_tree_->RootLayerIOSurface()));
318 } 319 }
319 params.size = swap->pixel_size; 320 params.size = swap->pixel_size;
320 params.scale_factor = swap->scale_factor; 321 params.scale_factor = swap->scale_factor;
321 params.latency_info.swap(swap->latency_info); 322 params.latency_info.swap(swap->latency_info);
322 helper_->SendAcceleratedSurfaceBuffersSwapped(params); 323 helper_->SendAcceleratedSurfaceBuffersSwapped(params);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 return pending_ca_layer_tree_->ScheduleCALayer( 448 return pending_ca_layer_tree_->ScheduleCALayer(
448 is_clipped, gfx::ToEnclosingRect(clip_rect), sorting_context_id, 449 is_clipped, gfx::ToEnclosingRect(clip_rect), sorting_context_id,
449 transform, io_surface, contents_rect, gfx::ToEnclosingRect(rect), 450 transform, io_surface, contents_rect, gfx::ToEnclosingRect(rect),
450 background_color, edge_aa_mask, opacity); 451 background_color, edge_aa_mask, opacity);
451 } 452 }
452 453
453 bool ImageTransportSurfaceOverlayMac::IsSurfaceless() const { 454 bool ImageTransportSurfaceOverlayMac::IsSurfaceless() const {
454 return true; 455 return true;
455 } 456 }
456 457
457 void ImageTransportSurfaceOverlayMac::OnBufferPresented( 458 void ImageTransportSurfaceOverlayMac::BufferPresented(
458 const AcceleratedSurfaceMsg_BufferPresented_Params& params) { 459 const BufferPresentedParams& params) {
459 vsync_timebase_ = params.vsync_timebase; 460 vsync_timebase_ = params.vsync_timebase;
460 vsync_interval_ = params.vsync_interval; 461 vsync_interval_ = params.vsync_interval;
461 vsync_parameters_valid_ = (vsync_interval_ != base::TimeDelta()); 462 vsync_parameters_valid_ = (vsync_interval_ != base::TimeDelta());
462 463
463 // Compute |vsync_timebase_| to be the first vsync after time zero. 464 // Compute |vsync_timebase_| to be the first vsync after time zero.
464 if (vsync_parameters_valid_) { 465 if (vsync_parameters_valid_) {
465 vsync_timebase_ -= 466 vsync_timebase_ -=
466 vsync_interval_ * 467 vsync_interval_ *
467 ((vsync_timebase_ - base::TimeTicks()) / vsync_interval_); 468 ((vsync_timebase_ - base::TimeTicks()) / vsync_interval_);
468 } 469 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 // Compute the previous vsync time. 515 // Compute the previous vsync time.
515 base::TimeTicks previous_vsync = 516 base::TimeTicks previous_vsync =
516 vsync_interval_ * ((from - vsync_timebase_) / vsync_interval_) + 517 vsync_interval_ * ((from - vsync_timebase_) / vsync_interval_) +
517 vsync_timebase_; 518 vsync_timebase_;
518 519
519 // Return |interval_fraction| through the next vsync. 520 // Return |interval_fraction| through the next vsync.
520 return previous_vsync + (1 + interval_fraction) * vsync_interval_; 521 return previous_vsync + (1 + interval_fraction) * vsync_interval_;
521 } 522 }
522 523
523 } // namespace content 524 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/image_transport_surface_overlay_mac.h ('k') | content/content_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698