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