[4.0] Support EGL_DONT_CARE for multi-sampling level
[platform/core/uifw/dali-adaptor.git] / adaptors / base / environment-options.cpp
index 4859efe..5310615 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 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.
@@ -38,6 +38,7 @@ namespace Adaptor
 namespace
 {
 const unsigned int DEFAULT_STATISTICS_LOG_FREQUENCY = 2;
+const int DEFAULT_MULTI_SAMPLING_LEVEL = 4;
 
 unsigned int GetIntegerEnvironmentVariable( const char* variable, unsigned int defaultValue )
 {
@@ -74,13 +75,22 @@ bool GetFloatEnvironmentVariable( const char* variable, float& floatValue )
   return true;
 }
 
+const char * GetCharEnvironmentVariable( const char * variable )
+{
+  return std::getenv( variable );
 }
+
+} // unnamed namespace
+
 EnvironmentOptions::EnvironmentOptions()
-: mNetworkControl(0),
+: mWindowName(),
+  mWindowClassName(),
+  mNetworkControl(0),
   mFpsFrequency(0),
   mUpdateStatusFrequency(0),
+  mObjectProfilerInterval( 0 ),
   mPerformanceStatsLevel(0),
-  mPerformanceStatsFrequency( DEFAULT_STATISTICS_LOG_FREQUENCY),
+  mPerformanceStatsFrequency( DEFAULT_STATISTICS_LOG_FREQUENCY ),
   mPerformanceTimeStampOutput(0),
   mPanGestureLoggingLevel(0),
   mPanGesturePredictionMode(-1),
@@ -92,9 +102,16 @@ EnvironmentOptions::EnvironmentOptions()
   mPanGestureSmoothingAmount(-1.0f),
   mPanMinimumDistance(-1),
   mPanMinimumEvents(-1),
-  mGlesCallTime(0),
+  mGlesCallTime( 0 ),
   mWindowWidth( 0 ),
-  mWindowHeight( 0 )
+  mWindowHeight( 0 ),
+  mThreadingMode( ThreadingMode::COMBINED_UPDATE_RENDER ),
+  mRenderRefreshRate( 1 ),
+  mGlesCallAccumulate( false ),
+  mMultiSamplingLevel( DEFAULT_MULTI_SAMPLING_LEVEL ),
+  mMaxTextureSize( 0 ),
+  mIndicatorVisibleMode( -1 ),
+  mLogFunction( NULL )
 {
   ParseEnvironmentOptions();
 }
@@ -132,6 +149,11 @@ unsigned int EnvironmentOptions::GetUpdateStatusLoggingFrequency() const
   return mUpdateStatusFrequency;
 }
 
+unsigned int EnvironmentOptions::GetObjectProfilerInterval() const
+{
+  return mObjectProfilerInterval;
+}
+
 unsigned int EnvironmentOptions::GetPerformanceStatsLoggingOptions() const
 {
   return mPerformanceStatsLevel;
@@ -205,74 +227,54 @@ unsigned int EnvironmentOptions::GetWindowHeight() const
   return mWindowHeight;
 }
 
-void EnvironmentOptions::SetPanGesturePredictionMode( unsigned int mode )
-{
-  mPanGesturePredictionMode = mode;
-}
-
-void EnvironmentOptions::SetPanGesturePredictionAmount( unsigned int amount )
-{
-  mPanGesturePredictionAmount = amount;
-}
-
-void EnvironmentOptions::SetPanGestureMaximumPredictionAmount( unsigned int amount )
-{
-  mPanGestureMaxPredictionAmount = amount;
-}
-
-void EnvironmentOptions::SetPanGestureMinimumPredictionAmount( unsigned int amount )
+int EnvironmentOptions::GetGlesCallTime() const
 {
-  mPanGestureMinPredictionAmount = amount;
+  return mGlesCallTime;
 }
 
-void EnvironmentOptions::SetPanGesturePredictionAmountAdjustment( unsigned int amount )
+bool EnvironmentOptions::GetGlesCallAccumulate() const
 {
-  mPanGesturePredictionAmountAdjustment = amount;
+  return mGlesCallAccumulate;
 }
 
-void EnvironmentOptions::SetPanGestureSmoothingMode( unsigned int mode )
+const std::string& EnvironmentOptions::GetWindowName() const
 {
-  mPanGestureSmoothingMode = mode;
+  return mWindowName;
 }
 
-void EnvironmentOptions::SetPanGestureSmoothingAmount( float amount )
+const std::string& EnvironmentOptions::GetWindowClassName() const
 {
-  mPanGestureSmoothingAmount = amount;
+  return mWindowClassName;
 }
 
-void EnvironmentOptions::SetMinimumPanDistance( int distance )
+ThreadingMode::Type EnvironmentOptions::GetThreadingMode() const
 {
-  mPanMinimumDistance = distance;
+  return mThreadingMode;
 }
 
