OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BEGIN_FRAME_ARGS_H_ | 5 #ifndef CC_OUTPUT_BEGIN_FRAME_ARGS_H_ |
6 #define CC_OUTPUT_BEGIN_FRAME_ARGS_H_ | 6 #define CC_OUTPUT_BEGIN_FRAME_ARGS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 private: | 104 private: |
105 BeginFrameArgs(uint32_t source_id, | 105 BeginFrameArgs(uint32_t source_id, |
106 uint64_t sequence_number, | 106 uint64_t sequence_number, |
107 base::TimeTicks frame_time, | 107 base::TimeTicks frame_time, |
108 base::TimeTicks deadline, | 108 base::TimeTicks deadline, |
109 base::TimeDelta interval, | 109 base::TimeDelta interval, |
110 BeginFrameArgsType type); | 110 BeginFrameArgsType type); |
111 }; | 111 }; |
112 | 112 |
| 113 // Sent by a BeginFrameObserver as acknowledgment of completing a BeginFrame. |
| 114 struct CC_EXPORT BeginFrameAck { |
| 115 BeginFrameAck(); |
| 116 BeginFrameAck(uint32_t source_id, |
| 117 uint64_t sequence_number, |
| 118 uint64_t latest_confirmed_sequence_number, |
| 119 uint32_t remaining_frames, |
| 120 bool has_damage); |
| 121 |
| 122 // Sequence number of the BeginFrame that is acknowledged. |
| 123 uint64_t sequence_number; |
| 124 |
| 125 // Sequence number of the latest BeginFrame that was positively acknowledged |
| 126 // (confirmed) by the observer. |
| 127 // |
| 128 // There are two scenarios for a positive acknowledgment: |
| 129 // a) All of the observer's pending updates led to successful damage (e.g. a |
| 130 // CompositorFrame or a damaged surface). |
| 131 // b) The observer did not have any updates and thus did not need to |
| 132 // produce damage. |
| 133 // A negative acknowledgment, in contrast, describes a situation in which the |
| 134 // observer had pending updates, but was unable to successfully produce |
| 135 // corresponding damage for all its updates in time. |
| 136 // |
| 137 // As a result, |latest_confirmed_sequence_number| describes the "staleness" |
| 138 // of the last damage that was produced by the observer. Note that even if |
| 139 // |has_damage == true|, the damage produced as a result of the acknowledged |
| 140 // BeginFrame may be stale |
| 141 // (|latest_confirmed_sequence_number < sequence_number|). In such a case, the |
| 142 // damage that was produced may contain updates from previous BeginFrames or |
| 143 // only part of this BeginFrame's updates. |
| 144 // |
| 145 // Observers aggregate the |latest_confirmed_sequence_number| of their |
| 146 // children: The compositor Scheduler indicates the latest BeginFrame that |
| 147 // both impl and main thread confirmed. Likewise, the DisplayScheduler |
| 148 // indicates the minimum |latest_confirmed_sequence_number| that all its |
| 149 // BeginFrameObservers acknowledged. |
| 150 // TODO(eseckler): Set this in Scheduler / DisplayScheduler and other |
| 151 // observers according to above comment. |
| 152 uint64_t latest_confirmed_sequence_number; |
| 153 |
| 154 // Source identifier of the BeginFrame that is acknowledged. The |
| 155 // BeginFrameSource that receives the acknowledgment uses this to discard |
| 156 // BeginFrameAcks for BeginFrames sent by a different source. Such a situation |
| 157 // may occur when the BeginFrameSource of the observer changes while a |
| 158 // BeginFrame from the old source is still in flight. |
| 159 uint32_t source_id; // |source_id| after above fields for packing. |
| 160 |
| 161 // Number of BeginFrames queued at the observer at time of acknowledgment. |
| 162 // TODO(eseckler): Remove this field and replace with ack-tracking if needed. |
| 163 uint32_t remaining_frames; |
| 164 |
| 165 // |true| if the observer has produced damage (e.g. sent a CompositorFrame or |
| 166 // damaged a surface) as part of responding to the BeginFrame. |
| 167 bool has_damage; |
| 168 }; |
| 169 |
113 } // namespace cc | 170 } // namespace cc |
114 | 171 |
115 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_ | 172 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_ |
OLD | NEW |