[4.0] Added interface to install logging function
[platform/core/uifw/dali-adaptor.git] / adaptors / base / environment-options.h
index 61e692b..af04593 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H__
-#define __DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H__
+#ifndef DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H
+#define DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
 
+// INTERNAL INCLUDES
+#include <base/threading-mode.h>
+#include <log-factory-interface.h>
+
 namespace Dali
 {
 namespace Internal
@@ -29,13 +33,12 @@ namespace Adaptor
 {
 
 /**
- * Contains environment options which define settings and the ability to install a log function.
+ * This class provides the environment options which define settings as well as
+ * the ability to install a log function.
  *
- * TODO: This file and adaptor needs cleaning up. There should not be any environment options in the adaptor class, only here!
  */
-class EnvironmentOptions
+class EnvironmentOptions : public Dali::LogFactoryInterface
 {
-
 public:
 
   /**
@@ -44,34 +47,19 @@ public:
   EnvironmentOptions();
 
   /**
-   * non-virtual destructor, not intended as a base class
+   * Virtual Destructor for interface cleanup
    */
-  ~EnvironmentOptions();
+  virtual ~EnvironmentOptions();
 
   /**
    * @param logFunction logging function
-   * @param networkControl whether network control is enabled
-   * @param logFilterOptions bitmask of the logging options defined in intergration/debug.h (e.g.
-   * @param logFrameRateFrequency frequency of how often FPS is logged out (e.g. 0 = off, 2 = every 2 seconds).
-   * @param logupdateStatusFrequency frequency of how often the update status is logged in number of frames
-   * @param logPerformanceStats performance statistics logging, 0 = disabled,  1+ =  enabled
-   * @param logPerformanceStatsFrequency statistics logging frequency in seconds
-   * @param performanceTimeStampOutput where to output performance related time stamps to
-   * @param logPanGestureLevel pan-gesture logging, 0 = disabled,  1 = enabled
-   */
-  void SetLogOptions( const Dali::Integration::Log::LogFunction& logFunction,
-                       unsigned int networkControl,
-                       unsigned int logFrameRateFrequency,
-                       unsigned int logupdateStatusFrequency,
-                       unsigned int logPerformanceStats,
-                       unsigned int logPerformanceStatsFrequency,
-                       unsigned int performanceTimeStampOutput,
-                       unsigned int logPanGestureLevel );
+   */
+  void SetLogFunction( const Dali::Integration::Log::LogFunction& logFunction );
 
   /**
    * Install the log function for the current thread.
    */
-  void InstallLogFunction() const;
+  virtual void InstallLogFunction() const;
 
   /**
    * Un-install the log function for the current thread.
@@ -94,6 +82,11 @@ public:
   unsigned int GetUpdateStatusLoggingFrequency() const;
 
   /**
+   * @return object profiler status interval ( 0 == off )
+   */
+  unsigned int GetObjectProfilerInterval() const;
+
+  /**
    * @return performance statistics log level ( 0 == off )
    */
   unsigned int GetPerformanceStatsLoggingOptions() const;
@@ -134,6 +127,13 @@ public:
   int GetPanGestureMinimumPredictionAmount() const;
 
   /**
+   * @brief Gets the prediction amount to adjust when the pan velocity is changed.
+   *
+   * If the pan velocity is accelerating, the prediction amount will be increased
+   * by the specified amount until it reaches the upper bound. If the pan velocity
+   * is decelerating, the prediction amount will be decreased by the specified
+   * amount until it reaches the lower bound.
+   *
    * @return pan-gesture prediction amount adjustment
    */
   int GetPanGesturePredictionAmountAdjustment() const;
@@ -149,6 +149,48 @@ public:
   float GetPanGestureSmoothingAmount() const;
 
   /**
+   * @return pan-gesture use actual times is true if real gesture and frame times are to be used.
+   */
+  int GetPanGestureUseActualTimes() const;
+
+  /**
+   * @return pan-gesture interpolation time range is the time range (ms) of past points to use (with weights) when interpolating.
+   */
+  int GetPanGestureInterpolationTimeRange() const;
+
+  /**
+   * @return pan-gesture scalar only prediction, when enabled, ignores acceleration.
+   */
+  int GetPanGestureScalarOnlyPredictionEnabled() const;
+
+  /**
+   * @return pan-gesture two point prediction combines two interpolated points to get more steady acceleration and velocity values.
+   */
+  int GetPanGestureTwoPointPredictionEnabled() const;
+
+  /**
+   * @return pan-gesture two point interpolate past time is the time delta (ms) in the past to interpolate the second point.
+   */
+  int GetPanGestureTwoPointInterpolatePastTime() const;
+
+  /**
+   * @return pan-gesture two point velocity bias is the ratio of first and second points to use for velocity.
+   * 0.0f = 100% of first point. 1.0f = 100% of second point.
+   */
+  float GetPanGestureTwoPointVelocityBias() const;
+
+  /**
+   * @return pan-gesture two point acceleration bias is the ratio of first and second points to use for acceleration.
+   * 0.0f = 100% of first point. 1.0f = 100% of second point.
+   */
+  float GetPanGestureTwoPointAccelerationBias() const;
+
+  /**
+   * @return pan-gesture multitap smoothing range is the range in time (ms) of points in the history to smooth the final output against.
+   */
+  int GetPanGestureMultitapSmoothingRange() const;
+
+  /**
    * @return The minimum distance before a pan can be started (-1 means it's not set)
    */
   int GetMinimumPanDistance() const;
@@ -169,108 +211,111 @@ public:
   unsigned int GetWindowHeight() const;
 
   /**
-   * @brief Sets the mode used to predict pan gesture movement
-   *
-   * @param[in] mode The prediction mode to use
+   * @brief Get the graphics status time
    */
-  void SetPanGesturePredictionMode( unsigned int mode );
+  int GetGlesCallTime() const;
 
   /**
-   * @brief Sets the prediction amount of the pan gesture
-   *
-   * @param[in] amount The prediction amount in milliseconds
+   * @brief Get whether or not to accumulate gles call statistics
    */
-  void SetPanGesturePredictionAmount( unsigned int amount );
+  bool GetGlesCallAccumulate() const;
 
   /**
-   * @brief Sets the upper bound of the prediction amount for clamping
-   *
-   * @param[in] amount The prediction amount in milliseconds
+   * @return true if performance server is required
    */
-  void SetPanGestureMaximumPredictionAmount( unsigned int amount );
+  bool PerformanceServerRequired() const;
 
   /**
-   * @brief Sets the lower bound of the prediction amount for clamping
-   *
-   * @param[in] amount The prediction amount in milliseconds
+   * @return Gets the window name.
    */
-  void SetPanGestureMinimumPredictionAmount( unsigned int amount );
+  const std::string& GetWindowName() const;
 
   /**
-   * @brief Sets the prediction amount to adjust when the pan velocity is changed.
-   * If the pan velocity is accelerating, the prediction amount will be increased
-   * by the specified amount until it reaches the upper bound. If the pan velocity
-   * is decelerating, the prediction amount will be decreased by the specified
-   * amount until it reaches the lower bound.
-   *
-   * @param[in] amount The prediction amount in milliseconds
+   * @return Gets the window class.
    */
-  void SetPanGesturePredictionAmountAdjustment( unsigned int amount );
+  const std::string& GetWindowClassName() const;
 
   /**
-   * @brief Called to set how pan gestures smooth input
-   *
-   * @param[in] mode The smoothing mode to use
+   * @return The thread mode that DALi should use.
    */
-  void SetPanGestureSmoothingMode( unsigned int mode );
+  ThreadingMode::Type GetThreadingMode() const;
 
   /**
-   * @brief Sets the mode used to smooth pan gesture movement properties calculated on the Update thread
-   *
-   * @param[in] amount The smoothing amount [0.0f,1.0f] - 0.0f would be no smoothing, 1.0f maximum smoothing
+   * @return The render refresh rate.
    */
-  void SetPanGestureSmoothingAmount( float amount );
+  unsigned int GetRenderRefreshRate() const;
 
   /**
-   * @brief Sets the minimum distance required before a pan starts
-   *
-   * @param[in] distance The minimum distance before a pan starts
+   * @return The number of samples required in multisample buffers
    */
-  void SetMinimumPanDistance( int distance );
+  int GetMultiSamplingLevel() const;
 
   /**
-   * @brief Sets the minimum number of events required before a pan starts
-   *
-   * @param[in] events The minimum events before a pan starts
+   * @return The maximum texture size
    */
-  void SetMinimumPanEvents( int events );
+  unsigned int GetMaxTextureSize() const;
 
   /**
-   * @brief Sets how often the gles call logging occurs
-   *
-   * @param[in] time the number of seconds between logging output
+   * @return The maximum texture size
    */
-  void SetGlesCallTime( int time );
+  int GetIndicatorVisibleMode() const;
 
   /**
-   * @brief Get the graphics status time
+   * @brief Retrieves the interval of frames to be rendered into the Frame Buffer Object and the Frame Buffer.
+   *
+   * @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.
    */
-  int GetGlesCallTime() const;
+  unsigned int GetRenderToFboInterval() const;
 
   /**
-   * @brief Sets the width of the window
+   * @return Whether the depth buffer is required.
    */
-  void SetWindowWidth( int width );
+  bool DepthBufferRequired() const;
 
   /**
-   * @brief Sets the width of the window
+   * @return Whether the stencil buffer is required.
    */
-  void SetWindowHeight( int height );
+  bool StencilBufferRequired() const;
+
+  /// Deleted copy constructor.
+  EnvironmentOptions( const EnvironmentOptions& ) = delete;
+
+  /// Deleted move constructor.
+  EnvironmentOptions( const EnvironmentOptions&& ) = delete;
+
+  /// Deleted assignment operator.
+  EnvironmentOptions& operator=( const EnvironmentOptions& ) = delete;
+
+  /// Deleted move assignment operator.
+  EnvironmentOptions& operator=( const EnvironmentOptions&& ) = delete;
+
+private: // Internal
 
   /**
-   * @return true if performance server is required
+   * Parses the environment options.
+   * Called from the constructor
    */
-  bool PerformanceServerRequired() const;
+  void ParseEnvironmentOptions();
 
-private:
+private: // Data
+
+  Dali::Integration::Log::LogFunction mLogFunction;
 
+  std::string mWindowName;                        ///< name of the window
+  std::string mWindowClassName;                   ///< name of the class the window belongs to
   unsigned int mNetworkControl;                   ///< whether network control is enabled
   unsigned int mFpsFrequency;                     ///< how often fps is logged out in seconds
   unsigned int mUpdateStatusFrequency;            ///< how often update status is logged out in frames
+  unsigned int mObjectProfilerInterval;           ///< how often object counts are logged out in seconds
   unsigned int mPerformanceStatsLevel;            ///< performance statistics logging bitmask
   unsigned int mPerformanceStatsFrequency;        ///< performance statistics logging frequency (seconds)
   unsigned int mPerformanceTimeStampOutput;       ///< performance time stamp output ( bitmask)
   unsigned int mPanGestureLoggingLevel;           ///< pan-gesture log level
+  unsigned int mWindowWidth;                      ///< width of the window
+  unsigned int mWindowHeight;                     ///< height of the window
+  unsigned int mRenderRefreshRate;                ///< render refresh rate
+  unsigned int mMaxTextureSize;                   ///< The maximum texture size that GL can handle
+  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.
   int mPanGesturePredictionMode;                  ///< prediction mode for pan gestures
   int mPanGesturePredictionAmount;                ///< prediction amount for pan gestures
   int mPanGestureMaxPredictionAmount;             ///< maximum prediction amount for pan gestures
@@ -278,24 +323,27 @@ private:
   int mPanGesturePredictionAmountAdjustment;      ///< adjustment of prediction amount for pan gestures
   int mPanGestureSmoothingMode;                   ///< prediction mode for pan gestures
   float mPanGestureSmoothingAmount;               ///< prediction amount for pan gestures
+  int mPanGestureUseActualTimes;                  ///< Disable to optionally override actual times if they make results worse.
+  int mPanGestureInterpolationTimeRange;          ///< Time into past history (ms) to use points to interpolate the first point.
+  int mPanGestureScalarOnlyPredictionEnabled;     ///< If enabled, prediction is done using velocity alone (no integration or acceleration).
+  int mPanGestureTwoPointPredictionEnabled;       ///< If enabled, a second interpolated point is predicted and combined with the first to get more stable values.
+  int mPanGestureTwoPointInterpolatePastTime;     ///< The target time in the past to generate the second interpolated point.
+  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.
+  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.
+  int mPanGestureMultitapSmoothingRange;          ///< The range in time (ms) of points in the history to smooth the final output against.
   int mPanMinimumDistance;                        ///< minimum distance required before pan starts
   int mPanMinimumEvents;                          ///< minimum events required before pan starts
   int mGlesCallTime;                              ///< time in seconds between status updates
-  unsigned int mWindowWidth;                      ///< width of the window
-  unsigned int mWindowHeight;                     ///< height of the window
-
-  Dali::Integration::Log::LogFunction mLogFunction;
-
-  // Undefined copy constructor.
-  EnvironmentOptions( const EnvironmentOptions& );
-
-  // Undefined assignment operator.
-  EnvironmentOptions& operator=( const EnvironmentOptions& );
-
+  int mMultiSamplingLevel;                        ///< The number of samples required in multisample buffers
+  int mIndicatorVisibleMode;                      ///< Indicator visible mode
+  ThreadingMode::Type mThreadingMode;             ///< threading mode
+  bool mGlesCallAccumulate;                       ///< Whether or not to accumulate gles call statistics
+  bool mDepthBufferRequired;                      ///< Whether the depth buffer is required
+  bool mStencilBufferRequired;                    ///< Whether the stencil buffer is required
 };
 
 } // Adaptor
 } // Internal
 } // Dali
 
-#endif // __DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H__
+#endif // DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H