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

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

Issue 1532813002: Replace IOSurfaceManager by directly passing IOSurface Mach ports over Chrome IPC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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
« no previous file with comments | « content/common/gpu/gpu_messages.h ('k') | content/common/mac/io_surface_manager_messages.h » ('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/command_line.h" 23 #include "base/command_line.h"
24 #include "base/mac/scoped_cftyperef.h" 24 #include "base/mac/scoped_cftyperef.h"
25 #include "content/common/gpu/gpu_messages.h" 25 #include "content/common/gpu/gpu_messages.h"
26 #include "ui/accelerated_widget_mac/io_surface_context.h" 26 #include "ui/accelerated_widget_mac/io_surface_context.h"
27 #include "ui/accelerated_widget_mac/surface_handle_types.h"
28 #include "ui/base/cocoa/animation_utils.h" 27 #include "ui/base/cocoa/animation_utils.h"
29 #include "ui/base/cocoa/remote_layer_api.h" 28 #include "ui/base/cocoa/remote_layer_api.h"
30 #include "ui/base/ui_base_switches.h" 29 #include "ui/base/ui_base_switches.h"
31 #include "ui/gfx/geometry/dip_util.h" 30 #include "ui/gfx/geometry/dip_util.h"
32 #include "ui/gfx/transform.h" 31 #include "ui/gfx/transform.h"
33 #include "ui/gl/gl_context.h" 32 #include "ui/gl/gl_context.h"
34 #include "ui/gl/gl_fence.h" 33 #include "ui/gl/gl_fence.h"
35 #include "ui/gl/gl_image_io_surface.h" 34 #include "ui/gl/gl_image_io_surface.h"
36 #include "ui/gl/gpu_switching_manager.h" 35 #include "ui/gl/gpu_switching_manager.h"
37 #include "ui/gl/scoped_api.h" 36 #include "ui/gl/scoped_api.h"
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 latency_info.AddLatencyNumberWithTimestamp( 457 latency_info.AddLatencyNumberWithTimestamp(
459 ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0, swap_time, 1); 458 ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0, swap_time, 1);
460 latency_info.AddLatencyNumberWithTimestamp( 459 latency_info.AddLatencyNumberWithTimestamp(
461 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0, 460 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0,
462 swap_time, 1); 461 swap_time, 1);
463 } 462 }
464 463
465 // Send acknowledgement to the browser. 464 // Send acknowledgement to the browser.
466 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; 465 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params;
467 if (use_remote_layer_api_) { 466 if (use_remote_layer_api_) {
468 params.surface_handle = 467 params.ca_context_id = [ca_context_ contextId];
469 ui::SurfaceHandleFromCAContextID([ca_context_ contextId]);
470 } else { 468 } else {
471 params.surface_handle = 469 params.io_surface.reset(
472 ui::SurfaceHandleFromIOSurfaceID(current_root_plane_->io_surface_id); 470 IOSurfaceCreateMachPort(current_root_plane_->io_surface));
473 } 471 }
474 params.size = swap->pixel_size; 472 params.size = swap->pixel_size;
475 params.scale_factor = swap->scale_factor; 473 params.scale_factor = swap->scale_factor;
476 params.latency_info.swap(swap->latency_info); 474 params.latency_info.swap(swap->latency_info);
477 helper_->SendAcceleratedSurfaceBuffersSwapped(params); 475 helper_->SendAcceleratedSurfaceBuffersSwapped(params);
478 476
479 // Remove this from the queue, and reset any callback timers. 477 // Remove this from the queue, and reset any callback timers.
480 pending_swaps_.pop_front(); 478 pending_swaps_.pop_front();
481 } 479 }
482 480
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 // Compute the previous vsync time. 862 // Compute the previous vsync time.
865 base::TimeTicks previous_vsync = 863 base::TimeTicks previous_vsync =
866 vsync_interval_ * ((from - vsync_timebase_) / vsync_interval_) + 864 vsync_interval_ * ((from - vsync_timebase_) / vsync_interval_) +
867 vsync_timebase_; 865 vsync_timebase_;
868 866
869 // Return |interval_fraction| through the next vsync. 867 // Return |interval_fraction| through the next vsync.
870 return previous_vsync + (1 + interval_fraction) * vsync_interval_; 868 return previous_vsync + (1 + interval_fraction) * vsync_interval_;
871 } 869 }
872 870
873 } // namespace content 871 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_messages.h ('k') | content/common/mac/io_surface_manager_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698