OLD | NEW |
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 #ifndef CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ | 5 #ifndef CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ | 6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <IOSurface/IOSurface.h> | 9 #include <IOSurface/IOSurface.h> |
10 #include <OpenGL/CGLTypes.h> | 10 #include <OpenGL/CGLTypes.h> |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 ~PendingSwap(); | 58 ~PendingSwap(); |
59 // The IOSurface with new content for this swap. | 59 // The IOSurface with new content for this swap. |
60 base::ScopedCFTypeRef<IOSurfaceRef> io_surface; | 60 base::ScopedCFTypeRef<IOSurfaceRef> io_surface; |
61 | 61 |
62 // A fence object, and the CGL context it was issued in. | 62 // A fence object, and the CGL context it was issued in. |
63 base::ScopedTypeRef<CGLContextObj> cgl_context; | 63 base::ScopedTypeRef<CGLContextObj> cgl_context; |
64 GLuint fence; | 64 GLuint fence; |
65 | 65 |
66 // The size of the full frame, in dip. | 66 // The size of the full frame, in dip. |
67 gfx::Size dip_size; | 67 gfx::Size dip_size; |
| 68 |
| 69 // If true, the partial damage rect for the frame. |
| 70 bool use_partial_damage; |
| 71 gfx::Rect dip_partial_damage_rect; |
68 }; | 72 }; |
69 | 73 |
70 ~ImageTransportSurfaceOverlayMac() override; | 74 ~ImageTransportSurfaceOverlayMac() override; |
71 | 75 |
72 gfx::SwapResult SwapBuffersInternal(const gfx::Rect& pixel_damage_rect); | 76 gfx::SwapResult SwapBuffersInternal(const gfx::Rect& pixel_damage_rect); |
73 | 77 |
74 // Check the oldest swap in |pending_swaps_|, and, if its fence has passed, | 78 // Check the oldest swap in |pending_swaps_|, and, if its fence has passed, |
75 // send the content to the window server by -[CALayer setContents:]. If | 79 // send the content to the window server by -[CALayer setContents:]. If |
76 void CheckAndDisplayPendingSwaps(bool force_immediate_display); | 80 void CheckAndDisplayPendingSwaps(bool force_immediate_display); |
77 | 81 |
78 // Post a call to CheckAndDisplayPendingSwaps at the next midpoint of a | 82 // Post a call to CheckAndDisplayPendingSwaps at the next midpoint of a |
79 // vsync period. | 83 // vsync period. |
80 void PostCheckAndDisplayPendingSwaps(); | 84 void PostCheckAndDisplayPendingSwaps(); |
81 | 85 |
82 scoped_ptr<ImageTransportHelper> helper_; | 86 scoped_ptr<ImageTransportHelper> helper_; |
83 base::scoped_nsobject<CAContext> ca_context_; | 87 base::scoped_nsobject<CAContext> ca_context_; |
84 base::scoped_nsobject<CALayer> layer_; | 88 base::scoped_nsobject<CALayer> layer_; |
| 89 base::scoped_nsobject<CALayer> partial_damage_layer_; |
85 | 90 |
86 gfx::Size pixel_size_; | 91 gfx::Size pixel_size_; |
87 float scale_factor_; | 92 float scale_factor_; |
88 std::vector<ui::LatencyInfo> latency_info_; | 93 std::vector<ui::LatencyInfo> latency_info_; |
89 | 94 |
90 // Weak pointer to the image provided when ScheduleOverlayPlane is called. Is | 95 // Weak pointer to the image provided when ScheduleOverlayPlane is called. Is |
91 // consumed and reset when SwapBuffers is called. For now, only one overlay | 96 // consumed and reset when SwapBuffers is called. For now, only one overlay |
92 // plane is supported. | 97 // plane is supported. |
93 gfx::GLImage* pending_overlay_image_; | 98 gfx::GLImage* pending_overlay_image_; |
94 | 99 |
95 // A queue of all frames that have been created by SwapBuffersInternal but | 100 // A queue of all frames that have been created by SwapBuffersInternal but |
96 // have not yet been displayed by CheckAndDisplayPendingSwaps. | 101 // have not yet been displayed by CheckAndDisplayPendingSwaps. |
97 std::deque<PendingSwap> pending_swaps_; | 102 std::deque<PendingSwap> pending_swaps_; |
98 | 103 |
| 104 // The union of the damage rects of SwapBuffersInternal since the last |
| 105 // non-partial swap. |
| 106 gfx::Rect accumulated_partial_damage_pixel_rect_; |
| 107 |
99 // The display link used to compute the delay for the posted task in | 108 // The display link used to compute the delay for the posted task in |
100 // PostCheckAndDisplayPendingSwaps. | 109 // PostCheckAndDisplayPendingSwaps. |
101 scoped_refptr<ui::DisplayLinkMac> display_link_mac_; | 110 scoped_refptr<ui::DisplayLinkMac> display_link_mac_; |
102 | 111 |
103 base::WeakPtrFactory<ImageTransportSurfaceOverlayMac> weak_factory_; | 112 base::WeakPtrFactory<ImageTransportSurfaceOverlayMac> weak_factory_; |
104 }; | 113 }; |
105 | 114 |
106 } // namespace content | 115 } // namespace content |
107 | 116 |
108 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ | 117 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
OLD | NEW |