Dali 3D User Interface Engine
frame-time.h
Go to the documentation of this file.
1 #ifndef __DALI_INTERNAL_ADAPTOR_FRAME_TIME_H__
2 #define __DALI_INTERNAL_ADAPTOR_FRAME_TIME_H__
3 
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20 
21 // EXTERNAL INCLUDES
22 #include <stdint.h>
23 
24 namespace Dali
25 {
26 
27 namespace Integration
28 {
29 class PlatformAbstraction;
30 }
31 
32 namespace Internal
33 {
34 namespace Adaptor
35 {
36 
41 class FrameTime
42 {
43 public:
44 
45  // Called from Event thread
46 
50  FrameTime();
51 
55  ~FrameTime();
56 
61  void SetMinimumFrameTimeInterval( unsigned int interval );
62 
66  void Suspend();
67 
71  void Resume();
72 
73  // Called from Update thread
74 
78  void Sleep();
79 
83  void WakeUp();
84 
94  void PredictNextSyncTime( float& lastFrameDeltaSeconds, unsigned int& lastVSyncTimeMilliseconds, unsigned int& nextVSyncTimeMilliseconds );
95 
96  // Called from VSync thread
97 
105  void SetSyncTime( unsigned int frameNumber );
106 
107 private:
108 
112  inline void SetLastSyncTime();
113 
114 private:
115 
117 
118  uint64_t mLastSyncTime;
120 
121  unsigned int mLastSyncFrameNumber;
122  unsigned int mLastUpdateFrameNumber;
123 
124  // NOTE cannot use bitfields or booleans as these are used from multiple threads, must use variable with machine word size for atomic read/write
125  unsigned int mRunning;
126  unsigned int mFirstFrame;
127 
128  unsigned int mPreviousUpdateFrames[3];
129  unsigned int writePos;
130 
131  unsigned int mExtraUpdatesSinceSync;
132 };
133 
134 } // namespace Adaptor
135 } // namespace Internal
136 } // namespace Dali
137 
138 #endif // __DALI_INTERNAL_ADAPTOR_FRAME_TIME_H__
Dali Docs Home
Read more about Dali