1 #ifndef DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H
2 #define DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H
5 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
23 #include <dali/integration-api/debug.h>
26 #include <dali/integration-api/adaptor-framework/log-factory-interface.h>
27 #include <dali/internal/adaptor/common/threading-mode.h>
36 class PerformanceInterface;
39 * This class provides the environment options which define settings as well as
40 * the ability to install a log function.
43 class EnvironmentOptions : public Dali::LogFactoryInterface
53 * Virtual Destructor for interface cleanup
55 virtual ~EnvironmentOptions();
58 * Create a TraceManager which is used for tracing.
59 * @param PerformanceInterface for using network logging for tracing on Ubuntu
61 void CreateTraceManager( PerformanceInterface* performanceInterface );
64 * Initialize TraceManager by installing Trace function.
66 void InstallTraceFunction() const;
69 * @param logFunction logging function
71 void SetLogFunction( const Dali::Integration::Log::LogFunction& logFunction );
74 * Install the log function for the current thread.
76 virtual void InstallLogFunction() const;
79 * Un-install the log function for the current thread.
81 void UnInstallLogFunction() const;
84 * @return whether network control is enabled or not ( 0 = off, 1 = on )
86 unsigned int GetNetworkControlMode() const;
89 * @return frequency of how often FPS is logged out (e.g. 0 = off, 2 = every 2 seconds).
91 unsigned int GetFrameRateLoggingFrequency() const;
94 * @return frequency of how often Update Status is logged out (e.g. 0 = off, 60 = log every 60 frames = 1 second @ 60FPS).
96 unsigned int GetUpdateStatusLoggingFrequency() const;
99 * @return object profiler status interval ( 0 == off )
101 unsigned int GetObjectProfilerInterval() const;
104 * @return performance statistics log level ( 0 == off )
106 unsigned int GetPerformanceStatsLoggingOptions() const;
109 * @return performance statistics log frequency in seconds
111 unsigned int GetPerformanceStatsLoggingFrequency() const;
114 * @return performance time stamp output ( 0 == off)
116 unsigned int GetPerformanceTimeStampOutput() const;
119 * @return pan-gesture logging level ( 0 == off )
121 unsigned int GetPanGestureLoggingLevel() const;
124 * @return pan-gesture prediction mode ( -1 means not set so no prediction, 0 = no prediction )
126 int GetPanGesturePredictionMode() const;
129 * @return pan-gesture prediction amount
131 int GetPanGesturePredictionAmount() const;
134 * @return maximum pan-gesture prediction amount
136 int GetPanGestureMaximumPredictionAmount() const;
139 * @return minimum pan-gesture prediction amount
141 int GetPanGestureMinimumPredictionAmount() const;
144 * @brief Gets the prediction amount to adjust when the pan velocity is changed.
146 * If the pan velocity is accelerating, the prediction amount will be increased
147 * by the specified amount until it reaches the upper bound. If the pan velocity
148 * is decelerating, the prediction amount will be decreased by the specified
149 * amount until it reaches the lower bound.
151 * @return pan-gesture prediction amount adjustment
153 int GetPanGesturePredictionAmountAdjustment() const;
156 * @return pan-gesture smoothing mode ( -1 means not set so no smoothing, 0 = no smoothing )
158 int GetPanGestureSmoothingMode() const;
161 * @return pan-gesture smoothing amount
163 float GetPanGestureSmoothingAmount() const;
166 * @return pan-gesture use actual times is true if real gesture and frame times are to be used.
168 int GetPanGestureUseActualTimes() const;
171 * @return pan-gesture interpolation time range is the time range (ms) of past points to use (with weights) when interpolating.
173 int GetPanGestureInterpolationTimeRange() const;
176 * @return pan-gesture scalar only prediction, when enabled, ignores acceleration.
178 int GetPanGestureScalarOnlyPredictionEnabled() const;
181 * @return pan-gesture two point prediction combines two interpolated points to get more steady acceleration and velocity values.
183 int GetPanGestureTwoPointPredictionEnabled() const;
186 * @return pan-gesture two point interpolate past time is the time delta (ms) in the past to interpolate the second point.
188 int GetPanGestureTwoPointInterpolatePastTime() const;
191 * @return pan-gesture two point velocity bias is the ratio of first and second points to use for velocity.
192 * 0.0f = 100% of first point. 1.0f = 100% of second point.
194 float GetPanGestureTwoPointVelocityBias() const;
197 * @return pan-gesture two point acceleration bias is the ratio of first and second points to use for acceleration.
198 * 0.0f = 100% of first point. 1.0f = 100% of second point.
200 float GetPanGestureTwoPointAccelerationBias() const;
203 * @return pan-gesture multitap smoothing range is the range in time (ms) of points in the history to smooth the final output against.
205 int GetPanGestureMultitapSmoothingRange() const;
208 * @return The minimum distance before a pan can be started (-1 means it's not set)
210 int GetMinimumPanDistance() const;
213 * @return The minimum events before a pan can be started (-1 means it's not set)
215 int GetMinimumPanEvents() const;
218 * @return The minimum pixels before a pinch can be started (-1 means it's not set)
220 float GetMinimumPinchDistance() const;
223 * @return The minimum holding time required to be recognized as a long press gesture (milliseconds)
225 int GetLongPressMinimumHoldingTime() const;
228 * @return The width of the window
230 unsigned int GetWindowWidth() const;
233 * @return The height of the window
235 unsigned int GetWindowHeight() const;
238 * @brief Get the graphics status time
240 int GetGlesCallTime() const;
243 * @brief Get whether or not to accumulate gles call statistics
245 bool GetGlesCallAccumulate() const;
248 * @return true if performance server is required
250 bool PerformanceServerRequired() const;
253 * @return Gets the window name.
255 const std::string& GetWindowName() const;
258 * @return Gets the window class.
260 const std::string& GetWindowClassName() const;
263 * @return The thread mode that DALi should use.
265 ThreadingMode::Type GetThreadingMode() const;
268 * @return The render refresh rate.
270 unsigned int GetRenderRefreshRate() const;
273 * @return The number of samples required in multisample buffers
275 int GetMultiSamplingLevel() const;
278 * @return The maximum texture size
280 unsigned int GetMaxTextureSize() const;
283 * @brief Retrieves the interval of frames to be rendered into the Frame Buffer Object and the Frame Buffer.
285 * @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.
287 unsigned int GetRenderToFboInterval() const;
290 * @return Whether the depth buffer is required.
292 bool DepthBufferRequired() const;
295 * @return Whether the stencil buffer is required.
297 bool StencilBufferRequired() const;
300 * @return whether the partial update is available.
302 bool PartialUpdateAvailable() const;
304 /// Deleted copy constructor.
305 EnvironmentOptions( const EnvironmentOptions& ) = delete;
307 /// Deleted move constructor.
308 EnvironmentOptions( const EnvironmentOptions&& ) = delete;
310 /// Deleted assignment operator.
311 EnvironmentOptions& operator=( const EnvironmentOptions& ) = delete;
313 /// Deleted move assignment operator.
314 EnvironmentOptions& operator=( const EnvironmentOptions&& ) = delete;
319 * Parses the environment options.
320 * Called from the constructor
322 void ParseEnvironmentOptions();
326 Dali::Integration::Log::LogFunction mLogFunction;
327 std::string mWindowName; ///< name of the window
328 std::string mWindowClassName; ///< name of the class the window belongs to
329 unsigned int mNetworkControl; ///< whether network control is enabled
330 unsigned int mFpsFrequency; ///< how often fps is logged out in seconds
331 unsigned int mUpdateStatusFrequency; ///< how often update status is logged out in frames
332 unsigned int mObjectProfilerInterval; ///< how often object counts are logged out in seconds
333 unsigned int mPerformanceStatsLevel; ///< performance statistics logging bitmask
334 unsigned int mPerformanceStatsFrequency; ///< performance statistics logging frequency (seconds)
335 unsigned int mPerformanceTimeStampOutput; ///< performance time stamp output ( bitmask)
336 unsigned int mPanGestureLoggingLevel; ///< pan-gesture log level
337 unsigned int mWindowWidth; ///< width of the window
338 unsigned int mWindowHeight; ///< height of the window
339 unsigned int mRenderRefreshRate; ///< render refresh rate
340 unsigned int mMaxTextureSize; ///< The maximum texture size that GL can handle
341 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.
342 int mPanGesturePredictionMode; ///< prediction mode for pan gestures
343 int mPanGesturePredictionAmount; ///< prediction amount for pan gestures
344 int mPanGestureMaxPredictionAmount; ///< maximum prediction amount for pan gestures
345 int mPanGestureMinPredictionAmount; ///< minimum prediction amount for pan gestures
346 int mPanGesturePredictionAmountAdjustment; ///< adjustment of prediction amount for pan gestures
347 int mPanGestureSmoothingMode; ///< prediction mode for pan gestures
348 float mPanGestureSmoothingAmount; ///< prediction amount for pan gestures
349 int mPanGestureUseActualTimes; ///< Disable to optionally override actual times if they make results worse.
350 int mPanGestureInterpolationTimeRange; ///< Time into past history (ms) to use points to interpolate the first point.
351 int mPanGestureScalarOnlyPredictionEnabled; ///< If enabled, prediction is done using velocity alone (no integration or acceleration).
352 int mPanGestureTwoPointPredictionEnabled; ///< If enabled, a second interpolated point is predicted and combined with the first to get more stable values.
353 int mPanGestureTwoPointInterpolatePastTime; ///< The target time in the past to generate the second interpolated point.
354 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.
355 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.
356 int mPanGestureMultitapSmoothingRange; ///< The range in time (ms) of points in the history to smooth the final output against.
357 int mPanMinimumDistance; ///< minimum distance required before pan starts
358 int mPanMinimumEvents; ///< minimum events required before pan starts
359 float mPinchMinimumDistance; ///< minimum number of pixels moved before a pinch starts
360 int mLongPressMinimumHoldingTime; ///< minimum holding time required to be recognized as a long press gesture (millisecond)
361 int mGlesCallTime; ///< time in seconds between status updates
362 int mMultiSamplingLevel; ///< The number of samples required in multisample buffers
363 ThreadingMode::Type mThreadingMode; ///< threading mode
364 bool mGlesCallAccumulate; ///< Whether or not to accumulate gles call statistics
365 bool mDepthBufferRequired; ///< Whether the depth buffer is required
366 bool mStencilBufferRequired; ///< Whether the stencil buffer is required
367 bool mPartialUpdateAvailable; ///< whether the partial update is available
368 std::unique_ptr<TraceManager> mTraceManager; ///< TraceManager
375 #endif // DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H