-void EnvironmentOptions::SetMinimumPanEvents( int events )
+unsigned int EnvironmentOptions::GetRenderRefreshRate() const
 {
-  mPanMinimumEvents = events;
+  return mRenderRefreshRate;
 }
 
-void EnvironmentOptions::SetGlesCallTime( int time )
+int EnvironmentOptions::GetMultiSamplingLevel() const
 {
-  mGlesCallTime = time;
+  return mMultiSamplingLevel;
 }
 
-int EnvironmentOptions::GetGlesCallTime() const
+unsigned int EnvironmentOptions::GetMaxTextureSize() const
 {
-  return mGlesCallTime;
+  return mMaxTextureSize;
 }
 
-void EnvironmentOptions::SetWindowWidth( int width )
+int EnvironmentOptions::GetIndicatorVisibleMode() const
 {
-  mWindowWidth = width;
-}
-
-void EnvironmentOptions::SetWindowHeight( int height )
-{
-  mWindowHeight = height;
+  return mIndicatorVisibleMode;
 }
 
 bool EnvironmentOptions::PerformanceServerRequired() const
 {
-  return ( (GetPerformanceStatsLoggingOptions() > 0) ||
+  return ( ( GetPerformanceStatsLoggingOptions() > 0) ||
            ( GetPerformanceTimeStampOutput() > 0 ) ||
            ( GetNetworkControlMode() > 0) );
 }
@@ -282,6 +284,7 @@ void EnvironmentOptions::ParseEnvironmentOptions()
   // get logging options
   mFpsFrequency = GetIntegerEnvironmentVariable( DALI_ENV_FPS_TRACKING, 0 );
   mUpdateStatusFrequency = GetIntegerEnvironmentVariable( DALI_ENV_UPDATE_STATUS_INTERVAL, 0 );
+  mObjectProfilerInterval = GetIntegerEnvironmentVariable( DALI_ENV_OBJECT_PROFILER_INTERVAL, 0 );
   mPerformanceStatsLevel = GetIntegerEnvironmentVariable( DALI_ENV_LOG_PERFORMANCE_STATS, 0 );
   mPerformanceStatsFrequency = GetIntegerEnvironmentVariable( DALI_ENV_LOG_PERFORMANCE_STATS_FREQUENCY, 0 );
   mPerformanceTimeStampOutput = GetIntegerEnvironmentVariable( DALI_ENV_PERFORMANCE_TIMESTAMP_OUTPUT, 0 );
@@ -291,7 +294,7 @@ void EnvironmentOptions::ParseEnvironmentOptions()
   int predictionMode;
   if( GetIntegerEnvironmentVariable(DALI_ENV_PAN_PREDICTION_MODE, predictionMode) )
   {
-    SetPanGesturePredictionMode(predictionMode);
+    mPanGesturePredictionMode = predictionMode;
   }
   int predictionAmount(-1);
   if( GetIntegerEnvironmentVariable(DALI_ENV_PAN_PREDICTION_AMOUNT, predictionAmount) )
@@ -301,7 +304,7 @@ void EnvironmentOptions::ParseEnvironmentOptions()
       // do not support times in the past
       predictionAmount = 0;
     }
-    SetPanGesturePredictionAmount(predictionAmount);
+    mPanGesturePredictionAmount = predictionAmount;
   }
   int minPredictionAmount(-1);
   if( GetIntegerEnvironmentVariable(DALI_ENV_PAN_MIN_PREDICTION_AMOUNT, minPredictionAmount) )
@@ -311,7 +314,7 @@ void EnvironmentOptions::ParseEnvironmentOptions()
       // do not support times in the past
       minPredictionAmount = 0;
     }
-    SetPanGestureMinimumPredictionAmount(minPredictionAmount);
+    mPanGestureMinPredictionAmount = minPredictionAmount;
   }
   int maxPredictionAmount(-1);
   if( GetIntegerEnvironmentVariable(DALI_ENV_PAN_MAX_PREDICTION_AMOUNT, maxPredictionAmount) )
@@ -321,7 +324,7 @@ void EnvironmentOptions::ParseEnvironmentOptions()
       // maximum amount should not be smaller than minimum amount
       maxPredictionAmount = minPredictionAmount;
     }
-    SetPanGestureMaximumPredictionAmount(maxPredictionAmount);
+    mPanGestureMaxPredictionAmount = maxPredictionAmount;
   }
   int predictionAmountAdjustment(-1);
   if( GetIntegerEnvironmentVariable(DALI_ENV_PAN_PREDICTION_AMOUNT_ADJUSTMENT, predictionAmountAdjustment) )
