Merge "Add to set Available Orientations" into devel/master
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 10 Feb 2020 18:14:44 +0000 (18:14 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Mon, 10 Feb 2020 18:14:44 +0000 (18:14 +0000)
20 files changed:
dali/devel-api/adaptor-framework/file-stream.h
dali/internal/adaptor-framework/generic/file-stream-impl-generic.cpp
dali/internal/adaptor/common/adaptor-impl.cpp
dali/internal/adaptor/common/adaptor-impl.h
dali/internal/adaptor/common/combined-update-render-controller.cpp
dali/internal/adaptor/common/combined-update-render-controller.h
dali/internal/adaptor/common/thread-controller-interface.h
dali/internal/adaptor/tizen-wayland/adaptor-impl-tizen.cpp [changed mode: 0644->0755]
dali/internal/graphics/gles/egl-implementation.cpp
dali/internal/system/common/configuration-manager.cpp [new file with mode: 0644]
dali/internal/system/common/configuration-manager.h [new file with mode: 0644]
dali/internal/system/common/environment-options.cpp
dali/internal/system/common/environment-options.h
dali/internal/system/common/environment-variables.h
dali/internal/system/common/thread-controller.cpp
dali/internal/system/common/thread-controller.h
dali/internal/system/file.list
dali/internal/system/tizen-wayland/tizen-wearable/capture-impl-tizen.cpp
dali/public-api/dali-adaptor-version.cpp
packaging/dali-adaptor.spec

index 32f373e..90a3a15 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_FILE_STREAM_H
 
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -42,10 +42,11 @@ public:
    */
   enum FileMode  ///< FileType format
   {
-    BINARY = 0x1,      ///< File stream will be opened as a binary
-    TEXT   = 0x2,      ///< File stream will be opened as text
-    READ   = 0x4,      ///< File stream will be opened for reading
-    WRITE  = 0x8,      ///< File stream will be opende for writing
+    BINARY = 1 << 0,      ///< File stream will be opened as a binary
+    TEXT   = 1 << 1,      ///< File stream will be opened as text
+    READ   = 1 << 2,      ///< File stream will be opened for reading
+    WRITE  = 1 << 3,      ///< File stream will be opened for writing
+    APPEND = 1 << 4,      ///< File stream will be opened for appending
   };
 
   /**
index 1a30951..45d350b 100644 (file)
@@ -106,14 +106,20 @@ std::iostream& FileStream::Impl::GetStream()
     return mBufferStream;
   }
 
-  std::ios_base::openmode openMode;
-  if( mMode & Dali::FileStream::WRITE )
+  int openMode = 0;
+
+  if( mMode & Dali::FileStream::APPEND )
   {
-    openMode = ( std::ios::out | std::ios::ate );
+    openMode |= ( std::ios::out | std::ios::app );
   }
-  else
+  else if( mMode & Dali::FileStream::WRITE )
+  {
+    openMode |= ( std::ios::out | std::ios::ate );
+  }
+
+  if( mMode & Dali::FileStream::READ )
   {
-    openMode = std::ios::in;
+    openMode |= std::ios::in;
   }
 
   if( mMode & Dali::FileStream::BINARY )
@@ -123,10 +129,10 @@ std::iostream& FileStream::Impl::GetStream()
 
   if( !mFileName.empty() )
   {
-    mFileStream.open( mFileName, openMode );
+    mFileStream.open( mFileName, static_cast<std::ios_base::openmode>( openMode ) );
     if( !mFileStream.is_open() )
     {
-      DALI_LOG_WARNING( "stream open failed for: \"%s\", in mode: \"%d\".\n", mFileName, static_cast<int>( openMode ) );
+      DALI_LOG_WARNING( "stream open failed for: \"%s\", in mode: \"%d\".\n", mFileName.c_str(), openMode );
     }
     return mFileStream;
   }
@@ -136,7 +142,7 @@ std::iostream& FileStream::Impl::GetStream()
     if( !mBufferStream.rdbuf()->in_avail() )
     {
       DALI_LOG_WARNING( "File open failed for memory buffer at location: \"%p\", of size: \"%u\", in mode: \"%d\".\n",
-          static_cast<void*>( mBuffer ), static_cast<unsigned>( mDataSize ), static_cast<int>( openMode ) );
+          static_cast<void*>( mBuffer ), static_cast<unsigned>( mDataSize ), openMode );
     }
   }
 
@@ -159,7 +165,11 @@ FILE* FileStream::Impl::GetFile()
   char openMode[16] = { 0 };
   int i = 0;
 
-  if( mMode & Dali::FileStream::WRITE )
+  if( mMode & Dali::FileStream::APPEND )
+  {
+    openMode[i++] = 'a';
+  }
+  else if( mMode & Dali::FileStream::WRITE )
   {
     openMode[i++] = 'w';
   }
index 4935c93..ce8863c 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -34,8 +34,6 @@
 #include <dali/integration-api/events/wheel-event-integ.h>
 #include <dali/integration-api/processor-interface.h>
 
-#include <fstream>
-
 // INTERNAL INCLUDES
 #include <dali/public-api/dali-adaptor-common.h>
 #include <dali/internal/system/common/thread-controller.h>
@@ -59,6 +57,7 @@
 #include <dali/internal/clipboard/common/clipboard-impl.h>
 #include <dali/internal/system/common/object-profiler.h>
 #include <dali/internal/window-system/common/display-connection.h>
+#include <dali/internal/window-system/common/display-utils.h> // For Utils::MakeUnique
 #include <dali/internal/window-system/common/window-impl.h>
 #include <dali/internal/window-system/common/window-render-surface.h>
 
@@ -68,7 +67,8 @@
 #include <dali/internal/imaging/common/image-loader-plugin-proxy.h>
 #include <dali/internal/imaging/common/image-loader.h>
 
-#include <dali/devel-api/adaptor-framework/file-stream.h>
+#include <dali/internal/system/common/configuration-manager.h>
+#include <dali/internal/system/common/environment-variables.h>
 
 using Dali::TextAbstraction::FontClient;
 
@@ -85,7 +85,9 @@ namespace Adaptor
 
 namespace
 {
+
 thread_local Adaptor* gThreadLocalAdaptor = NULL; // raw thread specific pointer to allow Adaptor::Get
+
 } // unnamed namespace
 
 Dali::Adaptor* Adaptor::New( Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
@@ -282,50 +284,39 @@ void Adaptor::Initialize( GraphicsFactory& graphicsFactory, Dali::Configuration:
   {
     Integration::SetPinchGestureMinimumDistance( mEnvironmentOptions->GetMinimumPinchDistance() );
   }
-  if( mEnvironmentOptions->GetLongPressMinimumHoldingTime() >= 0 )
+  if( mEnvironmentOptions->GetMinimumPinchTouchEvents() >= 0 )
   {
-    Integration::SetLongPressMinimumHoldingTime( mEnvironmentOptions->GetLongPressMinimumHoldingTime() );
+    Integration::SetPinchGestureMinimumTouchEvents( mEnvironmentOptions->GetMinimumPinchTouchEvents() );
   }
-
-  // Set max texture size
-  if( mEnvironmentOptions->GetMaxTextureSize() > 0 )
+  if( mEnvironmentOptions->GetMinimumPinchTouchEventsAfterStart() >= 0 )
   {
-    Dali::TizenPlatform::ImageLoader::SetMaxTextureSize( mEnvironmentOptions->GetMaxTextureSize() );
+    Integration::SetPinchGestureMinimumTouchEventsAfterStart( mEnvironmentOptions->GetMinimumPinchTouchEventsAfterStart() );
+  }
+  if( mEnvironmentOptions->GetMinimumRotationTouchEvents() >= 0 )
+  {
+    Integration::SetRotationGestureMinimumTouchEvents( mEnvironmentOptions->GetMinimumRotationTouchEvents() );
+  }
+  if( mEnvironmentOptions->GetMinimumRotationTouchEventsAfterStart() >= 0 )
+  {
+    Integration::SetRotationGestureMinimumTouchEventsAfterStart( mEnvironmentOptions->GetMinimumRotationTouchEventsAfterStart() );
+  }
+  if( mEnvironmentOptions->GetLongPressMinimumHoldingTime() >= 0 )
+  {
+    Integration::SetLongPressMinimumHoldingTime( mEnvironmentOptions->GetLongPressMinimumHoldingTime() );
   }
 
   std::string systemCachePath = GetSystemCachePath();
-  if ( ! systemCachePath.empty() )
+  if( ! systemCachePath.empty() )
   {
-    Dali::FileStream fileStream( systemCachePath + "gpu-environment.conf", Dali::FileStream::READ | Dali::FileStream::TEXT );
-    std::fstream& stream = dynamic_cast<std::fstream&>( fileStream.GetStream() );
-    if( stream.is_open() )
+    const int dir_err = system( std::string( "mkdir " + systemCachePath ).c_str() );
+    if (-1 == dir_err)
     {
-      std::string line;
-      while( std::getline( stream, line ) )
-      {
-        line.erase( line.find_last_not_of( " \t\r\n" ) + 1 );
-        line.erase( 0, line.find_first_not_of( " \t\r\n" ) );
-        if( '#' == *( line.cbegin() ) || line == "" )
-        {
-          continue;
-        }
-
-        std::istringstream stream( line );
-        std::string environmentVariableName, environmentVariableValue;
-        std::getline(stream, environmentVariableName, ' ');
-        if( environmentVariableName == "DALI_ENV_MAX_TEXTURE_SIZE" && mEnvironmentOptions->GetMaxTextureSize() == 0 )
-        {
-          std::getline(stream, environmentVariableValue);
-          setenv( environmentVariableName.c_str() , environmentVariableValue.c_str(), 1 );
-          Dali::TizenPlatform::ImageLoader::SetMaxTextureSize( std::atoi( environmentVariableValue.c_str() ) );
-        }
-      }
-    }
-    else
-    {
-      DALI_LOG_ERROR( "Fail to open file : %s\n", ( systemCachePath + "gpu-environment.conf" ).c_str() );
+        printf( "Error creating system cache directory: %s!\n", systemCachePath.c_str() );
+        exit(1);
     }
   }
+
+  mConfigurationManager = Utils::MakeUnique<ConfigurationManager>( systemCachePath, eglGraphics, mThreadController );
 }
 
 Adaptor::~Adaptor()
@@ -395,29 +386,16 @@ void Adaptor::Start()
   // Initialize the thread controller
   mThreadController->Initialize();
 
-  if( !Dali::TizenPlatform::ImageLoader::MaxTextureSizeUpdated() )
+  // Set max texture size
+  if( mEnvironmentOptions->GetMaxTextureSize() > 0 )
   {
-    auto eglGraphics = static_cast<EglGraphics *>( mGraphics );
-    GlImplementation& mGLES = eglGraphics->GetGlesInterface();
-    Dali::TizenPlatform::ImageLoader::SetMaxTextureSize( mGLES.GetMaxTextureSize() );
-
-    std::string systemCachePath = GetSystemCachePath();
-    if( ! systemCachePath.empty() )
-    {
-      const int dir_err = system( std::string( "mkdir " + systemCachePath ).c_str() );
-      if (-1 == dir_err)
-      {
-          printf("Error creating directory!n");
-          exit(1);
-      }
-
-      Dali::FileStream fileStream( systemCachePath + "gpu-environment.conf", Dali::FileStream::WRITE | Dali::FileStream::TEXT );
-      std::fstream& configFile = dynamic_cast<std::fstream&>( fileStream.GetStream() );
-      if( configFile.is_open() )
-      {
-        configFile << "DALI_ENV_MAX_TEXTURE_SIZE " << mGLES.GetMaxTextureSize() << std::endl;
-      }
-    }
+    Dali::TizenPlatform::ImageLoader::SetMaxTextureSize( mEnvironmentOptions->GetMaxTextureSize() );
+  }
+  else
+  {
+    unsigned int maxTextureSize = mConfigurationManager->GetMaxTextureSize();
+    setenv( DALI_ENV_MAX_TEXTURE_SIZE, std::to_string( maxTextureSize ).c_str(), 1 );
+    Dali::TizenPlatform::ImageLoader::SetMaxTextureSize( maxTextureSize );
   }
 
   ProcessCoreEvents(); // Ensure any startup messages are processed.
@@ -1066,10 +1044,7 @@ void Adaptor::UnregisterProcessor( Integration::Processor& processor )
 
 bool Adaptor::IsMultipleWindowSupported() const
 {
-  auto eglGraphics = static_cast<EglGraphics *>( mGraphics );
-  EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
-  bool ret = eglImpl.IsSurfacelessContextSupported();
-  return ret;
+  return mConfigurationManager->IsMultipleWindowSupported();
 }
 
 void Adaptor::RequestUpdateOnce()
@@ -1145,6 +1120,7 @@ Adaptor::Adaptor(Dali::Integration::SceneHolder window, Dali::Adaptor& adaptor,
   mGraphics( nullptr ),
   mDisplayConnection( nullptr ),
   mWindows(),
+  mConfigurationManager( nullptr ),
   mPlatformAbstraction( nullptr ),
   mCallbackManager( nullptr ),
   mNotificationOnIdleInstalled( false ),
index fd39a3a..49e9601 100755 (executable)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_ADAPTOR_IMPL_H
 
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -75,6 +75,7 @@ class PerformanceInterface;
 class LifeCycleObserver;
 class ObjectProfiler;
 class SceneHolder;
+class ConfigurationManager;
 
 /**
  * Implementation of the Adaptor class.
@@ -662,6 +663,8 @@ private: // Data
   Dali::DisplayConnection*              mDisplayConnection;           ///< Display connection
   WindowContainer                       mWindows;                     ///< A container of all the Windows that are currently created
 
+  std::unique_ptr<ConfigurationManager> mConfigurationManager;        ///< Configuration manager
+
   TizenPlatform::TizenPlatformAbstraction* mPlatformAbstraction;      ///< Platform abstraction
 
   CallbackManager*                      mCallbackManager;             ///< Used to install callbacks
@@ -679,7 +682,7 @@ private: // Data
   ObjectProfiler*                       mObjectProfiler;              ///< Tracks object lifetime for profiling
   SocketFactory                         mSocketFactory;               ///< Socket factory
   const bool                            mEnvironmentOptionsOwned:1;   ///< Whether we own the EnvironmentOptions (and thus, need to delete it)
-  bool                                  mUseRemoteSurface;            ///< whether the remoteSurface is used or not
+  bool                                  mUseRemoteSurface:1;          ///< whether the remoteSurface is used or not
 
 public:
   inline static Adaptor& GetImplementation(Dali::Adaptor& adaptor) { return *adaptor.mImpl; }
index 1270243..8be71f8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -91,6 +91,7 @@ CombinedUpdateRenderController::CombinedUpdateRenderController( AdaptorInternalS
 : mFpsTracker( environmentOptions ),
   mUpdateStatusLogger( environmentOptions ),
   mEventThreadSemaphore(),
+  mGraphicsInitializeSemaphore(),
   mUpdateRenderThreadWaitCondition(),
   mAdaptorInterfaces( adaptorInterfaces ),
   mPerformanceInterface( adaptorInterfaces.GetPerformanceInterface() ),
@@ -134,7 +135,9 @@ CombinedUpdateRenderController::CombinedUpdateRenderController( AdaptorInternalS
   TriggerEventFactoryInterface& triggerFactory = mAdaptorInterfaces.GetTriggerEventFactoryInterface();
   mSleepTrigger = triggerFactory.CreateTriggerEvent( MakeCallback( this, &CombinedUpdateRenderController::ProcessSleepRequest ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER );
 
-  sem_init( &mEventThreadSemaphore, 0, 0 ); // Initialize to 0 so that it just waits if sem_post has not been called
+  // Initialize to 0 so that it just waits if sem_post has not been called
+  sem_init( &mEventThreadSemaphore, 0, 0 );
+  sem_init( &mGraphicsInitializeSemaphore, 0, 0 );
 }
 
 CombinedUpdateRenderController::~CombinedUpdateRenderController()
@@ -343,6 +346,21 @@ void CombinedUpdateRenderController::DeleteSurface( Dali::RenderSurfaceInterface
   }
 }
 
+void CombinedUpdateRenderController::WaitForGraphicsInitialization()
+{
+  LOG_EVENT_TRACE;
+
+  if( mUpdateRenderThread )
+  {
+    LOG_EVENT( "Waiting for graphics initialisation, event-thread blocked" );
+
+    // Wait until the graphics has been initialised
+    sem_wait( &mGraphicsInitializeSemaphore );
+
+    LOG_EVENT( "graphics initialised, event-thread continuing" );
+  }
+}
+
 void CombinedUpdateRenderController::ResizeSurface()
 {
   LOG_EVENT_TRACE;
@@ -457,6 +475,9 @@ void CombinedUpdateRenderController::UpdateRenderThread()
   Dali::DisplayConnection& displayConnection = mAdaptorInterfaces.GetDisplayConnectionInterface();
   displayConnection.Initialize();
 
+  // EGL has been initialised at this point
+  NotifyGraphicsInitialised();
+
   RenderSurfaceInterface* currentSurface = nullptr;
 
   GraphicsInterface& graphics = mAdaptorInterfaces.GetGraphicsInterface();
@@ -849,6 +870,11 @@ void CombinedUpdateRenderController::NotifyThreadInitialised()
   sem_post( &mEventThreadSemaphore );
 }
 
+void CombinedUpdateRenderController::NotifyGraphicsInitialised()
+{
+  sem_post( &mGraphicsInitializeSemaphore );
+}
+
 void CombinedUpdateRenderController::AddPerformanceMarker( PerformanceInterface::MarkerType type )
 {
   if( mPerformanceInterface )
index b558831..03e511e 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_H
 
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -137,6 +137,11 @@ public:
   virtual void ResizeSurface();
 
   /**
+   * @copydoc ThreadControllerInterface::WaitForGraphicsInitialization()
+   */
+  virtual void WaitForGraphicsInitialization();
+
+  /**
    * @copydoc ThreadControllerInterface::SetRenderRefreshRate()
    */
   virtual void SetRenderRefreshRate( unsigned int numberOfFramesPerRender );
@@ -290,6 +295,11 @@ private:
   void NotifyThreadInitialised();
 
   /**
+   * Called by the update-render thread when graphics has been initialised.
+   */
+  void NotifyGraphicsInitialised();
+
+  /**
    * Helper to add a performance marker to the performance server (if it's active)
    * @param[in]  type  performance marker type
    */
@@ -328,6 +338,7 @@ private:
   UpdateStatusLogger                mUpdateStatusLogger;               ///< Object that logs the update-status as required.
 
   sem_t                             mEventThreadSemaphore;             ///< Used by the event thread to ensure all threads have been initialised, and when replacing the surface.
+  sem_t                             mGraphicsInitializeSemaphore;      ///< Used by the render thread to ensure the graphics has been initialised.
 
   ConditionalWait                   mUpdateRenderThreadWaitCondition;  ///< The wait condition for the update-render-thread.
 
index 8c63c7d..99317d6 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_THREAD_CONTROLLER_INTERFACE_H
 
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -104,6 +104,11 @@ public:
   virtual void ResizeSurface() = 0;
 
   /**
+   * Wait until the graphics is initialised.
+   */
+  virtual void WaitForGraphicsInitialization() = 0;
+
+  /**
    * @copydoc Dali::Adaptor::SetRenderRefreshRate()
    */
   virtual void SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender ) = 0;
