X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fadaptor%2Fcommon%2Fcombined-update-render-controller.h;h=ca225170d7d8258e10f5f1cc80d56b5af7963726;hb=e2b1bb333f68b1a21a24f84c6c21db2f618a8f53;hp=2e2dcad91cb4eef36e97600f4da9720ff2e5c25a;hpb=4ea6bcbe439574eca6e79a074236411a530ca34b;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/adaptor/common/combined-update-render-controller.h b/dali/internal/adaptor/common/combined-update-render-controller.h index 2e2dcad..ca22517 100644 --- a/dali/internal/adaptor/common/combined-update-render-controller.h +++ b/dali/internal/adaptor/common/combined-update-render-controller.h @@ -1,8 +1,8 @@ -#ifndef __DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_H__ -#define __DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_H__ +#ifndef DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_H +#define DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_H /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -19,23 +19,25 @@ */ // EXTERNAL INCLUDES +#include #include +#include #include -#include #include +#include // INTERNAL INCLUDES -#include -#include -#include -#include +#include #include +#include +#include #include +#include namespace Dali { -class RenderSurface; +class RenderSurfaceInterface; class TriggerEventInterface; namespace Internal @@ -118,12 +120,12 @@ public: /** * @copydoc ThreadControllerInterface::RequestUpdateOnce() */ - virtual void RequestUpdateOnce(); + virtual void RequestUpdateOnce( UpdateMode updateMode ); /** * @copydoc ThreadControllerInterface::ReplaceSurface() */ - virtual void ReplaceSurface( RenderSurface* surface ); + virtual void ReplaceSurface( Dali::RenderSurfaceInterface* surface ); /** * @copydoc ThreadControllerInterface::ResizeSurface() @@ -131,10 +133,30 @@ public: virtual void ResizeSurface(); /** + * @copydoc ThreadControllerInterface::WaitForGraphicsInitialization() + */ + virtual void WaitForGraphicsInitialization(); + + /** * @copydoc ThreadControllerInterface::SetRenderRefreshRate() */ virtual void SetRenderRefreshRate( unsigned int numberOfFramesPerRender ); + /** + * @copydoc ThreadControllerInterface::SetPreRenderCallback + */ + void SetPreRenderCallback( CallbackBase* callback ) override; + + /** + * @copydoc ThreadControllerInterface::AddSurface() + */ + virtual void AddSurface( Dali::RenderSurfaceInterface* surface ); + + /** + * @copydoc ThreadControllerInterface::IsRenderingWindows() + */ + bool IsRenderingWindows() const override { return mIsRenderingWindows; } + private: // Undefined copy constructor. @@ -147,14 +169,21 @@ private: // EventThread ///////////////////////////////////////////////////////////////////////////////////////////////// + enum AnimationProgression + { + USE_ELAPSED_TIME, ///< Animation progression using elapsed time + NONE ///< No animation progression + }; + /** * Runs the Update/Render Thread. * This will lock the mutex in mUpdateRenderThreadWaitCondition. * * @param[in] numberOfCycles The number of times the update/render cycle should run. If -1, then it will run continuously. - * @param[in] useElapsedTimeAfterWait If true, then the elapsed time during wait is used for animations, otherwise no animation progression is made. + * @param[in] animationProgression Whether to progress animation using time elapsed since the last frame. + * @param[in] updateMode The update mode (i.e. either update & render or skip rendering) */ - inline void RunUpdateRenderThread( int numberOfCycles, bool useElapsedTimeAfterWait ); + inline void RunUpdateRenderThread( int numberOfCycles, AnimationProgression animationProgression, UpdateMode updateMode ); /** * Pauses the Update/Render Thread. @@ -211,7 +240,7 @@ private: * * @return Pointer to the new surface, NULL otherwise */ - RenderSurface* ShouldSurfaceBeReplaced(); + Dali::RenderSurfaceInterface* ShouldSurfaceBeReplaced(); /** * Called by the Update/Render thread after a surface has been replaced. @@ -257,6 +286,11 @@ private: void NotifyThreadInitialised(); /** + * Called by the update-render thread when graphics has been initialised. + */ + void NotifyGraphicsInitialised(); + + /** * Helper to add a performance marker to the performance server (if it's active) * @param[in] type performance marker type */ @@ -294,9 +328,8 @@ private: FpsTracker mFpsTracker; ///< Object that tracks the FPS UpdateStatusLogger mUpdateStatusLogger; ///< Object that logs the update-status as required. - RenderHelper mRenderHelper; ///< Helper class for EGL, pre & post rendering - sem_t mEventThreadSemaphore; ///< Used by the event thread to ensure all threads have been initialised, and when replacing the surface. + sem_t mGraphicsInitializeSemaphore; ///< Used by the render thread to ensure the graphics has been initialised. ConditionalWait mUpdateRenderThreadWaitCondition; ///< The wait condition for the update-render-thread. @@ -306,10 +339,12 @@ private: const EnvironmentOptions& mEnvironmentOptions; ///< Environment options TriggerEventInterface& mNotificationTrigger; ///< Reference to notification event trigger TriggerEventInterface* mSleepTrigger; ///< Used by the update-render thread to trigger the event thread when it no longer needs to do any updates + CallbackBase* mPreRenderCallback; ///< Used by Update/Render thread when PreRender is about to be called on graphics. pthread_t* mUpdateRenderThread; ///< The Update/Render thread. float mDefaultFrameDelta; ///< Default time delta between each frame (used for animations). Not protected by lock, but written to rarely so not worth adding a lock when reading. + // TODO: mDefaultFrameDurationMilliseconds is defined as uint64_t, the only place where it is used, it is converted to an unsigned int!!! uint64_t mDefaultFrameDurationMilliseconds; ///< Default duration of a frame (used for predicting the time of the next frame). Not protected by lock, but written to rarely so not worth adding a lock when reading. uint64_t mDefaultFrameDurationNanoseconds; ///< Default duration of a frame (used for sleeping if not enough time elapsed). Not protected by lock, but written to rarely so not worth adding a lock when reading. uint64_t mDefaultHalfFrameNanoseconds; ///< Is half of mDefaultFrameDurationNanoseconds. Using a member variable avoids having to do the calculation every frame. Not protected by lock, but written to rarely so not worth adding a lock when reading. @@ -329,11 +364,17 @@ private: volatile unsigned int mUseElapsedTimeAfterWait; ///< Whether we should use the elapsed time after waiting (set by the event-thread, read by the update-render-thread). - RenderSurface* volatile mNewSurface; ///< Will be set to the new-surface if requested (set by the event-thread, read & cleared by the update-render thread). + Dali::RenderSurfaceInterface* volatile mNewSurface; ///< Will be set to the new-surface if requested (set by the event-thread, read & cleared by the update-render thread). volatile unsigned int mPostRendering; ///< Whether post-rendering is taking place (set by the event & render threads, read by the render-thread). volatile unsigned int mSurfaceResized; ///< Will be set to resize the surface (set by the event-thread, read & cleared by the update-render thread). - volatile unsigned int mForceClear; ///< Will be set to clear forcely + volatile unsigned int mForceClear; ///< Will be set to clear forcibly + + volatile unsigned int mUploadWithoutRendering; ///< Will be set to upload the resource only (with no rendering) + + volatile unsigned int mFirstFrameAfterResume; ///< Will be set to check the first frame after resume (for log) + + std::atomic mIsRenderingWindows; ///< This is set only from the render thread and read only from the event thread }; } // namespace Adaptor @@ -342,4 +383,4 @@ private: } // namespace Dali -#endif // __DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_H__ +#endif // DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_H