Revert "Remove EGL surface in the update thread"
[platform/core/uifw/dali-adaptor.git] / dali / internal / adaptor / common / thread-controller-interface.h
1 #ifndef DALI_INTERNAL_THREAD_CONTROLLER_INTERFACE_H
2 #define DALI_INTERNAL_THREAD_CONTROLLER_INTERFACE_H
3
4 /*
5  * Copyright (c) 2020 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 #include <dali/public-api/signals/callback.h>
22
23 namespace Dali
24 {
25
26 class RenderSurfaceInterface;
27
28 namespace Internal
29 {
30
31 namespace Adaptor
32 {
33
34 enum class UpdateMode
35 {
36   NORMAL,                     ///< Update and render
37   SKIP_RENDER                 ///< Update and resource upload but no rendering
38 };
39
40 /**
41  * Interface Class for all controlling threads.
42  */
43 class ThreadControllerInterface
44 {
45 public:
46
47   /**
48    * Virtual destructor. Not intended as base class.
49    */
50   virtual ~ThreadControllerInterface() { }
51
52   /**
53    * Initializes the thread controller
54    */
55   virtual void Initialize() = 0;
56
57   /**
58    * @copydoc Dali::Adaptor::Start()
59    */
60   virtual void Start() = 0;
61
62   /**
63    * @copydoc Dali::Adaptor::Pause()
64    */
65   virtual void Pause() = 0;
66
67   /**
68    * @copydoc Dali::Adaptor::Resume()
69    */
70   virtual void Resume() = 0;
71
72   /**
73    * @copydoc Dali::Adaptor::Stop()
74    */
75   virtual void Stop() = 0;
76
77   /**
78    * Called by the adaptor when core requires another update
79    */
80   virtual void RequestUpdate() = 0;
81
82   /**
83    * Called by the adaptor when core requires one update
84    * If Adaptor is paused, we do one update/render and return to pause
85    * @param updateMode The update mode (i.e. i.e. either update & render or skip rendering)
86    */
87   virtual void RequestUpdateOnce( UpdateMode updateMode ) = 0;
88
89   /**
90    * Replaces the surface.
91    * @param surface new surface
92    */
93   virtual void ReplaceSurface( Dali::RenderSurfaceInterface* surface ) = 0;
94
95   /**
96    * Resize the surface.
97    */
98   virtual void ResizeSurface() = 0;
99
100   /**
101    * Wait until the graphics is initialised.
102    */
103   virtual void WaitForGraphicsInitialization() = 0;
104
105   /**
106    * @copydoc Dali::Adaptor::SetRenderRefreshRate()
107    */
108   virtual void SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender ) = 0;
109
110   /**
111    * @copydoc Dali::Adaptor::SetPreRenderCallback()
112    */
113   virtual void SetPreRenderCallback( CallbackBase* callback ) = 0;
114
115   /**
116    * @brief Adds the new surface.
117    * @param surface new surface
118    */
119   virtual void AddSurface( Dali::RenderSurfaceInterface* surface ) = 0;
120
121   /**
122    * @copydoc Dali::Adaptor::IsRenderingWindows()
123    */
124   virtual bool IsRenderingWindows() const = 0;
125
126 protected:
127
128   /**
129    * Constructor
130    */
131   ThreadControllerInterface() { }
132
133 private:
134
135   // Undefined copy constructor.
136   ThreadControllerInterface( const ThreadControllerInterface& );
137
138   // Undefined assignment operator.
139   ThreadControllerInterface& operator=( const ThreadControllerInterface& );
140 };
141
142 } // namespace Adaptor
143
144 } // namespace Internal
145
146 } // namespace Dali
147
148 #endif // DALI_INTERNAL_THREAD_CONTROLLER_INTERFACE_H