old mode 100644 (file)
new mode 100755 (executable)
index 3e2865d..fb0cddd
@@ -126,9 +126,9 @@ void Adaptor::SurfaceInitialized()
 
 void Adaptor::SetupSystemInformation()
 {
-  if( system_settings_set_changed_cb( SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, OnSystemLanguageChanged, this ) != SYSTEM_SETTINGS_ERROR_NONE )
+  if( system_settings_add_changed_cb( SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, OnSystemLanguageChanged, this ) != SYSTEM_SETTINGS_ERROR_NONE )
   {
-    DALI_LOG_ERROR( "DALI system_settings_set_changed_cb failed.\n" );
+    DALI_LOG_ERROR( "DALI system_settings_add_changed_cb failed.\n" );
     return;
   }
 
index 3234393..c653ab6 100755 (executable)
@@ -115,7 +115,6 @@ bool EglImplementation::InitializeGles( EGLNativeDisplayType display, bool isOwn
     }
     eglBindAPI(EGL_OPENGL_ES_API);
 
-    mGlesInitialized = true;
     mIsOwnSurface = isOwnSurface;
   }
 
@@ -138,6 +137,8 @@ bool EglImplementation::InitializeGles( EGLNativeDisplayType display, bool isOwn
     }
   }
 
+  mGlesInitialized = true;
+
   // We want to display this information all the time, so use the LogMessage directly
   Integration::Log::LogMessage(Integration::Log::DebugInfo, "EGL Information\n"
       "            Vendor:        %s\n"
diff --git a/dali/internal/system/common/configuration-manager.cpp b/dali/internal/system/common/configuration-manager.cpp
new file mode 100644 (file)
index 0000000..975749e
--- /dev/null
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2020 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/system/common/configuration-manager.h>
+
+// EXTERNAL INCLUDES
+#include <fstream>
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/file-stream.h>
+#include <dali/internal/graphics/gles/egl-graphics.h>
+#include <dali/internal/system/common/environment-options.h>
+#include <dali/internal/system/common/environment-variables.h>
+#include <dali/internal/system/common/thread-controller.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace
+{
+
+const std::string SYSTEM_CACHE_FILE = "gpu-environment.conf";
+const std::string DALI_ENV_MULTIPLE_WINDOW_SUPPORT = "DALI_ENV_MULTIPLE_WINDOW_SUPPORT";
+
+bool RetrieveKeyFromFile( std::fstream& stream, std::string key, std::string& value )
+{
+  bool keyFound = false;
+
+  std::string line;
+  while( std::getline( stream, line ) )
+  {
+    line.erase( line.find_last_not_of( " \t\r\n" ) + 1 );
+    line.erase( 0, line.find_first_not_of( " \t\r\n" ) );
+    if( '#' == *( line.cbegin() ) || line == "" )
+    {
+      continue;
+    }
+
+    std::istringstream stream( line );
+    std::string name;
+    std::getline(stream, name, ' ');
+    if( name == key )
+    {
+      std::getline(stream, value);
+      keyFound = true;
+      break;
+    }
+  }
+
+  return keyFound;
+}
+
+
+} // unnamed namespace
+
+ConfigurationManager::ConfigurationManager( std::string systemCachePath, EglGraphics* eglGraphics, ThreadController* threadController )
+: mSystemCacheFilePath( systemCachePath + SYSTEM_CACHE_FILE ),
+  mFileStream( new Dali::FileStream( mSystemCacheFilePath, Dali::FileStream::READ | Dali::FileStream::APPEND | Dali::FileStream::TEXT ) ),
+  mEglGraphics( eglGraphics ),
+  mThreadController( threadController ),
+  mMaxTextureSize( 0u ),
+  mIsMultipleWindowSupported( true ),
+  mMaxTextureSizeCached( false ) ,
+  mIsMultipleWindowSupportedCached( false )
+{
+}
+
+ConfigurationManager::~ConfigurationManager()
+{
+}
+
+unsigned int ConfigurationManager::GetMaxTextureSize()
+{
+  if ( !mMaxTextureSizeCached )
+  {
+    std::fstream& configFile = dynamic_cast<std::fstream&>( mFileStream->GetStream() );
+    if( configFile.is_open() )
+    {
+      std::string environmentVariableValue;
+      if( RetrieveKeyFromFile( configFile, DALI_ENV_MAX_TEXTURE_SIZE, environmentVariableValue ) )
+      {
+        mMaxTextureSize = std::atoi( environmentVariableValue.c_str() );
+      }
+      else
+      {
+        GlImplementation& mGLES = mEglGraphics->GetGlesInterface();
+        mMaxTextureSize = mGLES.GetMaxTextureSize();
+
+        configFile.clear();
+        configFile << DALI_ENV_MAX_TEXTURE_SIZE << " " << mMaxTextureSize << std::endl;
+      }
+
+      mMaxTextureSizeCached = true;
+
+      if ( mIsMultipleWindowSupportedCached )
+      {
+        configFile.close();
+      }
+    }
+    else
+    {
+      DALI_LOG_ERROR( "Fail to open file : %s\n", mSystemCacheFilePath.c_str() );
+    }
+  }
+
+  return mMaxTextureSize;
+}
+
+bool ConfigurationManager::IsMultipleWindowSupported()
+{
+  if ( !mIsMultipleWindowSupportedCached )
+  {
+    std::fstream& configFile = dynamic_cast<std::fstream&>( mFileStream->GetStream() );
+    if( configFile.is_open() )
+    {
+      std::string environmentVariableValue;
+      if( RetrieveKeyFromFile( configFile, DALI_ENV_MULTIPLE_WINDOW_SUPPORT, environmentVariableValue ) )
+      {
+        mIsMultipleWindowSupported = std::atoi( environmentVariableValue.c_str() );
+      }
+      else
+      {
+        EglImplementation& eglImpl = mEglGraphics->GetEglImplementation();
+        if ( !eglImpl.IsGlesInitialized() )
+        {
+          // Wait until GLES is initialised, but this will happen once.
+          // This method blocks until the render thread has initialised the graphics.
+          mThreadController->WaitForGraphicsInitialization();
+        }
+
+        // Query from GLES and save the cache
+        mIsMultipleWindowSupported = eglImpl.IsSurfacelessContextSupported();
+
+        configFile.clear();
+        configFile << DALI_ENV_MULTIPLE_WINDOW_SUPPORT << " " << mIsMultipleWindowSupported << std::endl;
+      }
+
+      mIsMultipleWindowSupportedCached = true;
+
+      if ( mMaxTextureSizeCached )
+      {
+        configFile.close();
+      }
+    }
+    else
+    {
+      DALI_LOG_ERROR( "Fail to open file : %s\n", mSystemCacheFilePath.c_str() );
+    }
+  }
+
+  return mIsMultipleWindowSupported;
+}
+
+} // Adaptor
+
+} // Internal
+
+} // Dali
diff --git a/dali/internal/system/common/configuration-manager.h b/dali/internal/system/common/configuration-manager.h
new file mode 100644 (file)
index 0000000..105a5b4
--- /dev/null
@@ -0,0 +1,96 @@
+#ifndef DALI_INTERNAL_ENVIRONMENT_CONFIGURATION_MANAGER_H
+#define DALI_INTERNAL_ENVIRONMENT_CONFIGURATION_MANAGER_H
+
+/*
+ * Copyright (c) 2020 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <memory>
+#include <string>
+
+namespace Dali
+{
+
+class FileStream;
+
+namespace Internal
+{
+namespace Adaptor
+{
+
+class EglGraphics;
+class ThreadController;
+
+/**
+ * This class retrieves and caches the system configuration.
+ *
+ */
+class ConfigurationManager
+{
+public:
+
+  /**
+   * @brief Constructor
+   */
+  ConfigurationManager( std::string systemCachePath, EglGraphics* eglGraphics, ThreadController* threadController );
+
+  /**
+   * @brief Virtual Destructor for interface cleanup
+   */
+  virtual ~ConfigurationManager();
+
+  /**
+   * @brief Get the maximum texture size.
+   * @return The maximum texture size
+   */
+  unsigned int GetMaxTextureSize();
+
+  /**
+   * @brief Check whether multiple window is supported
+   * @return Whether multiple window is supported
+   */
+  bool IsMultipleWindowSupported();
+
+  // Deleted copy constructor.
+  ConfigurationManager( const ConfigurationManager& ) = delete;
+
+  // Deleted move constructor.
+  ConfigurationManager( const ConfigurationManager&& ) = delete;
+
+  // Deleted assignment operator.
+  ConfigurationManager& operator=( const ConfigurationManager& ) = delete;
+
+  // Deleted move assignment operator.
+  ConfigurationManager& operator=( const ConfigurationManager&& ) = delete;
+
+private: // Data
+
+  std::string mSystemCacheFilePath;              ///< The path of system cache file
+  std::unique_ptr<FileStream> mFileStream;       ///< The file stream to access the system cache
+  EglGraphics* mEglGraphics;                     ///< EGL graphics
+  ThreadController* mThreadController;           ///< The thread controller
+  unsigned int mMaxTextureSize;                  ///< The largest texture that the GL can handle
+  bool mIsMultipleWindowSupported:1;             ///< Whether multiple window is supported by the GLES
+  bool mMaxTextureSizeCached:1;                  ///< Whether we have checked the maximum texture size
+  bool mIsMultipleWindowSupportedCached:1;       ///< Whether we have checked the support of multiple window
+};
+
+} // Adaptor
+} // Internal
+} // Dali
+
+#endif // DALI_INTERNAL_ENVIRONMENT_CONFIGURATION_MANAGER_H
index bab51d1..7fea428 100644 (file)
@@ -120,6 +120,10 @@ EnvironmentOptions::EnvironmentOptions()
   mPanMinimumDistance( -1 ),
   mPanMinimumEvents( -1 ),
   mPinchMinimumDistance( -1.0f ),
