Removed mutex locking in render thread.
[platform/core/uifw/dali-adaptor.git] / adaptors / base / update-render-controller.h
1 #ifndef __DALI_INTERNAL_UPDATE_RENDER_CONTROLLER_H__
2 #define __DALI_INTERNAL_UPDATE_RENDER_CONTROLLER_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 namespace Dali
22 {
23
24 namespace Internal
25 {
26
27 namespace Adaptor
28 {
29
30 class UpdateThread;
31 class RenderThread;
32 class VSyncNotifier;
33 class UpdateRenderSynchronization;
34 class RenderSurface;
35 class AdaptorInternalServices;
36 class EnvironmentOptions;
37
38 /**
39  * Class to control the update and render threads.
40  */
41 class UpdateRenderController
42 {
43 public:
44
45   /**
46    * Constructor
47    */
48   UpdateRenderController( AdaptorInternalServices& adaptorInterfaces, const EnvironmentOptions& environmentOptions );
49
50   /**
51    * Non virtual destructor. Not intended as base class.
52    */
53   ~UpdateRenderController();
54
55   /**
56    * @copydoc Dali::Adaptor::Start()
57    */
58   void Start();
59
60   /**
61    * @copydoc Dali::Adaptor::Pause()
62    */
63   void Pause();
64
65   /**
66    * @copydoc Dali::Adaptor::Resume()
67    */
68   void Resume();
69
70   /**
71    * @copydoc Dali::Adaptor::Stop()
72    */
73   void Stop();
74
75   /**
76    * Ensure the frame time values are reset before the next call to Core::Update()
77    * following a Resume application state change.
78    */
79   void ResumeFrameTime();
80
81   /**
82    * Called by the adaptor when core requires another update
83    */
84   void RequestUpdate();
85
86   /**
87    * Called by the adaptor when core requires one update
88    * If Adaptor is paused, we do one update and return to pause
89    */
90   void RequestUpdateOnce();
91
92   /**
93    * Replaces the surface.
94    * @param surface new surface
95    */
96   void ReplaceSurface( RenderSurface* surface );
97
98   /**
99    * @copydoc Dali::Adaptor::SetRenderRefreshRate()
100    */
101   void SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender );
102
103 private:
104
105   // Undefined copy constructor.
106   UpdateRenderController( const UpdateRenderController& );
107
108   // Undefined assignment operator.
109   UpdateRenderController& operator=( const UpdateRenderController& );
110
111   AdaptorInternalServices&     mAdaptorInterfaces;
112
113   UpdateThread*                mUpdateThread;     ///< The update-thread owned by UpdateRenderController
114   RenderThread*                mRenderThread;     ///< The render-thread owned by UpdateRenderController
115   VSyncNotifier*               mVSyncNotifier;    ///< The vsync-thread owned by UpdateRenderController
116   UpdateRenderSynchronization* mUpdateRenderSync; ///< Used to synchronize the update & render threads; also owned by UpdateRenderController
117   unsigned int                 mNumberOfVSyncsPerRender; ///< Frame skipping count
118 };
119
120 } // namespace Adaptor
121
122 } // namespace Internal
123
124 } // namespace Dali
125
126 #endif // __DALI_INTERNAL_UPDATE_RENDER_CONTROLLER_H__