Changed Core::Update to add current time and vsync times as parameters. 29/26429/3
authorDavid Steele <david.steele@partner.samsung.com>
Fri, 22 Aug 2014 09:56:46 +0000 (10:56 +0100)
committerDavid Steele <david.steele@partner.samsung.com>
Thu, 28 Aug 2014 10:32:41 +0000 (11:32 +0100)
Moved FrameTime class to Adaptor.

[Problem]  Dali core is trying to second guess what the Vsync monitor is doing
in adaptor.
[Solution] Remove FrameTime from dali-core, and instead pass in the correct
elapsed time and last/next vsync times to Update().

Change-Id: I002dea0c3e126fdb982990776c4ea7966b72758f
Signed-off-by: David Steele <david.steele@partner.samsung.com>
12 files changed:
automated-tests/src/dali-internal/utc-Dali-Internal-Material.cpp
automated-tests/src/dali/dali-test-suite-utils/test-application.cpp
automated-tests/src/dali/dali-test-suite-utils/test-application.h
dali/integration-api/core.cpp
dali/integration-api/core.h
dali/internal/common/core-impl.cpp
dali/internal/common/core-impl.h
dali/internal/common/frame-time.cpp [deleted file]
dali/internal/common/frame-time.h [deleted file]
dali/internal/file.list
dali/internal/update/manager/update-manager.cpp
dali/internal/update/manager/update-manager.h

index 4e3fe95..e5643c8 100644 (file)
@@ -364,10 +364,7 @@ int UtcDaliMaterialStaging01(void)
   Internal::SceneGraph::UpdateManager& updateManager = Internal::ThreadLocalStorage::Get().GetUpdateManager();
   AddMaterialMessage( updateManager, sceneObject );
   application.SendNotification(); // Flush update Q
-
-  application.GetPlatform().IncrementGetTimeResult( 1 );
-  Integration::UpdateStatus status;
-  application.GetCore().Update( status );
+  application.UpdateOnly(1);
 
   // Check that a render object has been created
   Internal::SceneGraph::RenderMaterial* renderMaterial = sceneObject->GetRenderMaterial();
@@ -418,10 +415,7 @@ int UtcDaliMaterialStaging02(void)
   Internal::SceneGraph::UpdateManager& updateManager = Internal::ThreadLocalStorage::Get().GetUpdateManager();
   AddMaterialMessage( updateManager, sceneObject );
   application.SendNotification(); // Flush update Q
-
-  application.GetPlatform().IncrementGetTimeResult( 1 );
-  Integration::UpdateStatus status;
-  application.GetCore().Update( status );
+  application.UpdateOnly(1);
 
   // Check that a render object has been created
   Internal::SceneGraph::RenderMaterial* renderMaterial = sceneObject->GetRenderMaterial();
index ea7e48e..c2680b2 100644 (file)
@@ -29,7 +29,8 @@ TestApplication::TestApplication( size_t surfaceWidth,
   mSurfaceWidth( surfaceWidth ),
   mSurfaceHeight( surfaceHeight ),
   mFrame( 0u ),
-  mDpi( horizontalDpi, verticalDpi )
+  mDpi( horizontalDpi, verticalDpi ),
+  mLastVSyncTime(0u)
 {
   Initialize();
 }
@@ -142,15 +143,23 @@ void TestApplication::SetSurfaceWidth( unsigned int width, unsigned height )
   mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight );
 }
 
-bool TestApplication::Render( unsigned int intervalMilliseconds  )
+void TestApplication::DoUpdate( unsigned int intervalMilliseconds )
 {
-  // Update Time values
-  mPlatformAbstraction.IncrementGetTimeResult( intervalMilliseconds );
   unsigned int seconds(0u), microseconds(0u);
   mPlatformAbstraction.GetTimeMicroseconds( seconds, microseconds );
+  mLastVSyncTime = ( seconds * 1e3 ) + ( microseconds / 1e3 );
+  unsigned int nextVSyncTime = mLastVSyncTime + 16;
+
+  // Update Time values
+  mPlatformAbstraction.IncrementGetTimeResult( intervalMilliseconds );
+
+  float elapsedSeconds = intervalMilliseconds / 1e3f;
+  mCore->Update( elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus );
+}
 
