OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef CC_OUTPUT_OUTPUT_SURFACE_H_ | 5 #ifndef CC_OUTPUT_OUTPUT_SURFACE_H_ |
6 #define CC_OUTPUT_OUTPUT_SURFACE_H_ | 6 #define CC_OUTPUT_OUTPUT_SURFACE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // processing should be stopped, or lowered in priority. | 131 // processing should be stopped, or lowered in priority. |
132 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) {} | 132 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) {} |
133 | 133 |
134 // Requests a BeginFrame notification from the output surface. The | 134 // Requests a BeginFrame notification from the output surface. The |
135 // notification will be delivered by calling | 135 // notification will be delivered by calling |
136 // OutputSurfaceClient::BeginFrame until the callback is disabled. | 136 // OutputSurfaceClient::BeginFrame until the callback is disabled. |
137 virtual void SetNeedsBeginFrame(bool enable) {} | 137 virtual void SetNeedsBeginFrame(bool enable) {} |
138 | 138 |
139 bool HasClient() { return !!client_; } | 139 bool HasClient() { return !!client_; } |
140 | 140 |
141 // Returns an estimate of the current GPU latency. When only a software | |
142 // device is present, returns 0. | |
143 base::TimeDelta GpuLatencyEstimate(); | |
144 | |
145 // Get the class capable of informing cc of hardware overlay capability. | 141 // Get the class capable of informing cc of hardware overlay capability. |
146 OverlayCandidateValidator* overlay_candidate_validator() const { | 142 OverlayCandidateValidator* overlay_candidate_validator() const { |
147 return overlay_candidate_validator_.get(); | 143 return overlay_candidate_validator_.get(); |
148 } | 144 } |
149 | 145 |
150 protected: | 146 protected: |
151 OutputSurfaceClient* client_; | 147 OutputSurfaceClient* client_; |
152 | 148 |
153 // Synchronously initialize context3d and enter hardware mode. | 149 // Synchronously initialize context3d and enter hardware mode. |
154 // This can only supported in threaded compositing mode. | 150 // This can only supported in threaded compositing mode. |
(...skipping 19 matching lines...) Expand all Loading... |
174 void SetExternalStencilTest(bool enabled); | 170 void SetExternalStencilTest(bool enabled); |
175 void SetExternalDrawConstraints(const gfx::Transform& transform, | 171 void SetExternalDrawConstraints(const gfx::Transform& transform, |
176 const gfx::Rect& viewport, | 172 const gfx::Rect& viewport, |
177 const gfx::Rect& clip, | 173 const gfx::Rect& clip, |
178 bool valid_for_tile_management); | 174 bool valid_for_tile_management); |
179 | 175 |
180 private: | 176 private: |
181 void SetUpContext3d(); | 177 void SetUpContext3d(); |
182 void ResetContext3d(); | 178 void ResetContext3d(); |
183 void SetMemoryPolicy(const ManagedMemoryPolicy& policy); | 179 void SetMemoryPolicy(const ManagedMemoryPolicy& policy); |
184 void UpdateAndMeasureGpuLatency(); | |
185 | 180 |
186 bool external_stencil_test_enabled_; | 181 bool external_stencil_test_enabled_; |
187 | 182 |
188 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; | 183 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; |
189 | 184 |
190 std::deque<unsigned> available_gpu_latency_query_ids_; | |
191 std::deque<unsigned> pending_gpu_latency_query_ids_; | |
192 RollingTimeDeltaHistory gpu_latency_history_; | |
193 | |
194 DISALLOW_COPY_AND_ASSIGN(OutputSurface); | 185 DISALLOW_COPY_AND_ASSIGN(OutputSurface); |
195 }; | 186 }; |
196 | 187 |
197 } // namespace cc | 188 } // namespace cc |
198 | 189 |
199 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ | 190 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ |
OLD | NEW |