#ifndef __DALI_INTERNAL_VSYNC_NOTIFIER_H__
#define __DALI_INTERNAL_VSYNC_NOTIFIER_H__
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-namespace boost
-{
-
-class thread;
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
-} // namespace boost
+// EXTERNAL INCLUDES
+#include <pthread.h>
namespace Dali
{
{
class VSyncMonitorInterface;
-class UpdateRenderSynchronization;
+class ThreadSynchronization;
class EnvironmentOptions;
class AdaptorInternalServices;
/**
- * Implements a simple class that monitors vertical blanks from libdrm
- * and sends a notification to Core.
+ * Implements a simple class that either monitors vertical blanks from libdrm, or manages
+ * a software timer to handle syncing.
*/
class VSyncNotifier
{
* @param[in] adaptorInterfaces base adaptor interface
* @param[in] environmentOptions environment options
*/
- VSyncNotifier( UpdateRenderSynchronization& sync,
+ VSyncNotifier( ThreadSynchronization& sync,
AdaptorInternalServices& adaptorInterfaces,
const EnvironmentOptions& environmentOptions);
*/
void Run();
+ /**
+ * Helper for the thread calling the entry function
+ * @param[in] This A pointer to the current VSyncNotifier object
+ */
+ static inline void* InternalThreadEntryFunc( void* This )
+ {
+ ( static_cast<VSyncNotifier*>( This ) )->Run();
+ return NULL;
+ }
+
private:
- UpdateRenderSynchronization& mUpdateRenderSync; ///< Used to synchronize the update, render & vsync threads
- Dali::Integration::Core& mCore; ///< Dali core reference
- Integration::PlatformAbstraction& mPlatformAbstraction; ///< The platform abstraction for retrieving the current time etc.
- VSyncMonitorInterface* mVSyncMonitor; ///< VSyncMonitor interface
- boost::thread* mThread; ///< The actual thread.
- const EnvironmentOptions& mEnvironmentOptions; ///< Environment options
+ ThreadSynchronization& mThreadSynchronization; ///< Used to synchronize all the threads
+ Dali::Integration::Core& mCore; ///< Dali core reference
+ Integration::PlatformAbstraction& mPlatformAbstraction; ///< The platform abstraction for retrieving the current time etc.
+ VSyncMonitorInterface* mVSyncMonitor; ///< VSyncMonitor interface
+ pthread_t* mThread; ///< The actual thread.
+ const EnvironmentOptions& mEnvironmentOptions; ///< Environment options
+ unsigned int mNumberOfVSyncsPerRender; ///< How many frames for each update/render cycle.
}; // class VSyncNotifier