-  mCore->VSync( mFrame, seconds, microseconds );
-  mCore->Update( mStatus );
+bool TestApplication::Render( unsigned int intervalMilliseconds  )
+{
+  DoUpdate( intervalMilliseconds );
   mCore->Render( mRenderStatus );
 
   mFrame++;
@@ -165,14 +174,7 @@ unsigned int TestApplication::GetUpdateStatus()
 
 bool TestApplication::UpdateOnly( unsigned int intervalMilliseconds  )
 {
-  // Update Time values
-  mPlatformAbstraction.IncrementGetTimeResult( intervalMilliseconds );
-  unsigned int seconds(0u), microseconds(0u);
-  mPlatformAbstraction.GetTimeMicroseconds( seconds, microseconds );
-
-  mCore->VSync( mFrame, seconds, microseconds );
-  mCore->Update( mStatus );
-
+  DoUpdate( intervalMilliseconds );
   return mStatus.KeepUpdating();
 }
 
index 4084f2d..bcc2dd8 100644 (file)
@@ -76,6 +76,9 @@ public:
   bool RenderOnly( );
   void ResetContext();
 
+private:
+  void DoUpdate( unsigned int intervalMilliseconds );
+
 protected:
   TestPlatformAbstraction   mPlatformAbstraction;
   TestRenderController      mRenderController;
@@ -93,6 +96,7 @@ protected:
   unsigned int mFrame;
 
   Vector2 mDpi;
+  unsigned int mLastVSyncTime;
 };
 
 } // Dali
index 9c26043..f698eee 100644 (file)
@@ -85,11 +85,6 @@ void Core::SetDpi(unsigned int dpiHorizontal, unsigned int dpiVertical)
   mImpl->SetDpi(dpiHorizontal, dpiVertical);
 }
 
-void Core::SetMinimumFrameTimeInterval(unsigned int interval)
-{
-  mImpl->SetMinimumFrameTimeInterval(interval);
-}
-
 void Core::Suspend()
 {
   mImpl->Suspend();
@@ -120,9 +115,9 @@ unsigned int Core::GetMaximumUpdateCount() const
   return mImpl->GetMaximumUpdateCount();
 }
 
-void Core::Update( UpdateStatus& status )
+void Core::Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds, UpdateStatus& status )
 {
-  mImpl->Update( status );
+  mImpl->Update( elapsedSeconds, lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds, status );
 }
 
 void Core::Render( RenderStatus& status )
@@ -130,21 +125,6 @@ void Core::Render( RenderStatus& status )
   mImpl->Render( status );
 }
 
-void Core::Sleep()
-{
-  mImpl->Sleep();
-}
-
-void Core::WakeUp()
-{
-  mImpl->WakeUp();
-}
-
-void Core::VSync( unsigned int frameNumber, unsigned int seconds, unsigned int microseconds )
-{
-  mImpl->VSync( frameNumber, seconds, microseconds );
-}
-
 SystemOverlay& Core::GetSystemOverlay()
 {
   return mImpl->GetSystemOverlay();
index 1ba892d..c8bf646 100644 (file)
@@ -259,22 +259,6 @@ public:
    */
   void SetDpi(unsigned int dpiHorizontal, unsigned int dpiVertical);
 
-  /**
-   * Sets the expected interval between frames used to predict future intervals and the time when the
-   * next render will take place.
-   *
-   * This is the minimum interval that Core should expect. Core will adapt the predicted interval
-   * accordingly if the expected interval is constantly not met (but will not drop it below this
-   * amount).
-   *
-   * The value provided should be in microseconds.
-   *
-   * @param[in]  interval  The minimum interval between frames (in microseconds).
-   *
-   * Multi-threading note: this method should be called from the render thread
-   */
-  void SetMinimumFrameTimeInterval(unsigned int interval);
-
   // Core Lifecycle
 
   /**
@@ -337,10 +321,13 @@ public:
    * However the update-thread must wait until frame N has been rendered, before processing frame N+2.
    * After this method returns, messages may be queued internally for the main thread.
    * In order to process these messages, a notification is sent via the main thread's event loop.
+   * @param[in] elapsedSeconds Number of seconds since the last call
+   * @param[in] lastVSyncTimeMilliseconds The last vsync time in milliseconds
+   * @param[in] nextVSyncTimeMilliseconds The time of the next predicted VSync in milliseconds
    * @param[out] status showing whether further updates are required. This also shows
    * whether a Notification event should be sent, regardless of whether the multi-threading is used.
    */
-  void Update( UpdateStatus& status );
+  void Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds, UpdateStatus& status );
 
   /**
    * Render the next frame. This method should be preceded by a call up Update.
@@ -350,31 +337,6 @@ public:
    */
   void Render( RenderStatus& status );
 