@@ -331,45 +334,109 @@ void EnvironmentOptions::ParseEnvironmentOptions()
       // negative amount doesn't make sense
       predictionAmountAdjustment = 0;
     }
-    SetPanGesturePredictionAmountAdjustment(predictionAmountAdjustment);
+    mPanGesturePredictionAmountAdjustment = predictionAmountAdjustment;
   }
   int smoothingMode;
   if( GetIntegerEnvironmentVariable(DALI_ENV_PAN_SMOOTHING_MODE, smoothingMode) )
   {
-    SetPanGestureSmoothingMode(smoothingMode);
+    mPanGestureSmoothingMode = smoothingMode;
   }
   float smoothingAmount = 1.0f;
   if( GetFloatEnvironmentVariable(DALI_ENV_PAN_SMOOTHING_AMOUNT, smoothingAmount) )
   {
     smoothingAmount = Clamp(smoothingAmount, 0.0f, 1.0f);
-    SetPanGestureSmoothingAmount(smoothingAmount);
+    mPanGestureSmoothingAmount = smoothingAmount;
   }
 
   int minimumDistance(-1);
   if ( GetIntegerEnvironmentVariable(DALI_ENV_PAN_MINIMUM_DISTANCE, minimumDistance ))
   {
-    SetMinimumPanDistance( minimumDistance );
+    mPanMinimumDistance = minimumDistance;
   }
 
   int minimumEvents(-1);
   if ( GetIntegerEnvironmentVariable(DALI_ENV_PAN_MINIMUM_EVENTS, minimumEvents ))
   {
-    SetMinimumPanEvents( minimumEvents );
+    mPanMinimumEvents = minimumEvents;
   }
 
   int glesCallTime(0);
   if ( GetIntegerEnvironmentVariable(DALI_GLES_CALL_TIME, glesCallTime ))
   {
-    SetGlesCallTime( glesCallTime );
+    mGlesCallTime = glesCallTime;
+  }
+
+  int glesCallAccumulate( 0 );
+  if ( GetIntegerEnvironmentVariable( DALI_GLES_CALL_ACCUMULATE, glesCallAccumulate ) )
+  {
+    mGlesCallAccumulate = glesCallAccumulate != 0;
   }
 
   int windowWidth(0), windowHeight(0);
   if ( GetIntegerEnvironmentVariable( DALI_WINDOW_WIDTH, windowWidth ) && GetIntegerEnvironmentVariable( DALI_WINDOW_HEIGHT, windowHeight ) )
   {
-    SetWindowWidth( windowWidth );
-    SetWindowHeight( windowHeight );
+    mWindowWidth = windowWidth;
+    mWindowHeight = windowHeight;
   }
 
+  const char * windowName = GetCharEnvironmentVariable( DALI_WINDOW_NAME );
+  if ( windowName )
+  {
+    mWindowName = windowName;
+  }
+
+  const char * windowClassName = GetCharEnvironmentVariable( DALI_WINDOW_CLASS_NAME );
+  if ( windowClassName )
+  {
+    mWindowClassName = windowClassName;
+  }
+
+  int threadingMode(0);
+  if ( GetIntegerEnvironmentVariable( DALI_THREADING_MODE, threadingMode ) )
+  {
+    switch( threadingMode )
+    {
+      case ThreadingMode::COMBINED_UPDATE_RENDER:
+      {
+        mThreadingMode = static_cast< ThreadingMode::Type >( threadingMode );
+        break;
+      }
+    }
+  }
+
+  int renderRefreshRate(0);
+  if ( GetIntegerEnvironmentVariable( DALI_REFRESH_RATE, renderRefreshRate ) )
+  {
+    // Only change it if it's valid
+    if( renderRefreshRate > 1 )
+    {
+      mRenderRefreshRate = renderRefreshRate;
+    }
+  }
+
+  int multiSamplingLevel( 0 );
+  if( GetIntegerEnvironmentVariable( DALI_ENV_MULTI_SAMPLING_LEVEL, multiSamplingLevel ) )
+  {
+    mMultiSamplingLevel = multiSamplingLevel;
+  }
+
+  int maxTextureSize( 0 );
+  if( GetIntegerEnvironmentVariable( DALI_ENV_MAX_TEXTURE_SIZE, maxTextureSize ) )
+  {
+    if( maxTextureSize > 0 )
+    {
+      mMaxTextureSize = maxTextureSize;
+    }
+  }
+
+  int indicatorVisibleMode( -1 );
+  if( GetIntegerEnvironmentVariable( DALI_ENV_INDICATOR_VISIBLE_MODE, indicatorVisibleMode ) )
+  {
+    if( indicatorVisibleMode > -1 )
+    {
+      mIndicatorVisibleMode = indicatorVisibleMode;
+    }
+  }
 }
 
 } // Adaptor