1 #ifndef DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H
2 #define DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H
5 * Copyright (c) 2021 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.
22 #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
52 * Virtual Destructor for interface cleanup
54 virtual ~EnvironmentOptions();
57 * Create a TraceManager which is used for tracing.
58 * @param PerformanceInterface for using network logging for tracing on Ubuntu
60 void CreateTraceManager(PerformanceInterface* performanceInterface);
63 * Initialize TraceManager by installing Trace function.
65 void InstallTraceFunction() const;
68 * @param logFunction logging function
70 void SetLogFunction(const Dali::Integration::Log::LogFunction& logFunction);
73 * Install the log function for the current thread.
75 void InstallLogFunction() const override;
78 * Un-install the log function for the current thread.
80 void UnInstallLogFunction() const;
83 * @return whether network control is enabled or not ( 0 = off, 1 = on )
85 unsigned int GetNetworkControlMode() const;
88 * @return frequency of how often FPS is logged out (e.g. 0 = off, 2 = every 2 seconds).
90 unsigned int GetFrameRateLoggingFrequency() const;
93 * @return frequency of how often Update Status is logged out (e.g. 0 = off, 60 = log every 60 frames = 1 second @ 60FPS).
95 unsigned int GetUpdateStatusLoggingFrequency() const;
98 * @return object profiler status interval ( 0 == off )
100 unsigned int GetObjectProfilerInterval() const;
103 * @return performance statistics log level ( 0 == off )
105 unsigned int GetPerformanceStatsLoggingOptions() const;
108 * @return performance statistics log frequency in seconds
110 unsigned int GetPerformanceStatsLoggingFrequency() const;
113 * @return performance time stamp output ( 0 == off)
115 unsigned int GetPerformanceTimeStampOutput() const;
118 * @return pan-gesture logging level ( 0 == off )
120 unsigned int GetPanGestureLoggingLevel() const;
123 * @return pan-gesture prediction mode ( -1 means not set so no prediction, 0 = no prediction )
125 int GetPanGesturePredictionMode() const;
128 * @return pan-gesture prediction amount
130 int GetPanGesturePredictionAmount() const;
133 * @return maximum pan-gesture prediction amount
135 int GetPanGestureMaximumPredictionAmount() const;
138 * @return minimum pan-gesture prediction amount
140 int GetPanGestureMinimumPredictionAmount() const;
143 * @brief Gets the prediction amount to adjust when the pan velocity is changed.
145 * If the pan velocity is accelerating, the prediction amount will be increased
146 * by the specified amount until it reaches the upper bound. If the pan velocity
147 * is decelerating, the prediction amount will be decreased by the specified
148 * amount until it reaches the lower bound.
150 * @return pan-gesture prediction amount adjustment
152 int GetPanGesturePredictionAmountAdjustment() const;
155 * @return pan-gesture smoothing mode ( -1 means not set so no smoothing, 0 = no smoothing )
157 int GetPanGestureSmoothingMode() const;
160 * @return pan-gesture smoothing amount
162 float GetPanGestureSmoothingAmount() const;
165 * @return pan-gesture use actual times is true if real gesture and frame times are to be used.
167 int GetPanGestureUseActualTimes() const;
170 * @return pan-gesture interpolation time range is the time range (ms) of past points to use (with weights) when interpolating.
172 int GetPanGestureInterpolationTimeRange() const;
175 * @return pan-gesture scalar only prediction, when enabled, ignores acceleration.
177 int GetPanGestureScalarOnlyPredictionEnabled() const;
180 * @return pan-gesture two point prediction combines two interpolated points to get more steady acceleration and velocity values.
182 int GetPanGestureTwoPointPredictionEnabled() const;
185 * @return pan-gesture two point interpolate past time is the time delta (ms) in the past to interpolate the second point.
187 int GetPanGestureTwoPointInterpolatePastTime() const;
190 * @return pan-gesture two point velocity bias is the ratio of first and second points to use for velocity.
191 * 0.0f = 100% of first point. 1.0f = 100% of second point.
193 float GetPanGestureTwoPointVelocityBias() const;
196 * @return pan-gesture two point acceleration bias is the ratio of first and second points to use for acceleration.
197 * 0.0f = 100% of first point. 1.0f = 100% of second point.
199 float GetPanGestureTwoPointAccelerationBias() const;
202 * @return pan-gesture multitap smoothing range is the range in time (ms) of points in the history to smooth the final output against.
204 int GetPanGestureMultitapSmoothingRange() const;
207 * @return The minimum distance before a pan can be started (-1 means it's not set)
209 int GetMinimumPanDistance() const;
212 * @return The minimum events before a pan can be started (-1 means it's not set)
214 int GetMinimumPanEvents() const;
217 * @return The minimum pixels before a pinch can be started (-1 means it's not set)
219 float GetMinimumPinchDistance() const;
222 * @return The minimum touch events required before a pinch can be started (-1 means it's not set)
224 int GetMinimumPinchTouchEvents() const;
227 * @return The minimum touch events required after a pinch started (-1 means it's not set)
229 int GetMinimumPinchTouchEventsAfterStart() const;
232 * @return The minimum touch events required before a rotation can be started (-1 means it's not set)
234 int GetMinimumRotationTouchEvents() const;
237 * @return The minimum touch events required after a rotation started (-1 means it's not set)
239 int GetMinimumRotationTouchEventsAfterStart() const;
242 * @return The minimum holding time required to be recognized as a long press gesture (milliseconds)
244 int GetLongPressMinimumHoldingTime() const;
247 * @return The maximum allowed time required to be recognized as a multi tap gesture (millisecond)
249 int GetTapMaximumAllowedTime() const;
252 * @return The width of the window
254 unsigned int GetWindowWidth() const;
257 * @return The height of the window
259 unsigned int GetWindowHeight() const;
262 * @brief Get the graphics status time
264 int GetGlesCallTime() const;
267 * @brief Get whether or not to accumulate gles call statistics
269 bool GetGlesCallAccumulate() const;
272 * @return true if performance server is required
274 bool PerformanceServerRequired() const;
277 * @return Gets the window name.
279 const std::string& GetWindowName() const;
282 * @return Gets the window class.
284 const std::string& GetWindowClassName() const;
287 * @return The thread mode that DALi should use.
289 ThreadingMode::Type GetThreadingMode() const;
292 * @return The render refresh rate.
294 unsigned int GetRenderRefreshRate() const;
297 * @return The number of samples required in multisample buffers
299 int GetMultiSamplingLevel() const;
302 * @return The maximum texture size
304 unsigned int GetMaxTextureSize() const;
307 * @brief Retrieves the interval of frames to be rendered into the Frame Buffer Object and the Frame Buffer.
309 * @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.
311 unsigned int GetRenderToFboInterval() const;
314 * @return Whether the depth buffer is required.
316 bool DepthBufferRequired() const;
319 * @return Whether the stencil buffer is required.
321 bool StencilBufferRequired() const;
324 * @return Whether the partial update is required.
326 bool PartialUpdateRequired() const;
328 /// Deleted copy constructor.
329 EnvironmentOptions(const EnvironmentOptions&) = delete;
331 /// Deleted move constructor.
332 EnvironmentOptions(const EnvironmentOptions&&) = delete;
334 /// Deleted assignment operator.
335 EnvironmentOptions& operator=(const EnvironmentOptions&) = delete;
337 /// Deleted move assignment operator.
338 EnvironmentOptions& operator=(const EnvironmentOptions&&) = delete;
342 * Parses the environment options.
343 * Called from the constructor
345 void ParseEnvironmentOptions();
348 Dali::Integration::Log::LogFunction mLogFunction;
350 std::string mWindowName; ///< name of the window
351 std::string mWindowClassName; ///< name of the class the window belongs to
353 unsigned int mNetworkControl; ///< whether network control is enabled
354 unsigned int mFpsFrequency; ///< how often fps is logged out in seconds
355 unsigned int mUpdateStatusFrequency; ///< how often update status is logged out in frames
356 unsigned int mObjectProfilerInterval; ///< how often object counts are logged out in seconds
357 unsigned int mPerformanceStatsLevel; ///< performance statistics logging bitmask
358 unsigned int mPerformanceStatsFrequency; ///< performance statistics logging frequency (seconds)
359 unsigned int mPerformanceTimeStampOutput; ///< performance time stamp output ( bitmask)
360 unsigned int mPanGestureLoggingLevel; ///< pan-gesture log level
361 unsigned int mWindowWidth; ///< width of the window
362 unsigned int mWindowHeight; ///< height of the window
363 unsigned int mRenderRefreshRate; ///< render refresh rate
364 unsigned int mMaxTextureSize; ///< The maximum texture size that GL can handle
365 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.
367 int mPanGesturePredictionMode; ///< prediction mode for pan gestures
368 int mPanGesturePredictionAmount; ///< prediction amount for pan gestures
369 int mPanGestureMaxPredictionAmount; ///< maximum prediction amount for pan gestures
370 int mPanGestureMinPredictionAmount; ///< minimum prediction amount for pan gestures
371 int mPanGesturePredictionAmountAdjustment; ///< adjustment of prediction amount for pan gestures
372 int mPanGestureSmoothingMode; ///< prediction mode for pan gestures
373 float mPanGestureSmoothingAmount; ///< prediction amount for pan gestures
374 int mPanGestureUseActualTimes; ///< Disable to optionally override actual times if they make results worse.
375 int mPanGestureInterpolationTimeRange; ///< Time into past history (ms) to use points to interpolate the first point.
376 int mPanGestureScalarOnlyPredictionEnabled; ///< If enabled, prediction is done using velocity alone (no integration or acceleration).
377 int mPanGestureTwoPointPredictionEnabled; ///< If enabled, a second interpolated point is predicted and combined with the first to get more stable values.
378 int mPanGestureTwoPointInterpolatePastTime; ///< The target time in the past to generate the second interpolated point.
379 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.
380 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.
381 int mPanGestureMultitapSmoothingRange; ///< The range in time (ms) of points in the history to smooth the final output against.
382 int mPanMinimumDistance; ///< minimum distance required before pan starts
383 int mPanMinimumEvents; ///< minimum events required before pan starts
384 float mPinchMinimumDistance; ///< minimum number of pixels moved before a pinch starts
385 int mPinchMinimumTouchEvents; ///< minimum events required before a pinch starts
386 int mPinchMinimumTouchEventsAfterStart; ///< minimum events required after a pinch started
387 int mRotationMinimumTouchEvents; ///< minimum events required before a rotation starts
388 int mRotationMinimumTouchEventsAfterStart; ///< minimum events required after a rotation started
389 int mLongPressMinimumHoldingTime; ///< minimum holding time required to be recognized as a long press gesture (millisecond)
390 int mTapMaximumAllowedTime; ///< maximum allowed time required to be recognized as a multi tap gesture (millisecond)
391 int mGlesCallTime; ///< time in seconds between status updates
392 int mMultiSamplingLevel; ///< The number of samples required in multisample buffers
394 ThreadingMode::Type mThreadingMode; ///< threading mode
396 bool mGlesCallAccumulate; ///< Whether or not to accumulate gles call statistics
397 bool mDepthBufferRequired; ///< Whether the depth buffer is required
398 bool mStencilBufferRequired; ///< Whether the stencil buffer is required
399 bool mPartialUpdateRequired; ///< Whether the partial update is required
401 std::unique_ptr<TraceManager> mTraceManager; ///< TraceManager
404 } // namespace Adaptor
405 } // namespace Internal
408 #endif // DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H