-  /**
-   * Tells core that it is about to sleep.
-   * Application is running as normal, but no updates are taking place i.e. no ongoing animations.
-   * This should be called when we choose to stop updating and rendering when there are no screen
-   * updates required.
-   * Multi-threading note: this method should be called from the update-thread.
-   */
-  void Sleep();
-
-  /**
-   * Wakes up core from a sleep state.
-   * At the first update the elapsed time passed to the animations is zero.
-   * Multi-threading note: this method should be called from the update-thread.
-   */
-  void WakeUp();
-
-  /**
-   * Notification of a vertical blank sync
-   * @param[in] frameNumber  The frame number of this vsync. This number will not update
-   *                         while paused.
-   * @param[in] seconds      The timestamp seconds
-   * @param[in] microseconds The timestamp microseconds
-   */
-  void VSync( unsigned int frameNumber, unsigned int seconds, unsigned int microseconds );
-
   // System-level overlay
 
   /**
index 91559e7..a3f16c7 100644 (file)
@@ -37,7 +37,6 @@
 #include <dali/internal/render/common/render-manager.h>
 #include <dali/internal/update/common/discard-queue.h>
 #include <dali/internal/common/event-to-update.h>
-#include <dali/internal/common/frame-time.h>
 #include <dali/internal/update/resources/resource-manager.h>
 #include <dali/internal/event/text/font-factory.h>
 #include <dali/internal/event/images/image-factory.h>
@@ -87,7 +86,6 @@ Core::Core( RenderController& renderController, PlatformAbstraction& platform,
   mDiscardQueue(NULL),
   mResourcePostProcessQueue(),
   mNotificationManager(NULL),
-  mFrameTime(NULL),
   mFontFactory(NULL),
   mImageFactory(NULL),
   mModelFactory(NULL),
@@ -150,7 +148,6 @@ Core::Core( RenderController& renderController, PlatformAbstraction& platform,
   mGestureEventProcessor = new GestureEventProcessor(*mStage, gestureManager, mRenderController);
   mEventProcessor = new EventProcessor(*mStage, *mNotificationManager, *mGestureEventProcessor);
 
-  mFrameTime = new FrameTime( mPlatform );
   mFontFactory = new FontFactory(*mResourceClient);
   mImageFactory = new ImageFactory( *mResourceClient );
   mModelFactory = new ModelFactory(*mResourceClient);
@@ -199,7 +196,6 @@ Core::~Core()
   delete mRenderManager;
   delete mDiscardQueue;
   delete mResourcePostProcessQueue;
-  delete mFrameTime;
 }
 
 void Core::ContextCreated()
@@ -224,26 +220,17 @@ void Core::SetDpi(unsigned int dpiHorizontal, unsigned int dpiVertical)
   mStage->SetDpi( Vector2( dpiHorizontal , dpiVertical) );
 }
 
-void Core::SetMinimumFrameTimeInterval(unsigned int interval)
+void Core::Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds, Integration::UpdateStatus& status )
 {
-  mFrameTime->SetMinimumFrameTimeInterval(interval);
-}
-
-void Core::Update( UpdateStatus& status )
-{
-  // get the last delta and the predict when this update will be rendered
-  float lastFrameDelta( 0.0f );
-  unsigned int lastVSyncTime( 0 );
-  unsigned int nextVSyncTime( 0 );
-  mFrameTime->PredictNextVSyncTime( lastFrameDelta, lastVSyncTime, nextVSyncTime );
-
   // set the time delta so adaptor can easily print FPS with a release build with 0 as
   // it is cached by frametime
-  status.secondsFromLastFrame = lastFrameDelta;
+  status.secondsFromLastFrame = elapsedSeconds;
 
   // Render returns true when there are updates on the stage or one or more animations are completed.
   // Use the estimated time diff till we render as the elapsed time.
-  status.keepUpdating = mUpdateManager->Update( lastFrameDelta, lastVSyncTime, nextVSyncTime );
+  status.keepUpdating = mUpdateManager->Update( elapsedSeconds,
+                                                lastVSyncTimeMilliseconds,
+                                                nextVSyncTimeMilliseconds );
 
   // Check the Notification Manager message queue to set needsNotification
   status.needsNotification = mNotificationManager->MessagesToProcess();
@@ -273,11 +260,6 @@ void Core::Render( RenderStatus& status )
 
 void Core::Suspend()
 {
-  if( mFrameTime )
-  {
-    mFrameTime->Suspend();
-  }
-
   mPlatform.Suspend();
 
   mIsActive = false;
@@ -285,11 +267,6 @@ void Core::Suspend()
 
 void Core::Resume()
 {
-  if( mFrameTime )
-  {
-    mFrameTime->Resume();
-  }
-
   mPlatform.Resume();
 
   mIsActive = true;
@@ -298,28 +275,6 @@ void Core::Resume()
   ProcessEvents();
 }
 
-void Core::Sleep()
-{
-  if( mFrameTime )
-  {
-    mFrameTime->Sleep();
-  }
-}
-
-void Core::WakeUp()
-{
-  if( mFrameTime )
-  {
-    mFrameTime->WakeUp();
-  }
-}
-
-void Core::VSync( unsigned int frameNumber, unsigned int seconds, unsigned int microseconds )
-{
-  // Can't use passed in time as that is not the clock the touch events use so our predicted render value will be meaningless.
-  mFrameTime->SetVSyncTime( frameNumber );
-}
-
 void Core::QueueEvent( const Integration::Event& event )
 {
   mEventProcessor->QueueEvent( event );
index 130d2f4..c421838 100644 (file)
@@ -54,7 +54,6 @@ class EventProcessor;
 class GestureEventProcessor;
 class ResourceClient;
 class ResourceManager;
-class FrameTime;
 class FontFactory;
 class ImageFactory;
 class ModelFactory;
@@ -118,7 +117,7 @@ public:
   /**
    * @copydoc Dali::Integration::Core::Update()
    */
