1 #ifndef __DALI_INTERNAL_UPDATE_THREAD_H__
2 #define __DALI_INTERNAL_UPDATE_THREAD_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/common/vector-wrapper.h>
45 class UpdateRenderSynchronization;
46 class AdaptorInternalServices;
47 class TriggerEventInterface;
48 class EnvironmentOptions;
51 * The update-thread is responsible for calling Core::Update(), and
52 * for triggering the render-thread after each update.
59 * Create the update-thread; this will not do anything until Start() is called.
60 * @param[in] sync An object used to synchronize update & render threads.
61 * @param[in] adaptorInterfaces base adaptor interface
62 * @param[in] environmentOptions environment options
64 UpdateThread(UpdateRenderSynchronization& sync,
65 AdaptorInternalServices& adaptorInterfaces,
66 const EnvironmentOptions& environmentOptions );
69 * Non-virtual destructor; UpdateThread is not suitable as a base class.
74 * Starts the update-thread
79 * Stops the update-thread
86 * This method is used by the update-thread for calling Core::Update().
87 * @return true, if the thread finishes properly.
92 * When DALI_FPS_TRACKING is enabled, this method calculates the frame rates for the specified time period
94 void FPSTracking(float secondsFromLastFrame);
97 * Output the FPS information
98 * when the FSP tracking is enabled,
99 * it is called when the specified tracking period is elapsed or in the destructor when the process finished beforehand
101 void OutputFPSRecord();
104 * Optionally output the update thread status.
105 * @param[in] keepUpdatingStatus Whether the update-thread requested further updates.
106 * @param[in] renderNeedsUpdate Whether the render-thread requested another update.
108 void UpdateStatusLogging( unsigned int keepUpdatingStatus, bool renderNeedsUpdate );
112 UpdateRenderSynchronization& mUpdateRenderSync; ///< Used to synchronize the update & render threads
114 Dali::Integration::Core& mCore; ///< Dali core reference
116 unsigned int mFpsTrackingSeconds; ///< fps tracking time length in seconds
117 std::vector<float> mFpsRecord; ///< Record of frame rate
118 float mElapsedTime; ///< time elapsed within current second
119 unsigned int mElapsedSeconds; ///< seconds elapsed since the fps tracking started
121 unsigned int mStatusLogInterval; ///< Interval in frames between status debug prints
122 unsigned int mStatusLogCount; ///< Used to count frames between status debug prints
124 TriggerEventInterface& mNotificationTrigger; ///< Reference to notification event trigger
126 boost::thread* mThread; ///< The actual update-thread.
127 const EnvironmentOptions& mEnvironmentOptions; ///< environment options
128 }; // class UpdateThread
130 } // namespace Adaptor
132 } // namespace Internal
136 #endif // __DALI_INTERNAL_UPDATE_THREAD_H__