1 #ifndef __DALI_INTERNAL_VSYNC_NOTIFIER_H__
2 #define __DALI_INTERNAL_VSYNC_NOTIFIER_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.
31 class PlatformAbstraction;
33 } // namespace Integration
41 class VSyncMonitorInterface;
42 class UpdateRenderSynchronization;
43 class EnvironmentOptions;
44 class AdaptorInternalServices;
47 * Implements a simple class that either monitors vertical blanks from libdrm, or manages
48 * a software timer to handle syncing.
55 * Create the vsync notification thread; this will not start to monitor vsync and
56 * send notifications until Start() is called.
57 * @param[in] sync An object used to synchronize update, render and vsync threads.
58 * @param[in] adaptorInterfaces base adaptor interface
59 * @param[in] environmentOptions environment options
61 VSyncNotifier( UpdateRenderSynchronization& sync,
62 AdaptorInternalServices& adaptorInterfaces,
63 const EnvironmentOptions& environmentOptions);
66 * Non-virtual destructor; VSyncNotifier is not suitable as a base class.
83 * The main thread loop. The system thread will be destroyed on
84 * exit from this function.
89 * Helper for the thread calling the entry function
90 * @param[in] This A pointer to the current VSyncNotifier object
92 static inline void* InternalThreadEntryFunc( void* This )
94 ( static_cast<VSyncNotifier*>( This ) )->Run();
100 UpdateRenderSynchronization& mUpdateRenderSync; ///< Used to synchronize the update, render & vsync threads
101 Dali::Integration::Core& mCore; ///< Dali core reference
102 Integration::PlatformAbstraction& mPlatformAbstraction; ///< The platform abstraction for retrieving the current time etc.
103 VSyncMonitorInterface* mVSyncMonitor; ///< VSyncMonitor interface
104 pthread_t* mThread; ///< The actual thread.
105 const EnvironmentOptions& mEnvironmentOptions; ///< Environment options
106 unsigned int mNumberOfVSyncsPerRender;///< How many frames for each update/render cycle.
108 }; // class VSyncNotifier
110 } // namespace Adaptor
112 } // namespace Internal
116 #endif // __DALI_INTERNAL_VSYNC_NOTIFIER_H__