-  void Update( Integration::UpdateStatus& status );
+  void Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds, Integration::UpdateStatus& status );
 
   /**
    * @copydoc Dali::Integration::Core::Render()
@@ -156,21 +155,6 @@ public:
   unsigned int GetMaximumUpdateCount() const;
 
   /**
-   * @copydoc Dali::Integration::Core::Sleep()
-   */
-  void Sleep();
-
-  /**
-   * @copydoc Dali::Integration::Core::Wake()
-   */
-  void WakeUp();
-
-  /**
-   * @copydoc Dali::Integration::Core::VSync()
-   */
-  void VSync( unsigned int frameNumber, unsigned int seconds, unsigned int microseconds );
-
-  /**
    * @copydoc Dali::Integration::Core::GetSystemOverlay()
    */
   Integration::SystemOverlay& GetSystemOverlay();
@@ -305,7 +289,6 @@ private:
   NotificationManager*                      mNotificationManager;         ///< Notification manager
   AnimationPlaylistOwner                    mAnimationPlaylist;           ///< For 'Fire and forget' animation support
   OwnerPointer<PropertyNotificationManager> mPropertyNotificationManager; ///< For safe signal emmision of property changed notifications
-  FrameTime*                                mFrameTime;                   ///< Time when we render
   FontFactory*                              mFontFactory;                 ///< font resource factory
   ImageFactory*                             mImageFactory;                ///< Image resource factory
   ModelFactory*                             mModelFactory;                ///< Model resource factory
