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