Merge branch 'devel/master' into tizen
[platform/core/uifw/dali-adaptor.git] / dali / internal / system / common / environment-options.h
1 #ifndef DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H
2 #define DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H
3
4 /*
5  * Copyright (c) 2017 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 // EXTERNAL INCLUDES
22 #include <dali/integration-api/debug.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/internal/adaptor/common/threading-mode.h>
26 #include <dali/integration-api/log-factory-interface.h>
27
28 namespace Dali
29 {
30 namespace Internal
31 {
32 namespace Adaptor
33 {
34
35 /**
36  * This class provides the environment options which define settings as well as
37  * the ability to install a log function.
38  *
39  */
40 class EnvironmentOptions : public Dali::LogFactoryInterface
41 {
42 public:
43
44   /**
45    * Constructor
46    */
47   EnvironmentOptions();
48
49   /**
50    * Virtual Destructor for interface cleanup
51    */
52   virtual ~EnvironmentOptions();
53
54   /**
55    * @param logFunction logging function
56    */
57   void SetLogFunction( const Dali::Integration::Log::LogFunction& logFunction );
58
59   /**
60    * Install the log function for the current thread.
61    */
62   virtual void InstallLogFunction() const;
63
64   /**
65    * Un-install the log function for the current thread.
66    */
67   void UnInstallLogFunction() const;
68
69   /**
70    * @return whether network control is enabled or not ( 0 = off, 1 = on )
71    */
72   unsigned int GetNetworkControlMode() const;
73
74   /**
75    * @return frequency of how often FPS is logged out (e.g. 0 = off, 2 = every 2 seconds).
76    */
77   unsigned int GetFrameRateLoggingFrequency() const;
78
79   /**
80    * @return frequency of how often Update Status is logged out (e.g. 0 = off, 60 = log every 60 frames = 1 second @ 60FPS).
81    */
82   unsigned int GetUpdateStatusLoggingFrequency() const;
83
84   /**
85    * @return object profiler status interval ( 0 == off )
86    */
87   unsigned int GetObjectProfilerInterval() const;
88
89   /**
90    * @return performance statistics log level ( 0 == off )
91    */
92   unsigned int GetPerformanceStatsLoggingOptions() const;
93
94   /**
95    * @return performance statistics log frequency in seconds
96    */
97   unsigned int GetPerformanceStatsLoggingFrequency() const;
98
99   /**
100    * @return performance time stamp output ( 0 == off)
101    */
102   unsigned int GetPerformanceTimeStampOutput() const;
103
104   /**
105    * @return pan-gesture logging level ( 0 == off )
106    */
107   unsigned int GetPanGestureLoggingLevel() const;
108
109   /**
110    * @return pan-gesture prediction mode ( -1 means not set so no prediction, 0 = no prediction )
111    */
112   int GetPanGesturePredictionMode() const;
113
114   /**
115    * @return pan-gesture prediction amount
116    */
117   int GetPanGesturePredictionAmount() const;
118
119   /**
120    * @return maximum pan-gesture prediction amount
121    */
122   int GetPanGestureMaximumPredictionAmount() const;
123
124   /**
125    * @return minimum pan-gesture prediction amount
126    */
127   int GetPanGestureMinimumPredictionAmount() const;
128
129   /**
130    * @brief Gets the prediction amount to adjust when the pan velocity is changed.
131    *
132    * If the pan velocity is accelerating, the prediction amount will be increased
133    * by the specified amount until it reaches the upper bound. If the pan velocity
134    * is decelerating, the prediction amount will be decreased by the specified
135    * amount until it reaches the lower bound.
136    *
137    * @return pan-gesture prediction amount adjustment
138    */
139   int GetPanGesturePredictionAmountAdjustment() const;
140
141   /**
142    * @return pan-gesture smoothing mode ( -1 means not set so no smoothing, 0 = no smoothing )
143    */
144   int GetPanGestureSmoothingMode() const;
145
146   /**
147    * @return pan-gesture smoothing amount
148    */
149   float GetPanGestureSmoothingAmount() const;
150
151   /**
152    * @return pan-gesture use actual times is true if real gesture and frame times are to be used.
153    */
154   int GetPanGestureUseActualTimes() const;
155
156   /**
157    * @return pan-gesture interpolation time range is the time range (ms) of past points to use (with weights) when interpolating.
158    */
159   int GetPanGestureInterpolationTimeRange() const;
160
161   /**
162    * @return pan-gesture scalar only prediction, when enabled, ignores acceleration.
163    */
164   int GetPanGestureScalarOnlyPredictionEnabled() const;
165
166   /**
167    * @return pan-gesture two point prediction combines two interpolated points to get more steady acceleration and velocity values.
168    */
169   int GetPanGestureTwoPointPredictionEnabled() const;
170
171   /**
172    * @return pan-gesture two point interpolate past time is the time delta (ms) in the past to interpolate the second point.
173    */
174   int GetPanGestureTwoPointInterpolatePastTime() const;
175
176   /**
177    * @return pan-gesture two point velocity bias is the ratio of first and second points to use for velocity.
178    * 0.0f = 100% of first point. 1.0f = 100% of second point.
179    */
180   float GetPanGestureTwoPointVelocityBias() const;
181
182   /**
183    * @return pan-gesture two point acceleration bias is the ratio of first and second points to use for acceleration.
184    * 0.0f = 100% of first point. 1.0f = 100% of second point.
185    */
186   float GetPanGestureTwoPointAccelerationBias() const;
187
188   /**
189    * @return pan-gesture multitap smoothing range is the range in time (ms) of points in the history to smooth the final output against.
190    */
191   int GetPanGestureMultitapSmoothingRange() const;
192
193   /**
194    * @return The minimum distance before a pan can be started (-1 means it's not set)
195    */
196   int GetMinimumPanDistance() const;
197
198   /**
199    * @return The minimum events before a pan can be started (-1 means it's not set)
200    */
201   int GetMinimumPanEvents() const;
202
203   /**
204    * @return The width of the window
205    */
206   unsigned int GetWindowWidth() const;
207
208   /**
209    * @return The height of the window
210    */
211   unsigned int GetWindowHeight() const;
212
213   /**
214    * @brief Get the graphics status time
215    */
216   int GetGlesCallTime() const;
217
218   /**
219    * @brief Get whether or not to accumulate gles call statistics
220    */
221   bool GetGlesCallAccumulate() const;
222
223   /**
224    * @return true if performance server is required
225    */
226   bool PerformanceServerRequired() const;
227
228   /**
229    * @return Gets the window name.
230    */
231   const std::string& GetWindowName() const;
232
233   /**
234    * @return Gets the window class.
235    */
236   const std::string& GetWindowClassName() const;
237
238   /**
239    * @return The thread mode that DALi should use.
240    */
241   ThreadingMode::Type GetThreadingMode() const;
242
243   /**
244    * @return The render refresh rate.
245    */
246   unsigned int GetRenderRefreshRate() const;
247
248   /**
249    * @return The number of samples required in multisample buffers
250    */
251   int GetMultiSamplingLevel() const;
252
253   /**
254    * @return The maximum texture size
255    */
256   unsigned int GetMaxTextureSize() const;
257
258   /**
259    * @return The maximum texture size
260    */
261   int GetIndicatorVisibleMode() const;
262
263   /**
264    * @brief Retrieves the interval of frames to be rendered into the Frame Buffer Object and the Frame Buffer.
265    *
266    * @return The number of frames that are going to be rendered into the Frame Buffer Object but the last one which is going to be rendered into the Frame Buffer.
267    */
268   unsigned int GetRenderToFboInterval() const;
269
270   /**
271    * @return Whether the depth buffer is required.
272    */
273   bool DepthBufferRequired() const;
274
275   /**
276    * @return Whether the stencil buffer is required.
277    */
278   bool StencilBufferRequired() const;
279
280   /// Deleted copy constructor.
281   EnvironmentOptions( const EnvironmentOptions& ) = delete;
282
283   /// Deleted move constructor.
284   EnvironmentOptions( const EnvironmentOptions&& ) = delete;
285
286   /// Deleted assignment operator.
287   EnvironmentOptions& operator=( const EnvironmentOptions& ) = delete;
288
289   /// Deleted move assignment operator.
290   EnvironmentOptions& operator=( const EnvironmentOptions&& ) = delete;
291
292 private: // Internal
293
294   /**
295    * Parses the environment options.
296    * Called from the constructor
297    */
298   void ParseEnvironmentOptions();
299
300 private: // Data
301
302   Dali::Integration::Log::LogFunction mLogFunction;
303
304   std::string mWindowName;                        ///< name of the window
305   std::string mWindowClassName;                   ///< name of the class the window belongs to
306   unsigned int mNetworkControl;                   ///< whether network control is enabled
307   unsigned int mFpsFrequency;                     ///< how often fps is logged out in seconds
308   unsigned int mUpdateStatusFrequency;            ///< how often update status is logged out in frames
309   unsigned int mObjectProfilerInterval;           ///< how often object counts are logged out in seconds
310   unsigned int mPerformanceStatsLevel;            ///< performance statistics logging bitmask
311   unsigned int mPerformanceStatsFrequency;        ///< performance statistics logging frequency (seconds)
312   unsigned int mPerformanceTimeStampOutput;       ///< performance time stamp output ( bitmask)
313   unsigned int mPanGestureLoggingLevel;           ///< pan-gesture log level
314   unsigned int mWindowWidth;                      ///< width of the window
315   unsigned int mWindowHeight;                     ///< height of the window
316   unsigned int mRenderRefreshRate;                ///< render refresh rate
317   unsigned int mMaxTextureSize;                   ///< The maximum texture size that GL can handle
318   unsigned int mRenderToFboInterval;              ///< The number of frames that are going to be rendered into the Frame Buffer Object but the last one which is going to be rendered into the Frame Buffer.
319   int mPanGesturePredictionMode;                  ///< prediction mode for pan gestures
320   int mPanGesturePredictionAmount;                ///< prediction amount for pan gestures
321   int mPanGestureMaxPredictionAmount;             ///< maximum prediction amount for pan gestures
322   int mPanGestureMinPredictionAmount;             ///< minimum prediction amount for pan gestures
323   int mPanGesturePredictionAmountAdjustment;      ///< adjustment of prediction amount for pan gestures
324   int mPanGestureSmoothingMode;                   ///< prediction mode for pan gestures
325   float mPanGestureSmoothingAmount;               ///< prediction amount for pan gestures
326   int mPanGestureUseActualTimes;                  ///< Disable to optionally override actual times if they make results worse.
327   int mPanGestureInterpolationTimeRange;          ///< Time into past history (ms) to use points to interpolate the first point.
328   int mPanGestureScalarOnlyPredictionEnabled;     ///< If enabled, prediction is done using velocity alone (no integration or acceleration).
329   int mPanGestureTwoPointPredictionEnabled;       ///< If enabled, a second interpolated point is predicted and combined with the first to get more stable values.
330   int mPanGestureTwoPointInterpolatePastTime;     ///< The target time in the past to generate the second interpolated point.
331   float mPanGestureTwoPointVelocityBias;          ///< The ratio of first and second interpolated points to use for velocity. 0.0f = 100% of first point. 1.0f = 100% of second point.
332   float mPanGestureTwoPointAccelerationBias;      ///< The ratio of first and second interpolated points to use for acceleration. 0.0f = 100% of first point. 1.0f = 100% of second point.
333   int mPanGestureMultitapSmoothingRange;          ///< The range in time (ms) of points in the history to smooth the final output against.
334   int mPanMinimumDistance;                        ///< minimum distance required before pan starts
335   int mPanMinimumEvents;                          ///< minimum events required before pan starts
336   int mGlesCallTime;                              ///< time in seconds between status updates
337   int mMultiSamplingLevel;                        ///< The number of samples required in multisample buffers
338   int mIndicatorVisibleMode;                      ///< Indicator visible mode
339   ThreadingMode::Type mThreadingMode;             ///< threading mode
340   bool mGlesCallAccumulate;                       ///< Whether or not to accumulate gles call statistics
341   bool mDepthBufferRequired;                      ///< Whether the depth buffer is required
342   bool mStencilBufferRequired;                    ///< Whether the stencil buffer is required
343 };
344
345 } // Adaptor
346 } // Internal
347 } // Dali
348
349 #endif // DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H