+  mPinchMinimumTouchEvents( -1 ),
+  mPinchMinimumTouchEventsAfterStart( -1 ),
+  mRotationMinimumTouchEvents( -1 ),
+  mRotationMinimumTouchEventsAfterStart( -1 ),
   mLongPressMinimumHoldingTime( -1 ),
   mGlesCallTime( 0 ),
   mMultiSamplingLevel( DEFAULT_MULTI_SAMPLING_LEVEL ),
@@ -290,6 +294,26 @@ float EnvironmentOptions::GetMinimumPinchDistance() const
   return mPinchMinimumDistance;
 }
 
+int EnvironmentOptions::GetMinimumPinchTouchEvents() const
+{
+  return mPinchMinimumTouchEvents;
+}
+
+int EnvironmentOptions::GetMinimumPinchTouchEventsAfterStart() const
+{
+  return mPinchMinimumTouchEventsAfterStart;
+}
+
+int EnvironmentOptions::GetMinimumRotationTouchEvents() const
+{
+  return mRotationMinimumTouchEvents;
+}
+
+int EnvironmentOptions::GetMinimumRotationTouchEventsAfterStart() const
+{
+  return mRotationMinimumTouchEventsAfterStart;
+}
+
 int EnvironmentOptions::GetLongPressMinimumHoldingTime() const
 {
   return mLongPressMinimumHoldingTime;
@@ -516,6 +540,30 @@ void EnvironmentOptions::ParseEnvironmentOptions()
     mPinchMinimumDistance = pinchMinimumDistance;
   }
 
