Dali 3D User Interface Engine
List of all members | Public Member Functions | Private Member Functions | Private Attributes
Dali::Internal::Adaptor::FrameTime Class Reference

FrameTime stores the time of the last VSync. More...

#include <frame-time.h>

Public Member Functions

 FrameTime ()
 Constructor. More...
 
 ~FrameTime ()
 Destructor, non virtual. More...
 
void SetMinimumFrameTimeInterval (unsigned int interval)
 Sets the expected minimum frame time interval. More...
 
void Suspend ()
 Suspends the FrameTime object when the application state changes. More...
 
void Resume ()
 Resumes the FrameTime object when the application state changes. More...
 
void Sleep ()
 Sets the FrameTime object to sleep, i.e. More...
 
void WakeUp ()
 Wakes the FrameTime object from a sleep state. More...
 
void PredictNextSyncTime (float &lastFrameDeltaSeconds, unsigned int &lastVSyncTimeMilliseconds, unsigned int &nextVSyncTimeMilliseconds)
 Predicts when the next render time will occur. More...
 
void SetSyncTime (unsigned int frameNumber)
 Tells the FrameTime object that a Sync has occurred. More...
 

Private Member Functions

void SetLastSyncTime ()
 Sets the current time to be the last Vsync time. More...
 

Private Attributes

unsigned int mMinimumFrameTimeInterval
 The minimum frame time interval, set by Adaptor. More...
 
uint64_t mLastSyncTime
 The last Sync time (in microseconds). More...
 
uint64_t mLastSyncTimeAtUpdate
 The last Sync time at Update (in microseconds). More...
 
unsigned int mLastSyncFrameNumber
 The last Sync frame number. More...
 
unsigned int mLastUpdateFrameNumber
 The last Sync frame number handled in Update. More...
 
unsigned int mRunning
 The state of the FrameTime object. More...
 
unsigned int mFirstFrame
 Whether the current update is the first frame (after initialisation, resume or wake up). More...
 
unsigned int mPreviousUpdateFrames [3]
 Array holding the number of frames Update took in the last three iterations. More...
 
unsigned int writePos
 The current write position in the array. More...
 
unsigned int mExtraUpdatesSinceSync
 The number of extra updates since the last Sync. More...
 

Detailed Description

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.

Definition at line 41 of file frame-time.h.

Constructor & Destructor Documentation

Dali::Internal::Adaptor::FrameTime::FrameTime ( )
Dali::Internal::Adaptor::FrameTime::~FrameTime ( )

Destructor, non virtual.

Definition at line 83 of file frame-time.cpp.

Member Function Documentation

void Dali::Internal::Adaptor::FrameTime::PredictNextSyncTime ( float &  lastFrameDeltaSeconds,
unsigned int &  lastVSyncTimeMilliseconds,
unsigned int &  nextVSyncTimeMilliseconds 
)

Predicts when the next render time will occur.

Parameters
[out]lastFrameDeltaSecondsThe delta, in seconds (with float precision), between the last two renders.
[out]lastSyncTimeMillisecondsThe time, in milliseconds, of the last Sync.
[out]nextSyncTimeMillisecondsThe estimated time, in milliseconds, at the next Sync.
Note
Should only be called once per tick, from the update thread.

Definition at line 152 of file frame-time.cpp.

References DALI_LOG_INFO, Dali::Internal::Adaptor::anonymous_namespace{combined-update-render-controller.cpp}::FALSE, Dali::Internal::Adaptor::anonymous_namespace{frame-time.cpp}::HISTORY_SIZE(), mExtraUpdatesSinceSync, mFirstFrame, Dali::Internal::Adaptor::anonymous_namespace{frame-time.cpp}::MICROSECONDS_PER_MILLISECOND(), Dali::Internal::Adaptor::anonymous_namespace{frame-time.cpp}::MICROSECONDS_TO_SECONDS(), mLastSyncFrameNumber, mLastSyncTime, mLastSyncTimeAtUpdate, mLastUpdateFrameNumber, mMinimumFrameTimeInterval, mPreviousUpdateFrames, mRunning, and writePos.

Referenced by Dali::Internal::Adaptor::ThreadSynchronization::UpdateReady().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Adaptor::FrameTime::Resume ( )

Resumes the FrameTime object when the application state changes.

Definition at line 124 of file frame-time.cpp.

References DALI_LOG_INFO, mFirstFrame, mRunning, SetLastSyncTime(), and Dali::Internal::Adaptor::anonymous_namespace{combined-update-render-controller.cpp}::TRUE.

Referenced by Dali::Internal::Adaptor::ThreadSynchronization::Resume().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Adaptor::FrameTime::SetLastSyncTime ( )
inlineprivate

Sets the current time to be the last Vsync time.

Definition at line 224 of file frame-time.cpp.

References Dali::Internal::Adaptor::TimeService::GetNanoseconds(), mLastSyncTime, and Dali::Internal::Adaptor::anonymous_namespace{performance-server.cpp}::NANOSECONDS_PER_MICROSECOND.