diff --git a/dali/internal/common/frame-time.cpp b/dali/internal/common/frame-time.cpp
deleted file mode 100644 (file)
index 2148a05..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-// CLASS HEADER
-#include <dali/internal/common/frame-time.h>
-
-// INTERNAL INCLUDES
-#include <dali/integration-api/debug.h>
-#include <dali/integration-api/platform-abstraction.h>
-
-namespace Dali
-{
-
-using Integration::PlatformAbstraction;
-
-namespace Internal
-{
-
-namespace
-{
-#if defined(DEBUG_ENABLED)
-Integration::Log::Filter* gLogFilter = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_FRAME_TIME");
-#endif
-
-const unsigned int DEFAULT_MINIMUM_FRAME_TIME_INTERVAL( 16667u );
-
-const unsigned int MICROSECONDS_PER_SECOND( 1000000u );
-const unsigned int MICROSECONDS_PER_MILLISECOND( 1000u );
-
-const float        MICROSECONDS_TO_SECONDS( 0.000001f );
-
-const unsigned int HISTORY_SIZE(3);
-} // unnamed namespace
-
-FrameTime::FrameTime( PlatformAbstraction& platform )
-: mPlatform( platform ),
-  mMinimumFrameTimeInterval( DEFAULT_MINIMUM_FRAME_TIME_INTERVAL ),
-  mLastVSyncTime( 0u ),
-  mLastVSyncTimeAtUpdate( 0u ),
-  mLastVSyncFrameNumber( 0u ),
-  mLastUpdateFrameNumber( 0u ),
-  mRunning( true ),
-  mFirstFrame( true ),
-  writePos( 0u ),
-  mExtraUpdatesSinceVSync( 0u )
-{
-  // Clear buffer
-  for ( unsigned int i = 0; i < HISTORY_SIZE; ++i )
-  {
-    mPreviousUpdateFrames[i] = 0;
-  }
-
-  SetLastVSyncTime();
-  mLastVSyncTimeAtUpdate = mLastVSyncTime;
-
-  DALI_LOG_INFO( gLogFilter, Debug::Concise, "FrameTime Initialized\n" );
-}
-
-FrameTime::~FrameTime()
-{
-}
-
-void FrameTime::SetMinimumFrameTimeInterval( unsigned int interval )
-{
-  mMinimumFrameTimeInterval = interval;
-}
-
-void FrameTime::SetVSyncTime( unsigned int frameNumber )
-{
-  // Only set the render time if we are running
-  if ( mRunning )
-  {
-    SetLastVSyncTime();
-
-    mLastVSyncFrameNumber = frameNumber;
-
-    DALI_LOG_INFO( gLogFilter, Debug::General, "FrameTime: Frame: %u: Time: %u\n", mLastVSyncFrameNumber, (unsigned int) ( mLastVSyncTime / MICROSECONDS_PER_MILLISECOND ) );
-  }
-}
-
-void FrameTime::Suspend()
-{
-  mRunning = false;
-
-  // Reset members
-  mLastVSyncFrameNumber = 0;
-  mLastUpdateFrameNumber = 0;
-  writePos = 0;
-  mExtraUpdatesSinceVSync = 0;
-
-  // Clear buffer
-  for ( unsigned int i = 0; i < HISTORY_SIZE; ++i )
-  {
-    mPreviousUpdateFrames[i] = 0;
-  }
-
-  DALI_LOG_INFO( gLogFilter, Debug::Concise, "FrameTime: Suspended\n" );
-}
-
-void FrameTime::Resume()
-{
-  DALI_LOG_INFO( gLogFilter, Debug::Concise, "FrameTime: Resuming\n" );
-
-  SetLastVSyncTime();   // Should only update the last VSync time so the elapsed time during suspension is taken into consideration when we next update.
-  mFirstFrame = true;
-
-  mRunning = true;
-}
-
-void FrameTime::Sleep()
-{
-  DALI_LOG_INFO( gLogFilter, Debug::Concise, "FrameTime: Sleeping\n" );
-
-  // Mimic Suspend behaviour
-  Suspend();
-}
-
-void FrameTime::WakeUp()
-{
-  DALI_LOG_INFO( gLogFilter, Debug::Concise, "FrameTime: Waking Up\n" );
-
-  SetLastVSyncTime();
-  mLastVSyncTimeAtUpdate = mLastVSyncTime; // We do not want any animations to progress as we have just been woken up.
-  mFirstFrame = true;
-
-  mRunning = true;
-}
-
-void FrameTime::PredictNextVSyncTime( float& lastFrameDeltaSeconds, unsigned int& lastVSyncTimeMilliseconds, unsigned int& nextVSyncTimeMilliseconds )
-{
-  if ( mRunning )
-  {
-    const unsigned int minimumFrameTimeInterval( mMinimumFrameTimeInterval );
-    const uint64_t lastVSyncTime( mLastVSyncTime );
-    const unsigned int lastVSyncFrameNumber( mLastVSyncFrameNumber );
-
-    float lastFrameDelta( 0.0f ); // Assume the last update frame delta is 0.
-    unsigned int framesTillNextVSync( 1 ); // Assume next render will be in one VSync frame time.
-
-    unsigned int framesInLastUpdate( lastVSyncFrameNumber - mLastUpdateFrameNumber );
-    lastFrameDelta = lastVSyncTime - mLastVSyncTimeAtUpdate;
-
-    // We should only evaluate the previous frame values if this is not the first frame.
-    if ( !mFirstFrame )
-    {
-      // Check whether we have had any VSyncs since we last did an Update.
-      if ( framesInLastUpdate == 0 )
-      {
-        // We have had another update before a VSync, increment counter.
-        ++mExtraUpdatesSinceVSync;
-
-        // This update frame will be rendered mUpdatesSinceVSync later.
-        framesTillNextVSync += mExtraUpdatesSinceVSync;
-      }
-      else
-      {
-        mExtraUpdatesSinceVSync = 0;
-      }
-
-      // If more than one frame elapsed since last Update, then check if this is a recurring theme so we can accurately predict when this Update is rendered.
-      if ( framesInLastUpdate > 1 )
-      {
-        unsigned int average(0);
-        for ( unsigned int i = 0; i < HISTORY_SIZE; ++i )
-        {
-          average += mPreviousUpdateFrames[i];
-        }
-        average /= HISTORY_SIZE;
-
-        if ( average > 1 )
-        {
-          // Our average shows a recurring theme, we are missing frames when rendering so calculate number of frames this will take.
-          framesTillNextVSync = average;
-        }
-      }
-
-      // Write the number of frames the last update took to the array.
-      mPreviousUpdateFrames[writePos] = framesInLastUpdate;
-      writePos = ( writePos + 1 ) % HISTORY_SIZE;
-    }
-
-    mLastUpdateFrameNumber = lastVSyncFrameNumber;
-    mLastVSyncTimeAtUpdate = lastVSyncTime;
-    mFirstFrame = false;
-
-    // Calculate the time till the next render
-    unsigned int timeTillNextRender( minimumFrameTimeInterval * framesTillNextVSync );
-
-    // Set the input variables
-    lastFrameDeltaSeconds = lastFrameDelta * MICROSECONDS_TO_SECONDS;
-    lastVSyncTimeMilliseconds = lastVSyncTime / MICROSECONDS_PER_MILLISECOND;
-    nextVSyncTimeMilliseconds = ( lastVSyncTime + timeTillNextRender ) / MICROSECONDS_PER_MILLISECOND;
-
-    DALI_LOG_INFO( gLogFilter, Debug::General, "FrameTime: Frame: %u, Time: %u, NextTime: %u, LastDelta: %f\n", mLastUpdateFrameNumber, lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds, lastFrameDeltaSeconds );
-    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "                      FramesInLastUpdate: %u, FramesTillNextVSync: %u\n", framesInLastUpdate, framesTillNextVSync );
-  }
-}
-
-inline void FrameTime::SetLastVSyncTime()
-{
-  unsigned int seconds( 0u );
-  unsigned int microseconds( 0u );
-
-  mPlatform.GetTimeMicroseconds( seconds, microseconds );
-
-  mLastVSyncTime = seconds;
-  mLastVSyncTime = ( mLastVSyncTime * MICROSECONDS_PER_SECOND ) + microseconds;
-}
-
-} // namespace Internal
-
-} // namespace Dali
diff --git a/dali/internal/common/frame-time.h b/dali/internal/common/frame-time.h
deleted file mode 100644 (file)
index da52667..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-#ifndef __DALI_INTERNAL_FRAME_TIME_H__
-#define __DALI_INTERNAL_FRAME_TIME_H__
-
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-#include <stdint.h>
-
-namespace Dali
-{
-
-namespace Integration
-{
-class PlatformAbstraction;
-}
-
-namespace Internal
-{
-
-/**
- * FrameTime stores the time of the last VSync. It can then be used by the update thread to predict
- * the current update will be rendered.
- */
-class FrameTime
-{
-public: // Core Methods
-
-  // Called from Event thread
-
-  /**
-   * Constructor
-   * @param[in]  platform  The platform used to retrieve the current time
-   */
-  FrameTime( Integration::PlatformAbstraction& platform );
-
-  /**
-   * Destructor, non virtual
-   */
-  ~FrameTime();
-
-  /**
-   * Sets the expected minimum frame time interval.
-   * @param[in]  interval  The interval in microseconds.
-   */
-  void SetMinimumFrameTimeInterval( unsigned int interval );
-
-  /**
-   * Suspends the FrameTime object.
-   * During the suspended state animations will be paused.
-   * @note Should only be called by the Core.
-   */
-  void Suspend();
-
-  /**
-   * Resumes the FrameTime object.
-   * Animations etc. will carry on from where they left off.
-   * @note Should only be called by the Core.
-   */
-  void Resume();
-
-  // Called from Update thread
-
-  /**
-   * Sets the FrameTime object to sleep.
-   * @note Should only be called by the Core, from the update thread.
-   */
-  void Sleep();
-
-  /**
-   * Wakes the FrameTime object from a sleep state.
-   * @note Should only be called by the Core, from the update thread.
-   */
-  void WakeUp();
-
-  /**
-   * Predicts when the next render time will occur.
-   *
-   * @param[out]  lastFrameDeltaSeconds      The delta, in seconds (with float precision), between the last two renders.
-   * @param[out]  lastVSyncTimeMilliseconds  The time, in milliseconds, of the last VSync.
-   * @param[out]  nextVSyncTimeMilliseconds  The estimated time, in milliseconds, at the next VSync.
-   *
-   * @note Should only be called once per tick, from the update thread.
-   */
-  void PredictNextVSyncTime( float& lastFrameDeltaSeconds, unsigned int& lastVSyncTimeMilliseconds, unsigned int& nextVSyncTimeMilliseconds );
-
-  // Called from VSync thread
-
-  /**
-   * Tells the FrameTime object that a VSync has occurred.
-   *
-   * @param[in]  frameNumber  The frame number of the current VSync.
-   *
-   * @note Should only be called by the Core (from the VSync thread).
-   */
-  void SetVSyncTime( unsigned int frameNumber );
-
-private:
-
-  /**
-   * Sets the current time to be the last Vsync time.
-   */
-  inline void SetLastVSyncTime();
-
-private:
-
-  Integration::PlatformAbstraction& mPlatform;    ///< The platform abstraction.
-
-  unsigned int mMinimumFrameTimeInterval;   ///< The minimum frame time interval, set by Adaptor.
-
-  uint64_t mLastVSyncTime;                  ///< The last VSync time (in microseconds).
-  uint64_t mLastVSyncTimeAtUpdate;          ///< The last VSync time at Update (in microseconds).
-
-  unsigned int mLastVSyncFrameNumber;       ///< The last VSync frame number
-  unsigned int mLastUpdateFrameNumber;      ///< The last VSync frame number handled in Update.
-
-  bool         mRunning:1;                  ///< The state of the FrameTime object.
-  bool         mFirstFrame:1;               ///< Whether the current update is the first frame (after initialisation, resume or wake up).
-
-  unsigned int mPreviousUpdateFrames[3];    ///< Array holding the number of frames Update took in the last three iterations.
-  unsigned int writePos;                    ///< The current write position in the array.
-
-  unsigned int mExtraUpdatesSinceVSync;     ///< The number of extra updates since the last VSync.
-};
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_FRAME_TIME_H__
index a02838c..b60b9eb 100644 (file)
@@ -3,7 +3,6 @@
 internal_src_files = \
   $(internal_src_dir)/common/blending-options.cpp \
   $(internal_src_dir)/common/core-impl.cpp \
-  $(internal_src_dir)/common/frame-time.cpp \
   $(internal_src_dir)/common/internal-constants.cpp \
   $(internal_src_dir)/common/message-buffer.cpp \
   $(internal_src_dir)/common/text-parameters.cpp \
index 6cab25f..a3f8b6e 100644 (file)
@@ -797,7 +797,7 @@ void UpdateManager::ResetProperties()
   PERF_MONITOR_END(PerformanceMonitor::RESET_PROPERTIES);
 }
 
-bool UpdateManager::ProcessGestures( unsigned int lastVSyncTime, unsigned int nextVSyncTime )
+bool UpdateManager::ProcessGestures( unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds )
 {
   bool gestureUpdated( false );
 
@@ -808,7 +808,7 @@ bool UpdateManager::ProcessGestures( unsigned int lastVSyncTime, unsigned int ne
   {
     PanGesture& gesture = **iter;
     gesture.ResetToBaseValues( mSceneGraphBuffers.GetUpdateBufferIndex() ); // Needs to be done every time as gesture data is written directly to an update-buffer rather than via a message
-    gestureUpdated |= gesture.UpdateProperties( lastVSyncTime, nextVSyncTime );
+    gestureUpdated |= gesture.UpdateProperties( lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds );
   }
 
   return gestureUpdated;
@@ -996,7 +996,9 @@ void UpdateManager::PrepareMaterials( BufferIndex updateBufferIndex, MaterialCon
   }
 }
 
-unsigned int UpdateManager::Update( float elapsedSeconds, unsigned int lastVSyncTime, unsigned int nextVSyncTime )
+unsigned int UpdateManager::Update( float elapsedSeconds,
+                                    unsigned int lastVSyncTimeMilliseconds,
+                                    unsigned int nextVSyncTimeMilliseconds )
 {
   PERF_MONITOR_END(PerformanceMonitor::FRAME_RATE);   // Mark the End of the last frame
   PERF_MONITOR_NEXT_FRAME();             // Prints out performance info for the last frame (if enabled)
@@ -1016,7 +1018,7 @@ unsigned int UpdateManager::Update( float elapsedSeconds, unsigned int lastVSync
 
   // 3) Process Touches & Gestures
   mImpl->touchResampler.Update();
-  const bool gestureUpdated = ProcessGestures( lastVSyncTime, nextVSyncTime );
+  const bool gestureUpdated = ProcessGestures( lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds );
 
   const bool updateScene =                                            // The scene-graph requires an update if..
       mImpl->activeConstraints != 0 ||                                // ..constraints were active in previous frame OR
index 67c2daf..8fca6f0 100644 (file)
@@ -356,11 +356,11 @@ public:
   /**
    * Performs an Update traversal on the scene-graph.
    * @param[in] elapsedSeconds The elapsed time that should be applied to animations.
-   * @param[in] lastVSyncTime The last time, in milliseconds, that we had a VSync.
-   * @param[in] nextVSyncTime The estimated time, in milliseconds, of the next VSync.
+   * @param[in] lastVSyncTimeMilliseconds The last time, in milliseconds, that we had a VSync.
+   * @param[in] nextVSyncTimeMilliseconds The estimated time, in milliseconds, of the next VSync.
    * @return True if further updates are required e.g. during animations.
    */
-  unsigned int Update( float elapsedSeconds, unsigned int lastVSyncTime, unsigned int nextVSyncTime );
+  unsigned int Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds );
 
   /**
    * Set the background color i.e. the glClear color used at the beginning of each frame.
@@ -442,11 +442,11 @@ private:
 
   /**
    * Perform gesture updates.
-   * @param[in]  lastVSyncTime  The last VSync time.
-   * @param[in]  nextVSyncTime  The estimated time of the next VSync.
+   * @param[in]  lastVSyncTime  The last VSync time in milliseconds.
+   * @param[in]  nextVSyncTime  The estimated time of the next VSync in milliseconds.
    * @return true, if any properties were updated.
    */
-  bool ProcessGestures( unsigned int lastVSyncTime, unsigned int nextVSyncTime );
+  bool ProcessGestures( unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds );
 
   /**
    * Perform animation updates