+  int pinchMinimumTouchEvents = -1;
+  if( GetIntegerEnvironmentVariable( DALI_ENV_PINCH_MINIMUM_TOUCH_EVENTS, pinchMinimumTouchEvents ) )
+  {
+    mPinchMinimumTouchEvents = pinchMinimumTouchEvents;
+  }
+
+  int pinchMinimumTouchEventsAfterStart = -1;
+  if( GetIntegerEnvironmentVariable( DALI_ENV_PINCH_MINIMUM_TOUCH_EVENTS_AFTER_START, pinchMinimumTouchEventsAfterStart ) )
+  {
+    mPinchMinimumTouchEventsAfterStart = pinchMinimumTouchEventsAfterStart;
+  }
+
+  int rotationMinimumTouchEvents = -1;
+  if( GetIntegerEnvironmentVariable( DALI_ENV_ROTATION_MINIMUM_TOUCH_EVENTS, rotationMinimumTouchEvents ) )
+  {
+    mRotationMinimumTouchEvents = rotationMinimumTouchEvents;
+  }
+
+  int rotationMinimumTouchEventsAfterStart = -1;
+  if( GetIntegerEnvironmentVariable( DALI_ENV_ROTATION_MINIMUM_TOUCH_EVENTS_AFTER_START, rotationMinimumTouchEventsAfterStart ) )
+  {
+    mRotationMinimumTouchEventsAfterStart = rotationMinimumTouchEventsAfterStart;
+  }
+
   int longPressMinimumHoldingTime = -1;
   if( GetIntegerEnvironmentVariable( DALI_ENV_LONG_PRESS_MINIMUM_HOLDING_TIME, longPressMinimumHoldingTime ) )
   {
index d8e630a..f72ebdd 100644 (file)
@@ -220,6 +220,26 @@ public:
   float GetMinimumPinchDistance() const;
 
   /**
+   * @return The minimum touch events required before a pinch can be started (-1 means it's not set)
+   */
+  int GetMinimumPinchTouchEvents() const;
+
+  /**
+   * @return The minimum touch events required after a pinch started (-1 means it's not set)
+   */
+  int GetMinimumPinchTouchEventsAfterStart() const;
+
+  /**
+   * @return The minimum touch events required before a rotation can be started (-1 means it's not set)
+   */
+  int GetMinimumRotationTouchEvents() const;
+
+  /**
+   * @return The minimum touch events required after a rotation started (-1 means it's not set)
+   */
+  int GetMinimumRotationTouchEventsAfterStart() const;
+
+  /**
    * @return The minimum holding time required to be recognized as a long press gesture (milliseconds)
    */
   int GetLongPressMinimumHoldingTime() const;
@@ -352,6 +372,10 @@ private: // Data
   int mPanMinimumDistance;                        ///< minimum distance required before pan starts
   int mPanMinimumEvents;                          ///< minimum events required before pan starts
   float mPinchMinimumDistance;                    ///< minimum number of pixels moved before a pinch starts
+  int mPinchMinimumTouchEvents;                   ///< minimum events required before a pinch starts
+  int mPinchMinimumTouchEventsAfterStart;         ///< minimum events required after a pinch started
+  int mRotationMinimumTouchEvents;                ///< minimum events required before a rotation starts
+  int mRotationMinimumTouchEventsAfterStart;      ///< minimum events required after a rotation started
   int mLongPressMinimumHoldingTime;               ///< minimum holding time required to be recognized as a long press gesture (millisecond)
   int mGlesCallTime;                              ///< time in seconds between status updates
   int mMultiSamplingLevel;                        ///< The number of samples required in multisample buffers
index 013417e..ca1a9c8 100644 (file)
@@ -84,7 +84,14 @@ namespace Adaptor
 #define DALI_ENV_PAN_MINIMUM_DISTANCE                 "DALI_PAN_MINIMUM_DISTANCE"
 #define DALI_ENV_PAN_MINIMUM_EVENTS                   "DALI_PAN_MINIMUM_EVENTS"
 
-#define DALI_ENV_PINCH_MINIMUM_DISTANCE               "DALI_PINCH_MINIMUM_DISTANCE"
+// Pinch-Gesture
+#define DALI_ENV_PINCH_MINIMUM_DISTANCE                     "DALI_PINCH_MINIMUM_DISTANCE"
+#define DALI_ENV_PINCH_MINIMUM_TOUCH_EVENTS                 "DALI_PINCH_MINIMUM_TOUCH_EVENTS"
+#define DALI_ENV_PINCH_MINIMUM_TOUCH_EVENTS_AFTER_START     "DALI_PINCH_MINIMUM_TOUCH_EVENTS_AFTER_START"
+
+// Rotation-Gesture
+#define DALI_ENV_ROTATION_MINIMUM_TOUCH_EVENTS              "DALI_ROTATION_MINIMUM_TOUCH_EVENTS"
+#define DALI_ENV_ROTATION_MINIMUM_TOUCH_EVENTS_AFTER_START  "DALI_ROTATION_MINIMUM_TOUCH_EVENTS_AFTER_START"
 
 /**
  * The minimum holding time required to be recognized as a long press gesture (milliseconds)
index cd6671d..fbe90dc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -100,6 +100,11 @@ void ThreadController::ResizeSurface()
   mThreadControllerInterface->ResizeSurface();
 }
 
+void ThreadController::WaitForGraphicsInitialization()
+{
+  mThreadControllerInterface->WaitForGraphicsInitialization();
+}
+
 void ThreadController::SetRenderRefreshRate(unsigned int numberOfVSyncsPerRender )
 {
   mThreadControllerInterface->SetRenderRefreshRate( numberOfVSyncsPerRender );
index 686c653..e1f1c84 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_THREAD_CONTROLLER_H
 
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -123,6 +123,11 @@ public:
   void ResizeSurface();
 
   /**
+   * Wait until the graphics is initialised.
+   */
+  void WaitForGraphicsInitialization();
+
+  /**
    * @copydoc Dali::Adaptor::SetRenderRefreshRate()
    */
   void SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender );
index 4b57b14..0ac2ec5 100644 (file)
@@ -4,6 +4,7 @@ SET( adaptor_system_common_src_files
     ${adaptor_system_dir}/common/abort-handler.cpp
     ${adaptor_system_dir}/common/color-controller-impl.cpp
     ${adaptor_system_dir}/common/command-line-options.cpp
+    ${adaptor_system_dir}/common/configuration-manager.cpp
     ${adaptor_system_dir}/common/environment-options.cpp
     ${adaptor_system_dir}/common/fps-tracker.cpp
     ${adaptor_system_dir}/common/frame-time-stamp.cpp
index 0e896c1..0c9487e 100755 (executable)
@@ -263,14 +263,9 @@ void Capture::UnsetRenderTask()
   mCameraActor.Unparent();
   mCameraActor.Reset();
 
-  DALI_ASSERT_ALWAYS(mRenderTask && "RenderTask is NULL.");
+  DALI_ASSERT_ALWAYS( mRenderTask && "RenderTask is NULL." );
 
   Dali::RenderTaskList taskList = Dali::Stage::GetCurrent().GetRenderTaskList();
-  Dali::RenderTask firstTask = taskList.GetTask( 0u );
-
-  // Stop rendering via frame-buffers as empty handle is used to clear target
-  firstTask.SetFrameBuffer( Dali::FrameBuffer() );
-
   taskList.RemoveTask( mRenderTask );
   mRenderTask.Reset();
 }
index 321bd98..7a7c44e 100644 (file)
@@ -28,7 +28,7 @@ namespace Dali
 
 const unsigned int ADAPTOR_MAJOR_VERSION = 1;
 const unsigned int ADAPTOR_MINOR_VERSION = 4;
-const unsigned int ADAPTOR_MICRO_VERSION = 55;
+const unsigned int ADAPTOR_MICRO_VERSION = 57;
 const char * const ADAPTOR_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index dd25f0f..5610986 100644 (file)
@@ -17,7 +17,7 @@
 
 Name:       dali-adaptor
 Summary:    The DALi Tizen Adaptor
-Version:    1.4.55
+Version:    1.4.57
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT