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

Side by Side Diff: cc/output/output_surface.h

Issue 199523002: cc: Throttle swaps in Scheduler instead of OutputSurface (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 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
OLDNEW
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // (namely Android WebView), this is called to determine whether the software 97 // (namely Android WebView), this is called to determine whether the software
98 // device should be used on the current frame. 98 // device should be used on the current frame.
99 virtual bool ForcedDrawToSoftwareDevice() const; 99 virtual bool ForcedDrawToSoftwareDevice() const;
100 100
101 // Called by the compositor on the compositor thread. This is a place where 101 // Called by the compositor on the compositor thread. This is a place where
102 // thread-specific data for the output surface can be initialized, since from 102 // thread-specific data for the output surface can be initialized, since from
103 // this point on the output surface will only be used on the compositor 103 // this point on the output surface will only be used on the compositor
104 // thread. 104 // thread.
105 virtual bool BindToClient(OutputSurfaceClient* client); 105 virtual bool BindToClient(OutputSurfaceClient* client);
106 106
107 // Enable or disable vsync.
108 void SetThrottleFrameProduction(bool enable);
109
107 void InitializeBeginImplFrameEmulation( 110 void InitializeBeginImplFrameEmulation(
brianderson 2014/03/13 21:11:52 In the interest of simplifying OutputSurface, we c
108 base::SingleThreadTaskRunner* task_runner, 111 base::SingleThreadTaskRunner* task_runner,
109 bool throttle_frame_production,
110 base::TimeDelta interval); 112 base::TimeDelta interval);
111 113
112 void SetMaxFramesPending(int max_frames_pending);
113
114 virtual void EnsureBackbuffer(); 114 virtual void EnsureBackbuffer();
115 virtual void DiscardBackbuffer(); 115 virtual void DiscardBackbuffer();
116 116
117 virtual void Reshape(const gfx::Size& size, float scale_factor); 117 virtual void Reshape(const gfx::Size& size, float scale_factor);
118 virtual gfx::Size SurfaceSize() const; 118 virtual gfx::Size SurfaceSize() const;
119 119
120 virtual void BindFramebuffer(); 120 virtual void BindFramebuffer();
121 121
122 // The implementation may destroy or steal the contents of the CompositorFrame 122 // The implementation may destroy or steal the contents of the CompositorFrame
123 // passed in (though it will not take ownership of the CompositorFrame 123 // passed in (though it will not take ownership of the CompositorFrame
(...skipping 25 matching lines...) Expand all
149 scoped_refptr<ContextProvider> offscreen_context_provider); 149 scoped_refptr<ContextProvider> offscreen_context_provider);
150 void ReleaseGL(); 150 void ReleaseGL();
151 151
152 void PostSwapBuffersComplete(); 152 void PostSwapBuffersComplete();
153 153
154 struct OutputSurface::Capabilities capabilities_; 154 struct OutputSurface::Capabilities capabilities_;
155 scoped_refptr<ContextProvider> context_provider_; 155 scoped_refptr<ContextProvider> context_provider_;
156 scoped_ptr<SoftwareOutputDevice> software_device_; 156 scoped_ptr<SoftwareOutputDevice> software_device_;
157 gfx::Size surface_size_; 157 gfx::Size surface_size_;
158 float device_scale_factor_; 158 float device_scale_factor_;
159 base::TimeDelta begin_impl_frame_interval_;
159 160
160 // The FrameRateController is deprecated. 161 // The FrameRateController is deprecated.
161 // Platforms should move to native BeginImplFrames instead. 162 // Platforms should move to native BeginImplFrames instead.
162 void CommitVSyncParameters(base::TimeTicks timebase, 163 void CommitVSyncParameters(base::TimeTicks timebase,
163 base::TimeDelta interval); 164 base::TimeDelta interval);
164 virtual void FrameRateControllerTick(bool throttled, 165 virtual void FrameRateControllerTick(const BeginFrameArgs& args) OVERRIDE;
165 const BeginFrameArgs& args) OVERRIDE;
166 scoped_ptr<FrameRateController> frame_rate_controller_; 166 scoped_ptr<FrameRateController> frame_rate_controller_;
167 int max_frames_pending_; 167 bool throttle_frame_production_;
168 int pending_swap_buffers_;
169 bool needs_begin_impl_frame_; 168 bool needs_begin_impl_frame_;
170 bool client_ready_for_begin_impl_frame_; 169 bool client_ready_for_begin_impl_frame_;
171 170
172 // This stores a BeginImplFrame that we couldn't process immediately, 171 // This stores a BeginImplFrame that we couldn't process immediately,
173 // but might process retroactively in the near future. 172 // but might process retroactively in the near future.
174 BeginFrameArgs skipped_begin_impl_frame_args_; 173 BeginFrameArgs skipped_begin_impl_frame_args_;
175 174
176 // Forwarded to OutputSurfaceClient but threaded through OutputSurface 175 // Forwarded to OutputSurfaceClient but threaded through OutputSurface
177 // first so OutputSurface has a chance to update the FrameRateController 176 // first so OutputSurface has a chance to update the FrameRateController
178 void SetNeedsRedrawRect(const gfx::Rect& damage_rect); 177 void SetNeedsRedrawRect(const gfx::Rect& damage_rect);
(...skipping 14 matching lines...) Expand all
193 void CheckForRetroactiveBeginImplFrame(); 192 void CheckForRetroactiveBeginImplFrame();
194 193
195 private: 194 private:
196 OutputSurfaceClient* client_; 195 OutputSurfaceClient* client_;
197 196
198 void SetUpContext3d(); 197 void SetUpContext3d();
199 void ResetContext3d(); 198 void ResetContext3d();
200 void SetMemoryPolicy(const ManagedMemoryPolicy& policy); 199 void SetMemoryPolicy(const ManagedMemoryPolicy& policy);
201 void UpdateAndMeasureGpuLatency(); 200 void UpdateAndMeasureGpuLatency();
202 201
202 bool is_lost_;
203
203 // check_for_retroactive_begin_impl_frame_pending_ is used to avoid posting 204 // check_for_retroactive_begin_impl_frame_pending_ is used to avoid posting
204 // redundant checks for a retroactive BeginImplFrame. 205 // redundant checks for a retroactive BeginImplFrame.
205 bool check_for_retroactive_begin_impl_frame_pending_; 206 bool check_for_retroactive_begin_impl_frame_pending_;
206 207
207 bool external_stencil_test_enabled_; 208 bool external_stencil_test_enabled_;
208 209
209 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; 210 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_;
210 211
211 std::deque<unsigned> available_gpu_latency_query_ids_; 212 std::deque<unsigned> available_gpu_latency_query_ids_;
212 std::deque<unsigned> pending_gpu_latency_query_ids_; 213 std::deque<unsigned> pending_gpu_latency_query_ids_;
213 RollingTimeDeltaHistory gpu_latency_history_; 214 RollingTimeDeltaHistory gpu_latency_history_;
214 215
215 DISALLOW_COPY_AND_ASSIGN(OutputSurface); 216 DISALLOW_COPY_AND_ASSIGN(OutputSurface);
216 }; 217 };
217 218
218 } // namespace cc 219 } // namespace cc
219 220
220 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ 221 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698