Referenced by FrameTime(), Resume(), SetSyncTime(), and WakeUp().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Adaptor::FrameTime::SetMinimumFrameTimeInterval ( unsigned int  interval)

Sets the expected minimum frame time interval.

Parameters
[in]intervalThe interval in microseconds.

Definition at line 87 of file frame-time.cpp.

References mMinimumFrameTimeInterval.

Referenced by Dali::Internal::Adaptor::ThreadSynchronization::Start(), and Dali::Internal::Adaptor::ThreadSynchronization::VSyncReady().

Here is the caller graph for this function:

void Dali::Internal::Adaptor::FrameTime::SetSyncTime ( unsigned int  frameNumber)

Tells the FrameTime object that a Sync has occurred.

Parameters
[in]frameNumberThe frame number of the current Sync.
Note
Should only be called from the VSync thread.

Definition at line 92 of file frame-time.cpp.

References DALI_LOG_INFO, Dali::Internal::Adaptor::anonymous_namespace{frame-time.cpp}::MICROSECONDS_PER_MILLISECOND(), mLastSyncFrameNumber, mLastSyncTime, mRunning, and SetLastSyncTime().

Referenced by Dali::Internal::Adaptor::ThreadSynchronization::VSyncReady().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Adaptor::FrameTime::Sleep ( )

Sets the FrameTime object to sleep, i.e.

when there are no more updates required.

Definition at line 134 of file frame-time.cpp.

References DALI_LOG_INFO, and Suspend().

Referenced by Dali::Internal::Adaptor::ThreadSynchronization::UpdateTryToSleep().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Adaptor::FrameTime::Suspend ( )
void Dali::Internal::Adaptor::FrameTime::WakeUp ( )

Wakes the FrameTime object from a sleep state.

Definition at line 142 of file frame-time.cpp.

References DALI_LOG_INFO, mFirstFrame, mLastSyncTime, mLastSyncTimeAtUpdate, mRunning, SetLastSyncTime(), and Dali::Internal::Adaptor::anonymous_namespace{combined-update-render-controller.cpp}::TRUE.

Referenced by Dali::Internal::Adaptor::ThreadSynchronization::UpdateTryToSleep().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

unsigned int Dali::Internal::Adaptor::FrameTime::mExtraUpdatesSinceSync
private

The number of extra updates since the last Sync.

Definition at line 131 of file frame-time.h.

Referenced by PredictNextSyncTime(), and Suspend().

unsigned int Dali::Internal::Adaptor::FrameTime::mFirstFrame
private

Whether the current update is the first frame (after initialisation, resume or wake up).

Definition at line 126 of file frame-time.h.

Referenced by PredictNextSyncTime(), Resume(), and WakeUp().

unsigned int Dali::Internal::Adaptor::FrameTime::mLastSyncFrameNumber
private

The last Sync frame number.

Definition at line 121 of file frame-time.h.

Referenced by PredictNextSyncTime(), SetSyncTime(), and Suspend().

uint64_t Dali::Internal::Adaptor::FrameTime::mLastSyncTime
private

The last Sync time (in microseconds).

Definition at line 118 of file frame-time.h.

Referenced by FrameTime(), PredictNextSyncTime(), SetLastSyncTime(), SetSyncTime(), and WakeUp().

uint64_t Dali::Internal::Adaptor::FrameTime::mLastSyncTimeAtUpdate
private

The last Sync time at Update (in microseconds).

Definition at line 119 of file frame-time.h.

Referenced by FrameTime(), PredictNextSyncTime(), and WakeUp().

unsigned int Dali::Internal::Adaptor::FrameTime::mLastUpdateFrameNumber
private

The last Sync frame number handled in Update.

Definition at line 122 of file frame-time.h.

Referenced by PredictNextSyncTime(), and Suspend().

unsigned int Dali::Internal::Adaptor::FrameTime::mMinimumFrameTimeInterval
private

The minimum frame time interval, set by Adaptor.

Definition at line 116 of file frame-time.h.

Referenced by PredictNextSyncTime(), and SetMinimumFrameTimeInterval().

unsigned int Dali::Internal::Adaptor::FrameTime::mPreviousUpdateFrames[3]
private

Array holding the number of frames Update took in the last three iterations.

Definition at line 128 of file frame-time.h.

Referenced by FrameTime(), PredictNextSyncTime(), and Suspend().

unsigned int Dali::Internal::Adaptor::FrameTime::mRunning
private

The state of the FrameTime object.

Definition at line 125 of file frame-time.h.

Referenced by PredictNextSyncTime(), Resume(), SetSyncTime(), Suspend(), and WakeUp().

unsigned int Dali::Internal::Adaptor::FrameTime::writePos
private

The current write position in the array.

Definition at line 129 of file frame-time.h.

Referenced by PredictNextSyncTime(), and Suspend().


The documentation for this class was generated from the following files:
Dali Docs Home
Read more about Dali