Initial refactoring of graphics interface 15/251615/6
authorDavid Steele <david.steele@samsung.com>
Thu, 14 Jan 2021 19:13:39 +0000 (19:13 +0000)
committerDavid Steele <david.steele@samsung.com>
Mon, 18 Jan 2021 13:02:23 +0000 (13:02 +0000)
Wrapped GL abstractions in EglGraphicsController.

Cleaned up initialization of EglGraphics, moved most of it to render
thread.

(Kept initialization of GlImplementation in event thread - it has no
dependence on EGL)

TestGraphicsApplication creates EglGraphicsController, so that we can
now write tests for the new graphics API that run the actual code, and
can be tested using the existing gl abstraction.

Change-Id: I4237f52ff4912e8eec0dfc161b33e44d2f5e620f

27 files changed:
automated-tests/src/dali-adaptor/dali-test-suite-utils/test-application.cpp
automated-tests/src/dali-adaptor/dali-test-suite-utils/test-application.h
automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-application.cpp [new file with mode: 0644]
automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-application.h [new file with mode: 0644]
automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.h [new file with mode: 0644]
automated-tests/src/dali-graphics/CMakeLists.txt [new file with mode: 0644]
automated-tests/src/dali-graphics/tct-dali-graphics-core.cpp [new file with mode: 0644]
automated-tests/src/dali-graphics/utc-Dali-GraphicsGeometry.cpp [new file with mode: 0644]
dali/internal/adaptor/common/adaptor-builder-impl.cpp
dali/internal/adaptor/common/adaptor-builder-impl.h
dali/internal/adaptor/common/adaptor-impl.cpp [changed mode: 0755->0644]
dali/internal/adaptor/common/application-impl.cpp
dali/internal/adaptor/common/combined-update-render-controller.cpp
dali/internal/graphics/common/graphics-interface.h
dali/internal/graphics/file.list
dali/internal/graphics/gles/egl-graphics-controller.cpp [new file with mode: 0644]
dali/internal/graphics/gles/egl-graphics-controller.h [new file with mode: 0644]
dali/internal/graphics/gles/egl-graphics-factory.cpp
dali/internal/graphics/gles/egl-graphics-factory.h
dali/internal/graphics/gles/egl-graphics.cpp
dali/internal/graphics/gles/egl-graphics.h
dali/internal/graphics/gles/gl-proxy-implementation.cpp
dali/internal/graphics/gles/gl-proxy-implementation.h
dali/internal/system/common/configuration-manager.cpp
dali/internal/system/common/configuration-manager.h
dali/internal/window-system/common/gl-window-impl.cpp
dali/internal/window-system/common/gl-window-impl.h

index 062276a..a2a1848 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -55,9 +55,7 @@ void TestApplication::CreateCore()
 
   mCore = Dali::Integration::Core::New(mRenderController,
                                        mPlatformAbstraction,
-                                       mGlAbstraction,
-                                       mGlSyncAbstraction,
-                                       mGlContextHelperAbstraction,
+                                       mGraphicsController,
                                        Integration::RenderToFrameBuffer::FALSE,
                                        Integration::DepthBufferAvailable::TRUE,
                                        Integration::StencilBufferAvailable::TRUE,
@@ -141,19 +139,24 @@ TestRenderController& TestApplication::GetRenderController()
   return mRenderController;
 }
 
+TestGraphicsController& TestApplication::GetGraphicsController()
+{
+  return mGraphicsController;
+}
+
 TestGlAbstraction& TestApplication::GetGlAbstraction()
 {
-  return mGlAbstraction;
+  return static_cast<TestGlAbstraction&>(mGraphicsController.GetGlAbstraction());
 }
 
 TestGlSyncAbstraction& TestApplication::GetGlSyncAbstraction()
 {
-  return mGlSyncAbstraction;
+  return static_cast<TestGlSyncAbstraction&>(mGraphicsController.GetGlSyncAbstraction());
 }
 
 TestGlContextHelperAbstraction& TestApplication::GetGlContextHelperAbstraction()
 {
-  return mGlContextHelperAbstraction;
+  return static_cast<TestGlContextHelperAbstraction&>(mGraphicsController.GetGlContextHelperAbstraction());
 }
 
 void TestApplication::ProcessEvent(const Integration::Event& event)
@@ -262,7 +265,7 @@ bool TestApplication::RenderOnly()
 void TestApplication::ResetContext()
 {
   mCore->ContextDestroyed();
-  mGlAbstraction.Initialize();
+  mGraphicsController.Initialize();
   mCore->ContextCreated();
 }
 
index 7362505..e7d8c76 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TEST_APPLICATION_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 #include <dali/integration-api/resource-policies.h>
 #include <dali/integration-api/scene.h>
 #include <dali/integration-api/trace.h>
+
 #include <dali/public-api/common/dali-common.h>
 #include <test-platform-abstraction.h>
 
-#include "test-gl-abstraction.h"
-#include "test-gl-context-helper-abstraction.h"
-#include "test-gl-sync-abstraction.h"
+#include "test-graphics-controller.h"
 #include "test-render-controller.h"
 
 namespace Dali
@@ -58,27 +57,30 @@ public:
   void CreateScene();
   void InitializeCore();
   ~TestApplication() override;
-  static void                     LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message);
-  static void                     LogContext(bool start, const char* tag);
-  Dali::Integration::Core&        GetCore();
-  TestPlatformAbstraction&        GetPlatform();
-  TestRenderController&           GetRenderController();
+  static void              LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message);
+  static void              LogContext(bool start, const char* tag);
+  Dali::Integration::Core& GetCore();
+  TestPlatformAbstraction& GetPlatform();
+  TestRenderController&    GetRenderController();
+  TestGraphicsController&  GetGraphicsController();
+
   TestGlAbstraction&              GetGlAbstraction();
   TestGlSyncAbstraction&          GetGlSyncAbstraction();
   TestGlContextHelperAbstraction& GetGlContextHelperAbstraction();
-  void                            ProcessEvent(const Integration::Event& event);
-  void                            SendNotification();
-  bool                            Render(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location = NULL);
-  bool                            PreRenderWithPartialUpdate(uint32_t intervalMilliseconds, const char* location, std::vector<Rect<int>>& damagedRects);
-  bool                            RenderWithPartialUpdate(std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect);
-  uint32_t                        GetUpdateStatus();
-  bool                            UpdateOnly(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL);
-  bool                            RenderOnly();
-  void                            ResetContext();
-  bool                            GetRenderNeedsUpdate();
-  bool                            GetRenderNeedsPostRender();
-  uint32_t                        Wait(uint32_t durationToWait);
-  static void                     EnableLogging(bool enabled)
+
+  void        ProcessEvent(const Integration::Event& event);
+  void        SendNotification();
+  bool        Render(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location = NULL);
+  bool        PreRenderWithPartialUpdate(uint32_t intervalMilliseconds, const char* location, std::vector<Rect<int>>& damagedRects);
+  bool        RenderWithPartialUpdate(std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect);
+  uint32_t    GetUpdateStatus();
+  bool        UpdateOnly(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL);
+  bool        RenderOnly();
+  void        ResetContext();
+  bool        GetRenderNeedsUpdate();
+  bool        GetRenderNeedsPostRender();
+  uint32_t    Wait(uint32_t durationToWait);
+  static void EnableLogging(bool enabled)
   {
     mLoggingEnabled = enabled;
   }
@@ -92,11 +94,9 @@ private:
   void DoUpdate(uint32_t intervalMilliseconds, const char* location = NULL);
 
 protected:
-  TestPlatformAbstraction        mPlatformAbstraction;
-  TestRenderController           mRenderController;
-  TestGlAbstraction              mGlAbstraction;
-  TestGlSyncAbstraction          mGlSyncAbstraction;
-  TestGlContextHelperAbstraction mGlContextHelperAbstraction;
+  TestPlatformAbstraction mPlatformAbstraction;
+  TestRenderController    mRenderController;
+  TestGraphicsController  mGraphicsController;
 
   Integration::UpdateStatus mStatus;
   Integration::RenderStatus mRenderStatus;
diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-application.cpp b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-application.cpp
new file mode 100644 (file)
index 0000000..96b999d
--- /dev/null
@@ -0,0 +1,289 @@
+/*
+ * Copyright (c) 2021 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.
+ *
+ */
+
+#include "test-graphics-application.h"
+
+namespace Dali
+{
+bool TestGraphicsApplication::mLoggingEnabled = true;
+
+TestGraphicsApplication::TestGraphicsApplication(uint32_t surfaceWidth,
+                                                 uint32_t surfaceHeight,
+                                                 uint32_t horizontalDpi,
+                                                 uint32_t verticalDpi,
+                                                 bool     initialize,
+                                                 bool     enablePartialUpdate)
+: mCore(NULL),
+  mSurfaceWidth(surfaceWidth),
+  mSurfaceHeight(surfaceHeight),
+  mFrame(0u),
+  mDpi{horizontalDpi, verticalDpi},
+  mLastVSyncTime(0u),
+  mPartialUpdateEnabled(enablePartialUpdate)
+{
+  if(initialize)
+  {
+    Initialize();
+  }
+}
+
+void TestGraphicsApplication::Initialize()
+{
+  CreateCore();
+  CreateScene();
+  InitializeCore();
+}
+
+void TestGraphicsApplication::CreateCore()
+{
+  // We always need the first update!
+  mStatus.keepUpdating = Integration::KeepUpdating::STAGE_KEEP_RENDERING;
+
+  mGraphicsController.InitializeGLES(mGlAbstraction);
+  mGraphicsController.Initialize(mGlSyncAbstraction, mGlContextHelperAbstraction);
+
+  mCore = Dali::Integration::Core::New(mRenderController,
+                                       mPlatformAbstraction,
+                                       mGraphicsController,
+                                       Integration::RenderToFrameBuffer::FALSE,
+                                       Integration::DepthBufferAvailable::TRUE,
+                                       Integration::StencilBufferAvailable::TRUE,
+                                       mPartialUpdateEnabled ? Integration::PartialUpdateAvailable::TRUE : Integration::PartialUpdateAvailable::FALSE);
+
+  mCore->ContextCreated();
+
+  Dali::Integration::Log::LogFunction logFunction(&TestGraphicsApplication::LogMessage);
+  Dali::Integration::Log::InstallLogFunction(logFunction);
+
+  Dali::Integration::Trace::LogContextFunction logContextFunction(&TestGraphicsApplication::LogContext);
+  Dali::Integration::Trace::InstallLogContextFunction(logContextFunction);
+
+  Dali::Integration::Trace::LogContext(true, "Test");
+}
+
+void TestGraphicsApplication::CreateScene()
+{
+  mScene = Dali::Integration::Scene::New(Size(static_cast<float>(mSurfaceWidth), static_cast<float>(mSurfaceHeight)));
+  mScene.SetDpi(Vector2(static_cast<float>(mDpi.x), static_cast<float>(mDpi.y)));
+}
+
+void TestGraphicsApplication::InitializeCore()
+{
+  mCore->SceneCreated();
+  mCore->Initialize();
+}
+
+TestGraphicsApplication::~TestGraphicsApplication()
+{
+  Dali::Integration::Log::UninstallLogFunction();
+  delete mCore;
+}
+
+void TestGraphicsApplication::LogContext(bool start, const char* tag)
+{
+  if(start)
+  {
+    fprintf(stderr, "INFO: Trace Start: %s\n", tag);
+  }
+  else
+  {
+    fprintf(stderr, "INFO: Trace End: %s\n", tag);
+  }
+}
+
+void TestGraphicsApplication::LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message)
+{
+  if(mLoggingEnabled)
+  {
+    switch(level)
+    {
+      case Dali::Integration::Log::DebugInfo:
+        fprintf(stderr, "INFO: %s", message.c_str());
+        break;
+      case Dali::Integration::Log::DebugWarning:
+        fprintf(stderr, "WARN: %s", message.c_str());
+        break;
+      case Dali::Integration::Log::DebugError:
+        fprintf(stderr, "ERROR: %s", message.c_str());
+        break;
+      default:
+        fprintf(stderr, "DEFAULT: %s", message.c_str());
+        break;
+    }
+  }
+}
+
+Dali::Integration::Core& TestGraphicsApplication::GetCore()
+{
+  return *mCore;
+}
+
+TestPlatformAbstraction& TestGraphicsApplication::GetPlatform()
+{
+  return mPlatformAbstraction;
+}
+
+TestRenderController& TestGraphicsApplication::GetRenderController()
+{
+  return mRenderController;
+}
+
+Graphics::Controller& TestGraphicsApplication::GetGraphicsController()
+{
+  return mGraphicsController;
+}
+
+TestGlAbstraction& TestGraphicsApplication::GetGlAbstraction()
+{
+  return static_cast<TestGlAbstraction&>(mGraphicsController.GetGlAbstraction());
+}
+
+TestGlSyncAbstraction& TestGraphicsApplication::GetGlSyncAbstraction()
+{
+  return static_cast<TestGlSyncAbstraction&>(mGraphicsController.GetGlSyncAbstraction());
+}
+
+TestGlContextHelperAbstraction& TestGraphicsApplication::GetGlContextHelperAbstraction()
+{
+  return static_cast<TestGlContextHelperAbstraction&>(mGraphicsController.GetGlContextHelperAbstraction());
+}
+
+void TestGraphicsApplication::ProcessEvent(const Integration::Event& event)
+{
+  mCore->QueueEvent(event);
+  mCore->ProcessEvents();
+}
+
+void TestGraphicsApplication::SendNotification()
+{
+  mCore->ProcessEvents();
+}
+
+void TestGraphicsApplication::DoUpdate(uint32_t intervalMilliseconds, const char* location)
+{
+  if(GetUpdateStatus() == 0 &&
+     mRenderStatus.NeedsUpdate() == false &&
+     !GetRenderController().WasCalled(TestRenderController::RequestUpdateFunc))
+  {
+    fprintf(stderr, "WARNING - Update not required :%s\n", location == NULL ? "NULL" : location);
+  }
+
+  uint32_t nextVSyncTime  = mLastVSyncTime + intervalMilliseconds;
+  float    elapsedSeconds = static_cast<float>(intervalMilliseconds) * 0.001f;
+
+  mCore->Update(elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus, false, false);
+
+  GetRenderController().Initialize();
+
+  mLastVSyncTime = nextVSyncTime;
+}
+
+bool TestGraphicsApplication::Render(uint32_t intervalMilliseconds, const char* location)
+{
+  DoUpdate(intervalMilliseconds, location);
+
+  // Reset the status
+  mRenderStatus.SetNeedsUpdate(false);
+  mRenderStatus.SetNeedsPostRender(false);
+
+  mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/);
+  mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/);
+  mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/);
+  mCore->PostRender(false /*do not skip rendering*/);
+
+  mFrame++;
+
+  return mStatus.KeepUpdating() || mRenderStatus.NeedsUpdate();
+}
+
+bool TestGraphicsApplication::PreRenderWithPartialUpdate(uint32_t intervalMilliseconds, const char* location, std::vector<Rect<int>>& damagedRects)
+{
+  DoUpdate(intervalMilliseconds, location);
+
+  mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/);
+  mCore->PreRender(mScene, damagedRects);
+
+  return mStatus.KeepUpdating() || mRenderStatus.NeedsUpdate();
+}
+
+bool TestGraphicsApplication::RenderWithPartialUpdate(std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect)
+{
+  mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/, clippingRect);
+  mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/, clippingRect);
+  mCore->PostRender(false /*do not skip rendering*/);
+
+  mFrame++;
+
+  return mStatus.KeepUpdating() || mRenderStatus.NeedsUpdate();
+}
+
+uint32_t TestGraphicsApplication::GetUpdateStatus()
+{
+  return mStatus.KeepUpdating();
+}
+
+bool TestGraphicsApplication::UpdateOnly(uint32_t intervalMilliseconds)
+{
+  DoUpdate(intervalMilliseconds);
+  return mStatus.KeepUpdating();
+}
+
+bool TestGraphicsApplication::GetRenderNeedsUpdate()
+{
+  return mRenderStatus.NeedsUpdate();
+}
+
+bool TestGraphicsApplication::GetRenderNeedsPostRender()
+{
+  return mRenderStatus.NeedsPostRender();
+}
+
+bool TestGraphicsApplication::RenderOnly()
+{
+  // Update Time values
+  mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/);
+  mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/);
+  mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/);
+  mCore->PostRender(false /*do not skip rendering*/);
+
+  mFrame++;
+
+  return mRenderStatus.NeedsUpdate();
+}
+
+void TestGraphicsApplication::ResetContext()
+{
+  mCore->ContextDestroyed();
+  mGraphicsController.InitializeGLES(mGlAbstraction);
+  mGraphicsController.Initialize(mGlSyncAbstraction, mGlContextHelperAbstraction);
+  mCore->ContextCreated();
+}
+
+uint32_t TestGraphicsApplication::Wait(uint32_t durationToWait)
+{
+  int time = 0;
+
+  for(uint32_t i = 0; i <= (durationToWait / RENDER_FRAME_INTERVAL); i++)
+  {
+    SendNotification();
+    Render(RENDER_FRAME_INTERVAL);
+    time += RENDER_FRAME_INTERVAL;
+  }
+  return time;
+}
+
+} // namespace Dali
diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-application.h b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-application.h
new file mode 100644 (file)
index 0000000..afcc1d2
--- /dev/null
@@ -0,0 +1,130 @@
+#ifndef DALI_TEST_GRAPHICS_APPLICATION_H
+#define DALI_TEST_GRAPHICS_APPLICATION_H
+
+/*
+ * Copyright (c) 2021 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/integration-api/core.h>
+#include <dali/integration-api/resource-policies.h>
+#include <dali/integration-api/scene.h>
+#include <dali/integration-api/trace.h>
+
+#include <dali/internal/graphics/gles/egl-graphics-controller.h>
+#include <dali/public-api/common/dali-common.h>
+
+#include <test-gl-abstraction.h>
+#include <test-gl-context-helper-abstraction.h>
+#include <test-gl-sync-abstraction.h>
+#include <test-platform-abstraction.h>
+#include <test-render-controller.h>
+
+namespace Dali
+{
+class DALI_CORE_API TestGraphicsApplication : public ConnectionTracker
+{
+public:
+  // Default values derived from H2 device.
+  static const uint32_t DEFAULT_SURFACE_WIDTH  = 480;
+  static const uint32_t DEFAULT_SURFACE_HEIGHT = 800;
+
+  static constexpr uint32_t DEFAULT_HORIZONTAL_DPI = 220;
+  static constexpr uint32_t DEFAULT_VERTICAL_DPI   = 217;
+
+  static const uint32_t DEFAULT_RENDER_INTERVAL = 1;
+
+  static const uint32_t RENDER_FRAME_INTERVAL = 16;
+
+  TestGraphicsApplication(uint32_t surfaceWidth        = DEFAULT_SURFACE_WIDTH,
+                          uint32_t surfaceHeight       = DEFAULT_SURFACE_HEIGHT,
+                          uint32_t horizontalDpi       = DEFAULT_HORIZONTAL_DPI,
+                          uint32_t verticalDpi         = DEFAULT_VERTICAL_DPI,
+                          bool     initialize          = true,
+                          bool     enablePartialUpdate = false);
+
+  void Initialize();
+  void CreateCore();
+  void CreateScene();
+  void InitializeCore();
+  ~TestGraphicsApplication() override;
+  static void              LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message);
+  static void              LogContext(bool start, const char* tag);
+  Dali::Integration::Core& GetCore();
+  TestPlatformAbstraction& GetPlatform();
+  TestRenderController&    GetRenderController();
+  Graphics::Controller&    GetGraphicsController();
+
+  TestGlAbstraction&              GetGlAbstraction();
+  TestGlSyncAbstraction&          GetGlSyncAbstraction();
+  TestGlContextHelperAbstraction& GetGlContextHelperAbstraction();
+
+  void        ProcessEvent(const Integration::Event& event);
+  void        SendNotification();
+  bool        Render(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location = NULL);
+  bool        PreRenderWithPartialUpdate(uint32_t intervalMilliseconds, const char* location, std::vector<Rect<int>>& damagedRects);
+  bool        RenderWithPartialUpdate(std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect);
+  uint32_t    GetUpdateStatus();
+  bool        UpdateOnly(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL);
+  bool        RenderOnly();
+  void        ResetContext();
+  bool        GetRenderNeedsUpdate();
+  bool        GetRenderNeedsPostRender();
+  uint32_t    Wait(uint32_t durationToWait);
+  static void EnableLogging(bool enabled)
+  {
+    mLoggingEnabled = enabled;
+  }
+
+  Integration::Scene GetScene() const
+  {
+    return mScene;
+  }
+
+private:
+  void DoUpdate(uint32_t intervalMilliseconds, const char* location = NULL);
+
+protected:
+  TestPlatformAbstraction         mPlatformAbstraction;
+  TestRenderController            mRenderController;
+  Graphics::EglGraphicsController mGraphicsController; // Use real controller in Adaptor
+  TestGlAbstraction               mGlAbstraction;
+  TestGlSyncAbstraction           mGlSyncAbstraction;
+  TestGlContextHelperAbstraction  mGlContextHelperAbstraction;
+
+  Integration::UpdateStatus mStatus;
+  Integration::RenderStatus mRenderStatus;
+
+  Integration::Core*       mCore;
+  Dali::Integration::Scene mScene;
+
+  uint32_t mSurfaceWidth;
+  uint32_t mSurfaceHeight;
+  uint32_t mFrame;
+
+  struct
+  {
+    uint32_t x;
+    uint32_t y;
+  } mDpi;
+  uint32_t    mLastVSyncTime;
+  bool        mPartialUpdateEnabled;
+  static bool mLoggingEnabled;
+};
+
+} // namespace Dali
+
+#endif // DALI_TEST_GRAPHICS_APPLICATION_H
diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.h b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.h
new file mode 100644 (file)
index 0000000..f5ab764
--- /dev/null
@@ -0,0 +1,61 @@
+#ifndef TEST_GRAPHICS_CONTROLLER_H
+#define TEST_GRAPHICS_CONTROLLER_H
+
+/*
+ * Copyright (c) 2021 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.
+ */
+
+#include <dali/graphics-api/graphics-controller.h>
+#include "test-gl-abstraction.h"
+#include "test-gl-context-helper-abstraction.h"
+#include "test-gl-sync-abstraction.h"
+
+namespace Dali
+{
+class TestGraphicsController : public Dali::Graphics::Controller
+{
+public:
+  TestGraphicsController()          = default;
+  virtual ~TestGraphicsController() = default;
+
+  void Initialize()
+  {
+    mGlAbstraction.Initialize();
+  }
+
+  Integration::GlAbstraction& GetGlAbstraction() override
+  {
+    return mGlAbstraction;
+  }
+
+  Integration::GlSyncAbstraction& GetGlSyncAbstraction() override
+  {
+    return mGlSyncAbstraction;
+  }
+
+  Integration::GlContextHelperAbstraction& GetGlContextHelperAbstraction() override
+  {
+    return mGlContextHelperAbstraction;
+  }
+
+private:
+  TestGlAbstraction              mGlAbstraction;
+  TestGlSyncAbstraction          mGlSyncAbstraction;
+  TestGlContextHelperAbstraction mGlContextHelperAbstraction;
+};
+
+} // namespace Dali
+
+#endif //TEST_GRAPHICS_CONTROLLER_H
diff --git a/automated-tests/src/dali-graphics/CMakeLists.txt b/automated-tests/src/dali-graphics/CMakeLists.txt
new file mode 100644 (file)
index 0000000..8f39441
--- /dev/null
@@ -0,0 +1,55 @@
+SET(PKG_NAME "dali-graphics")
+
+SET(EXEC_NAME "tct-${PKG_NAME}-core")
+SET(RPM_NAME "core-${PKG_NAME}-tests")
+
+SET(CAPI_LIB "dali-graphics")
+SET(TC_SOURCES
+    utc-Dali-GraphicsGeometry.cpp
+)
+
+LIST(APPEND TC_SOURCES
+  ../dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.cpp
+  ../dali-adaptor/dali-test-suite-utils/test-harness.cpp
+  ../dali-adaptor/dali-test-suite-utils/test-graphics-application.cpp
+  ../dali-adaptor/dali-test-suite-utils/test-gl-abstraction.cpp
+  ../dali-adaptor/dali-test-suite-utils/test-gl-sync-abstraction.cpp
+  ../dali-adaptor/dali-test-suite-utils/test-native-image.cpp
+  ../dali-adaptor/dali-test-suite-utils/test-platform-abstraction.cpp
+  ../dali-adaptor/dali-test-suite-utils/test-render-controller.cpp
+  ../dali-adaptor/dali-test-suite-utils/test-trace-call-stack.cpp
+  ../dali-adaptor/dali-test-suite-utils/adaptor-test-adaptor-impl.cpp
+  tct-dali-graphics-core.cpp
+)
+
+PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
+    dali2-core
+    dali2-adaptor
+    ecore
+    ecore-x
+)
+
+ADD_COMPILE_OPTIONS( -O0 -ggdb --coverage -Wall -Werror )
+ADD_COMPILE_OPTIONS( ${${CAPI_LIB}_CFLAGS_OTHER} )
+
+ADD_DEFINITIONS(-DTEST_RESOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/../../resources\" )
+
+FOREACH(directory ${${CAPI_LIB}_LIBRARY_DIRS})
+    SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -L${directory}")
+ENDFOREACH(directory ${CAPI_LIB_LIBRARY_DIRS})
+
+INCLUDE_DIRECTORIES(
+  ../../../
+  ${${CAPI_LIB}_INCLUDE_DIRS}
+  ../dali-adaptor/dali-test-suite-utils
+)
+
+ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES})
+TARGET_LINK_LIBRARIES(${EXEC_NAME}
+  ${${CAPI_LIB}_LIBRARIES}
+  --coverage
+)
+
+INSTALL(PROGRAMS ${EXEC_NAME}
+    DESTINATION ${BIN_DIR}/${EXEC_NAME}
+)
diff --git a/automated-tests/src/dali-graphics/tct-dali-graphics-core.cpp b/automated-tests/src/dali-graphics/tct-dali-graphics-core.cpp
new file mode 100644 (file)
index 0000000..30ec505
--- /dev/null
@@ -0,0 +1,52 @@
+#include <getopt.h>
+#include <stdlib.h>
+#include <string.h>
+#include <test-harness.h>
+
+#include "tct-dali-graphics-core.h"
+
+int main(int argc, char* const argv[])
+{
+  int result = TestHarness::EXIT_STATUS_BAD_ARGUMENT;
+
+  const char* optString = "sf";
+  bool        optRerunFailed(true);
+  bool        optRunSerially(false);
+
+  int nextOpt = 0;
+  do
+  {
+    nextOpt = getopt(argc, argv, optString);
+    switch(nextOpt)
+    {
+      case 'f':
+        optRerunFailed = false;
+        break;
+      case 's':
+        optRunSerially = true;
+        break;
+      case '?':
+        TestHarness::Usage(argv[0]);
+        exit(TestHarness::EXIT_STATUS_BAD_ARGUMENT);
+        break;
+    }
+  } while(nextOpt != -1);
+
+  if(optind == argc) // no testcase name in argument list
+  {
+    if(optRunSerially)
+    {
+      result = TestHarness::RunAll(argv[0], tc_array);
+    }
+    else
+    {
+      result = TestHarness::RunAllInParallel(argv[0], tc_array, optRerunFailed);
+    }
+  }
+  else
+  {
+    // optind is index of next argument - interpret as testcase name
+    result = TestHarness::FindAndRunTestCase(tc_array, argv[optind]);
+  }
+  return result;
+}
diff --git a/automated-tests/src/dali-graphics/utc-Dali-GraphicsGeometry.cpp b/automated-tests/src/dali-graphics/utc-Dali-GraphicsGeometry.cpp
new file mode 100644 (file)
index 0000000..85be66d
--- /dev/null
@@ -0,0 +1,42 @@
+#include <dali-test-suite-utils.h>
+
+#include <dali/graphics-api/graphics-controller.h>
+#include <dali/internal/graphics/gles/egl-graphics-controller.h>
+#include <test-graphics-application.h>
+//#include <dali/graphics-api/graphics-api-buffer.h>
+
+int UtcDaliGraphicsCreateGeometry(void)
+{
+  // Initialize actual egl graphics controller (without initializing egl!)
+  TestGraphicsApplication app;
+
+  struct Vertex
+  {
+    float x;
+    float y;
+  };
+
+  std::vector<Vertex> someData(100);
+  //Graphics::Controller& graphicsController = app.GetGraphicsController();
+
+  //Graphics::BufferCreateInfo createInfo;
+  //createInfo
+  //    .SetBufferUsageFlags(BufferUsage::VERTEX_BUFFER)
+  //    .SetSize(someData.size();
+
+  //auto buffer = graphicsController->CreateBuffer(createInfo);
+  //std::unique_ptr<Graphics::Memory> memory = graphicsController.MapBufferRange(buffer, 0, someData.size());
+  //uint32_t* memory = memory->Lock();
+  //std::memcpy(memory, &someData[0], someData.size()*sizeof(Vertex));
+  //memory->Unlock();
+
+  //graphicsController.SubmitCommands(emptyCommand);
+
+  // Test that data has been uploaded to GL, e.g. test that GPU buffer has been created
+  //auto& gl              = app.GetGlAbstraction();
+  //auto& bufferDataCalls = gl.GetBufferDataCalls();
+  //DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION);
+  //DALI_TEST_EQUALS(bufferDataCalls[0], someData.size(), TEST_LOCATION);
+  DALI_TEST_CHECK(1);
+  END_TEST;
+}
index 37332b1..73ca7f9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 #include <dali/internal/adaptor/common/adaptor-builder-impl.h>
 
 // INTERNAL INCLUDES
-#include <dali/public-api/dali-adaptor-common.h>
 #include <dali/internal/graphics/gles/egl-graphics-factory.h>
 #include <dali/internal/window-system/common/display-utils.h>
-
+#include <dali/public-api/dali-adaptor-common.h>
 
 namespace Dali
 {
-
 namespace Internal
 {
-
 namespace Adaptor
 {
-
-AdaptorBuilder::AdaptorBuilder()
+AdaptorBuilder::AdaptorBuilder(EnvironmentOptions& environmentOptions)
+: mEnvironmentOptions(environmentOptions)
 {
   // Construct Graphics Factory
-  mGraphicsFactory = Utils::MakeUnique< GraphicsFactory >();
+  mGraphicsFactory = Utils::MakeUnique<GraphicsFactory>(environmentOptions);
 }
 
 GraphicsFactory& AdaptorBuilder::GetGraphicsFactory() const
index ab09a34..795cc8a 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_ADAPTOR_BUILDER_IMPL_H
 
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
  *
  */
 
-
 // INTERNAL INCLUDES
-#include <dali/internal/system/common/environment-options.h>
 #include <dali/internal/graphics/gles/egl-graphics-factory.h>
-
+#include <dali/internal/system/common/environment-options.h>
 
 namespace Dali
 {
-
 namespace Internal
 {
-
 namespace Adaptor
 {
-
 /**
  * Implementation of the Adaptor Builder class.
  */
 class AdaptorBuilder
 {
 public:
-
   /**
    * Constructor
    */
-  AdaptorBuilder();
-
+  AdaptorBuilder(EnvironmentOptions& environmentOptions);
 
   /**
    * Destructor
    */
-  ~AdaptorBuilder() {};
-
+  ~AdaptorBuilder(){};
 
 public:
-
   /**
    * @return reference to the GraphicsFactory object
    */
   GraphicsFactory& GetGraphicsFactory() const;
 
-
 private:
   // Eliminate copy and assigned operations
   AdaptorBuilder(const AdaptorBuilder&) = delete;
   AdaptorBuilder& operator=(AdaptorBuilder&) = delete;
 
-
 private:
-  std::unique_ptr< GraphicsFactory > mGraphicsFactory; ///< GraphicsFactory object
-
+  std::unique_ptr<GraphicsFactory> mGraphicsFactory; ///< GraphicsFactory object
+  EnvironmentOptions&              mEnvironmentOptions;
 };
 
-} // namespace Internal
-
 } // namespace Adaptor
 
+} // namespace Internal
+
 } // namespace Dali
 
 #endif // DALI_INTERNAL_ADAPTOR_BUILDER_IMPL_H
old mode 100755 (executable)
new mode 100644 (file)
index bc70e9b..a2c3f76
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
  */
 
 // CLASS HEADER
+#include <dali/internal/adaptor/common/adaptor-builder-impl.h>
 #include <dali/internal/adaptor/common/adaptor-impl.h>
-#include <dali/internal/addons/common/addon-manager-impl.h>
 #include <dali/internal/addons/common/addon-manager-factory.h>
-#include <dali/internal/adaptor/common/adaptor-builder-impl.h>
+#include <dali/internal/addons/common/addon-manager-impl.h>
 
 // EXTERNAL INCLUDES
-#include <errno.h>
-#include <sys/stat.h>
-#include <dali/public-api/actors/layer.h>
-#include <dali/public-api/object/any.h>
-#include <dali/public-api/object/object-registry.h>
-#include <dali/public-api/events/wheel-event.h>
 #include <dali/devel-api/actors/actor-devel.h>
 #include <dali/devel-api/common/stage.h>
-#include <dali/integration-api/debug.h>
-#include <dali/integration-api/core.h>
+#include <dali/integration-api/addon-manager.h>
 #include <dali/integration-api/context-notifier.h>
-#include <dali/integration-api/profiling.h>
-#include <dali/integration-api/input-options.h>
+#include <dali/integration-api/core.h>
+#include <dali/integration-api/debug.h>
 #include <dali/integration-api/events/key-event-integ.h>
 #include <dali/integration-api/events/touch-event-integ.h>
 #include <dali/integration-api/events/wheel-event-integ.h>
+#include <dali/integration-api/input-options.h>
 #include <dali/integration-api/processor-interface.h>
-#include <dali/integration-api/addon-manager.h>
+#include <dali/integration-api/profiling.h>
+#include <dali/public-api/actors/layer.h>
+#include <dali/public-api/events/wheel-event.h>
+#include <dali/public-api/object/any.h>
+#include <dali/public-api/object/object-registry.h>
+#include <errno.h>
+#include <sys/stat.h>
 
 // INTERNAL INCLUDES
-#include <dali/public-api/dali-adaptor-common.h>
-#include <dali/internal/system/common/thread-controller.h>
-#include <dali/internal/system/common/performance-interface-factory.h>
 #include <dali/internal/adaptor/common/lifecycle-observer.h>
 #include <dali/internal/adaptor/common/thread-controller-interface.h>
+#include <dali/internal/system/common/performance-interface-factory.h>
+#include <dali/internal/system/common/thread-controller.h>
+#include <dali/public-api/dali-adaptor-common.h>
 
 #include <dali/internal/graphics/gles/egl-graphics-factory.h>
 #include <dali/internal/graphics/gles/egl-graphics.h> // Temporary until Core is abstracted
 
 #include <dali/devel-api/text-abstraction/font-client.h>
 
-#include <dali/internal/system/common/callback-manager.h>
 #include <dali/internal/accessibility/common/tts-player-impl.h>
-#include <dali/internal/window-system/common/event-handler.h>
-#include <dali/internal/graphics/gles/gl-proxy-implementation.h>
-#include <dali/internal/graphics/gles/gl-implementation.h>
-#include <dali/internal/graphics/gles/egl-sync-implementation.h>
-#include <dali/internal/graphics/common/egl-image-extensions.h>
 #include <dali/internal/clipboard/common/clipboard-impl.h>
+#include <dali/internal/graphics/common/egl-image-extensions.h>
+#include <dali/internal/graphics/gles/egl-sync-implementation.h>
+#include <dali/internal/graphics/gles/gl-implementation.h>
+#include <dali/internal/graphics/gles/gl-proxy-implementation.h>
+#include <dali/internal/system/common/callback-manager.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/event-handler.h>
 #include <dali/internal/window-system/common/window-impl.h>
 #include <dali/internal/window-system/common/window-render-surface.h>
 
 #include <dali/devel-api/adaptor-framework/accessibility-impl.h>
 #include <dali/internal/system/common/logging.h>
 
-#include <dali/internal/system/common/locale-utils.h>
 #include <dali/internal/imaging/common/image-loader-plugin-proxy.h>
 #include <dali/internal/imaging/common/image-loader.h>
+#include <dali/internal/system/common/locale-utils.h>
 
 #include <dali/internal/system/common/configuration-manager.h>
 #include <dali/internal/system/common/environment-variables.h>
@@ -83,260 +83,242 @@ extern std::string GetSystemCachePath();
 
 namespace Dali
 {
-
 namespace Internal
 {
-
 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, EnvironmentOptions* environmentOptions, ThreadMode threadMode )
+Dali::Adaptor* Adaptor::New(Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions, ThreadMode threadMode)
 {
   Dali::Adaptor* adaptor = new Dali::Adaptor;
-  Adaptor* impl = new Adaptor( window, *adaptor, surface, environmentOptions, threadMode );
-  adaptor->mImpl = impl;
+  Adaptor*       impl    = new Adaptor(window, *adaptor, surface, environmentOptions, threadMode);
+  adaptor->mImpl         = impl;
 
-  Dali::Internal::Adaptor::AdaptorBuilder* mAdaptorBuilder = new AdaptorBuilder();
-  auto graphicsFactory = mAdaptorBuilder->GetGraphicsFactory();
+  Dali::Internal::Adaptor::AdaptorBuilder* mAdaptorBuilder = new AdaptorBuilder(*environmentOptions);
+  auto                                     graphicsFactory = mAdaptorBuilder->GetGraphicsFactory();
 
-  impl->Initialize( graphicsFactory );
+  impl->Initialize(graphicsFactory);
   delete mAdaptorBuilder; // Not needed anymore as the graphics interface has now been created
 
   return adaptor;
 }
 
-Dali::Adaptor* Adaptor::New( Dali::Integration::SceneHolder window, EnvironmentOptions* environmentOptions )
+Dali::Adaptor* Adaptor::New(Dali::Integration::SceneHolder window, EnvironmentOptions* environmentOptions)
 {
-  Internal::Adaptor::SceneHolder& windowImpl = Dali::GetImplementation( window );
-  Dali::Adaptor* adaptor = New( window, windowImpl.GetSurface(), environmentOptions, ThreadMode::NORMAL );
-  windowImpl.SetAdaptor( *adaptor );
+  Internal::Adaptor::SceneHolder& windowImpl = Dali::GetImplementation(window);
+  Dali::Adaptor*                  adaptor    = New(window, windowImpl.GetSurface(), environmentOptions, ThreadMode::NORMAL);
+  windowImpl.SetAdaptor(*adaptor);
   return adaptor;
 }
 
-Dali::Adaptor* Adaptor::New( GraphicsFactory& graphicsFactory, Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface *surface, EnvironmentOptions* environmentOptions, ThreadMode threadMode )
+Dali::Adaptor* Adaptor::New(GraphicsFactory& graphicsFactory, Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions, ThreadMode threadMode)
 {
-  Dali::Adaptor* adaptor = new Dali::Adaptor; // Public adaptor
-  Adaptor* impl = new Adaptor( window, *adaptor, surface, environmentOptions, threadMode ); // Impl adaptor
-  adaptor->mImpl = impl;
+  Dali::Adaptor* adaptor = new Dali::Adaptor;                                                      // Public adaptor
+  Adaptor*       impl    = new Adaptor(window, *adaptor, surface, environmentOptions, threadMode); // Impl adaptor
+  adaptor->mImpl         = impl;
 
-  impl->Initialize( graphicsFactory );
+  impl->Initialize(graphicsFactory);
 
   return adaptor;
 } // Called second
 
-Dali::Adaptor* Adaptor::New( GraphicsFactory& graphicsFactory, Dali::Integration::SceneHolder window, EnvironmentOptions* environmentOptions )
+Dali::Adaptor* Adaptor::New(GraphicsFactory& graphicsFactory, Dali::Integration::SceneHolder window, EnvironmentOptions* environmentOptions)
 {
-  Internal::Adaptor::SceneHolder& windowImpl = Dali::GetImplementation( window );
-  Dali::Adaptor* adaptor = New( graphicsFactory, window, windowImpl.GetSurface(), environmentOptions, ThreadMode::NORMAL );
-  windowImpl.SetAdaptor( *adaptor );
+  Internal::Adaptor::SceneHolder& windowImpl = Dali::GetImplementation(window);
+  Dali::Adaptor*                  adaptor    = New(graphicsFactory, window, windowImpl.GetSurface(), environmentOptions, ThreadMode::NORMAL);
+  windowImpl.SetAdaptor(*adaptor);
   return adaptor;
 } // Called first
 
-void Adaptor::Initialize( GraphicsFactory& graphicsFactory )
+void Adaptor::Initialize(GraphicsFactory& graphicsFactory)
 {
   // all threads here (event, update, and render) will send their logs to TIZEN Platform's LogMessage handler.
-  Dali::Integration::Log::LogFunction logFunction( Dali::TizenPlatform::LogMessage );
-  mEnvironmentOptions->SetLogFunction( logFunction );
+  Dali::Integration::Log::LogFunction logFunction(Dali::TizenPlatform::LogMessage);
+  mEnvironmentOptions->SetLogFunction(logFunction);
   mEnvironmentOptions->InstallLogFunction(); // install logging for main thread
 
   mPlatformAbstraction = new TizenPlatform::TizenPlatformAbstraction;
 
   std::string path;
-  GetDataStoragePath( path );
-  mPlatformAbstraction->SetDataStoragePath( path );
+  GetDataStoragePath(path);
+  mPlatformAbstraction->SetDataStoragePath(path);
 
-  if( mEnvironmentOptions->PerformanceServerRequired() )
+  if(mEnvironmentOptions->PerformanceServerRequired())
   {
-    mPerformanceInterface = PerformanceInterfaceFactory::CreateInterface( *this, *mEnvironmentOptions );
+    mPerformanceInterface = PerformanceInterfaceFactory::CreateInterface(*this, *mEnvironmentOptions);
   }
 
-  mEnvironmentOptions->CreateTraceManager( mPerformanceInterface );
+  mEnvironmentOptions->CreateTraceManager(mPerformanceInterface);
   mEnvironmentOptions->InstallTraceFunction(); // install tracing for main thread
 
   mCallbackManager = CallbackManager::New();
 
   Dali::Internal::Adaptor::SceneHolder* defaultWindow = mWindows.front();
 
-  DALI_ASSERT_DEBUG( defaultWindow->GetSurface() && "Surface not initialized" );
-
-  mGraphics = std::unique_ptr< GraphicsInterface >( &graphicsFactory.Create() );
-  mGraphics->Initialize( mEnvironmentOptions );
-
-  GraphicsInterface* graphics = mGraphics.get(); // This interface is temporary until Core has been updated to match
-  auto eglGraphics = static_cast<EglGraphics *>( graphics );
+  DALI_ASSERT_DEBUG(defaultWindow->GetSurface() && "Surface not initialized");
 
-  // This will only be created once
-  eglGraphics->Create();
-
-  GlImplementation& mGLES = eglGraphics->GetGlesInterface();
-  EglSyncImplementation& eglSyncImpl = eglGraphics->GetSyncImplementation();
-  EglContextHelperImplementation& eglContextHelperImpl = eglGraphics->GetContextHelperImplementation();
+  mGraphics = std::unique_ptr<GraphicsInterface>(&graphicsFactory.Create());
 
   // Create the AddOnManager
-  mAddOnManager.reset( Dali::Internal::AddOnManagerFactory::CreateAddOnManager() );
-
-  mCore = Integration::Core::New( *this,
-                                  *mPlatformAbstraction,
-                                  mGLES,
-                                  eglSyncImpl,
-                                  eglContextHelperImpl,
-                                  ( 0u != mEnvironmentOptions->GetRenderToFboInterval() ) ? Integration::RenderToFrameBuffer::TRUE : Integration::RenderToFrameBuffer::FALSE,
-                                  mGraphics->GetDepthBufferRequired(),
-                                  mGraphics->GetStencilBufferRequired(),
-                                  mGraphics->GetPartialUpdateRequired() );
+  mAddOnManager.reset(Dali::Internal::AddOnManagerFactory::CreateAddOnManager());
 
+  mCore = Integration::Core::New(*this,
+                                 *mPlatformAbstraction,
+                                 mGraphics->GetController(),
+                                 (0u != mEnvironmentOptions->GetRenderToFboInterval()) ? Integration::RenderToFrameBuffer::TRUE : Integration::RenderToFrameBuffer::FALSE,
+                                 mGraphics->GetDepthBufferRequired(),
+                                 mGraphics->GetStencilBufferRequired(),
+                                 mGraphics->GetPartialUpdateRequired());
 
-  defaultWindow->SetAdaptor( Get() );
+  defaultWindow->SetAdaptor(Get());
 
-  Dali::Integration::SceneHolder defaultSceneHolder( defaultWindow );
+  Dali::Integration::SceneHolder defaultSceneHolder(defaultWindow);
 
-  mWindowCreatedSignal.Emit( defaultSceneHolder );
+  mWindowCreatedSignal.Emit(defaultSceneHolder);
 
   const unsigned int timeInterval = mEnvironmentOptions->GetObjectProfilerInterval();
-  if( 0u < timeInterval )
+  if(0u < timeInterval)
   {
-    mObjectProfiler = new ObjectProfiler( mCore->GetObjectRegistry(), timeInterval );
+    mObjectProfiler = new ObjectProfiler(mCore->GetObjectRegistry(), timeInterval);
   }
 
-  mNotificationTrigger = TriggerEventFactory::CreateTriggerEvent( MakeCallback( this, &Adaptor::ProcessCoreEvents ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER);
+  mNotificationTrigger = TriggerEventFactory::CreateTriggerEvent(MakeCallback(this, &Adaptor::ProcessCoreEvents), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER);
 
-  mDisplayConnection = Dali::DisplayConnection::New( *mGraphics, defaultWindow->GetSurface()->GetSurfaceType() );
+  mDisplayConnection = Dali::DisplayConnection::New(*mGraphics, defaultWindow->GetSurface()->GetSurfaceType());
 
-  mThreadController = new ThreadController( *this, *mEnvironmentOptions, mThreadMode );
+  mThreadController = new ThreadController(*this, *mEnvironmentOptions, mThreadMode);
 
   // Should be called after Core creation
-  if( mEnvironmentOptions->GetPanGestureLoggingLevel() )
+  if(mEnvironmentOptions->GetPanGestureLoggingLevel())
   {
-    Integration::EnableProfiling( Dali::Integration::PROFILING_TYPE_PAN_GESTURE );
+    Integration::EnableProfiling(Dali::Integration::PROFILING_TYPE_PAN_GESTURE);
   }
-  if( mEnvironmentOptions->GetPanGesturePredictionMode() >= 0 )
+  if(mEnvironmentOptions->GetPanGesturePredictionMode() >= 0)
   {
     Integration::SetPanGesturePredictionMode(mEnvironmentOptions->GetPanGesturePredictionMode());
   }
-  if( mEnvironmentOptions->GetPanGesturePredictionAmount() >= 0 )
+  if(mEnvironmentOptions->GetPanGesturePredictionAmount() >= 0)
   {
     Integration::SetPanGesturePredictionAmount(mEnvironmentOptions->GetPanGesturePredictionAmount());
   }
-  if( mEnvironmentOptions->GetPanGestureMaximumPredictionAmount() >= 0 )
+  if(mEnvironmentOptions->GetPanGestureMaximumPredictionAmount() >= 0)
   {
     Integration::SetPanGestureMaximumPredictionAmount(mEnvironmentOptions->GetPanGestureMaximumPredictionAmount());
   }
-  if( mEnvironmentOptions->GetPanGestureMinimumPredictionAmount() >= 0 )
+  if(mEnvironmentOptions->GetPanGestureMinimumPredictionAmount() >= 0)
   {
     Integration::SetPanGestureMinimumPredictionAmount(mEnvironmentOptions->GetPanGestureMinimumPredictionAmount());
   }
-  if( mEnvironmentOptions->GetPanGesturePredictionAmountAdjustment() >= 0 )
+  if(mEnvironmentOptions->GetPanGesturePredictionAmountAdjustment() >= 0)
   {
     Integration::SetPanGesturePredictionAmountAdjustment(mEnvironmentOptions->GetPanGesturePredictionAmountAdjustment());
   }
-  if( mEnvironmentOptions->GetPanGestureSmoothingMode() >= 0 )
+  if(mEnvironmentOptions->GetPanGestureSmoothingMode() >= 0)
   {
     Integration::SetPanGestureSmoothingMode(mEnvironmentOptions->GetPanGestureSmoothingMode());
   }
-  if( mEnvironmentOptions->GetPanGestureSmoothingAmount() >= 0.0f )
+  if(mEnvironmentOptions->GetPanGestureSmoothingAmount() >= 0.0f)
   {
     Integration::SetPanGestureSmoothingAmount(mEnvironmentOptions->GetPanGestureSmoothingAmount());
   }
-  if( mEnvironmentOptions->GetPanGestureUseActualTimes() >= 0 )
+  if(mEnvironmentOptions->GetPanGestureUseActualTimes() >= 0)
   {
-    Integration::SetPanGestureUseActualTimes( mEnvironmentOptions->GetPanGestureUseActualTimes() == 0 ? true : false );
+    Integration::SetPanGestureUseActualTimes(mEnvironmentOptions->GetPanGestureUseActualTimes() == 0 ? true : false);
   }
-  if( mEnvironmentOptions->GetPanGestureInterpolationTimeRange() >= 0 )
+  if(mEnvironmentOptions->GetPanGestureInterpolationTimeRange() >= 0)
   {
-    Integration::SetPanGestureInterpolationTimeRange( mEnvironmentOptions->GetPanGestureInterpolationTimeRange() );
+    Integration::SetPanGestureInterpolationTimeRange(mEnvironmentOptions->GetPanGestureInterpolationTimeRange());
   }
-  if( mEnvironmentOptions->GetPanGestureScalarOnlyPredictionEnabled() >= 0 )
+  if(mEnvironmentOptions->GetPanGestureScalarOnlyPredictionEnabled() >= 0)
   {
-    Integration::SetPanGestureScalarOnlyPredictionEnabled( mEnvironmentOptions->GetPanGestureScalarOnlyPredictionEnabled() == 0 ? true : false  );
+    Integration::SetPanGestureScalarOnlyPredictionEnabled(mEnvironmentOptions->GetPanGestureScalarOnlyPredictionEnabled() == 0 ? true : false);
   }
-  if( mEnvironmentOptions->GetPanGestureTwoPointPredictionEnabled() >= 0 )
+  if(mEnvironmentOptions->GetPanGestureTwoPointPredictionEnabled() >= 0)
   {
-    Integration::SetPanGestureTwoPointPredictionEnabled( mEnvironmentOptions->GetPanGestureTwoPointPredictionEnabled() == 0 ? true : false  );
+    Integration::SetPanGestureTwoPointPredictionEnabled(mEnvironmentOptions->GetPanGestureTwoPointPredictionEnabled() == 0 ? true : false);
   }
-  if( mEnvironmentOptions->GetPanGestureTwoPointInterpolatePastTime() >= 0 )
+  if(mEnvironmentOptions->GetPanGestureTwoPointInterpolatePastTime() >= 0)
   {
-    Integration::SetPanGestureTwoPointInterpolatePastTime( mEnvironmentOptions->GetPanGestureTwoPointInterpolatePastTime() );
+    Integration::SetPanGestureTwoPointInterpolatePastTime(mEnvironmentOptions->GetPanGestureTwoPointInterpolatePastTime());
   }
-  if( mEnvironmentOptions->GetPanGestureTwoPointVelocityBias() >= 0.0f )
+  if(mEnvironmentOptions->GetPanGestureTwoPointVelocityBias() >= 0.0f)
   {
-    Integration::SetPanGestureTwoPointVelocityBias( mEnvironmentOptions->GetPanGestureTwoPointVelocityBias() );
+    Integration::SetPanGestureTwoPointVelocityBias(mEnvironmentOptions->GetPanGestureTwoPointVelocityBias());
   }
-  if( mEnvironmentOptions->GetPanGestureTwoPointAccelerationBias() >= 0.0f )
+  if(mEnvironmentOptions->GetPanGestureTwoPointAccelerationBias() >= 0.0f)
   {
-    Integration::SetPanGestureTwoPointAccelerationBias( mEnvironmentOptions->GetPanGestureTwoPointAccelerationBias() );
+    Integration::SetPanGestureTwoPointAccelerationBias(mEnvironmentOptions->GetPanGestureTwoPointAccelerationBias());
   }
-  if( mEnvironmentOptions->GetPanGestureMultitapSmoothingRange() >= 0 )
+  if(mEnvironmentOptions->GetPanGestureMultitapSmoothingRange() >= 0)
   {
-    Integration::SetPanGestureMultitapSmoothingRange( mEnvironmentOptions->GetPanGestureMultitapSmoothingRange() );
+    Integration::SetPanGestureMultitapSmoothingRange(mEnvironmentOptions->GetPanGestureMultitapSmoothingRange());
   }
-  if( mEnvironmentOptions->GetMinimumPanDistance() >= 0 )
+  if(mEnvironmentOptions->GetMinimumPanDistance() >= 0)
   {
-    Integration::SetPanGestureMinimumDistance( mEnvironmentOptions->GetMinimumPanDistance() );
+    Integration::SetPanGestureMinimumDistance(mEnvironmentOptions->GetMinimumPanDistance());
   }
-  if( mEnvironmentOptions->GetMinimumPanEvents() >= 0 )
+  if(mEnvironmentOptions->GetMinimumPanEvents() >= 0)
   {
-    Integration::SetPanGestureMinimumPanEvents( mEnvironmentOptions->GetMinimumPanEvents() );
+    Integration::SetPanGestureMinimumPanEvents(mEnvironmentOptions->GetMinimumPanEvents());
   }
-  if( mEnvironmentOptions->GetMinimumPinchDistance() >= 0 )
+  if(mEnvironmentOptions->GetMinimumPinchDistance() >= 0)
   {
-    Integration::SetPinchGestureMinimumDistance( mEnvironmentOptions->GetMinimumPinchDistance() );
+    Integration::SetPinchGestureMinimumDistance(mEnvironmentOptions->GetMinimumPinchDistance());
   }
-  if( mEnvironmentOptions->GetMinimumPinchTouchEvents() >= 0 )
+  if(mEnvironmentOptions->GetMinimumPinchTouchEvents() >= 0)
   {
-    Integration::SetPinchGestureMinimumTouchEvents( mEnvironmentOptions->GetMinimumPinchTouchEvents() );
+    Integration::SetPinchGestureMinimumTouchEvents(mEnvironmentOptions->GetMinimumPinchTouchEvents());
   }
-  if( mEnvironmentOptions->GetMinimumPinchTouchEventsAfterStart() >= 0 )
+  if(mEnvironmentOptions->GetMinimumPinchTouchEventsAfterStart() >= 0)
   {
-    Integration::SetPinchGestureMinimumTouchEventsAfterStart( mEnvironmentOptions->GetMinimumPinchTouchEventsAfterStart() );
+    Integration::SetPinchGestureMinimumTouchEventsAfterStart(mEnvironmentOptions->GetMinimumPinchTouchEventsAfterStart());
   }
-  if( mEnvironmentOptions->GetMinimumRotationTouchEvents() >= 0 )
+  if(mEnvironmentOptions->GetMinimumRotationTouchEvents() >= 0)
   {
-    Integration::SetRotationGestureMinimumTouchEvents( mEnvironmentOptions->GetMinimumRotationTouchEvents() );
+    Integration::SetRotationGestureMinimumTouchEvents(mEnvironmentOptions->GetMinimumRotationTouchEvents());
   }
-  if( mEnvironmentOptions->GetMinimumRotationTouchEventsAfterStart() >= 0 )
+  if(mEnvironmentOptions->GetMinimumRotationTouchEventsAfterStart() >= 0)
   {
-    Integration::SetRotationGestureMinimumTouchEventsAfterStart( mEnvironmentOptions->GetMinimumRotationTouchEventsAfterStart() );
+    Integration::SetRotationGestureMinimumTouchEventsAfterStart(mEnvironmentOptions->GetMinimumRotationTouchEventsAfterStart());
   }
-  if( mEnvironmentOptions->GetLongPressMinimumHoldingTime() >= 0 )
+  if(mEnvironmentOptions->GetLongPressMinimumHoldingTime() >= 0)
   {
-    Integration::SetLongPressMinimumHoldingTime( mEnvironmentOptions->GetLongPressMinimumHoldingTime() );
+    Integration::SetLongPressMinimumHoldingTime(mEnvironmentOptions->GetLongPressMinimumHoldingTime());
   }
 
   std::string systemCachePath = GetSystemCachePath();
-  if( ! systemCachePath.empty() )
+  if(!systemCachePath.empty())
   {
-    const int dir_err = mkdir( systemCachePath.c_str(), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH );
-    if ( 0 != dir_err && errno != EEXIST )
+    const int dir_err = mkdir(systemCachePath.c_str(), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+    if(0 != dir_err && errno != EEXIST)
     {
-      DALI_LOG_ERROR( "Error creating system cache directory: %s!\n", systemCachePath.c_str() );
-      exit( 1 );
+      DALI_LOG_ERROR("Error creating system cache directory: %s!\n", systemCachePath.c_str());
+      exit(1);
     }
   }
 
-  mConfigurationManager = Utils::MakeUnique<ConfigurationManager>( systemCachePath, eglGraphics, mThreadController );
+  mConfigurationManager = Utils::MakeUnique<ConfigurationManager>(systemCachePath, mGraphics.get(), mThreadController);
 
   auto appName = GetApplicationPackageName();
-  auto bridge = Accessibility::Bridge::GetCurrentBridge();
-  bridge->SetApplicationName( appName );
+  auto bridge  = Accessibility::Bridge::GetCurrentBridge();
+  bridge->SetApplicationName(appName);
   bridge->Initialize();
-  Dali::Stage::GetCurrent().KeyEventSignal().Connect( &accessibilityObserver, &AccessibilityObserver::OnAccessibleKeyEvent );
+  Dali::Stage::GetCurrent().KeyEventSignal().Connect(&accessibilityObserver, &AccessibilityObserver::OnAccessibleKeyEvent);
 }
 
-void Adaptor::AccessibilityObserver::OnAccessibleKeyEvent( const Dali::KeyEvent& event )
+void Adaptor::AccessibilityObserver::OnAccessibleKeyEvent(const Dali::KeyEvent& event)
 {
   Accessibility::KeyEventType type;
-  if( event.GetState() == Dali::KeyEvent::DOWN )
+  if(event.GetState() == Dali::KeyEvent::DOWN)
   {
     type = Accessibility::KeyEventType::KEY_PRESSED;
   }
-  else if( event.GetState() == Dali::KeyEvent::UP )
+  else if(event.GetState() == Dali::KeyEvent::UP)
   {
     type = Accessibility::KeyEventType::KEY_RELEASED;
   }
@@ -344,7 +326,7 @@ void Adaptor::AccessibilityObserver::OnAccessibleKeyEvent( const Dali::KeyEvent&
   {
     return;
   }
-  Dali::Accessibility::Bridge::GetCurrentBridge()->Emit( type, event.GetKeyCode(), event.GetKeyName(), event.GetTime(), !event.GetKeyString().empty() );
+  Dali::Accessibility::Bridge::GetCurrentBridge()->Emit(type, event.GetKeyCode(), event.GetKeyName(), event.GetTime(), !event.GetKeyString().empty());
 }
 
 Adaptor::~Adaptor()
@@ -357,7 +339,7 @@ Adaptor::~Adaptor()
   // set to NULL first as we do not want any access to Adaptor as it is being destroyed.
   gThreadLocalAdaptor = NULL;
 
-  for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
+  for(ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter)
   {
     (*iter)->OnDestroy();
   }
@@ -381,7 +363,7 @@ Adaptor::~Adaptor()
   Dali::Integration::Log::UninstallLogFunction();
 
   // Delete environment options if we own it
-  if( mEnvironmentOptionsOwned )
+  if(mEnvironmentOptionsOwned)
   {
     delete mEnvironmentOptions;
   }
@@ -390,7 +372,7 @@ Adaptor::~Adaptor()
 void Adaptor::Start()
 {
   // It doesn't support restart after stop at this moment to support restarting, need more testing
-  if( READY != mState )
+  if(READY != mState)
   {
     return;
   }
@@ -407,44 +389,40 @@ void Adaptor::Start()
   unsigned int dpiHor, dpiVer;
   dpiHor = dpiVer = 0;
 
-  defaultWindow->GetSurface()->GetDpi( dpiHor, dpiVer );
+  defaultWindow->GetSurface()->GetDpi(dpiHor, dpiVer);
 
   // set the DPI value for font rendering
   FontClient fontClient = FontClient::Get();
-  fontClient.SetDpi( dpiHor, dpiVer );
+  fontClient.SetDpi(dpiHor, dpiVer);
 
   // Initialize the thread controller
   mThreadController->Initialize();
 
   // Set max texture size
-  if( mEnvironmentOptions->GetMaxTextureSize() > 0 )
+  if(mEnvironmentOptions->GetMaxTextureSize() > 0)
   {
-    Dali::TizenPlatform::ImageLoader::SetMaxTextureSize( mEnvironmentOptions->GetMaxTextureSize() );
+    Dali::TizenPlatform::ImageLoader::SetMaxTextureSize(mEnvironmentOptions->GetMaxTextureSize());
   }
   else
   {
     unsigned int maxTextureSize = mConfigurationManager->GetMaxTextureSize();
-    Dali::TizenPlatform::ImageLoader::SetMaxTextureSize( maxTextureSize );
+    Dali::TizenPlatform::ImageLoader::SetMaxTextureSize(maxTextureSize);
   }
 
-  // Set cached isAdvancedBlendEquationSupported
-  GraphicsInterface* graphics = mGraphics.get(); // This interface is temporary until Core has been updated to match
-  auto eglGraphics = static_cast<EglGraphics *>( graphics );
-  GlImplementation& mGLES = eglGraphics->GetGlesInterface();
-  mGLES.SetIsAdvancedBlendEquationSupported( mConfigurationManager->IsAdvancedBlendEquationSupported() );
-  mGLES.SetShadingLanguageVersion( mConfigurationManager->GetShadingLanguageVersion() );
+  // cache advanced blending and shader language version
+  mGraphics->CacheConfigurations(*mConfigurationManager.get());
 
   ProcessCoreEvents(); // Ensure any startup messages are processed.
 
   // Initialize the image loader plugin
   Internal::Adaptor::ImageLoaderPluginProxy::Initialize();
 
-  for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
+  for(ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter)
   {
     (*iter)->OnStart();
   }
 
-  if (mAddOnManager)
+  if(mAddOnManager)
   {
     mAddOnManager->Start();
   }
@@ -454,22 +432,22 @@ void Adaptor::Start()
 void Adaptor::Pause()
 {
   // Only pause the adaptor if we're actually running.
-  if( RUNNING == mState )
+  if(RUNNING == mState)
   {
     // Inform observers that we are about to be paused.
-    for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
+    for(ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter)
     {
       (*iter)->OnPause();
     }
 
     // Extensions
-    if (mAddOnManager)
+    if(mAddOnManager)
     {
       mAddOnManager->Pause();
     }
 
     // Pause all windows event handlers when adaptor paused
-    for( auto window : mWindows )
+    for(auto window : mWindows)
     {
       window->Pause();
     }
@@ -480,11 +458,11 @@ void Adaptor::Pause()
     // Ensure any messages queued during pause callbacks are processed by doing another update.
     RequestUpdateOnce();
 
-    DALI_LOG_RELEASE_INFO( "Adaptor::Pause: Paused\n" );
+    DALI_LOG_RELEASE_INFO("Adaptor::Pause: Paused\n");
   }
   else
   {
-    DALI_LOG_RELEASE_INFO( "Adaptor::Pause: Not paused [%d]\n", mState );
+    DALI_LOG_RELEASE_INFO("Adaptor::Pause: Not paused [%d]\n", mState);
   }
 }
 
@@ -492,24 +470,24 @@ void Adaptor::Pause()
 void Adaptor::Resume()
 {
   // Only resume the adaptor if we are in the suspended state.
-  if( PAUSED == mState )
+  if(PAUSED == mState)
   {
     mState = RUNNING;
 
     // Reset the event handlers when adaptor resumed
-    for( auto window : mWindows )
+    for(auto window : mWindows)
     {
       window->Resume();
     }
 
     // Resume AddOnManager
-    if (mAddOnManager)
+    if(mAddOnManager)
     {
       mAddOnManager->Resume();
     }
 
     // Inform observers that we have resumed.
-    for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
+    for(ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter)
     {
       (*iter)->OnResume();
     }
@@ -520,26 +498,26 @@ void Adaptor::Resume()
     // Do at end to ensure our first update/render after resumption includes the processed messages as well
     mThreadController->Resume();
 
-    DALI_LOG_RELEASE_INFO( "Adaptor::Resume: Resumed\n");
+    DALI_LOG_RELEASE_INFO("Adaptor::Resume: Resumed\n");
   }
   else
   {
-    DALI_LOG_RELEASE_INFO( "Adaptor::Resume: Not resumed [%d]\n", mState );
+    DALI_LOG_RELEASE_INFO("Adaptor::Resume: Not resumed [%d]\n", mState);
   }
 }
 
 void Adaptor::Stop()
 {
-  if( RUNNING == mState ||
-      PAUSED  == mState ||
-      PAUSED_WHILE_HIDDEN == mState )
+  if(RUNNING == mState ||
+     PAUSED == mState ||
+     PAUSED_WHILE_HIDDEN == mState)
   {
-    for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
+    for(ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter)
     {
       (*iter)->OnStop();
     }
 
-    if (mAddOnManager)
+    if(mAddOnManager)
     {
       mAddOnManager->Stop();
     }
@@ -547,9 +525,9 @@ void Adaptor::Stop()
     mThreadController->Stop();
 
     // Delete the TTS player
-    for( int i =0; i < Dali::TtsPlayer::MODE_NUM; i++ )
+    for(int i = 0; i < Dali::TtsPlayer::MODE_NUM; i++)
     {
-      if( mTtsPlayers[i] )
+      if(mTtsPlayers[i])
       {
         mTtsPlayers[i].Reset();
       }
@@ -565,7 +543,7 @@ void Adaptor::Stop()
 
     mState = STOPPED;
 
-    DALI_LOG_RELEASE_INFO( "Adaptor::Stop\n" );
+    DALI_LOG_RELEASE_INFO("Adaptor::Stop\n");
   }
 }
 
@@ -582,54 +560,54 @@ void Adaptor::ContextRegained()
   mCore->GetContextNotifier()->NotifyContextRegained(); // Inform stage
 }
 
-void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
+void Adaptor::FeedTouchPoint(TouchPoint& point, int timeStamp)
 {
-  Integration::Point convertedPoint( point );
-  mWindows.front()->FeedTouchPoint( convertedPoint, timeStamp );
+  Integration::Point convertedPoint(point);
+  mWindows.front()->FeedTouchPoint(convertedPoint, timeStamp);
 }
 
-void Adaptor::FeedWheelEvent( Dali::WheelEvent& wheelEvent )
+void Adaptor::FeedWheelEvent(Dali::WheelEvent& wheelEvent)
 {
-  Integration::WheelEvent event( static_cast< Integration::WheelEvent::Type >( wheelEvent.GetType() ), wheelEvent.GetDirection(), wheelEvent.GetModifiers(), wheelEvent.GetPoint(), wheelEvent.GetDelta(), wheelEvent.GetTime() );
-  mWindows.front()->FeedWheelEvent( event );
+  Integration::WheelEvent event(static_cast<Integration::WheelEvent::Type>(wheelEvent.GetType()), wheelEvent.GetDirection(), wheelEvent.GetModifiers(), wheelEvent.GetPoint(), wheelEvent.GetDelta(), wheelEvent.GetTime());
+  mWindows.front()->FeedWheelEvent(event);
 }
 
-void Adaptor::FeedKeyEvent( Dali::KeyEvent& keyEvent )
+void Adaptor::FeedKeyEvent(Dali::KeyEvent& keyEvent)
 {
-  Integration::KeyEvent convertedEvent( keyEvent.GetKeyName(), keyEvent.GetLogicalKey(), keyEvent.GetKeyString(), keyEvent.GetKeyCode(), keyEvent.GetKeyModifier(), keyEvent.GetTime(), static_cast< Integration::KeyEvent::State >( keyEvent.GetState() ), keyEvent.GetCompose(), keyEvent.GetDeviceName(), keyEvent.GetDeviceClass(), keyEvent.GetDeviceSubclass() );
-  mWindows.front()->FeedKeyEvent( convertedEvent );
+  Integration::KeyEvent convertedEvent(keyEvent.GetKeyName(), keyEvent.GetLogicalKey(), keyEvent.GetKeyString(), keyEvent.GetKeyCode(), keyEvent.GetKeyModifier(), keyEvent.GetTime(), static_cast<Integration::KeyEvent::State>(keyEvent.GetState()), keyEvent.GetCompose(), keyEvent.GetDeviceName(), keyEvent.GetDeviceClass(), keyEvent.GetDeviceSubclass());
+  mWindows.front()->FeedKeyEvent(convertedEvent);
 }
 
-void Adaptor::ReplaceSurface( Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface& newSurface )
+void Adaptor::ReplaceSurface(Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface& newSurface)
 {
-  Internal::Adaptor::SceneHolder* windowImpl = &Dali::GetImplementation( window );
-  for( auto windowPtr : mWindows )
+  Internal::Adaptor::SceneHolder* windowImpl = &Dali::GetImplementation(window);
+  for(auto windowPtr : mWindows)
   {
-    if( windowPtr == windowImpl ) // the window is not deleted
+    if(windowPtr == windowImpl) // the window is not deleted
     {
-      mResizedSignal.Emit( mAdaptor );
+      mResizedSignal.Emit(mAdaptor);
 
-      windowImpl->SetSurface( &newSurface );
+      windowImpl->SetSurface(&newSurface);
 
       // Flush the event queue to give the update-render thread chance
       // to start processing messages for new camera setup etc as soon as possible
       ProcessCoreEvents();
 
       // This method blocks until the render thread has completed the replace.
-      mThreadController->ReplaceSurface( &newSurface );
+      mThreadController->ReplaceSurface(&newSurface);
       break;
     }
   }
 }
 
-void Adaptor::DeleteSurface( Dali::RenderSurfaceInterface& surface )
+void Adaptor::DeleteSurface(Dali::RenderSurfaceInterface& surface)
 {
   // Flush the event queue to give the update-render thread chance
   // to start processing messages for new camera setup etc as soon as possible
   ProcessCoreEvents();
 
   // This method blocks until the render thread has finished rendering the current surface.
-  mThreadController->DeleteSurface( &surface );
+  mThreadController->DeleteSurface(&surface);
 }
 
 Dali::RenderSurfaceInterface& Adaptor::GetSurface() const
@@ -644,7 +622,7 @@ void Adaptor::ReleaseSurfaceLock()
 
 Dali::TtsPlayer Adaptor::GetTtsPlayer(Dali::TtsPlayer::Mode mode)
 {
-  if( !mTtsPlayers[mode] )
+  if(!mTtsPlayers[mode])
   {
     // Create the TTS player when it needed, because it can reduce launching time.
     mTtsPlayers[mode] = TtsPlayer::New(mode);
@@ -653,63 +631,63 @@ Dali::TtsPlayer Adaptor::GetTtsPlayer(Dali::TtsPlayer::Mode mode)
   return mTtsPlayers[mode];
 }
 
-bool Adaptor::AddIdle( CallbackBase* callback, bool hasReturnValue, bool forceAdd )
+bool Adaptor::AddIdle(CallbackBase* callback, bool hasReturnValue, bool forceAdd)
 {
   bool idleAdded(false);
 
   // Only add an idle if the Adaptor is actually running
-  if( RUNNING == mState || READY == mState || forceAdd )
+  if(RUNNING == mState || READY == mState || forceAdd)
   {
-    idleAdded = mCallbackManager->AddIdleCallback( callback, hasReturnValue );
+    idleAdded = mCallbackManager->AddIdleCallback(callback, hasReturnValue);
   }
 
   return idleAdded;
 }
 
-void Adaptor::RemoveIdle( CallbackBase* callback )
+void Adaptor::RemoveIdle(CallbackBase* callback)
 {
-  mCallbackManager->RemoveIdleCallback( callback );
+  mCallbackManager->RemoveIdleCallback(callback);
 }
 
 void Adaptor::ProcessIdle()
 {
-  bool idleProcessed = mCallbackManager->ProcessIdle();
+  bool idleProcessed           = mCallbackManager->ProcessIdle();
   mNotificationOnIdleInstalled = mNotificationOnIdleInstalled && !idleProcessed;
 }
 
-void Adaptor::SetPreRenderCallback( CallbackBase* callback )
+void Adaptor::SetPreRenderCallback(CallbackBase* callback)
 {
-  mThreadController->SetPreRenderCallback( callback );
+  mThreadController->SetPreRenderCallback(callback);
 }
 
-bool Adaptor::AddWindow( Dali::Integration::SceneHolder childWindow )
+bool Adaptor::AddWindow(Dali::Integration::SceneHolder childWindow)
 {
-  Internal::Adaptor::SceneHolder& windowImpl = Dali::GetImplementation( childWindow );
-  windowImpl.SetAdaptor( Get() );
+  Internal::Adaptor::SceneHolder& windowImpl = Dali::GetImplementation(childWindow);
+  windowImpl.SetAdaptor(Get());
 
   // ChildWindow is set to the layout direction of the default window.
-  windowImpl.GetRootLayer().SetProperty( Dali::Actor::Property::LAYOUT_DIRECTION, mRootLayoutDirection );
+  windowImpl.GetRootLayer().SetProperty(Dali::Actor::Property::LAYOUT_DIRECTION, mRootLayoutDirection);
 
   // Add the new Window to the container - the order is not important
-  mWindows.push_back( &windowImpl );
+  mWindows.push_back(&windowImpl);
 
   Dali::RenderSurfaceInterface* surface = windowImpl.GetSurface();
 
-  mThreadController->AddSurface( surface );
+  mThreadController->AddSurface(surface);
 
-  mWindowCreatedSignal.Emit( childWindow );
+  mWindowCreatedSignal.Emit(childWindow);
 
   return true;
 }
 
-bool Adaptor::RemoveWindow( Dali::Integration::SceneHolder* childWindow )
+bool Adaptor::RemoveWindow(Dali::Integration::SceneHolder* childWindow)
 {
-  Internal::Adaptor::SceneHolder& windowImpl = Dali::GetImplementation( *childWindow );
-  for ( WindowContainer::iterator iter = mWindows.begin(); iter != mWindows.end(); ++iter )
+  Internal::Adaptor::SceneHolder& windowImpl = Dali::GetImplementation(*childWindow);
+  for(WindowContainer::iterator iter = mWindows.begin(); iter != mWindows.end(); ++iter)
   {
-    if( *iter == &windowImpl )
+    if(*iter == &windowImpl)
     {
-      mWindows.erase( iter );
+      mWindows.erase(iter);
       return true;
     }
   }
@@ -717,13 +695,13 @@ bool Adaptor::RemoveWindow( Dali::Integration::SceneHolder* childWindow )
   return false;
 }
 
-bool Adaptor::RemoveWindow( std::string childWindowName )
+bool Adaptor::RemoveWindow(std::string childWindowName)
 {
-  for ( WindowContainer::iterator iter = mWindows.begin(); iter != mWindows.end(); ++iter )
+  for(WindowContainer::iterator iter = mWindows.begin(); iter != mWindows.end(); ++iter)
   {
-    if( ( *iter )->GetName() == childWindowName )
+    if((*iter)->GetName() == childWindowName)
     {
-      mWindows.erase( iter );
+      mWindows.erase(iter);
       return true;
     }
   }
@@ -731,13 +709,13 @@ bool Adaptor::RemoveWindow( std::string childWindowName )
   return false;
 }
 
-bool Adaptor::RemoveWindow( Internal::Adaptor::SceneHolder* childWindow )
+bool Adaptor::RemoveWindow(Internal::Adaptor::SceneHolder* childWindow)
 {
-  for ( WindowContainer::iterator iter = mWindows.begin(); iter != mWindows.end(); ++iter )
+  for(WindowContainer::iterator iter = mWindows.begin(); iter != mWindows.end(); ++iter)
   {
-    if( ( *iter )->GetId() == childWindow->GetId() )
+    if((*iter)->GetId() == childWindow->GetId())
     {
-      mWindows.erase( iter );
+      mWindows.erase(iter);
       return true;
     }
   }
@@ -747,7 +725,7 @@ bool Adaptor::RemoveWindow( Internal::Adaptor::SceneHolder* childWindow )
 
 Dali::Adaptor& Adaptor::Get()
 {
-  DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
+  DALI_ASSERT_ALWAYS(IsAvailable() && "Adaptor not instantiated");
   return gThreadLocalAdaptor->mAdaptor;
 }
 
@@ -766,21 +744,21 @@ Dali::Integration::Core& Adaptor::GetCore()
   return *mCore;
 }
 
-void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
+void Adaptor::SetRenderRefreshRate(unsigned int numberOfVSyncsPerRender)
 {
-  mThreadController->SetRenderRefreshRate( numberOfVSyncsPerRender );
+  mThreadController->SetRenderRefreshRate(numberOfVSyncsPerRender);
 }
 
 Dali::DisplayConnection& Adaptor::GetDisplayConnectionInterface()
 {
-  DALI_ASSERT_DEBUG( mDisplayConnection && "Display connection not created" );
+  DALI_ASSERT_DEBUG(mDisplayConnection && "Display connection not created");
   return *mDisplayConnection;
 }
 
 GraphicsInterface& Adaptor::GetGraphicsInterface()
 {
-  DALI_ASSERT_DEBUG( mGraphics && "Graphics interface not created" );
-  return *( mGraphics.get() );
+  DALI_ASSERT_DEBUG(mGraphics && "Graphics interface not created");
+  return *(mGraphics.get());
 }
 
 Dali::Integration::PlatformAbstraction& Adaptor::GetPlatformAbstractionInterface()
@@ -800,7 +778,7 @@ SocketFactoryInterface& Adaptor::GetSocketFactoryInterface()
 
 Dali::RenderSurfaceInterface* Adaptor::GetRenderSurfaceInterface()
 {
-  if( !mWindows.empty() )
+  if(!mWindows.empty())
   {
     return mWindows.front()->GetSurface();
   }
@@ -825,18 +803,18 @@ PerformanceInterface* Adaptor::GetPerformanceInterface()
 
 Integration::PlatformAbstraction& Adaptor::GetPlatformAbstraction() const
 {
-  DALI_ASSERT_DEBUG( mPlatformAbstraction && "PlatformAbstraction not created" );
+  DALI_ASSERT_DEBUG(mPlatformAbstraction && "PlatformAbstraction not created");
   return *mPlatformAbstraction;
 }
 
-void Adaptor::GetWindowContainerInterface( WindowContainer& windows )
+void Adaptor::GetWindowContainerInterface(WindowContainer& windows)
 {
   windows = mWindows;
 }
 
 void Adaptor::DestroyTtsPlayer(Dali::TtsPlayer::Mode mode)
 {
-  if( mTtsPlayers[mode] )
+  if(mTtsPlayers[mode])
   {
     mTtsPlayers[mode].Reset();
   }
@@ -847,15 +825,15 @@ Any Adaptor::GetNativeWindowHandle()
   return mWindows.front()->GetNativeHandle();
 }
 
-Any Adaptor::GetNativeWindowHandle( Dali::Actor actor )
+Any Adaptor::GetNativeWindowHandle(Dali::Actor actor)
 {
   Any nativeWindowHandle;
 
-  Dali::Integration::Scene scene = Dali::Integration::Scene::Get( actor );
+  Dali::Integration::Scene scene = Dali::Integration::Scene::Get(actor);
 
-  for( auto sceneHolder : mWindows )
+  for(auto sceneHolder : mWindows)
   {
-    if ( scene == sceneHolder->GetScene() )
+    if(scene == sceneHolder->GetScene())
     {
       nativeWindowHandle = sceneHolder->GetNativeHandle();
       break;
@@ -869,13 +847,13 @@ Any Adaptor::GetGraphicsDisplay()
 {
   Any display;
 
-  if (mGraphics)
+  if(mGraphics)
   {
-    GraphicsInterface* graphics = mGraphics.get(); // This interface is temporary until Core has been updated to match
-    auto eglGraphics = static_cast<EglGraphics *>( graphics );
+    GraphicsInterface* graphics    = mGraphics.get(); // This interface is temporary until Core has been updated to match
+    auto               eglGraphics = static_cast<EglGraphics*>(graphics);
 
     EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
-    display = eglImpl.GetDisplay();
+    display                    = eglImpl.GetDisplay();
   }
 
   return display;
@@ -886,29 +864,29 @@ void Adaptor::SetUseRemoteSurface(bool useRemoteSurface)
   mUseRemoteSurface = useRemoteSurface;
 }
 
-void Adaptor::AddObserver( LifeCycleObserver& observer )
+void Adaptor::AddObserver(LifeCycleObserver& observer)
 {
-  ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
+  ObserverContainer::iterator match(find(mObservers.begin(), mObservers.end(), &observer));
 
-  if ( match == mObservers.end() )
+  if(match == mObservers.end())
   {
-    mObservers.push_back( &observer );
+    mObservers.push_back(&observer);
   }
 }
 
-void Adaptor::RemoveObserver( LifeCycleObserver& observer )
+void Adaptor::RemoveObserver(LifeCycleObserver& observer)
 {
-  ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
+  ObserverContainer::iterator match(find(mObservers.begin(), mObservers.end(), &observer));
 
-  if ( match != mObservers.end() )
+  if(match != mObservers.end())
   {
-    mObservers.erase( match );
+    mObservers.erase(match);
   }
 }
 
 void Adaptor::QueueCoreEvent(const Dali::Integration::Event& event)
 {
-  if( mCore )
+  if(mCore)
   {
     mCore->QueueEvent(event);
   }
@@ -916,25 +894,25 @@ void Adaptor::QueueCoreEvent(const Dali::Integration::Event& event)
 
 void Adaptor::ProcessCoreEvents()
 {
-  if( mCore )
+  if(mCore)
   {
-    if( mPerformanceInterface )
+    if(mPerformanceInterface)
     {
-      mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_START );
+      mPerformanceInterface->AddMarker(PerformanceInterface::PROCESS_EVENTS_START);
     }
 
     mCore->ProcessEvents();
 
-    if( mPerformanceInterface )
+    if(mPerformanceInterface)
     {
-      mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_END );
+      mPerformanceInterface->AddMarker(PerformanceInterface::PROCESS_EVENTS_END);
     }
   }
 }
 
-void Adaptor::RequestUpdate( bool forceUpdate )
+void Adaptor::RequestUpdate(bool forceUpdate)
 {
-  switch( mState )
+  switch(mState)
   {
     case RUNNING:
     {
@@ -944,10 +922,10 @@ void Adaptor::RequestUpdate( bool forceUpdate )
     case PAUSED:
     case PAUSED_WHILE_HIDDEN:
     {
-      if( forceUpdate )
+      if(forceUpdate)
       {
         // Update (and resource upload) without rendering
-        mThreadController->RequestUpdateOnce( UpdateMode::SKIP_RENDER );
+        mThreadController->RequestUpdateOnce(UpdateMode::SKIP_RENDER);
       }
       break;
     }
@@ -959,13 +937,13 @@ void Adaptor::RequestUpdate( bool forceUpdate )
   }
 }
 
-void Adaptor::RequestProcessEventsOnIdle( bool forceProcess )
+void Adaptor::RequestProcessEventsOnIdle(bool forceProcess)
 {
   // Only request a notification if the Adaptor is actually running
   // and we haven't installed the idle notification
-  if( ( ! mNotificationOnIdleInstalled ) && ( RUNNING == mState || READY == mState || forceProcess ) )
+  if((!mNotificationOnIdleInstalled) && (RUNNING == mState || READY == mState || forceProcess))
   {
-    mNotificationOnIdleInstalled = AddIdleEnterer( MakeCallback( this, &Adaptor::ProcessCoreEventsFromIdle ), forceProcess );
+    mNotificationOnIdleInstalled = AddIdleEnterer(MakeCallback(this, &Adaptor::ProcessCoreEventsFromIdle), forceProcess);
   }
 }
 
@@ -973,7 +951,7 @@ void Adaptor::OnWindowShown()
 {
   Dali::Accessibility::Bridge::GetCurrentBridge()->ApplicationShown();
 
-  if( PAUSED_WHILE_HIDDEN == mState )
+  if(PAUSED_WHILE_HIDDEN == mState)
   {
     // Adaptor can now be resumed
     mState = PAUSED;
@@ -983,21 +961,21 @@ void Adaptor::OnWindowShown()
     // Force a render task
     RequestUpdateOnce();
   }
-  else if( RUNNING == mState )
+  else if(RUNNING == mState)
   {
     // Force a render task
     RequestUpdateOnce();
 
-    DALI_LOG_RELEASE_INFO( "Adaptor::OnWindowShown: Update requested.\n" );
+    DALI_LOG_RELEASE_INFO("Adaptor::OnWindowShown: Update requested.\n");
   }
-  else if( PAUSED_WHILE_INITIALIZING == mState )
+  else if(PAUSED_WHILE_INITIALIZING == mState)
   {
     // Change the state to READY again. It will be changed to RUNNING after the adaptor is started.
     mState = READY;
   }
   else
   {
-    DALI_LOG_RELEASE_INFO( "Adaptor::OnWindowShown: Adaptor is not paused state.[%d]\n", mState );
+    DALI_LOG_RELEASE_INFO("Adaptor::OnWindowShown: Adaptor is not paused state.[%d]\n", mState);
   }
 }
 
@@ -1005,13 +983,13 @@ void Adaptor::OnWindowHidden()
 {
   Dali::Accessibility::Bridge::GetCurrentBridge()->ApplicationHidden();
 
-  if( RUNNING == mState || READY == mState )
+  if(RUNNING == mState || READY == mState)
   {
     bool allWindowsHidden = true;
 
-    for( auto window : mWindows )
+    for(auto window : mWindows)
     {
-      if ( window->IsVisible() )
+      if(window->IsVisible())
       {
         allWindowsHidden = false;
         break;
@@ -1019,16 +997,16 @@ void Adaptor::OnWindowHidden()
     }
 
     // Only pause the adaptor when all the windows are hidden
-    if( allWindowsHidden )
+    if(allWindowsHidden)
     {
-      if( mState == RUNNING )
+      if(mState == RUNNING)
       {
         Pause();
 
         // Adaptor cannot be resumed until any window is shown
         mState = PAUSED_WHILE_HIDDEN;
       }
-      else  // mState is READY
+      else // mState is READY
       {
         // Pause the adaptor after the state gets RUNNING
         mState = PAUSED_WHILE_INITIALIZING;
@@ -1036,28 +1014,28 @@ void Adaptor::OnWindowHidden()
     }
     else
     {
-      DALI_LOG_RELEASE_INFO( "Adaptor::OnWindowHidden: Some windows are shown. Don't pause adaptor.\n" );
+      DALI_LOG_RELEASE_INFO("Adaptor::OnWindowHidden: Some windows are shown. Don't pause adaptor.\n");
     }
   }
   else
   {
-    DALI_LOG_RELEASE_INFO( "Adaptor::OnWindowHidden: Adaptor is not running state.[%d]\n", mState );
+    DALI_LOG_RELEASE_INFO("Adaptor::OnWindowHidden: Adaptor is not running state.[%d]\n", mState);
   }
 }
 
 // Dali::Internal::Adaptor::Adaptor::OnDamaged
-void Adaptor::OnDamaged( const DamageArea& area )
+void Adaptor::OnDamaged(const DamageArea& area)
 {
   // This is needed for the case where Dali window is partially obscured
-  RequestUpdate( false );
+  RequestUpdate(false);
 }
 
-void Adaptor::SurfaceResizePrepare( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize )
+void Adaptor::SurfaceResizePrepare(Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize)
 {
-  mResizedSignal.Emit( mAdaptor );
+  mResizedSignal.Emit(mAdaptor);
 }
 
-void Adaptor::SurfaceResizeComplete( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize )
+void Adaptor::SurfaceResizeComplete(Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize)
 {
   // Nofify surface resizing before flushing event queue
   mThreadController->ResizeSurface();
@@ -1081,11 +1059,11 @@ void Adaptor::NotifySceneCreated()
   // Process after surface is created (registering to remote surface provider if required)
   SurfaceInitialized();
 
-  if( mState != PAUSED_WHILE_INITIALIZING )
+  if(mState != PAUSED_WHILE_INITIALIZING)
   {
     mState = RUNNING;
 
-    DALI_LOG_RELEASE_INFO( "Adaptor::NotifySceneCreated: Adaptor is running\n" );
+    DALI_LOG_RELEASE_INFO("Adaptor::NotifySceneCreated: Adaptor is running\n");
   }
   else
   {
@@ -1095,21 +1073,21 @@ void Adaptor::NotifySceneCreated()
 
     mState = PAUSED_WHILE_HIDDEN;
 
-    DALI_LOG_RELEASE_INFO( "Adaptor::NotifySceneCreated: Adaptor is paused\n" );
+    DALI_LOG_RELEASE_INFO("Adaptor::NotifySceneCreated: Adaptor is paused\n");
   }
 }
 
 void Adaptor::NotifyLanguageChanged()
 {
-  mLanguageChangedSignal.Emit( mAdaptor );
+  mLanguageChangedSignal.Emit(mAdaptor);
 }
 
 void Adaptor::RenderOnce()
 {
-  if( mThreadController )
+  if(mThreadController)
   {
     UpdateMode updateMode;
-    if( mThreadMode == ThreadMode::NORMAL )
+    if(mThreadMode == ThreadMode::NORMAL)
     {
       updateMode = UpdateMode::NORMAL;
     }
@@ -1119,7 +1097,7 @@ void Adaptor::RenderOnce()
 
       ProcessCoreEvents();
     }
-    mThreadController->RequestUpdateOnce( updateMode );
+    mThreadController->RequestUpdateOnce(updateMode);
   }
 }
 
@@ -1128,12 +1106,12 @@ const LogFactoryInterface& Adaptor::GetLogFactory()
   return *mEnvironmentOptions;
 }
 
-void Adaptor::RegisterProcessor( Integration::Processor& processor )
+void Adaptor::RegisterProcessor(Integration::Processor& processor)
 {
   GetCore().RegisterProcessor(processor);
 }
 
-void Adaptor::UnregisterProcessor( Integration::Processor& processor )
+void Adaptor::UnregisterProcessor(Integration::Processor& processor)
 {
   GetCore().UnregisterProcessor(processor);
 }
@@ -1145,9 +1123,9 @@ bool Adaptor::IsMultipleWindowSupported() const
 
 void Adaptor::RequestUpdateOnce()
 {
-  if( mThreadController )
+  if(mThreadController)
   {
-    mThreadController->RequestUpdateOnce( UpdateMode::NORMAL );
+    mThreadController->RequestUpdateOnce(UpdateMode::NORMAL);
   }
 }
 
@@ -1161,13 +1139,13 @@ bool Adaptor::ProcessCoreEventsFromIdle()
   return false;
 }
 
-Dali::Internal::Adaptor::SceneHolder* Adaptor::GetWindow( Dali::Actor& actor )
+Dali::Internal::Adaptor::SceneHolder* Adaptor::GetWindow(Dali::Actor& actor)
 {
-  Dali::Integration::Scene scene = Dali::Integration::Scene::Get( actor );
+  Dali::Integration::Scene scene = Dali::Integration::Scene::Get(actor);
 
-  for( auto window : mWindows )
+  for(auto window : mWindows)
   {
-    if ( scene == window->GetScene() )
+    if(scene == window->GetScene())
     {
       return window;
     }
@@ -1180,13 +1158,13 @@ Dali::WindowContainer Adaptor::GetWindows() const
 {
   Dali::WindowContainer windows;
 
-  for ( auto iter = mWindows.begin(); iter != mWindows.end(); ++iter )
+  for(auto iter = mWindows.begin(); iter != mWindows.end(); ++iter)
   {
     // Downcast to Dali::Window
-    Dali::Window window( dynamic_cast<Dali::Internal::Adaptor::Window*>( *iter ) );
-    if ( window )
+    Dali::Window window(dynamic_cast<Dali::Internal::Adaptor::Window*>(*iter));
+    if(window)
     {
-      windows.push_back( window );
+      windows.push_back(window);
     }
   }
 
@@ -1197,9 +1175,9 @@ Dali::SceneHolderList Adaptor::GetSceneHolders() const
 {
   Dali::SceneHolderList sceneHolderList;
 
-  for( auto iter = mWindows.begin(); iter != mWindows.end(); ++iter )
+  for(auto iter = mWindows.begin(); iter != mWindows.end(); ++iter)
   {
-    sceneHolderList.push_back( Dali::Integration::SceneHolder( *iter ) );
+    sceneHolderList.push_back(Dali::Integration::SceneHolder(*iter));
   }
 
   return sceneHolderList;
@@ -1208,71 +1186,71 @@ Dali::SceneHolderList Adaptor::GetSceneHolders() const
 Dali::ObjectRegistry Adaptor::GetObjectRegistry() const
 {
   Dali::ObjectRegistry registry;
-  if( mCore )
+  if(mCore)
   {
     registry = mCore->GetObjectRegistry();
   }
   return registry;
 }
 
-Adaptor::Adaptor(Dali::Integration::SceneHolder window, Dali::Adaptor& adaptor, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions, ThreadMode threadMode )
+Adaptor::Adaptor(Dali::Integration::SceneHolder window, Dali::Adaptor& adaptor, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions, ThreadMode threadMode)
 : mResizedSignal(),
   mLanguageChangedSignal(),
   mWindowCreatedSignal(),
-  mAdaptor( adaptor ),
-  mState( READY ),
-  mCore( nullptr ),
-  mThreadController( nullptr ),
-  mGraphics( nullptr ),
-  mDisplayConnection( nullptr ),
+  mAdaptor(adaptor),
+  mState(READY),
+  mCore(nullptr),
+  mThreadController(nullptr),
+  mGraphics(nullptr),
+  mDisplayConnection(nullptr),
   mWindows(),
-  mConfigurationManager( nullptr ),
-  mPlatformAbstraction( nullptr ),
-  mCallbackManager( nullptr ),
-  mNotificationOnIdleInstalled( false ),
-  mNotificationTrigger( nullptr ),
+  mConfigurationManager(nullptr),
+  mPlatformAbstraction(nullptr),
+  mCallbackManager(nullptr),
+  mNotificationOnIdleInstalled(false),
+  mNotificationTrigger(nullptr),
   mDaliFeedbackPlugin(),
-  mFeedbackController( nullptr ),
+  mFeedbackController(nullptr),
   mTtsPlayers(),
   mObservers(),
-  mEnvironmentOptions( environmentOptions ? environmentOptions : new EnvironmentOptions /* Create the options if not provided */),
-  mPerformanceInterface( nullptr ),
+  mEnvironmentOptions(environmentOptions ? environmentOptions : new EnvironmentOptions /* Create the options if not provided */),
+  mPerformanceInterface(nullptr),
   mKernelTracer(),
   mSystemTracer(),
-  mObjectProfiler( nullptr ),
+  mObjectProfiler(nullptr),
   mSocketFactory(),
-  mThreadMode( threadMode ),
-  mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ ),
-  mUseRemoteSurface( false ),
-  mRootLayoutDirection( Dali::LayoutDirection::LEFT_TO_RIGHT )
+  mThreadMode(threadMode),
+  mEnvironmentOptionsOwned(environmentOptions ? false : true /* If not provided then we own the object */),
+  mUseRemoteSurface(false),
+  mRootLayoutDirection(Dali::LayoutDirection::LEFT_TO_RIGHT)
 {
-  DALI_ASSERT_ALWAYS( !IsAvailable() && "Cannot create more than one Adaptor per thread" );
-  mWindows.insert( mWindows.begin(), &Dali::GetImplementation( window ) );
+  DALI_ASSERT_ALWAYS(!IsAvailable() && "Cannot create more than one Adaptor per thread");
+  mWindows.insert(mWindows.begin(), &Dali::GetImplementation(window));
 
   gThreadLocalAdaptor = this;
 }
 
-void Adaptor::SetRootLayoutDirection( std::string locale )
+void Adaptor::SetRootLayoutDirection(std::string locale)
 {
-  mRootLayoutDirection = static_cast< LayoutDirection::Type >( Internal::Adaptor::Locale::GetDirection( std::string( locale ) ) );
-  for ( auto& window : mWindows )
+  mRootLayoutDirection = static_cast<LayoutDirection::Type>(Internal::Adaptor::Locale::GetDirection(std::string(locale)));
+  for(auto& window : mWindows)
   {
     Dali::Actor root = window->GetRootLayer();
-    root.SetProperty( Dali::Actor::Property::LAYOUT_DIRECTION, mRootLayoutDirection );
+    root.SetProperty(Dali::Actor::Property::LAYOUT_DIRECTION, mRootLayoutDirection);
   }
 }
 
-bool Adaptor::AddIdleEnterer( CallbackBase* callback, bool forceAdd )
+bool Adaptor::AddIdleEnterer(CallbackBase* callback, bool forceAdd)
 {
-  bool idleAdded( false );
+  bool idleAdded(false);
 
   // Only add an idle if the Adaptor is actually running
-  if( RUNNING == mState || READY == mState || forceAdd )
+  if(RUNNING == mState || READY == mState || forceAdd)
   {
-    idleAdded = mCallbackManager->AddIdleEntererCallback( callback );
+    idleAdded = mCallbackManager->AddIdleEntererCallback(callback);
   }
 
-  if( !idleAdded )
+  if(!idleAdded)
   {
     // Delete callback
     delete callback;
@@ -1281,9 +1259,9 @@ bool Adaptor::AddIdleEnterer( CallbackBase* callback, bool forceAdd )
   return idleAdded;
 }
 
-void Adaptor::RemoveIdleEnterer( CallbackBase* callback )
+void Adaptor::RemoveIdleEnterer(CallbackBase* callback)
 {
-  mCallbackManager->RemoveIdleEntererCallback( callback );
+  mCallbackManager->RemoveIdleEntererCallback(callback);
 }
 
 } // namespace Adaptor
index 9ad4c54..61260ba 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 #include <dali/internal/adaptor/common/application-impl.h>
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/object/object-registry.h>
-#include <dali/integration-api/debug.h>
 #include <dali/devel-api/common/singleton-service.h>
+#include <dali/integration-api/debug.h>
+#include <dali/public-api/object/object-registry.h>
 
 // INTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/accessibility-impl.h>
 #include <dali/devel-api/adaptor-framework/style-monitor.h>
 #include <dali/devel-api/text-abstraction/font-client.h>
-#include <dali/devel-api/adaptor-framework/accessibility-impl.h>
 #include <dali/internal/adaptor/common/adaptor-impl.h>
-#include <dali/internal/system/common/command-line-options.h>
 #include <dali/internal/adaptor/common/framework.h>
 #include <dali/internal/adaptor/common/lifecycle-controller-impl.h>
+#include <dali/internal/system/common/command-line-options.h>
+#include <dali/internal/window-system/common/render-surface-factory.h>
 #include <dali/internal/window-system/common/window-impl.h>
 #include <dali/internal/window-system/common/window-render-surface.h>
-#include <dali/internal/window-system/common/render-surface-factory.h>
 
 // To disable a macro with the same name from one of OpenGL headers
 #undef Status
 
 namespace Dali
 {
-
 namespace TizenPlatform
 {
 class TizenPlatformAbstraction;
@@ -53,38 +52,35 @@ class Core;
 
 namespace Internal
 {
-
 namespace Adaptor
 {
-
-ApplicationPtr Application::gPreInitializedApplication( NULL );
+ApplicationPtr Application::gPreInitializedApplication(NULL);
 
 ApplicationPtr Application::New(
-  int* argc,
-  char **argv[],
-  const std::string& stylesheet,
+  int*                           argc,
+  char**                         argv[],
+  const std::string&             stylesheet,
   Dali::Application::WINDOW_MODE windowMode,
-  const PositionSize& positionSize,
-  Framework::Type applicationType)
+  const PositionSize&            positionSize,
+  Framework::Type                applicationType)
 {
-  ApplicationPtr application ( new Application (argc, argv, stylesheet, windowMode, positionSize, applicationType ) );
+  ApplicationPtr application(new Application(argc, argv, stylesheet, windowMode, positionSize, applicationType));
   return application;
 }
 
-void Application::PreInitialize( int* argc, char** argv[] )
+void Application::PreInitialize(int* argc, char** argv[])
 {
-  if( !gPreInitializedApplication )
+  if(!gPreInitializedApplication)
   {
     Dali::TextAbstraction::FontClientPreInitialize();
 
-    gPreInitializedApplication = new Application ( argc, argv, "", Dali::Application::OPAQUE, PositionSize(), Framework::NORMAL );
-    gPreInitializedApplication->CreateWindow();    // Only create window
+    gPreInitializedApplication = new Application(argc, argv, "", Dali::Application::OPAQUE, PositionSize(), Framework::NORMAL);
+    gPreInitializedApplication->CreateWindow(); // Only create window
     gPreInitializedApplication->mLaunchpadState = Launchpad::PRE_INITIALIZED;
   }
 }
 
-Application::Application( int* argc, char** argv[], const std::string& stylesheet,
-  Dali::Application::WINDOW_MODE windowMode, const PositionSize& positionSize, Framework::Type applicationType )
+Application::Application(int* argc, char** argv[], const std::string& stylesheet, Dali::Application::WINDOW_MODE windowMode, const PositionSize& positionSize, Framework::Type applicationType)
 : mInitSignal(),
   mTerminateSignal(),
   mPauseSignal(),
@@ -93,38 +89,38 @@ Application::Application( int* argc, char** argv[], const std::string& styleshee
   mAppControlSignal(),
   mLanguageChangedSignal(),
   mRegionChangedSignal(),
-  mEventLoop( nullptr ),
-  mFramework( nullptr ),
-  mCommandLineOptions( nullptr ),
-  mAdaptorBuilder( nullptr ),
-  mAdaptor( nullptr ),
+  mEventLoop(nullptr),
+  mFramework(nullptr),
+  mCommandLineOptions(nullptr),
+  mAdaptorBuilder(nullptr),
+  mAdaptor(nullptr),
   mMainWindow(),
-  mMainWindowMode( windowMode ),
+  mMainWindowMode(windowMode),
   mMainWindowName(),
-  mStylesheet( stylesheet ),
+  mStylesheet(stylesheet),
   mEnvironmentOptions(),
-  mWindowPositionSize( positionSize ),
-  mLaunchpadState( Launchpad::NONE ),
-  mSlotDelegate( this )
+  mWindowPositionSize(positionSize),
+  mLaunchpadState(Launchpad::NONE),
+  mSlotDelegate(this)
 {
   // Get mName from environment options
   mMainWindowName = mEnvironmentOptions.GetWindowName();
-  if( mMainWindowName.empty() && argc && ( *argc > 0 ) )
+  if(mMainWindowName.empty() && argc && (*argc > 0))
   {
     // Set mName from command-line args if environment option not set
     mMainWindowName = (*argv)[0];
   }
 
   mCommandLineOptions = new CommandLineOptions(argc, argv);
-  mFramework = new Framework( *this, argc, argv, applicationType );
-  mUseRemoteSurface = (applicationType == Framework::WATCH);
+  mFramework          = new Framework(*this, argc, argv, applicationType);
+  mUseRemoteSurface   = (applicationType == Framework::WATCH);
 }
 
 Application::~Application()
 {
   SingletonService service = SingletonService::Get();
   // Note this can be false i.e. if Application has never created a Core instance
-  if( service )
+  if(service)
   {
     service.UnregisterAll();
   }
@@ -138,18 +134,18 @@ Application::~Application()
 
 void Application::CreateWindow()
 {
-  if( mWindowPositionSize.width == 0 && mWindowPositionSize.height == 0 )
+  if(mWindowPositionSize.width == 0 && mWindowPositionSize.height == 0)
   {
-    if( mCommandLineOptions->stageWidth > 0 && mCommandLineOptions->stageHeight > 0 )
+    if(mCommandLineOptions->stageWidth > 0 && mCommandLineOptions->stageHeight > 0)
     {
       // Command line options override environment options and full screen
-      mWindowPositionSize.width = mCommandLineOptions->stageWidth;
+      mWindowPositionSize.width  = mCommandLineOptions->stageWidth;
       mWindowPositionSize.height = mCommandLineOptions->stageHeight;
     }
-    else if( mEnvironmentOptions.GetWindowWidth() && mEnvironmentOptions.GetWindowHeight() )
+    else if(mEnvironmentOptions.GetWindowWidth() && mEnvironmentOptions.GetWindowHeight())
     {
       // Environment options override full screen functionality if command line arguments not provided
-      mWindowPositionSize.width = mEnvironmentOptions.GetWindowWidth();
+      mWindowPositionSize.width  = mEnvironmentOptions.GetWindowWidth();
       mWindowPositionSize.height = mEnvironmentOptions.GetWindowHeight();
     }
   }
@@ -157,28 +153,28 @@ void Application::CreateWindow()
   const std::string& windowClassName = mEnvironmentOptions.GetWindowClassName();
 
   Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(mWindowPositionSize, mMainWindowName, windowClassName, mMainWindowMode == Dali::Application::TRANSPARENT);
-  mMainWindow = Dali::Window( window );
+  mMainWindow                       = Dali::Window(window);
 
   // Quit the application when the window is closed
-  GetImplementation( mMainWindow ).DeleteRequestSignal().Connect( mSlotDelegate, &Application::Quit );
+  GetImplementation(mMainWindow).DeleteRequestSignal().Connect(mSlotDelegate, &Application::Quit);
 }
 
 void Application::CreateAdaptor()
 {
-  DALI_ASSERT_ALWAYS( mMainWindow && "Window required to create adaptor" );
+  DALI_ASSERT_ALWAYS(mMainWindow && "Window required to create adaptor");
 
   auto graphicsFactory = mAdaptorBuilder->GetGraphicsFactory();
 
-  Integration::SceneHolder sceneHolder = Integration::SceneHolder( &Dali::GetImplementation( mMainWindow ) );
+  Integration::SceneHolder sceneHolder = Integration::SceneHolder(&Dali::GetImplementation(mMainWindow));
 
-  mAdaptor = Adaptor::New( graphicsFactory, sceneHolder, &mEnvironmentOptions );
+  mAdaptor = Adaptor::New(graphicsFactory, sceneHolder, &mEnvironmentOptions);
 
-  Adaptor::GetImplementation( *mAdaptor ).SetUseRemoteSurface( mUseRemoteSurface );
+  Adaptor::GetImplementation(*mAdaptor).SetUseRemoteSurface(mUseRemoteSurface);
 }
 
 void Application::CreateAdaptorBuilder()
 {
-  mAdaptorBuilder = new AdaptorBuilder();
+  mAdaptorBuilder = new AdaptorBuilder(mEnvironmentOptions);
 }
 
 void Application::MainLoop()
@@ -197,7 +193,7 @@ void Application::Quit()
 {
   // Actually quit the application.
   // Force a call to Quit even if adaptor is not running.
-  Internal::Adaptor::Adaptor::GetImplementation(*mAdaptor).AddIdle( MakeCallback( this, &Application::QuitFromMainLoop ), false, true );
+  Internal::Adaptor::Adaptor::GetImplementation(*mAdaptor).AddIdle(MakeCallback(this, &Application::QuitFromMainLoop), false, true);
 }
 
 void Application::QuitFromMainLoop()
@@ -212,11 +208,11 @@ void Application::QuitFromMainLoop()
 
 void Application::OnInit()
 {
-  mFramework->AddAbortCallback( MakeCallback( this, &Application::QuitFromMainLoop ) );
+  mFramework->AddAbortCallback(MakeCallback(this, &Application::QuitFromMainLoop));
 
   CreateAdaptorBuilder();
   // If an application was pre-initialized, a window was made in advance
-  if( mLaunchpadState == Launchpad::NONE )
+  if(mLaunchpadState == Launchpad::NONE)
   {
     CreateWindow();
   }
@@ -227,23 +223,23 @@ void Application::OnInit()
   mAdaptor->Start();
   Accessibility::Accessible::SetObjectRegistry(mAdaptor->GetObjectRegistry());
 
-  if( ! mStylesheet.empty() )
+  if(!mStylesheet.empty())
   {
-    Dali::StyleMonitor::Get().SetTheme( mStylesheet );
+    Dali::StyleMonitor::Get().SetTheme(mStylesheet);
   }
 
   // Wire up the LifecycleController
   Dali::LifecycleController lifecycleController = Dali::LifecycleController::Get();
 
-  InitSignal().Connect( &GetImplementation( lifecycleController ), &LifecycleController::OnInit );
-  TerminateSignal().Connect( &GetImplementation( lifecycleController ), &LifecycleController::OnTerminate );
-  PauseSignal().Connect( &GetImplementation( lifecycleController ), &LifecycleController::OnPause );
-  ResumeSignal().Connect( &GetImplementation( lifecycleController ), &LifecycleController::OnResume );
-  ResetSignal().Connect( &GetImplementation( lifecycleController ), &LifecycleController::OnReset );
-  LanguageChangedSignal().Connect( &GetImplementation( lifecycleController ), &LifecycleController::OnLanguageChanged );
+  InitSignal().Connect(&GetImplementation(lifecycleController), &LifecycleController::OnInit);
+  TerminateSignal().Connect(&GetImplementation(lifecycleController), &LifecycleController::OnTerminate);
+  PauseSignal().Connect(&GetImplementation(lifecycleController), &LifecycleController::OnPause);
+  ResumeSignal().Connect(&GetImplementation(lifecycleController), &LifecycleController::OnResume);
+  ResetSignal().Connect(&GetImplementation(lifecycleController), &LifecycleController::OnReset);
+  LanguageChangedSignal().Connect(&GetImplementation(lifecycleController), &LifecycleController::OnLanguageChanged);
 
   Dali::Application application(this);
-  mInitSignal.Emit( application );
+  mInitSignal.Emit(application);
 
   mAdaptor->NotifySceneCreated();
 }
@@ -254,9 +250,9 @@ void Application::OnTerminate()
   // delete the window as ecore_x has been destroyed by AppCore
 
   Dali::Application application(this);
-  mTerminateSignal.Emit( application );
+  mTerminateSignal.Emit(application);
 
-  if( mAdaptor )
+  if(mAdaptor)
   {
     // Ensure that the render-thread is not using the surface(window) after we delete it
     mAdaptor->Stop();
@@ -271,7 +267,7 @@ void Application::OnPause()
   // DALi just delivers the framework Pause event to the application, but not actually pause DALi core.
   // Pausing DALi core only occurs on the Window Hidden framework event
   Dali::Application application(this);
-  mPauseSignal.Emit( application );
+  mPauseSignal.Emit(application);
 }
 
 void Application::OnResume()
@@ -279,13 +275,13 @@ void Application::OnResume()
   // Emit the signal first so the application can queue any messages before we do an update/render
   // This ensures we do not just redraw the last frame before pausing if that's not required
   Dali::Application application(this);
-  mResumeSignal.Emit( application );
+  mResumeSignal.Emit(application);
 
   // DALi just delivers the framework Resume event to the application.
   // Resuming DALi core only occurs on the Window Show framework event
 
   // Trigger processing of events queued up while paused
-  CoreEventInterface& coreEventInterface = Internal::Adaptor::Adaptor::GetImplementation( GetAdaptor() );
+  CoreEventInterface& coreEventInterface = Internal::Adaptor::Adaptor::GetImplementation(GetAdaptor());
   coreEventInterface.ProcessCoreEvents();
 }
 
@@ -296,61 +292,60 @@ void Application::OnReset()
    * because Application class already handled initialization in OnInit(), OnReset do nothing.
    */
   Dali::Application application(this);
-  mResetSignal.Emit( application );
+  mResetSignal.Emit(application);
 }
 
-void Application::OnAppControl(void *data)
+void Application::OnAppControl(voiddata)
 {
   Dali::Application application(this);
-  mAppControlSignal.Emit( application , data );
+  mAppControlSignal.Emit(application, data);
 }
 
 void Application::OnLanguageChanged()
 {
   mAdaptor->NotifyLanguageChanged();
   Dali::Application application(this);
-  mLanguageChangedSignal.Emit( application );
+  mLanguageChangedSignal.Emit(application);
 }
 
 void Application::OnRegionChanged()
 {
   Dali::Application application(this);
-  mRegionChangedSignal.Emit( application );
+  mRegionChangedSignal.Emit(application);
 }
 
-void Application::OnBatteryLow( Dali::DeviceStatus::Battery::Status status )
+void Application::OnBatteryLow(Dali::DeviceStatus::Battery::Status status)
 {
   Dali::Application application(this);
-  mLowBatterySignal.Emit( status );
+  mLowBatterySignal.Emit(status);
 }
 
-void Application::OnMemoryLow( Dali::DeviceStatus::Memory::Status status )
+void Application::OnMemoryLow(Dali::DeviceStatus::Memory::Status status)
 {
   Dali::Application application(this);
-  mLowMemorySignal.Emit( status );
+  mLowMemorySignal.Emit(status);
 }
 
-void Application::OnSurfaceCreated( Any newSurface )
+void Application::OnSurfaceCreated(Any newSurface)
 {
-  void* newWindow = AnyCast< void* >( newSurface );
-  void* oldWindow = AnyCast< void* >( mMainWindow.GetNativeHandle() );
-  if( oldWindow != newWindow )
+  void* newWindow = AnyCast<void*>(newSurface);
+  void* oldWindow = AnyCast<void*>(mMainWindow.GetNativeHandle());
+  if(oldWindow != newWindow)
   {
-    auto renderSurfaceFactory = Dali::Internal::Adaptor::GetRenderSurfaceFactory();
-    std::unique_ptr< WindowRenderSurface > newSurfacePtr
-      = renderSurfaceFactory->CreateWindowRenderSurface( PositionSize(), newSurface, true );
+    auto                                 renderSurfaceFactory = Dali::Internal::Adaptor::GetRenderSurfaceFactory();
+    std::unique_ptr<WindowRenderSurface> newSurfacePtr        = renderSurfaceFactory->CreateWindowRenderSurface(PositionSize(), newSurface, true);
 
-    mAdaptor->ReplaceSurface( mMainWindow, *newSurfacePtr.release() );
+    mAdaptor->ReplaceSurface(mMainWindow, *newSurfacePtr.release());
   }
 }
 
-void Application::OnSurfaceDestroyed( Any surface )
+void Application::OnSurfaceDestroyed(Any surface)
 {
 }
 
-bool Application::AddIdle( CallbackBase* callback, bool hasReturnValue )
+bool Application::AddIdle(CallbackBase* callback, bool hasReturnValue)
 {
-  return mAdaptor->AddIdle( callback, hasReturnValue );
+  return mAdaptor->AddIdle(callback, hasReturnValue);
 }
 
 std::string Application::GetRegion() const
@@ -366,7 +361,7 @@ std::string Application::GetLanguage() const
 Dali::ObjectRegistry Application::GetObjectRegistry() const
 {
   Dali::ObjectRegistry objectRegistry;
-  if( mAdaptor )
+  if(mAdaptor)
   {
     objectRegistry = mAdaptor->GetObjectRegistry();
   }
@@ -393,18 +388,18 @@ std::string Application::GetDataPath()
   return Internal::Adaptor::Framework::GetDataPath();
 }
 
-void Application::SetStyleSheet( const std::string& stylesheet )
+void Application::SetStyleSheet(const std::string& stylesheet)
 {
   mStylesheet = stylesheet;
 }
 
-void Application::SetCommandLineOptions( int* argc, char **argv[] )
+void Application::SetCommandLineOptions(int* argc, char** argv[])
 {
   delete mCommandLineOptions;
 
-  mCommandLineOptions = new CommandLineOptions( argc, argv );
+  mCommandLineOptions = new CommandLineOptions(argc, argv);
 
-  mFramework->SetCommandLineOptions( argc, argv );
+  mFramework->SetCommandLineOptions(argc, argv);
 }
 
 ApplicationPtr Application::GetPreInitializedApplication()
index 1b9e11f..2076d17 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 #include <dali/internal/adaptor/common/combined-update-render-controller.h>
 
 // EXTERNAL INCLUDES
-#include <errno.h>
 #include <dali/integration-api/platform-abstraction.h>
+#include <errno.h>
 #include <unistd.h>
 #include "dali/public-api/common/dali-common.h"
 
 // INTERNAL INCLUDES
-#include <dali/integration-api/adaptor-framework/trigger-event-factory.h>
 #include <dali/devel-api/adaptor-framework/thread-settings.h>
+#include <dali/integration-api/adaptor-framework/trigger-event-factory.h>
 #include <dali/internal/adaptor/common/adaptor-internal-services.h>
 #include <dali/internal/adaptor/common/combined-update-render-controller-debug.h>
+#include <dali/internal/graphics/common/graphics-interface.h>
 #include <dali/internal/graphics/gles/egl-graphics.h>
 #include <dali/internal/graphics/gles/egl-implementation.h>
-#include <dali/internal/graphics/common/graphics-interface.h>
 #include <dali/internal/system/common/environment-options.h>
 #include <dali/internal/system/common/time-service.h>
 #include <dali/internal/window-system/common/window-impl.h>
 
 namespace Dali
 {
-
 namespace Internal
 {
-
 namespace Adaptor
 {
-
 namespace
 {
-
 const unsigned int CREATED_THREAD_COUNT = 1u;
 
 const int CONTINUOUS = -1;
-const int ONCE = 1;
+const int ONCE       = 1;
 
-const unsigned int TRUE = 1u;
+const unsigned int TRUE  = 1u;
 const unsigned int FALSE = 0u;
 
-const unsigned int MILLISECONDS_PER_SECOND( 1e+3 );
-const float        NANOSECONDS_TO_SECOND( 1e-9f );
-const unsigned int NANOSECONDS_PER_SECOND( 1e+9 );
-const unsigned int NANOSECONDS_PER_MILLISECOND( 1e+6 );
+const unsigned int MILLISECONDS_PER_SECOND(1e+3);
+const float        NANOSECONDS_TO_SECOND(1e-9f);
+const unsigned int NANOSECONDS_PER_SECOND(1e+9);
+const unsigned int NANOSECONDS_PER_MILLISECOND(1e+6);
 
 // The following values will get calculated at compile time
-const float        DEFAULT_FRAME_DURATION_IN_SECONDS( 1.0f / 60.0f );
-const uint64_t DEFAULT_FRAME_DURATION_IN_MILLISECONDS( DEFAULT_FRAME_DURATION_IN_SECONDS * MILLISECONDS_PER_SECOND );
-const uint64_t DEFAULT_FRAME_DURATION_IN_NANOSECONDS( DEFAULT_FRAME_DURATION_IN_SECONDS * NANOSECONDS_PER_SECOND );
+const float    DEFAULT_FRAME_DURATION_IN_SECONDS(1.0f / 60.0f);
+const uint64_t DEFAULT_FRAME_DURATION_IN_MILLISECONDS(DEFAULT_FRAME_DURATION_IN_SECONDS* MILLISECONDS_PER_SECOND);
+const uint64_t DEFAULT_FRAME_DURATION_IN_NANOSECONDS(DEFAULT_FRAME_DURATION_IN_SECONDS* NANOSECONDS_PER_SECOND);
 
 /**
  * Handles the use case when an update-request is received JUST before we process a sleep-request. If we did not have an update-request count then
@@ -90,53 +86,53 @@ const unsigned int MAXIMUM_UPDATE_REQUESTS = 2;
 // EVENT THREAD
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-CombinedUpdateRenderController::CombinedUpdateRenderController( AdaptorInternalServices& adaptorInterfaces, const EnvironmentOptions& environmentOptions, ThreadMode threadMode )
-: mFpsTracker( environmentOptions ),
-  mUpdateStatusLogger( environmentOptions ),
+CombinedUpdateRenderController::CombinedUpdateRenderController(AdaptorInternalServices& adaptorInterfaces, const EnvironmentOptions& environmentOptions, ThreadMode threadMode)
+: mFpsTracker(environmentOptions),
+  mUpdateStatusLogger(environmentOptions),
   mEventThreadSemaphore(0),
   mSurfaceSemaphore(0),
   mUpdateRenderThreadWaitCondition(),
-  mAdaptorInterfaces( adaptorInterfaces ),
-  mPerformanceInterface( adaptorInterfaces.GetPerformanceInterface() ),
-  mCore( adaptorInterfaces.GetCore() ),
-  mEnvironmentOptions( environmentOptions ),
-  mNotificationTrigger( adaptorInterfaces.GetProcessCoreEventsTrigger() ),
-  mSleepTrigger( NULL ),
-  mPreRenderCallback( NULL ),
-  mUpdateRenderThread( NULL ),
-  mDefaultFrameDelta( 0.0f ),
-  mDefaultFrameDurationMilliseconds( 0u ),
-  mDefaultFrameDurationNanoseconds( 0u ),
-  mDefaultHalfFrameNanoseconds( 0u ),
-  mUpdateRequestCount( 0u ),
-  mRunning( FALSE ),
-  mThreadMode( threadMode ),
-  mUpdateRenderRunCount( 0 ),
-  mDestroyUpdateRenderThread( FALSE ),
-  mUpdateRenderThreadCanSleep( FALSE ),
-  mPendingRequestUpdate( FALSE ),
-  mUseElapsedTimeAfterWait( FALSE ),
-  mNewSurface( NULL ),
-  mDeletedSurface( nullptr ),
-  mPostRendering( FALSE ),
-  mSurfaceResized( FALSE ),
-  mForceClear( FALSE ),
-  mUploadWithoutRendering( FALSE ),
-  mFirstFrameAfterResume( FALSE )
+  mAdaptorInterfaces(adaptorInterfaces),
+  mPerformanceInterface(adaptorInterfaces.GetPerformanceInterface()),
+  mCore(adaptorInterfaces.GetCore()),
+  mEnvironmentOptions(environmentOptions),
+  mNotificationTrigger(adaptorInterfaces.GetProcessCoreEventsTrigger()),
+  mSleepTrigger(NULL),
+  mPreRenderCallback(NULL),
+  mUpdateRenderThread(NULL),
+  mDefaultFrameDelta(0.0f),
+  mDefaultFrameDurationMilliseconds(0u),
+  mDefaultFrameDurationNanoseconds(0u),
+  mDefaultHalfFrameNanoseconds(0u),
+  mUpdateRequestCount(0u),
+  mRunning(FALSE),
+  mThreadMode(threadMode),
+  mUpdateRenderRunCount(0),
+  mDestroyUpdateRenderThread(FALSE),
+  mUpdateRenderThreadCanSleep(FALSE),
+  mPendingRequestUpdate(FALSE),
+  mUseElapsedTimeAfterWait(FALSE),
+  mNewSurface(NULL),
+  mDeletedSurface(nullptr),
+  mPostRendering(FALSE),
+  mSurfaceResized(FALSE),
+  mForceClear(FALSE),
+  mUploadWithoutRendering(FALSE),
+  mFirstFrameAfterResume(FALSE)
 {
   LOG_EVENT_TRACE;
 
   // Initialise frame delta/duration variables first
-  SetRenderRefreshRate( environmentOptions.GetRenderRefreshRate() );
+  SetRenderRefreshRate(environmentOptions.GetRenderRefreshRate());
 
   // Set the thread-synchronization interface on the render-surface
   Dali::RenderSurfaceInterface* currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface();
-  if( currentSurface )
+  if(currentSurface)
   {
-    currentSurface->SetThreadSynchronization( *this );
+    currentSurface->SetThreadSynchronization(*this);
   }
 
-  mSleepTrigger = TriggerEventFactory::CreateTriggerEvent( MakeCallback( this, &CombinedUpdateRenderController::ProcessSleepRequest ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER );
+  mSleepTrigger = TriggerEventFactory::CreateTriggerEvent(MakeCallback(this, &CombinedUpdateRenderController::ProcessSleepRequest), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER);
 }
 
 CombinedUpdateRenderController::~CombinedUpdateRenderController()
@@ -154,13 +150,13 @@ void CombinedUpdateRenderController::Initialize()
   LOG_EVENT_TRACE;
 
   // Ensure Update/Render Thread not already created
-  DALI_ASSERT_ALWAYS( ! mUpdateRenderThread );
+  DALI_ASSERT_ALWAYS(!mUpdateRenderThread);
 
   // Create Update/Render Thread
   ConditionalWait::ScopedLock lock(mGraphicsInitializeWait);
   mUpdateRenderThread = new pthread_t();
-  int error = pthread_create( mUpdateRenderThread, NULL, InternalUpdateRenderThreadEntryFunc, this );
-  DALI_ASSERT_ALWAYS( !error && "Return code from pthread_create() when creating UpdateRenderThread" );
+  int error           = pthread_create(mUpdateRenderThread, NULL, InternalUpdateRenderThreadEntryFunc, this);
+  DALI_ASSERT_ALWAYS(!error && "Return code from pthread_create() when creating UpdateRenderThread");
 
   // The Update/Render thread will now run and initialise the graphics interface etc. and will then wait for Start to be called
   // When this function returns, the application initialisation on the event thread should occur
@@ -170,27 +166,27 @@ void CombinedUpdateRenderController::Start()
 {
   LOG_EVENT_TRACE;
 
-  DALI_ASSERT_ALWAYS( !mRunning && mUpdateRenderThread );
+  DALI_ASSERT_ALWAYS(!mRunning && mUpdateRenderThread);
 
   // Wait until all threads created in Initialise are up and running
-  for( unsigned int i = 0; i < CREATED_THREAD_COUNT; ++i )
+  for(unsigned int i = 0; i < CREATED_THREAD_COUNT; ++i)
   {
     mEventThreadSemaphore.Acquire();
   }
 
   mRunning = TRUE;
 
-  LOG_EVENT( "Startup Complete, starting Update/Render Thread" );
+  LOG_EVENT("Startup Complete, starting Update/Render Thread");
 
-  RunUpdateRenderThread( CONTINUOUS, AnimationProgression::NONE, UpdateMode::NORMAL );
+  RunUpdateRenderThread(CONTINUOUS, AnimationProgression::NONE, UpdateMode::NORMAL);
 
   Dali::RenderSurfaceInterface* currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface();
-  if( currentSurface )
+  if(currentSurface)
   {
     currentSurface->StartRender();
   }
 
-  DALI_LOG_RELEASE_INFO( "CombinedUpdateRenderController::Start\n" );
+  DALI_LOG_RELEASE_INFO("CombinedUpdateRenderController::Start\n");
 }
 
 void CombinedUpdateRenderController::Pause()
@@ -201,32 +197,32 @@ void CombinedUpdateRenderController::Pause()
 
   PauseUpdateRenderThread();
 
-  AddPerformanceMarker( PerformanceInterface::PAUSED );
+  AddPerformanceMarker(PerformanceInterface::PAUSED);
 
-  DALI_LOG_RELEASE_INFO( "CombinedUpdateRenderController::Pause\n" );
+  DALI_LOG_RELEASE_INFO("CombinedUpdateRenderController::Pause\n");
 }
 
 void CombinedUpdateRenderController::Resume()
 {
   LOG_EVENT_TRACE;
 
-  if( !mRunning && IsUpdateRenderThreadPaused() )
+  if(!mRunning && IsUpdateRenderThreadPaused())
   {
-    LOG_EVENT( "Resuming" );
+    LOG_EVENT("Resuming");
 
-    RunUpdateRenderThread( CONTINUOUS, AnimationProgression::USE_ELAPSED_TIME, UpdateMode::NORMAL );
+    RunUpdateRenderThread(CONTINUOUS, AnimationProgression::USE_ELAPSED_TIME, UpdateMode::NORMAL);
 
-    AddPerformanceMarker( PerformanceInterface::RESUME );
+    AddPerformanceMarker(PerformanceInterface::RESUME);
 
-    mRunning = TRUE;
-    mForceClear = TRUE;
+    mRunning               = TRUE;
+    mForceClear            = TRUE;
     mFirstFrameAfterResume = TRUE;
 
-    DALI_LOG_RELEASE_INFO( "CombinedUpdateRenderController::Resume\n" );
+    DALI_LOG_RELEASE_INFO("CombinedUpdateRenderController::Resume\n");
   }
   else
   {
-    DALI_LOG_RELEASE_INFO( "CombinedUpdateRenderController::Resume: Already resumed [%d, %d, %d]\n", mRunning, mUpdateRenderRunCount, mUpdateRenderThreadCanSleep );
+    DALI_LOG_RELEASE_INFO("CombinedUpdateRenderController::Resume: Already resumed [%d, %d, %d]\n", mRunning, mUpdateRenderRunCount, mUpdateRenderThreadCanSleep);
   }
 }
 
@@ -236,19 +232,19 @@ void CombinedUpdateRenderController::Stop()
 
   // Stop Rendering and the Update/Render Thread
   Dali::RenderSurfaceInterface* currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface();
-  if( currentSurface )
+  if(currentSurface)
   {
     currentSurface->StopRender();
   }
 
   StopUpdateRenderThread();
 
-  if( mUpdateRenderThread )
+  if(mUpdateRenderThread)
   {
-    LOG_EVENT( "Destroying UpdateRenderThread" );
+    LOG_EVENT("Destroying UpdateRenderThread");
 
     // wait for the thread to finish
-    pthread_join( *mUpdateRenderThread, NULL );
+    pthread_join(*mUpdateRenderThread, NULL);
 
     delete mUpdateRenderThread;
     mUpdateRenderThread = NULL;
@@ -256,7 +252,7 @@ void CombinedUpdateRenderController::Stop()
 
   mRunning = FALSE;
 
-  DALI_LOG_RELEASE_INFO( "CombinedUpdateRenderController::Stop\n" );
+  DALI_LOG_RELEASE_INFO("CombinedUpdateRenderController::Stop\n");
 }
 
 void CombinedUpdateRenderController::RequestUpdate()
@@ -264,85 +260,85 @@ void CombinedUpdateRenderController::RequestUpdate()
   LOG_EVENT_TRACE;
 
   // Increment the update-request count to the maximum
-  if( mUpdateRequestCount < MAXIMUM_UPDATE_REQUESTS )
+  if(mUpdateRequestCount < MAXIMUM_UPDATE_REQUESTS)
   {
     ++mUpdateRequestCount;
   }
 
-  if( mRunning && IsUpdateRenderThreadPaused() )
+  if(mRunning && IsUpdateRenderThreadPaused())
   {
-    LOG_EVENT( "Processing" );
+    LOG_EVENT("Processing");
 
-    RunUpdateRenderThread( CONTINUOUS, AnimationProgression::NONE, UpdateMode::NORMAL );
+    RunUpdateRenderThread(CONTINUOUS, AnimationProgression::NONE, UpdateMode::NORMAL);
   }
 
-  ConditionalWait::ScopedLock updateLock( mUpdateRenderThreadWaitCondition );
+  ConditionalWait::ScopedLock updateLock(mUpdateRenderThreadWaitCondition);
   mPendingRequestUpdate = TRUE;
 }
 
-void CombinedUpdateRenderController::RequestUpdateOnce( UpdateMode updateMode )
+void CombinedUpdateRenderController::RequestUpdateOnce(UpdateMode updateMode)
 {
   // Increment the update-request count to the maximum
-  if( mUpdateRequestCount < MAXIMUM_UPDATE_REQUESTS )
+  if(mUpdateRequestCount < MAXIMUM_UPDATE_REQUESTS)
   {
     ++mUpdateRequestCount;
   }
 
-  if( IsUpdateRenderThreadPaused() || updateMode == UpdateMode::FORCE_RENDER )
+  if(IsUpdateRenderThreadPaused() || updateMode == UpdateMode::FORCE_RENDER)
   {
     LOG_EVENT_TRACE;
 
     // Run Update/Render once
-    RunUpdateRenderThread( ONCE, AnimationProgression::NONE, updateMode );
+    RunUpdateRenderThread(ONCE, AnimationProgression::NONE, updateMode);
   }
 }
 
-void CombinedUpdateRenderController::ReplaceSurface( Dali::RenderSurfaceInterface* newSurface )
+void CombinedUpdateRenderController::ReplaceSurface(Dali::RenderSurfaceInterface* newSurface)
 {
   LOG_EVENT_TRACE;
 
-  if( mUpdateRenderThread )
+  if(mUpdateRenderThread)
   {
     // Set the ThreadSyncronizationInterface on the new surface
-    newSurface->SetThreadSynchronization( *this );
+    newSurface->SetThreadSynchronization(*this);
 
-    LOG_EVENT( "Starting to replace the surface, event-thread blocked" );
+    LOG_EVENT("Starting to replace the surface, event-thread blocked");
 
     // Start replacing the surface.
     {
-      ConditionalWait::ScopedLock lock( mUpdateRenderThreadWaitCondition );
+      ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
       mPostRendering = FALSE; // Clear the post-rendering flag as Update/Render thread will replace the surface now
-      mNewSurface = newSurface;
-      mUpdateRenderThreadWaitCondition.Notify( lock );
+      mNewSurface    = newSurface;
+      mUpdateRenderThreadWaitCondition.Notify(lock);
     }
 
     // Wait until the surface has been replaced
     mSurfaceSemaphore.Acquire();
 
-    LOG_EVENT( "Surface replaced, event-thread continuing" );
+    LOG_EVENT("Surface replaced, event-thread continuing");
   }
 }
 
-void CombinedUpdateRenderController::DeleteSurface( Dali::RenderSurfaceInterface* surface )
+void CombinedUpdateRenderController::DeleteSurface(Dali::RenderSurfaceInterface* surface)
 {
   LOG_EVENT_TRACE;
 
-  if( mUpdateRenderThread )
+  if(mUpdateRenderThread)
   {
-    LOG_EVENT( "Starting to delete the surface, event-thread blocked" );
+    LOG_EVENT("Starting to delete the surface, event-thread blocked");
 
     // Start replacing the surface.
     {
-      ConditionalWait::ScopedLock lock( mUpdateRenderThreadWaitCondition );
-      mPostRendering = FALSE; // Clear the post-rendering flag as Update/Render thread will delete the surface now
+      ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
+      mPostRendering  = FALSE; // Clear the post-rendering flag as Update/Render thread will delete the surface now
       mDeletedSurface = surface;
-      mUpdateRenderThreadWaitCondition.Notify( lock );
+      mUpdateRenderThreadWaitCondition.Notify(lock);
     }
 
     // Wait until the surface has been deleted
     mSurfaceSemaphore.Acquire();
 
-    LOG_EVENT( "Surface deleted, event-thread continuing" );
+    LOG_EVENT("Surface deleted, event-thread continuing");
   }
 }
 
@@ -351,14 +347,14 @@ void CombinedUpdateRenderController::WaitForGraphicsInitialization()
   ConditionalWait::ScopedLock lk(mGraphicsInitializeWait);
   LOG_EVENT_TRACE;
 
-  if( mUpdateRenderThread )
+  if(mUpdateRenderThread)
   {
-    LOG_EVENT( "Waiting for graphics initialisation, event-thread blocked" );
+    LOG_EVENT("Waiting for graphics initialisation, event-thread blocked");
 
     // Wait until the graphics has been initialised
     mGraphicsInitializeWait.Wait(lk);
 
-    LOG_EVENT( "graphics initialised, event-thread continuing" );
+    LOG_EVENT("graphics initialised, event-thread continuing");
   }
 }
 
@@ -366,48 +362,48 @@ void CombinedUpdateRenderController::ResizeSurface()
 {
   LOG_EVENT_TRACE;
 
-  LOG_EVENT( "Resize the surface" );
+  LOG_EVENT("Resize the surface");
 
   {
-    ConditionalWait::ScopedLock lock( mUpdateRenderThreadWaitCondition );
-    mPostRendering = FALSE; // Clear the post-rendering flag as Update/Render thread will resize the surface now
+    ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
+    mPostRendering  = FALSE; // Clear the post-rendering flag as Update/Render thread will resize the surface now
     mSurfaceResized = TRUE;
-    mUpdateRenderThreadWaitCondition.Notify( lock );
+    mUpdateRenderThreadWaitCondition.Notify(lock);
   }
 }
 
-void CombinedUpdateRenderController::SetRenderRefreshRate( unsigned int numberOfFramesPerRender )
+void CombinedUpdateRenderController::SetRenderRefreshRate(unsigned int numberOfFramesPerRender)
 {
   // Not protected by lock, but written to rarely so not worth adding a lock when reading
-  mDefaultFrameDelta                  = numberOfFramesPerRender * DEFAULT_FRAME_DURATION_IN_SECONDS;
-  mDefaultFrameDurationMilliseconds   = uint64_t( numberOfFramesPerRender ) * DEFAULT_FRAME_DURATION_IN_MILLISECONDS;
-  mDefaultFrameDurationNanoseconds    = uint64_t( numberOfFramesPerRender ) * DEFAULT_FRAME_DURATION_IN_NANOSECONDS;
-  mDefaultHalfFrameNanoseconds        = mDefaultFrameDurationNanoseconds / 2u;
+  mDefaultFrameDelta                = numberOfFramesPerRender * DEFAULT_FRAME_DURATION_IN_SECONDS;
+  mDefaultFrameDurationMilliseconds = uint64_t(numberOfFramesPerRender) * DEFAULT_FRAME_DURATION_IN_MILLISECONDS;
+  mDefaultFrameDurationNanoseconds  = uint64_t(numberOfFramesPerRender) * DEFAULT_FRAME_DURATION_IN_NANOSECONDS;
+  mDefaultHalfFrameNanoseconds      = mDefaultFrameDurationNanoseconds / 2u;
 
-  LOG_EVENT( "mDefaultFrameDelta(%.6f), mDefaultFrameDurationMilliseconds(%lld), mDefaultFrameDurationNanoseconds(%lld)", mDefaultFrameDelta, mDefaultFrameDurationMilliseconds, mDefaultFrameDurationNanoseconds );
+  LOG_EVENT("mDefaultFrameDelta(%.6f), mDefaultFrameDurationMilliseconds(%lld), mDefaultFrameDurationNanoseconds(%lld)", mDefaultFrameDelta, mDefaultFrameDurationMilliseconds, mDefaultFrameDurationNanoseconds);
 }
 
-void CombinedUpdateRenderController::SetPreRenderCallback( CallbackBase* callback )
+void CombinedUpdateRenderController::SetPreRenderCallback(CallbackBase* callback)
 {
   LOG_EVENT_TRACE;
-  LOG_EVENT( "Set PreRender Callback" );
+  LOG_EVENT("Set PreRender Callback");
 
-  ConditionalWait::ScopedLock updateLock( mUpdateRenderThreadWaitCondition );
-  if( mPreRenderCallback )
+  ConditionalWait::ScopedLock updateLock(mUpdateRenderThreadWaitCondition);
+  if(mPreRenderCallback)
   {
     delete mPreRenderCallback;
   }
   mPreRenderCallback = callback;
 }
 
-void CombinedUpdateRenderController::AddSurface( Dali::RenderSurfaceInterface* surface )
+void CombinedUpdateRenderController::AddSurface(Dali::RenderSurfaceInterface* surface)
 {
   LOG_EVENT_TRACE;
-  LOG_EVENT( "Surface is added" );
-  if( mUpdateRenderThread )
+  LOG_EVENT("Surface is added");
+  if(mUpdateRenderThread)
   {
     // Set the ThreadSyncronizationInterface on the added surface
-    surface->SetThreadSynchronization( *this );
+    surface->SetThreadSynchronization(*this);
   }
 }
 
@@ -415,63 +411,63 @@ void CombinedUpdateRenderController::AddSurface( Dali::RenderSurfaceInterface* s
 // EVENT THREAD
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-void CombinedUpdateRenderController::RunUpdateRenderThread( int numberOfCycles, AnimationProgression animationProgression, UpdateMode updateMode )
+void CombinedUpdateRenderController::RunUpdateRenderThread(int numberOfCycles, AnimationProgression animationProgression, UpdateMode updateMode)
 {
-  ConditionalWait::ScopedLock lock( mUpdateRenderThreadWaitCondition );
+  ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
 
-  switch( mThreadMode )
+  switch(mThreadMode)
   {
     case ThreadMode::NORMAL:
     {
-      mUpdateRenderRunCount = numberOfCycles;
-      mUseElapsedTimeAfterWait = ( animationProgression == AnimationProgression::USE_ELAPSED_TIME );
+      mUpdateRenderRunCount    = numberOfCycles;
+      mUseElapsedTimeAfterWait = (animationProgression == AnimationProgression::USE_ELAPSED_TIME);
       break;
     }
     case ThreadMode::RUN_IF_REQUESTED:
     {
-      if( updateMode != UpdateMode::FORCE_RENDER )
+      if(updateMode != UpdateMode::FORCE_RENDER)
       {
         // Render only if the update mode is FORCE_RENDER which means the application requests it.
         // We don't want to awake the update thread.
         return;
       }
 
-      mUpdateRenderRunCount++;          // Increase the update request count
-      mUseElapsedTimeAfterWait = TRUE;  // The elapsed time should be used. We want animations to proceed.
+      mUpdateRenderRunCount++;         // Increase the update request count
+      mUseElapsedTimeAfterWait = TRUE; // The elapsed time should be used. We want animations to proceed.
       break;
     }
   }
 
   mUpdateRenderThreadCanSleep = FALSE;
-  mUploadWithoutRendering = ( updateMode == UpdateMode::SKIP_RENDER );
-  LOG_COUNTER_EVENT( "mUpdateRenderRunCount: %d, mUseElapsedTimeAfterWait: %d", mUpdateRenderRunCount, mUseElapsedTimeAfterWait );
-  mUpdateRenderThreadWaitCondition.Notify( lock );
+  mUploadWithoutRendering     = (updateMode == UpdateMode::SKIP_RENDER);
+  LOG_COUNTER_EVENT("mUpdateRenderRunCount: %d, mUseElapsedTimeAfterWait: %d", mUpdateRenderRunCount, mUseElapsedTimeAfterWait);
+  mUpdateRenderThreadWaitCondition.Notify(lock);
 }
 
 void CombinedUpdateRenderController::PauseUpdateRenderThread()
 {
-  ConditionalWait::ScopedLock lock( mUpdateRenderThreadWaitCondition );
+  ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
   mUpdateRenderRunCount = 0;
 }
 
 void CombinedUpdateRenderController::StopUpdateRenderThread()
 {
-  ConditionalWait::ScopedLock lock( mUpdateRenderThreadWaitCondition );
+  ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
   mDestroyUpdateRenderThread = TRUE;
-  mUpdateRenderThreadWaitCondition.Notify( lock );
+  mUpdateRenderThreadWaitCondition.Notify(lock);
 }
 
 bool CombinedUpdateRenderController::IsUpdateRenderThreadPaused()
 {
-  ConditionalWait::ScopedLock lock( mUpdateRenderThreadWaitCondition );
+  ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
 
-  if( mThreadMode == ThreadMode::RUN_IF_REQUESTED )
+  if(mThreadMode == ThreadMode::RUN_IF_REQUESTED)
   {
     return !mRunning || mUpdateRenderThreadCanSleep;
   }
 
-  return ( mUpdateRenderRunCount != CONTINUOUS ) || // Report paused if NOT continuously running
-         mUpdateRenderThreadCanSleep;               // Report paused if sleeping
+  return (mUpdateRenderRunCount != CONTINUOUS) || // Report paused if NOT continuously running
+         mUpdateRenderThreadCanSleep;             // Report paused if sleeping
 }
 
 void CombinedUpdateRenderController::ProcessSleepRequest()
@@ -479,18 +475,18 @@ void CombinedUpdateRenderController::ProcessSleepRequest()
   LOG_EVENT_TRACE;
 
   // Decrement Update request count
-  if( mUpdateRequestCount > 0 )
+  if(mUpdateRequestCount > 0)
   {
     --mUpdateRequestCount;
   }
 
   // Can sleep if our update-request count is 0
   // Update/Render thread can choose to carry on updating if it determines more update/renders are required
-  if( mUpdateRequestCount == 0 )
+  if(mUpdateRequestCount == 0)
   {
-    LOG_EVENT( "Going to sleep" );
+    LOG_EVENT("Going to sleep");
 
-    ConditionalWait::ScopedLock lock( mUpdateRenderThreadWaitCondition );
+    ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
     mUpdateRenderThreadCanSleep = TRUE;
   }
 }
@@ -509,58 +505,19 @@ void CombinedUpdateRenderController::UpdateRenderThread()
   // Install a function for tracing
   mEnvironmentOptions.InstallTraceFunction();
 
-  LOG_UPDATE_RENDER( "THREAD CREATED" );
-
-  // Initialize EGL & OpenGL
-  Dali::DisplayConnection& displayConnection = mAdaptorInterfaces.GetDisplayConnectionInterface();
-  displayConnection.Initialize();
-
-  // EGL has been initialised at this point
-  NotifyGraphicsInitialised();
-
-  RenderSurfaceInterface* currentSurface = nullptr;
+  LOG_UPDATE_RENDER("THREAD CREATED");
 
+  // Initialize graphics
   GraphicsInterface& graphics = mAdaptorInterfaces.GetGraphicsInterface();
-  EglGraphics* eglGraphics = static_cast<EglGraphics *>(&graphics);
-
-  // This will only be created once
-  EglInterface* eglInterface = &eglGraphics->GetEglInterface();
+  graphics.Initialize();
 
-  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( *eglInterface );
-
-  // Try to use OpenGL es 3.0
-  // ChooseConfig returns false here when the device only support gles 2.0.
-  // Because eglChooseConfig with gles 3.0 setting fails when the device only support gles 2.0 and Our default setting is gles 3.0.
-  if( !eglImpl.ChooseConfig( true, COLOR_DEPTH_32 ) )
-  {
-    // Retry to use OpenGL es 2.0
-    eglGraphics->SetGlesVersion( 20 );
-    eglImpl.ChooseConfig( true, COLOR_DEPTH_32 );
-  }
-
-  // Check whether surfaceless context is supported
-  bool isSurfacelessContextSupported = eglImpl.IsSurfacelessContextSupported();
-  eglGraphics->SetIsSurfacelessContextSupported( isSurfacelessContextSupported );
+  Dali::DisplayConnection& displayConnection = mAdaptorInterfaces.GetDisplayConnectionInterface();
+  displayConnection.Initialize(); //@todo Move InitializeGraphics code into graphics implementation
 
-  if ( isSurfacelessContextSupported )
-  {
-    // Create a surfaceless OpenGL context for shared resources
-    eglImpl.CreateContext();
-    eglImpl.MakeContextCurrent( EGL_NO_SURFACE, eglImpl.GetContext() );
-  }
-  else
-  {
-    currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface();
-    if( currentSurface )
-    {
-      currentSurface->InitializeGraphics();
-      currentSurface->MakeContextCurrent();
-    }
-  }
+  NotifyGraphicsInitialised();
 
-  GlImplementation& gles = eglGraphics->GetGlesInterface();
-  gles.ContextCreated();
-  eglGraphics->SetGlesVersion( gles.GetGlesVersion() );
+  //@todo Vk swaps this around, but we need to support surfaceless context for multi-window
+  graphics.ConfigureSurface(mAdaptorInterfaces.GetRenderSurfaceInterface());
 
   // Tell core it has a context
   mCore.ContextCreated();
@@ -569,36 +526,36 @@ void CombinedUpdateRenderController::UpdateRenderThread()
 
   // Update time
   uint64_t lastFrameTime;
-  TimeService::GetNanoseconds( lastFrameTime );
+  TimeService::GetNanoseconds(lastFrameTime);
 
-  LOG_UPDATE_RENDER( "THREAD INITIALISED" );
+  LOG_UPDATE_RENDER("THREAD INITIALISED");
 
-  bool useElapsedTime = true;
-  bool updateRequired = true;
-  uint64_t timeToSleepUntil = 0;
-  int extraFramesDropped = 0;
+  bool     useElapsedTime     = true;
+  bool     updateRequired     = true;
+  uint64_t timeToSleepUntil   = 0;
+  int      extraFramesDropped = 0;
 
   const unsigned int renderToFboInterval = mEnvironmentOptions.GetRenderToFboInterval();
-  const bool renderToFboEnabled = 0u != renderToFboInterval;
-  unsigned int frameCount = 0u;
+  const bool         renderToFboEnabled  = 0u != renderToFboInterval;
+  unsigned int       frameCount          = 0u;
 
-  while( UpdateRenderReady( useElapsedTime, updateRequired, timeToSleepUntil ) )
+  while(UpdateRenderReady(useElapsedTime, updateRequired, timeToSleepUntil))
   {
     LOG_UPDATE_RENDER_TRACE;
 
     // Performance statistics are logged upon a VSYNC tick so use this point for a VSync marker
-    AddPerformanceMarker( PerformanceInterface::VSYNC );
+    AddPerformanceMarker(PerformanceInterface::VSYNC);
 
     uint64_t currentFrameStartTime = 0;
-    TimeService::GetNanoseconds( currentFrameStartTime );
+    TimeService::GetNanoseconds(currentFrameStartTime);
 
     uint64_t timeSinceLastFrame = currentFrameStartTime - lastFrameTime;
 
     // Optional FPS Tracking when continuously rendering
-    if( useElapsedTime && mFpsTracker.Enabled() )
+    if(useElapsedTime && mFpsTracker.Enabled())
     {
       float absoluteTimeSinceLastRender = timeSinceLastFrame * NANOSECONDS_TO_SECOND;
-      mFpsTracker.Track( absoluteTimeSinceLastRender );
+      mFpsTracker.Track(absoluteTimeSinceLastRender);
     }
 
     lastFrameTime = currentFrameStartTime; // Store frame start time
@@ -608,9 +565,9 @@ void CombinedUpdateRenderController::UpdateRenderThread()
     //////////////////////////////
 
     Dali::RenderSurfaceInterface* newSurface = ShouldSurfaceBeReplaced();
-    if( DALI_UNLIKELY( newSurface ) )
+    if(DALI_UNLIKELY(newSurface))
     {
-      LOG_UPDATE_RENDER_TRACE_FMT( "Replacing Surface" );
+      LOG_UPDATE_RENDER_TRACE_FMT("Replacing Surface");
       // This is designed for replacing pixmap surfaces, but should work for window as well
       // we need to delete the surface and renderable (pixmap / window)
       // Then create a new pixmap/window and new surface
@@ -625,27 +582,27 @@ void CombinedUpdateRenderController::UpdateRenderThread()
       SurfaceReplaced();
     }
 
-    const bool isRenderingToFbo = renderToFboEnabled && ( ( 0u == frameCount ) || ( 0u != frameCount % renderToFboInterval ) );
+    const bool isRenderingToFbo = renderToFboEnabled && ((0u == frameCount) || (0u != frameCount % renderToFboInterval));
     ++frameCount;
 
     //////////////////////////////
     // UPDATE
     //////////////////////////////
 
-    const unsigned int currentTime = currentFrameStartTime / NANOSECONDS_PER_MILLISECOND;
+    const unsigned int currentTime   = currentFrameStartTime / NANOSECONDS_PER_MILLISECOND;
     const unsigned int nextFrameTime = currentTime + mDefaultFrameDurationMilliseconds;
 
     uint64_t noOfFramesSinceLastUpdate = 1;
-    float frameDelta = 0.0f;
-    if( useElapsedTime )
+    float    frameDelta                = 0.0f;
+    if(useElapsedTime)
     {
-      if( mThreadMode == ThreadMode::RUN_IF_REQUESTED )
+      if(mThreadMode == ThreadMode::RUN_IF_REQUESTED)
       {
         extraFramesDropped = 0;
-        while( timeSinceLastFrame >= mDefaultFrameDurationNanoseconds )
+        while(timeSinceLastFrame >= mDefaultFrameDurationNanoseconds)
         {
-           timeSinceLastFrame -= mDefaultFrameDurationNanoseconds;
-           extraFramesDropped++;
+          timeSinceLastFrame -= mDefaultFrameDurationNanoseconds;
+          extraFramesDropped++;
         }
       }
 
@@ -654,43 +611,43 @@ void CombinedUpdateRenderController::UpdateRenderThread()
 
       frameDelta = mDefaultFrameDelta * noOfFramesSinceLastUpdate;
     }
-    LOG_UPDATE_RENDER( "timeSinceLastFrame(%llu) noOfFramesSinceLastUpdate(%u) frameDelta(%.6f)", timeSinceLastFrame, noOfFramesSinceLastUpdate, frameDelta );
+    LOG_UPDATE_RENDER("timeSinceLastFrame(%llu) noOfFramesSinceLastUpdate(%u) frameDelta(%.6f)", timeSinceLastFrame, noOfFramesSinceLastUpdate, frameDelta);
 
     Integration::UpdateStatus updateStatus;
 
-    AddPerformanceMarker( PerformanceInterface::UPDATE_START );
-    mCore.Update( frameDelta,
-                  currentTime,
-                  nextFrameTime,
-                  updateStatus,
-                  renderToFboEnabled,
-                  isRenderingToFbo );
-    AddPerformanceMarker( PerformanceInterface::UPDATE_END );
+    AddPerformanceMarker(PerformanceInterface::UPDATE_START);
+    mCore.Update(frameDelta,
+                 currentTime,
+                 nextFrameTime,
+                 updateStatus,
+                 renderToFboEnabled,
+                 isRenderingToFbo);
+    AddPerformanceMarker(PerformanceInterface::UPDATE_END);
 
     unsigned int keepUpdatingStatus = updateStatus.KeepUpdating();
 
     // Tell the event-thread to wake up (if asleep) and send a notification event to Core if required
-    if( updateStatus.NeedsNotification() )
+    if(updateStatus.NeedsNotification())
     {
       mNotificationTrigger.Trigger();
-      LOG_UPDATE_RENDER( "Notification Triggered" );
+      LOG_UPDATE_RENDER("Notification Triggered");
     }
 
     // Check resize
-    bool surfaceResized = false;
+    bool surfaceResized         = false;
     bool shouldSurfaceBeResized = ShouldSurfaceBeResized();
-    if( DALI_UNLIKELY( shouldSurfaceBeResized ) )
+    if(DALI_UNLIKELY(shouldSurfaceBeResized))
     {
-      if( updateStatus.SurfaceRectChanged() )
+      if(updateStatus.SurfaceRectChanged())
       {
-        LOG_UPDATE_RENDER_TRACE_FMT( "Resizing Surface" );
+        LOG_UPDATE_RENDER_TRACE_FMT("Resizing Surface");
         SurfaceResized();
         surfaceResized = true;
       }
     }
 
     // Optional logging of update/render status
-    mUpdateStatusLogger.Log( keepUpdatingStatus );
+    mUpdateStatusLogger.Log(keepUpdatingStatus);
 
     //////////////////////////////
     // RENDER
@@ -698,49 +655,45 @@ void CombinedUpdateRenderController::UpdateRenderThread()
 
     mAdaptorInterfaces.GetDisplayConnectionInterface().ConsumeEvents();
 
-    if( mPreRenderCallback != NULL )
+    if(mPreRenderCallback != NULL)
     {
       bool keepCallback = CallbackBase::ExecuteReturn<bool>(*mPreRenderCallback);
-      if( ! keepCallback )
+      if(!keepCallback)
       {
         delete mPreRenderCallback;
         mPreRenderCallback = NULL;
       }
     }
 
-    if( eglImpl.IsSurfacelessContextSupported() )
-    {
-      // Make the shared surfaceless context as current before rendering
-      eglImpl.MakeContextCurrent( EGL_NO_SURFACE, eglImpl.GetContext() );
-    }
+    graphics.ActivateResourceContext();
 
-    if( mFirstFrameAfterResume )
+    if(mFirstFrameAfterResume)
     {
       // mFirstFrameAfterResume is set to true when the thread is resumed
-      // Let eglImplementation know the first frame after thread initialized or resumed.
-      eglImpl.SetFirstFrameAfterResume();
+      // Let graphics know the first frame after thread initialized or resumed.
+      graphics.SetFirstFrameAfterResume();
       mFirstFrameAfterResume = FALSE;
     }
 
     Integration::RenderStatus renderStatus;
 
-    AddPerformanceMarker( PerformanceInterface::RENDER_START );
+    AddPerformanceMarker(PerformanceInterface::RENDER_START);
 
     // Upload shared resources
-    mCore.PreRender( renderStatus, mForceClear, mUploadWithoutRendering );
+    mCore.PreRender(renderStatus, mForceClear, mUploadWithoutRendering);
 
-    if ( !mUploadWithoutRendering )
+    if(!mUploadWithoutRendering)
     {
       // Go through each window
       WindowContainer windows;
-      mAdaptorInterfaces.GetWindowContainerInterface( windows );
+      mAdaptorInterfaces.GetWindowContainerInterface(windows);
 
-      for( auto&& window : windows )
+      for(auto&& window : windows)
       {
-        Dali::Integration::Scene scene = window->GetScene();
+        Dali::Integration::Scene      scene         = window->GetScene();
         Dali::RenderSurfaceInterface* windowSurface = window->GetSurface();
 
-        if ( scene && windowSurface )
+        if(scene && windowSurface)
         {
           Integration::RenderStatus windowRenderStatus;
 
@@ -750,58 +703,58 @@ void CombinedUpdateRenderController::UpdateRenderThread()
           mDamagedRects.clear();
 
           // Collect damage rects
-          mCore.PreRender( scene, mDamagedRects );
+          mCore.PreRender(scene, mDamagedRects);
 
           // Render off-screen frame buffers first if any
-          mCore.RenderScene( windowRenderStatus, scene, true );
+          mCore.RenderScene(windowRenderStatus, scene, true);
 
           Rect<int> clippingRect; // Empty for fbo rendering
 
-          // Switch to the EGL context of the surface, merge damaged areas for previous frames
-          windowSurface->PreRender( surfaceResized, mDamagedRects, clippingRect ); // Switch GL context
+          // Switch to the context of the surface, merge damaged areas for previous frames
+          windowSurface->PreRender(surfaceResized, mDamagedRects, clippingRect); // Switch GL context
 
-          if (clippingRect.IsEmpty())
+          if(clippingRect.IsEmpty())
           {
             mDamagedRects.clear();
           }
 
           // Render the surface
-          mCore.RenderScene( windowRenderStatus, scene, false, clippingRect );
+          mCore.RenderScene(windowRenderStatus, scene, false, clippingRect);
 
-          if( windowRenderStatus.NeedsPostRender() )
+          if(windowRenderStatus.NeedsPostRender())
           {
-            windowSurface->PostRender( false, false, surfaceResized, mDamagedRects ); // Swap Buffer with damage
+            windowSurface->PostRender(false, false, surfaceResized, mDamagedRects); // Swap Buffer with damage
           }
         }
       }
     }
 
-    mCore.PostRender( mUploadWithoutRendering );
+    mCore.PostRender(mUploadWithoutRendering);
 
     //////////////////////////////
     // DELETE SURFACE
     //////////////////////////////
 
     Dali::RenderSurfaceInterface* deletedSurface = ShouldSurfaceBeDeleted();
-    if( DALI_UNLIKELY( deletedSurface ) )
+    if(DALI_UNLIKELY(deletedSurface))
     {
-      LOG_UPDATE_RENDER_TRACE_FMT( "Deleting Surface" );
+      LOG_UPDATE_RENDER_TRACE_FMT("Deleting Surface");
 
       deletedSurface->DestroySurface();
 
       SurfaceDeleted();
     }
 
-    AddPerformanceMarker( PerformanceInterface::RENDER_END );
+    AddPerformanceMarker(PerformanceInterface::RENDER_END);
 
     mForceClear = false;
 
     // Trigger event thread to request Update/Render thread to sleep if update not required
-    if( ( Integration::KeepUpdating::NOT_REQUESTED == keepUpdatingStatus ) && !renderStatus.NeedsUpdate() )
+    if((Integration::KeepUpdating::NOT_REQUESTED == keepUpdatingStatus) && !renderStatus.NeedsUpdate())
     {
       mSleepTrigger->Trigger();
       updateRequired = false;
-      LOG_UPDATE_RENDER( "Sleep Triggered" );
+      LOG_UPDATE_RENDER("Sleep Triggered");
     }
     else
     {
@@ -814,7 +767,7 @@ void CombinedUpdateRenderController::UpdateRenderThread()
 
     extraFramesDropped = 0;
 
-    if (timeToSleepUntil == 0)
+    if(timeToSleepUntil == 0)
     {
       // If this is the first frame after the thread is initialized or resumed, we
       // use the actual time the current frame starts from to calculate the time to
@@ -833,22 +786,22 @@ void CombinedUpdateRenderController::UpdateRenderThread()
 
       // Check the current time at the end of the frame
       uint64_t currentFrameEndTime = 0;
-      TimeService::GetNanoseconds( currentFrameEndTime );
-      while ( currentFrameEndTime > timeToSleepUntil + mDefaultFrameDurationNanoseconds )
+      TimeService::GetNanoseconds(currentFrameEndTime);
+      while(currentFrameEndTime > timeToSleepUntil + mDefaultFrameDurationNanoseconds)
       {
-         // We are more than one frame behind already, so just drop the next frames
-         // until the sleep-until time is later than the current time so that we can
-         // catch up.
-         timeToSleepUntil += mDefaultFrameDurationNanoseconds;
-         extraFramesDropped++;
+        // We are more than one frame behind already, so just drop the next frames
+        // until the sleep-until time is later than the current time so that we can
+        // catch up.
+        timeToSleepUntil += mDefaultFrameDurationNanoseconds;
+        extraFramesDropped++;
       }
     }
 
     // Render to FBO is intended to measure fps above 60 so sleep is not wanted.
-    if( 0u == renderToFboInterval )
+    if(0u == renderToFboInterval)
     {
       // Sleep until at least the the default frame duration has elapsed. This will return immediately if the specified end-time has already passed.
-      TimeService::SleepUntil( timeToSleepUntil );
+      TimeService::SleepUntil(timeToSleepUntil);
     }
   }
 
@@ -856,84 +809,83 @@ void CombinedUpdateRenderController::UpdateRenderThread()
   mCore.ContextDestroyed();
 
   WindowContainer windows;
-  mAdaptorInterfaces.GetWindowContainerInterface( windows );
+  mAdaptorInterfaces.GetWindowContainerInterface(windows);
 
   // Destroy surfaces
-  for( auto&& window : windows )
+  for(auto&& window : windows)
   {
     Dali::RenderSurfaceInterface* surface = window->GetSurface();
     surface->DestroySurface();
   }
 
-  // Shutdown EGL
-  eglInterface->TerminateGles();
+  graphics.Shutdown();
 
-  LOG_UPDATE_RENDER( "THREAD DESTROYED" );
+  LOG_UPDATE_RENDER("THREAD DESTROYED");
 
   // Uninstall the logging function
   mEnvironmentOptions.UnInstallLogFunction();
 }
 
-bool CombinedUpdateRenderController::UpdateRenderReady( bool& useElapsedTime, bool updateRequired, uint64_t& timeToSleepUntil )
+bool CombinedUpdateRenderController::UpdateRenderReady(bool& useElapsedTime, bool updateRequired, uint64_t& timeToSleepUntil)
 {
   useElapsedTime = true;
 
-  ConditionalWait::ScopedLock updateLock( mUpdateRenderThreadWaitCondition );
-  while( ( ! mUpdateRenderRunCount || // Should try to wait if event-thread has paused the Update/Render thread
-           ( mUpdateRenderThreadCanSleep && ! updateRequired && ! mPendingRequestUpdate ) ) && // Ensure we wait if we're supposed to be sleeping AND do not require another update
-         ! mDestroyUpdateRenderThread && // Ensure we don't wait if the update-render-thread is supposed to be destroyed
-         ! mNewSurface &&  // Ensure we don't wait if we need to replace the surface
-         ! mDeletedSurface && // Ensure we don't wait if we need to delete the surface
-         ! mSurfaceResized ) // Ensure we don't wait if we need to resize the surface
+  ConditionalWait::ScopedLock updateLock(mUpdateRenderThreadWaitCondition);
+  while((!mUpdateRenderRunCount ||                                                      // Should try to wait if event-thread has paused the Update/Render thread
+         (mUpdateRenderThreadCanSleep && !updateRequired && !mPendingRequestUpdate)) && // Ensure we wait if we're supposed to be sleeping AND do not require another update
+        !mDestroyUpdateRenderThread &&                                                  // Ensure we don't wait if the update-render-thread is supposed to be destroyed
+        !mNewSurface &&                                                                 // Ensure we don't wait if we need to replace the surface
+        !mDeletedSurface &&                                                             // Ensure we don't wait if we need to delete the surface
+        !mSurfaceResized)                                                               // Ensure we don't wait if we need to resize the surface
   {
-    LOG_UPDATE_RENDER( "WAIT: mUpdateRenderRunCount:       %d", mUpdateRenderRunCount );
-    LOG_UPDATE_RENDER( "      mUpdateRenderThreadCanSleep: %d, updateRequired: %d, mPendingRequestUpdate: %d", mUpdateRenderThreadCanSleep, updateRequired, mPendingRequestUpdate );
-    LOG_UPDATE_RENDER( "      mDestroyUpdateRenderThread:  %d", mDestroyUpdateRenderThread );
-    LOG_UPDATE_RENDER( "      mNewSurface:                 %d", mNewSurface );
-    LOG_UPDATE_RENDER( "      mDeletedSurface:             %d", mDeletedSurface );
-    LOG_UPDATE_RENDER( "      mSurfaceResized:             %d", mSurfaceResized );
+    LOG_UPDATE_RENDER("WAIT: mUpdateRenderRunCount:       %d", mUpdateRenderRunCount);
+    LOG_UPDATE_RENDER("      mUpdateRenderThreadCanSleep: %d, updateRequired: %d, mPendingRequestUpdate: %d", mUpdateRenderThreadCanSleep, updateRequired, mPendingRequestUpdate);
+    LOG_UPDATE_RENDER("      mDestroyUpdateRenderThread:  %d", mDestroyUpdateRenderThread);
+    LOG_UPDATE_RENDER("      mNewSurface:                 %d", mNewSurface);
+    LOG_UPDATE_RENDER("      mDeletedSurface:             %d", mDeletedSurface);
+    LOG_UPDATE_RENDER("      mSurfaceResized:             %d", mSurfaceResized);
 
     // Reset the time when the thread is waiting, so the sleep-until time for
     // the first frame after resuming should be based on the actual start time
     // of the first frame.
     timeToSleepUntil = 0;
 
-    mUpdateRenderThreadWaitCondition.Wait( updateLock );
+    mUpdateRenderThreadWaitCondition.Wait(updateLock);
 
-    if( ! mUseElapsedTimeAfterWait )
+    if(!mUseElapsedTimeAfterWait)
     {
       useElapsedTime = false;
     }
   }
 
-  LOG_COUNTER_UPDATE_RENDER( "mUpdateRenderRunCount:       %d", mUpdateRenderRunCount );
-  LOG_COUNTER_UPDATE_RENDER( "mUpdateRenderThreadCanSleep: %d, updateRequired: %d, mPendingRequestUpdate: %d", mUpdateRenderThreadCanSleep, updateRequired, mPendingRequestUpdate );
-  LOG_COUNTER_UPDATE_RENDER( "mDestroyUpdateRenderThread:  %d", mDestroyUpdateRenderThread );
-  LOG_COUNTER_UPDATE_RENDER( "mNewSurface:                 %d", mNewSurface );
-  LOG_COUNTER_UPDATE_RENDER( "mDeletedSurface:             %d", mDeletedSurface );
-  LOG_COUNTER_UPDATE_RENDER( "mSurfaceResized:             %d", mSurfaceResized );
+  LOG_COUNTER_UPDATE_RENDER("mUpdateRenderRunCount:       %d", mUpdateRenderRunCount);
+  LOG_COUNTER_UPDATE_RENDER("mUpdateRenderThreadCanSleep: %d, updateRequired: %d, mPendingRequestUpdate: %d", mUpdateRenderThreadCanSleep, updateRequired, mPendingRequestUpdate);
+  LOG_COUNTER_UPDATE_RENDER("mDestroyUpdateRenderThread:  %d", mDestroyUpdateRenderThread);
+  LOG_COUNTER_UPDATE_RENDER("mNewSurface:                 %d", mNewSurface);
+  LOG_COUNTER_UPDATE_RENDER("mDeletedSurface:             %d", mDeletedSurface);
+  LOG_COUNTER_UPDATE_RENDER("mSurfaceResized:             %d", mSurfaceResized);
 
-  mUseElapsedTimeAfterWait = FALSE;
+  mUseElapsedTimeAfterWait    = FALSE;
   mUpdateRenderThreadCanSleep = FALSE;
-  mPendingRequestUpdate = FALSE;
+  mPendingRequestUpdate       = FALSE;
 
   // If we've been asked to run Update/Render cycles a finite number of times then decrement so we wait after the
   // requested number of cycles
-  if( mUpdateRenderRunCount > 0 )
+  if(mUpdateRenderRunCount > 0)
   {
     --mUpdateRenderRunCount;
   }
 
   // Keep the update-render thread alive if this thread is NOT to be destroyed
-  return ! mDestroyUpdateRenderThread;
+  return !mDestroyUpdateRenderThread;
 }
 
 Dali::RenderSurfaceInterface* CombinedUpdateRenderController::ShouldSurfaceBeReplaced()
 {
-  ConditionalWait::ScopedLock lock( mUpdateRenderThreadWaitCondition );
+  ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
 
   Dali::RenderSurfaceInterface* newSurface = mNewSurface;
-  mNewSurface = NULL;
+  mNewSurface                              = NULL;
 
   return newSurface;
 }
@@ -946,10 +898,10 @@ void CombinedUpdateRenderController::SurfaceReplaced()
 
 Dali::RenderSurfaceInterface* CombinedUpdateRenderController::ShouldSurfaceBeDeleted()
 {
-  ConditionalWait::ScopedLock lock( mUpdateRenderThreadWaitCondition );
+  ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
 
   Dali::RenderSurfaceInterface* deletedSurface = mDeletedSurface;
-  mDeletedSurface = NULL;
+  mDeletedSurface                              = NULL;
 
   return deletedSurface;
 }
@@ -962,13 +914,13 @@ void CombinedUpdateRenderController::SurfaceDeleted()
 
 bool CombinedUpdateRenderController::ShouldSurfaceBeResized()
 {
-  ConditionalWait::ScopedLock lock( mUpdateRenderThreadWaitCondition );
+  ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
   return mSurfaceResized;
 }
 
 void CombinedUpdateRenderController::SurfaceResized()
 {
-  ConditionalWait::ScopedLock lock( mUpdateRenderThreadWaitCondition );
+  ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
   mSurfaceResized = FALSE;
 }
 
@@ -987,11 +939,11 @@ void CombinedUpdateRenderController::NotifyGraphicsInitialised()
   mGraphicsInitializeWait.Notify();
 }
 
-void CombinedUpdateRenderController::AddPerformanceMarker( PerformanceInterface::MarkerType type )
+void CombinedUpdateRenderController::AddPerformanceMarker(PerformanceInterface::MarkerType type)
 {
-  if( mPerformanceInterface )
+  if(mPerformanceInterface)
   {
-    mPerformanceInterface->AddMarker( type );
+    mPerformanceInterface->AddMarker(type);
   }
 }
 
@@ -1001,9 +953,9 @@ void CombinedUpdateRenderController::AddPerformanceMarker( PerformanceInterface:
 
 void CombinedUpdateRenderController::PostRenderComplete()
 {
-  ConditionalWait::ScopedLock lock( mUpdateRenderThreadWaitCondition );
+  ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
   mPostRendering = FALSE;
-  mUpdateRenderThreadWaitCondition.Notify( lock );
+  mUpdateRenderThreadWaitCondition.Notify(lock);
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1012,19 +964,19 @@ void CombinedUpdateRenderController::PostRenderComplete()
 
 void CombinedUpdateRenderController::PostRenderStarted()
 {
-  ConditionalWait::ScopedLock lock( mUpdateRenderThreadWaitCondition );
+  ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
   mPostRendering = TRUE;
 }
 
 void CombinedUpdateRenderController::PostRenderWaitForCompletion()
 {
-  ConditionalWait::ScopedLock lock( mUpdateRenderThreadWaitCondition );
-  while( mPostRendering &&
-         ! mNewSurface &&                // We should NOT wait if we're replacing the surface
-         ! mDeletedSurface &&            // We should NOT wait if we're deleting the surface
-         ! mDestroyUpdateRenderThread )
+  ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
+  while(mPostRendering &&
+        !mNewSurface &&     // We should NOT wait if we're replacing the surface
+        !mDeletedSurface && // We should NOT wait if we're deleting the surface
+        !mDestroyUpdateRenderThread)
   {
-    mUpdateRenderThreadWaitCondition.Wait( lock );
+    mUpdateRenderThreadWaitCondition.Wait(lock);
   }
 }
 
index 4404fab..e61a2ac 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_BASE_GRAPHICS_INTERFACE_H
 
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
  */
 
 // INTERNAL INCLUDES
-#include <dali/internal/system/common/environment-options.h>
+#include <dali/graphics-api/graphics-controller.h>
 #include <dali/integration-api/core-enumerations.h>
+#include <dali/internal/system/common/environment-options.h>
 
 namespace Dali
 {
+class RenderSurfaceInterface;
 
 namespace Internal
 {
-
 namespace Adaptor
 {
+class ConfigurationManager;
 
 /**
  * Factory interface for creating Graphics Factory implementation
@@ -37,30 +39,64 @@ namespace Adaptor
 class GraphicsInterface
 {
 public:
-
   /**
    * Constructor
    */
   GraphicsInterface()
-  : mDepthBufferRequired( Integration::DepthBufferAvailable::FALSE ),
-    mStencilBufferRequired( Integration::StencilBufferAvailable::FALSE ),
-    mPartialUpdateRequired( Integration::PartialUpdateAvailable::FALSE )
-  {
-  };
+  : mDepthBufferRequired(Integration::DepthBufferAvailable::FALSE),
+    mStencilBufferRequired(Integration::StencilBufferAvailable::FALSE),
+    mPartialUpdateRequired(Integration::PartialUpdateAvailable::FALSE){};
 
   /**
    * Destructor
    */
-  virtual ~GraphicsInterface() {}
+  virtual ~GraphicsInterface() = default;
+
+  /**
+   * Returns controller object
+   * @return
+   */
+  virtual Dali::Graphics::Controller& GetController() = 0;
+
+  /**
+   * Initialize the graphics subsystem, configured from environment
+   */
+  virtual void Initialize() = 0;
+
+  /**
+   * Initialize the graphics subsystem, providing explicit parameters.
+   *
+   * @param[in] depth True if depth buffer is required
+   * @param[in] stencil True if stencil buffer is required
+   * @param[in] partialRendering True if partial rendering is required
+   * @param[in] msaa level of anti-aliasing required (-1 = off)
+   */
+  virtual void Initialize(bool depth, bool stencil, bool partialRendering, int msaa) = 0;
 
   /**
-   * Initialize the graphics interface
-   * @param[in]  environmentOptions  The environment options.
+   * Configure the graphics surface
+   *
+   * @param[in] surface The surface to configure, or NULL if not present
    */
-  virtual void Initialize( EnvironmentOptions* environmentOptions ) = 0;
+  virtual void ConfigureSurface(Dali::RenderSurfaceInterface* surface) = 0;
 
   /**
-   * Destroy the Graphics Factory implementation
+   * Activate the resource context
+   */
+  virtual void ActivateResourceContext() = 0;
+
+  /**
+   * Inform graphics interface that this is the first frame after a resume.
+   */
+  virtual void SetFirstFrameAfterResume() = 0;
+
+  /**
+   * Shut down the graphics implementation
+   */
+  virtual void Shutdown() = 0;
+
+  /**
+   * Destroy the Graphics implementation
    */
   virtual void Destroy() = 0;
 
@@ -91,17 +127,46 @@ public:
     return mPartialUpdateRequired;
   };
 
-protected:
+  /**
+   * @return true if advanced blending options are supported
+   */
+  virtual bool IsAdvancedBlendEquationSupported() = 0;
+
+  /**
+   * @return true if graphics subsystem is initialized
+   */
+  virtual bool IsInitialized() = 0;
+
+  /**
+   * @return true if a separate resource context is supported
+   */
+  virtual bool IsResourceContextSupported() = 0;
 
-  Integration::DepthBufferAvailable mDepthBufferRequired;       ///< Whether the depth buffer is required
-  Integration::StencilBufferAvailable mStencilBufferRequired;   ///< Whether the stencil buffer is required
-  Integration::PartialUpdateAvailable mPartialUpdateRequired;   ///< Whether the partial update is required
+  /**
+   * @return the maximum texture size
+   */
+  virtual uint32_t GetMaxTextureSize() = 0;
+
+  /**
+   * @return the version number of the shader language
+   */
+  virtual uint32_t GetShaderLanguageVersion() = 0;
+
+  /**
+   * Store cached configurations
+   */
+  virtual void CacheConfigurations(ConfigurationManager& configurationManager) = 0;
+
+protected:
+  Integration::DepthBufferAvailable   mDepthBufferRequired;   ///< Whether the depth buffer is required
+  Integration::StencilBufferAvailable mStencilBufferRequired; ///< Whether the stencil buffer is required
+  Integration::PartialUpdateAvailable mPartialUpdateRequired; ///< Whether the partial update is required
 };
 
-} // Adaptor
+} // namespace Adaptor
 
-} // Internal
+} // namespace Internal
 
-} // Dali
+} // namespace Dali
 
 #endif // DALI_INTERNAL_BASE_GRAPHICS_INTERFACE_H
index 9bc00e6..7978f0b 100644 (file)
@@ -9,6 +9,7 @@ SET( adaptor_graphics_gles_src_files
     ${adaptor_graphics_dir}/gles/gl-proxy-implementation.cpp
     ${adaptor_graphics_dir}/gles/egl-graphics-factory.cpp
     ${adaptor_graphics_dir}/gles/egl-graphics.cpp
+    ${adaptor_graphics_dir}/gles/egl-graphics-controller.cpp
 )
 
 # module: graphics, backend: tizen
@@ -35,4 +36,3 @@ SET( adaptor_graphics_windows_src_files
 SET( adaptor_graphics_macos_src_files
     ${adaptor_graphics_dir}/macos/egl-image-extensions.cpp
 )
-
diff --git a/dali/internal/graphics/gles/egl-graphics-controller.cpp b/dali/internal/graphics/gles/egl-graphics-controller.cpp
new file mode 100644 (file)
index 0000000..564aa9b
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2021 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/graphics/gles/egl-graphics-controller.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+
+namespace Dali
+{
+namespace Graphics
+{
+void EglGraphicsController::InitializeGLES(Integration::GlAbstraction& glAbstraction)
+{
+  mGlAbstraction = &glAbstraction;
+}
+
+void EglGraphicsController::Initialize(Integration::GlSyncAbstraction&          glSyncAbstraction,
+                                       Integration::GlContextHelperAbstraction& glContextHelperAbstraction)
+{
+  mGlSyncAbstraction          = &glSyncAbstraction;
+  mGlContextHelperAbstraction = &glContextHelperAbstraction;
+}
+
+Integration::GlAbstraction& EglGraphicsController::GetGlAbstraction()
+{
+  DALI_ASSERT_DEBUG(mGlAbstraction && "Graphics controller not initialized");
+  return *mGlAbstraction;
+}
+
+Integration::GlSyncAbstraction& EglGraphicsController::GetGlSyncAbstraction()
+{
+  DALI_ASSERT_DEBUG(mGlSyncAbstraction && "Graphics controller not initialized");
+  return *mGlSyncAbstraction;
+}
+
+Integration::GlContextHelperAbstraction& EglGraphicsController::GetGlContextHelperAbstraction()
+{
+  DALI_ASSERT_DEBUG(mGlContextHelperAbstraction && "Graphics controller not initialized");
+  return *mGlContextHelperAbstraction;
+}
+
+} // namespace Graphics
+} // namespace Dali
diff --git a/dali/internal/graphics/gles/egl-graphics-controller.h b/dali/internal/graphics/gles/egl-graphics-controller.h
new file mode 100644 (file)
index 0000000..5942d76
--- /dev/null
@@ -0,0 +1,72 @@
+#ifndef DALI_EGL_GRAPHICS_CONTROLLER_H
+#define DALI_EGL_GRAPHICS_CONTROLLER_H
+
+/*
+ * Copyright (c) 2021 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.
+ */
+
+#include <dali/graphics-api/graphics-controller.h>
+
+namespace Dali
+{
+namespace Integration
+{
+class GlAbstraction;
+class GlSyncAbstraction;
+class GlContextHelperAbstraction;
+} // namespace Integration
+
+namespace Graphics
+{
+/**
+ * EGL Implementation of the graphics controller.
+ *
+ * Temporarily holds the old GL abstractions whilst dali-core is migrated to the new API.
+ */
+class EglGraphicsController : public Graphics::Controller
+{
+public:
+  EglGraphicsController() = default;
+
+  virtual ~EglGraphicsController() = default;
+
+  /**
+   * Initialize the GLES abstraction. This can be called from the main thread.
+   */
+  void InitializeGLES(Integration::GlAbstraction& glAbstraction);
+
+  /**
+   * Initialize with a reference to the GL abstractions.
+   *
+   * Note, this is now executed in the render thread, after core initialization
+   */
+  void Initialize(Integration::GlSyncAbstraction&          glSyncAbstraction,
+                  Integration::GlContextHelperAbstraction& glContextHelperAbstraction);
+
+  Integration::GlAbstraction&              GetGlAbstraction() override;
+  Integration::GlSyncAbstraction&          GetGlSyncAbstraction() override;
+  Integration::GlContextHelperAbstraction& GetGlContextHelperAbstraction() override;
+
+private:
+  Integration::GlAbstraction*              mGlAbstraction{nullptr};
+  Integration::GlSyncAbstraction*          mGlSyncAbstraction{nullptr};
+  Integration::GlContextHelperAbstraction* mGlContextHelperAbstraction{nullptr};
+};
+
+} // namespace Graphics
+
+} // namespace Dali
+
+#endif //DALI_EGL_GRAPHICS_CONTROLLER_H
index 5588bc6..6881f90 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -15,7 +15,6 @@
  *
  */
 
-
 // CLASS HEADER
 #include <dali/internal/graphics/gles/egl-graphics-factory.h>
 #include <dali/internal/graphics/gles/egl-graphics.h>
@@ -28,8 +27,8 @@ namespace Internal
 {
 namespace Adaptor
 {
-
-GraphicsFactory::GraphicsFactory()
+GraphicsFactory::GraphicsFactory(EnvironmentOptions& environmentOptions)
+: mEnvironmentOptions(environmentOptions)
 {
 }
 
@@ -40,7 +39,7 @@ GraphicsFactory::~GraphicsFactory()
 
 GraphicsInterface& GraphicsFactory::Create()
 {
-  GraphicsInterface* eglGraphicsInterface = new EglGraphics;
+  GraphicsInterface* eglGraphicsInterface = new EglGraphics(mEnvironmentOptions);
   return *eglGraphicsInterface;
 }
 
@@ -49,6 +48,6 @@ void GraphicsFactory::Destroy()
   /* Deleted by EglGraphics */
 }
 
-} // Adaptor
-} // Internal
-} // Dali
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
index a175248..9be337a 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_GRAPHICS_FACTORY_H
 
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 // CLASS HEADER
 #include <dali/internal/graphics/common/graphics-factory-interface.h>
 
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/environment-options.h>
 
 namespace Dali
 {
-
 namespace Internal
 {
-
 namespace Adaptor
 {
-
 class GraphicsFactory : public GraphicsFactoryInterface
 {
 public:
-
   /**
    * Constructor
    */
-  GraphicsFactory();
+  GraphicsFactory(EnvironmentOptions& environmentOptions);
 
   /**
    * Destructor
@@ -54,12 +52,15 @@ public:
    * @copydoc Dali::Internal::Adaptor::GraphicsFactoryInterface::Destroy()
    */
   void Destroy() override;
+
+private:
+  EnvironmentOptions& mEnvironmentOptions;
 };
 
-} // Adaptor
+} // namespace Adaptor
 
-} // Internal
+} // namespace Internal
 
-} // Dali
+} // namespace Dali
 
 #endif // DALI_INTERNAL_GRAPHICS_FACTORY_H
index f78176b..488559e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
  *
  */
 
-
 // CLASS HEADER
 #include <dali/internal/graphics/gles/egl-graphics.h>
 
 // INTERNAL INCLUDES
+#include <dali/integration-api/adaptor-framework/render-surface-interface.h>
+#include <dali/internal/system/common/configuration-manager.h>
+#include <dali/internal/system/common/environment-options.h>
 #include <dali/internal/window-system/common/display-utils.h> // For Utils::MakeUnique
 
 namespace Dali
@@ -28,71 +30,124 @@ namespace Internal
 {
 namespace Adaptor
 {
-
-EglGraphics::EglGraphics( )
-: mMultiSamplingLevel( 0 )
+EglGraphics::EglGraphics(EnvironmentOptions& environmentOptions)
+: mMultiSamplingLevel(0)
 {
+  mDepthBufferRequired   = static_cast<Integration::DepthBufferAvailable>(environmentOptions.DepthBufferRequired());
+  mStencilBufferRequired = static_cast<Integration::StencilBufferAvailable>(environmentOptions.StencilBufferRequired());
+  mPartialUpdateRequired = static_cast<Integration::PartialUpdateAvailable>(environmentOptions.PartialUpdateRequired());
+  mMultiSamplingLevel    = environmentOptions.GetMultiSamplingLevel();
+
+  if(environmentOptions.GetGlesCallTime() > 0)
+  {
+    mGLES = Utils::MakeUnique<GlProxyImplementation>(environmentOptions);
+  }
+  else
+  {
+    mGLES.reset(new GlImplementation());
+  }
+
+  mGraphicsController.InitializeGLES(*mGLES.get());
 }
 
 EglGraphics::~EglGraphics()
 {
 }
 
-void EglGraphics::SetGlesVersion( const int32_t glesVersion )
+void EglGraphics::SetGlesVersion(const int32_t glesVersion)
 {
-  mEglImplementation->SetGlesVersion( glesVersion );
-  mGLES->SetGlesVersion( glesVersion );
+  mEglImplementation->SetGlesVersion(glesVersion);
+  mGLES->SetGlesVersion(glesVersion);
 }
 
-void EglGraphics::SetIsSurfacelessContextSupported( const bool isSupported )
+void EglGraphics::SetIsSurfacelessContextSupported(const bool isSupported)
 {
-  mGLES->SetIsSurfacelessContextSupported( isSupported );
+  mGLES->SetIsSurfacelessContextSupported(isSupported);
 }
 
-void EglGraphics::Initialize( EnvironmentOptions* environmentOptions )
+void EglGraphics::ActivateResourceContext()
 {
-  if( environmentOptions->GetGlesCallTime() > 0 )
+  if(mEglImplementation->IsSurfacelessContextSupported())
   {
-    mGLES = Utils::MakeUnique< GlProxyImplementation >( *environmentOptions );
+    // Make the shared surfaceless context as current before rendering
+    mEglImplementation->MakeContextCurrent(EGL_NO_SURFACE, mEglImplementation->GetContext());
   }
-  else
-  {
-    mGLES.reset ( new GlImplementation() );
-  }
-
-  mDepthBufferRequired = static_cast< Integration::DepthBufferAvailable >( environmentOptions->DepthBufferRequired() );
-  mStencilBufferRequired = static_cast< Integration::StencilBufferAvailable >( environmentOptions->StencilBufferRequired() );
-  mPartialUpdateRequired = static_cast< Integration::PartialUpdateAvailable >( environmentOptions->PartialUpdateRequired() );
+}
 
-  mMultiSamplingLevel = environmentOptions->GetMultiSamplingLevel();
+void EglGraphics::SetFirstFrameAfterResume()
+{
+  mEglImplementation->SetFirstFrameAfterResume();
+}
 
-  mEglSync = Utils::MakeUnique< EglSyncImplementation >();
+void EglGraphics::Initialize()
+{
+  EglInitialize();
 
-  mEglContextHelper = Utils::MakeUnique< EglContextHelperImplementation >();
+  // Sync and context helper require EGL to be initialized first (can't execute in the constructor)
+  mGraphicsController.Initialize(*mEglSync.get(), *mEglContextHelper.get());
 }
 
-void EglGraphics::Initialize( bool depth, bool stencil, int msaa )
+void EglGraphics::Initialize(bool depth, bool stencil, bool partialRendering, int msaa)
 {
-  mDepthBufferRequired = static_cast< Integration::DepthBufferAvailable >( depth );
-  mStencilBufferRequired = static_cast< Integration::StencilBufferAvailable >( stencil );
+  mDepthBufferRequired   = static_cast<Integration::DepthBufferAvailable>(depth);
+  mStencilBufferRequired = static_cast<Integration::StencilBufferAvailable>(stencil);
+  mPartialUpdateRequired = static_cast<Integration::PartialUpdateAvailable>(partialRendering);
+  mMultiSamplingLevel    = msaa;
 
-  mMultiSamplingLevel = msaa;
+  EglInitialize();
+}
 
-  mEglSync = std::unique_ptr<EglSyncImplementation>( new EglSyncImplementation() );
+void EglGraphics::EglInitialize()
+{
+  mEglSync            = Utils::MakeUnique<EglSyncImplementation>();
+  mEglContextHelper   = Utils::MakeUnique<EglContextHelperImplementation>();
+  mEglImplementation  = Utils::MakeUnique<EglImplementation>(mMultiSamplingLevel, mDepthBufferRequired, mStencilBufferRequired, mPartialUpdateRequired);
+  mEglImageExtensions = Utils::MakeUnique<EglImageExtensions>(mEglImplementation.get());
 
-  mEglContextHelper = std::unique_ptr<EglContextHelperImplementation>( new EglContextHelperImplementation() );
+  mEglSync->Initialize(mEglImplementation.get());          // The sync impl needs the EglDisplay
+  mEglContextHelper->Initialize(mEglImplementation.get()); // The context helper impl needs the EglContext
 }
 
-EglInterface* EglGraphics::Create()
+void EglGraphics::ConfigureSurface(Dali::RenderSurfaceInterface* surface)
 {
-  mEglImplementation = Utils::MakeUnique< EglImplementation >( mMultiSamplingLevel, mDepthBufferRequired, mStencilBufferRequired, mPartialUpdateRequired );
-  mEglImageExtensions = Utils::MakeUnique< EglImageExtensions >( mEglImplementation.get() );
+  // Try to use OpenGL es 3.0
+  // ChooseConfig returns false here when the device only support gles 2.0.
+  // Because eglChooseConfig with gles 3.0 setting fails when the device only support gles 2.0 and Our default setting is gles 3.0.
+  if(!mEglImplementation->ChooseConfig(true, COLOR_DEPTH_32))
+  {
+    // Retry to use OpenGL es 2.0
+    SetGlesVersion(20);
+    mEglImplementation->ChooseConfig(true, COLOR_DEPTH_32);
+  }
 
-  mEglSync->Initialize( mEglImplementation.get() ); // The sync impl needs the EglDisplay
+  // Check whether surfaceless context is supported
+  bool isSurfacelessContextSupported = mEglImplementation->IsSurfacelessContextSupported();
+  SetIsSurfacelessContextSupported(isSurfacelessContextSupported);
 
-  mEglContextHelper->Initialize( mEglImplementation.get() ); // The context helper impl needs the EglContext
+  RenderSurfaceInterface* currentSurface = nullptr;
+  if(isSurfacelessContextSupported)
+  {
+    // Create a surfaceless OpenGL context for shared resources
+    mEglImplementation->CreateContext();
+    mEglImplementation->MakeContextCurrent(EGL_NO_SURFACE, mEglImplementation->GetContext());
+  }
+  else
+  {
+    currentSurface = surface;
+    if(currentSurface)
+    {
+      currentSurface->InitializeGraphics();
+      currentSurface->MakeContextCurrent();
+    }
+  }
 
-  return mEglImplementation.get();
+  mGLES->ContextCreated();
+  SetGlesVersion(mGLES->GetGlesVersion());
+}
+
+void EglGraphics::Shutdown()
+{
+  mEglImplementation->TerminateGles();
 }
 
 void EglGraphics::Destroy()
@@ -106,41 +161,52 @@ GlImplementation& EglGraphics::GetGlesInterface()
 
 Integration::GlAbstraction& EglGraphics::GetGlAbstraction() const
 {
-  DALI_ASSERT_DEBUG( mGLES && "GLImplementation not created" );
+  DALI_ASSERT_DEBUG(mGLES && "GLImplementation not created");
   return *mGLES;
 }
 
 EglImplementation& EglGraphics::GetEglImplementation() const
 {
-  DALI_ASSERT_DEBUG( mEglImplementation && "EGLImplementation not created" );
+  DALI_ASSERT_DEBUG(mEglImplementation && "EGLImplementation not created");
   return *mEglImplementation;
 }
 
 EglInterface& EglGraphics::GetEglInterface() const
 {
-  DALI_ASSERT_DEBUG( mEglImplementation && "EGLImplementation not created" );
+  DALI_ASSERT_DEBUG(mEglImplementation && "EGLImplementation not created");
   EglInterface* eglInterface = mEglImplementation.get();
   return *eglInterface;
 }
 
 EglSyncImplementation& EglGraphics::GetSyncImplementation()
 {
-  DALI_ASSERT_DEBUG( mEglSync && "EglSyncImplementation not created" );
+  DALI_ASSERT_DEBUG(mEglSync && "EglSyncImplementation not created");
   return *mEglSync;
 }
 
 EglContextHelperImplementation& EglGraphics::GetContextHelperImplementation()
 {
-  DALI_ASSERT_DEBUG( mEglContextHelper && "EglContextHelperImplementation not created" );
+  DALI_ASSERT_DEBUG(mEglContextHelper && "EglContextHelperImplementation not created");
   return *mEglContextHelper;
 }
 
 EglImageExtensions* EglGraphics::GetImageExtensions()
 {
-  DALI_ASSERT_DEBUG( mEglImageExtensions && "EglImageExtensions not created" );
+  DALI_ASSERT_DEBUG(mEglImageExtensions && "EglImageExtensions not created");
   return mEglImageExtensions.get();
 }
 
-} // Adaptor
-} // Internal
-} // Dali
+Graphics::Controller& EglGraphics::GetController()
+{
+  return mGraphicsController;
+}
+
+void EglGraphics::CacheConfigurations(ConfigurationManager& configurationManager)
+{
+  mGLES->SetIsAdvancedBlendEquationSupported(configurationManager.IsAdvancedBlendEquationSupported());
+  mGLES->SetShadingLanguageVersion(configurationManager.GetShadingLanguageVersion());
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
index 7476f94..68e2ab3 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_BASE_GRAPHICS_IMPLEMENTATION_H
 
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 #include <dali/integration-api/adaptor-framework/egl-interface.h>
 #include <dali/internal/graphics/common/egl-image-extensions.h>
 #include <dali/internal/graphics/common/graphics-interface.h>
-#include <dali/internal/graphics/gles/gl-implementation.h>
-#include <dali/internal/graphics/gles/gl-proxy-implementation.h>
 #include <dali/internal/graphics/gles/egl-context-helper-implementation.h>
+#include <dali/internal/graphics/gles/egl-graphics-controller.h>
 #include <dali/internal/graphics/gles/egl-implementation.h>
 #include <dali/internal/graphics/gles/egl-sync-implementation.h>
+#include <dali/internal/graphics/gles/gl-implementation.h>
+#include <dali/internal/graphics/gles/gl-proxy-implementation.h>
 
 namespace Dali
 {
-
 namespace Internal
 {
-
 namespace Adaptor
 {
+class EnvironmentOptions;
+class ConfigurationManager;
 
 class EglGraphics : public GraphicsInterface
 {
 public:
-
   /**
    * Constructor
    */
-  EglGraphics();
+  EglGraphics(EnvironmentOptions& environmentOptions);
 
   /**
    * Destructor
@@ -54,33 +54,40 @@ public:
   /**
    * @copydoc Dali::Internal::Adaptor::GraphicsInterface::Initialize()
    */
-  void Initialize( EnvironmentOptions* environmentOptions ) override;
+  void Initialize() override;
 
   /**
-   * Initialize the graphics interface with specific input parameters
-   * @param[in]  depth  The flag to enable depth buffer
-   * @param[in]  stencil  The flag to enable stencil buffer
-   * @param[in]  msaa  The value of multi sampleing bit
+   * @copydoc Dali::Internal::Adaptor::GraphicsInterface::Initialize(bool,bool,bool,int)
    */
-  void Initialize( bool depth, bool stencil, int msaa );
+  void Initialize(bool depth, bool stencil, bool partialRendering, int msaa);
 
   /**
-   * Creates the graphics interface for EGL
-   * @return The graphics interface for EGL
+   * @copydoc Dali::Internal::Adaptor::GraphicsInterface::ConfigureSurface()
    */
-  EglInterface* Create();
+  void ConfigureSurface(Dali::RenderSurfaceInterface* surface) override;
 
   /**
    * Set gles version
    * Default version is gles 3.0
    */
-  void SetGlesVersion( const int32_t glesVersion );
+  void SetGlesVersion(const int32_t glesVersion);
 
   /**
    * Set whether the surfaceless context is supported
    * @param[in] isSupported Whether the surfaceless context is supported
    */
-  void SetIsSurfacelessContextSupported( const bool isSupported );
+  void SetIsSurfacelessContextSupported(const bool isSupported);
+
+  /**
+   * Activate the resource context (shared surfaceless context)
+   */
+  void ActivateResourceContext() override;
+
+  /**
+   * Inform graphics interface that this is the first frame after a resume.
+   * (For debug only)
+   */
+  void SetFirstFrameAfterResume() override;
 
   /**
    * Gets the GL abstraction
@@ -134,24 +141,66 @@ public:
   EglImageExtensions* GetImageExtensions();
 
   /**
+   * @copydoc Dali::Internal::Adaptor::GraphicsInterface::Shutdown()
+   */
+  void Shutdown() override;
+
+  /**
    * @copydoc Dali::Internal::Adaptor::GraphicsInterface::Destroy()
    */
   void Destroy() override;
 
+  Graphics::Controller& GetController() override;
+
+  bool IsAdvancedBlendEquationSupported() override
+  {
+    return mGLES->IsAdvancedBlendEquationSupported();
+  }
+
+  /**
+   * @return true if graphics subsystem is initialized
+   */
+  bool IsInitialized() override
+  {
+    return mEglImplementation->IsGlesInitialized();
+  }
+
+  bool IsResourceContextSupported() override
+  {
+    return mEglImplementation->IsSurfacelessContextSupported();
+  }
+
+  uint32_t GetMaxTextureSize() override
+  {
+    return mGLES->GetMaxTextureSize();
+  }
+
+  uint32_t GetShaderLanguageVersion() override
+  {
+    return mGLES->GetShadingLanguageVersion();
+  }
+
+  void CacheConfigurations(ConfigurationManager& configurationManager) override;
+
 private:
   // Eliminate copy and assigned operations
   EglGraphics(const EglGraphics& rhs) = delete;
   EglGraphics& operator=(const EglGraphics& rhs) = delete;
 
+  /**
+   * Initialize graphics subsystems
+   */
+  void EglInitialize();
 
 private:
-  std::unique_ptr< GlImplementation > mGLES;                    ///< GL implementation
-  std::unique_ptr< EglImplementation > mEglImplementation;      ///< EGL implementation
-  std::unique_ptr< EglImageExtensions > mEglImageExtensions;    ///< EGL image extension
-  std::unique_ptr< EglSyncImplementation > mEglSync;            ///< GlSyncAbstraction implementation for EGL
-  std::unique_ptr< EglContextHelperImplementation > mEglContextHelper; ///< GlContextHelperAbstraction implementation for EGL
-
-  int mMultiSamplingLevel;                                      ///< The multiple sampling level
+  Graphics::EglGraphicsController                 mGraphicsController; ///< Graphics Controller for Dali Core
+  std::unique_ptr<GlImplementation>               mGLES;               ///< GL implementation
+  std::unique_ptr<EglImplementation>              mEglImplementation;  ///< EGL implementation
+  std::unique_ptr<EglImageExtensions>             mEglImageExtensions; ///< EGL image extension
+  std::unique_ptr<EglSyncImplementation>          mEglSync;            ///< GlSyncAbstraction implementation for EGL
+  std::unique_ptr<EglContextHelperImplementation> mEglContextHelper;   ///< GlContextHelperAbstraction implementation for EGL
+
+  int mMultiSamplingLevel; ///< The multiple sampling level
 };
 
 } // namespace Adaptor
index ae87def..a9c31e7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 
 namespace
 {
-const int NUM_FRAMES_PER_SECOND( 60 );
+const int NUM_FRAMES_PER_SECOND(60);
 }
 
-
 namespace Dali
 {
 namespace Internal
 {
 namespace Adaptor
 {
-
-Sampler::Sampler( const char* description )
-: mDescription( description ),
-  mAccumulatedSquare( 0 ),
-  mAccumulated( 0 ),
-  mNumSamples( 0 ),
-  mMin( 0.0f ),
-  mMax( 0.0f ),
-  mCurrentFrameCount( 0 )
+Sampler::Sampler(const char* description)
+: mDescription(description),
+  mAccumulatedSquare(0),
+  mAccumulated(0),
+  mNumSamples(0),
+  mMin(0.0f),
+  mMax(0.0f),
+  mCurrentFrameCount(0)
 {
 }
 
@@ -58,27 +56,27 @@ void Sampler::Increment()
 void Sampler::Reset()
 {
   mAccumulatedSquare = 0;
-  mAccumulated = 0;
-  mNumSamples = 0;
-  mMin = 0.0f;
-  mMax = 0.0f;
+  mAccumulated       = 0;
+  mNumSamples        = 0;
+  mMin               = 0.0f;
+  mMax               = 0.0f;
   mCurrentFrameCount = 0;
 }
 
 void Sampler::Accumulate()
 {
-  if( mNumSamples == 0 )
+  if(mNumSamples == 0)
   {
     mMin = mCurrentFrameCount;
     mMax = mCurrentFrameCount;
   }
   else
   {
-    if( mCurrentFrameCount < mMin )
+    if(mCurrentFrameCount < mMin)
     {
       mMin = mCurrentFrameCount;
     }
-    if( mCurrentFrameCount > mMax )
+    if(mCurrentFrameCount > mMax)
     {
       mMax = mCurrentFrameCount;
     }
@@ -87,7 +85,7 @@ void Sampler::Accumulate()
   mNumSamples++;
 
   mAccumulated += mCurrentFrameCount;
-  mAccumulatedSquare += ( mCurrentFrameCount * mCurrentFrameCount );
+  mAccumulatedSquare += (mCurrentFrameCount * mCurrentFrameCount);
   mCurrentFrameCount = 0;
 }
 const char* Sampler::GetDescription() const
@@ -98,9 +96,9 @@ const char* Sampler::GetDescription() const
 float Sampler::GetMeanValue() const
 {
   float meanValue = 0;
-  if( mNumSamples > 0 )
+  if(mNumSamples > 0)
   {
-    meanValue = static_cast<double>( mAccumulated ) / static_cast<double>( mNumSamples );
+    meanValue = static_cast<double>(mAccumulated) / static_cast<double>(mNumSamples);
   }
   return meanValue;
 }
@@ -108,9 +106,9 @@ float Sampler::GetMeanValue() const
 float Sampler::GetStandardDeviation() const
 {
   float standardDeviation = 0.0f;
-  if( mNumSamples > 0 )
+  if(mNumSamples > 0)
   {
-    standardDeviation = sqrtf( mNumSamples * mAccumulatedSquare - ( mAccumulated * mAccumulated ) ) / mNumSamples;
+    standardDeviation = sqrtf(mNumSamples * mAccumulatedSquare - (mAccumulated * mAccumulated)) / mNumSamples;
   }
   return standardDeviation;
 }
@@ -130,16 +128,17 @@ uint64_t Sampler::GetCount() const
   return mAccumulated;
 }
 
-ObjectCounter::ObjectCounter( const char* description )
-: mDescription( description ),
-  mCount( 0 ),
-  mPeak( 0 )
-{}
+ObjectCounter::ObjectCounter(const char* description)
+: mDescription(description),
+  mCount(0),
+  mPeak(0)
+{
+}
 
 void ObjectCounter::Increment()
 {
   ++mCount;
-  if( mCount > mPeak )
+  if(mCount > mPeak)
   {
     mPeak = mCount;
   }
@@ -164,20 +163,20 @@ const char* ObjectCounter::GetDescription() const
   return mDescription;
 }
 
-GlProxyImplementation::GlProxyImplementation( EnvironmentOptions& environmentOptions )
-: mEnvironmentOptions( environmentOptions ),
-  mActiveTextureSampler( "ActiveTexture calls" ),
-  mClearSampler( "Clear calls" ),
-  mBindBufferSampler( "Bind buffers" ),
-  mBindTextureSampler( "Bind textures" ),
-  mDrawSampler( "Draw calls" ),
-  mUniformSampler( "Uniform sets" ),
-  mUseProgramSampler( "Used programs" ),
-  mBufferCount( "Buffer Count" ),
-  mTextureCount( "Texture Count" ),
-  mProgramCount( "Program Count" ),
-  mCurrentFrameCount( 0 ),
-  mTotalFrameCount( 0 )
+GlProxyImplementation::GlProxyImplementation(const EnvironmentOptions& environmentOptions)
+: mEnvironmentOptions(environmentOptions),
+  mActiveTextureSampler("ActiveTexture calls"),
+  mClearSampler("Clear calls"),
+  mBindBufferSampler("Bind buffers"),
+  mBindTextureSampler("Bind textures"),
+  mDrawSampler("Draw calls"),
+  mUniformSampler("Uniform sets"),
+  mUseProgramSampler("Used programs"),
+  mBufferCount("Buffer Count"),
+  mTextureCount("Texture Count"),
+  mProgramCount("Program Count"),
+  mCurrentFrameCount(0),
+  mTotalFrameCount(0)
 {
 }
 
@@ -198,19 +197,19 @@ void GlProxyImplementation::PostRender()
   mTotalFrameCount++;
   mCurrentFrameCount++;
 
-  if( mCurrentFrameCount >= mEnvironmentOptions.GetGlesCallTime() * NUM_FRAMES_PER_SECOND )
+  if(mCurrentFrameCount >= mEnvironmentOptions.GetGlesCallTime() * NUM_FRAMES_PER_SECOND)
   {
     mCurrentFrameCount = 0;
     LogResults();
 
-    if( !mEnvironmentOptions.GetGlesCallAccumulate() )
+    if(!mEnvironmentOptions.GetGlesCallAccumulate())
     {
       ResetSamplers();
     }
   }
 }
 
-void GlProxyImplementation::Clear( GLbitfield mask )
+void GlProxyImplementation::Clear(GLbitfield mask)
 {
   mClearSampler.Increment();
   GlImplementation::Clear(mask);
@@ -219,187 +218,187 @@ void GlProxyImplementation::Clear( GLbitfield mask )
 void GlProxyImplementation::GenBuffers(GLsizei n, GLuint* buffers)
 {
   mBufferCount.Increment();
-  GlImplementation::GenBuffers( n, buffers );
+  GlImplementation::GenBuffers(n, buffers);
 }
 
-void GlProxyImplementation::DeleteBuffers( GLsizei n, const GLuint* buffers )
+void GlProxyImplementation::DeleteBuffers(GLsizei n, const GLuint* buffers)
 {
   mBufferCount.Decrement();
-  GlImplementation::DeleteBuffers( n, buffers );
+  GlImplementation::DeleteBuffers(n, buffers);
 }
 
-void GlProxyImplementation::BindBuffer( GLenum target, GLuint buffer )
+void GlProxyImplementation::BindBuffer(GLenum target, GLuint buffer)
 {
   mBindBufferSampler.Increment();
-  GlImplementation::BindBuffer( target, buffer );
+  GlImplementation::BindBuffer(target, buffer);
 }
 
-void GlProxyImplementation::GenTextures( GLsizei n, GLuint* textures )
+void GlProxyImplementation::GenTextures(GLsizei n, GLuint* textures)
 {
   mTextureCount.Increment();
-  GlImplementation::GenTextures( n, textures );
+  GlImplementation::GenTextures(n, textures);
 }
 
-void GlProxyImplementation::DeleteTextures( GLsizei n, const GLuint* textures )
+void GlProxyImplementation::DeleteTextures(GLsizei n, const GLuint* textures)
 {
   mTextureCount.Decrement();
-  GlImplementation::DeleteTextures( n, textures );
+  GlImplementation::DeleteTextures(n, textures);
 }
 
-void GlProxyImplementation::ActiveTexture( GLenum texture )
+void GlProxyImplementation::ActiveTexture(GLenum texture)
 {
   mActiveTextureSampler.Increment();
-  GlImplementation::ActiveTexture( texture );
+  GlImplementation::ActiveTexture(texture);
 }
 
-void GlProxyImplementation::BindTexture( GLenum target, GLuint texture )
+void GlProxyImplementation::BindTexture(GLenum target, GLuint texture)
 {
   mBindTextureSampler.Increment();
-  GlImplementation::BindTexture(target,texture);
+  GlImplementation::BindTexture(target, texture);
 }
 
-void GlProxyImplementation::DrawArrays( GLenum mode, GLint first, GLsizei count )
+void GlProxyImplementation::DrawArrays(GLenum mode, GLint first, GLsizei count)
 {
   mDrawSampler.Increment();
-  GlImplementation::DrawArrays( mode, first, count );
+  GlImplementation::DrawArrays(mode, first, count);
 }
 
-void GlProxyImplementation::DrawElements( GLenum mode, GLsizei count, GLenum type, const void* indices )
+void GlProxyImplementation::DrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices)
 {
   mDrawSampler.Increment();
-  GlImplementation::DrawElements( mode, count, type, indices );
+  GlImplementation::DrawElements(mode, count, type, indices);
 }
 
-void GlProxyImplementation::Uniform1f( GLint location, GLfloat x )
+void GlProxyImplementation::Uniform1f(GLint location, GLfloat x)
 {
   mUniformSampler.Increment();
-  GlImplementation::Uniform1f( location, x );
+  GlImplementation::Uniform1f(location, x);
 }
 
-void GlProxyImplementation::Uniform1fv( GLint location, GLsizei count, const GLfloat* v )
+void GlProxyImplementation::Uniform1fv(GLint location, GLsizei count, const GLfloat* v)
 {
   mUniformSampler.Increment();
-  GlImplementation::Uniform1fv( location, count, v );
+  GlImplementation::Uniform1fv(location, count, v);
 }
 
-void GlProxyImplementation::Uniform1i( GLint location, GLint x )
+void GlProxyImplementation::Uniform1i(GLint location, GLint x)
 {
   mUniformSampler.Increment();
-  GlImplementation::Uniform1i( location, x );
+  GlImplementation::Uniform1i(location, x);
 }
 
-void GlProxyImplementation::Uniform1iv( GLint location, GLsizei count, const GLint* v )
+void GlProxyImplementation::Uniform1iv(GLint location, GLsizei count, const GLint* v)
 {
   mUniformSampler.Increment();
-  GlImplementation::Uniform1iv( location, count, v );
+  GlImplementation::Uniform1iv(location, count, v);
 }
 
-void GlProxyImplementation::Uniform2f( GLint location, GLfloat x, GLfloat y)
+void GlProxyImplementation::Uniform2f(GLint location, GLfloat x, GLfloat y)
 {
   mUniformSampler.Increment();
-  GlImplementation::Uniform2f( location, x, y );
+  GlImplementation::Uniform2f(location, x, y);
 }
 
-void GlProxyImplementation::Uniform2fv( GLint location, GLsizei count, const GLfloat* v )
+void GlProxyImplementation::Uniform2fv(GLint location, GLsizei count, const GLfloat* v)
 {
   mUniformSampler.Increment();
-  GlImplementation::Uniform2fv( location, count, v );
+  GlImplementation::Uniform2fv(location, count, v);
 }
 
-void GlProxyImplementation::Uniform2i( GLint location, GLint x, GLint y )
+void GlProxyImplementation::Uniform2i(GLint location, GLint x, GLint y)
 {
   mUniformSampler.Increment();
-  GlImplementation::Uniform2i( location, x, y );
+  GlImplementation::Uniform2i(location, x, y);
 }
 
-void GlProxyImplementation::Uniform2iv( GLint location, GLsizei count, const GLint* v )
+void GlProxyImplementation::Uniform2iv(GLint location, GLsizei count, const GLint* v)
 {
   mUniformSampler.Increment();
-  GlImplementation::Uniform2iv( location, count, v );
+  GlImplementation::Uniform2iv(location, count, v);
 }
 
-void GlProxyImplementation::Uniform3f( GLint location, GLfloat x, GLfloat y, GLfloat z )
+void GlProxyImplementation::Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
 {
   mUniformSampler.Increment();
-  GlImplementation::Uniform3f( location, x, y, z );
+  GlImplementation::Uniform3f(location, x, y, z);
 }
 
-void GlProxyImplementation::Uniform3fv( GLint location, GLsizei count, const GLfloat* v )
+void GlProxyImplementation::Uniform3fv(GLint location, GLsizei count, const GLfloat* v)
 {
   mUniformSampler.Increment();
-  GlImplementation::Uniform3fv( location, count, v );
+  GlImplementation::Uniform3fv(location, count, v);
 }
 
-void GlProxyImplementation::Uniform3i( GLint location, GLint x, GLint y, GLint z )
+void GlProxyImplementation::Uniform3i(GLint location, GLint x, GLint y, GLint z)
 {
   mUniformSampler.Increment();
-  GlImplementation::Uniform3i( location, x, y, z );
+  GlImplementation::Uniform3i(location, x, y, z);
 }
 
-void GlProxyImplementation::Uniform3iv( GLint location, GLsizei count, const GLint* v )
+void GlProxyImplementation::Uniform3iv(GLint location, GLsizei count, const GLint* v)
 {
   mUniformSampler.Increment();
-  GlImplementation::Uniform3iv( location, count, v );
+  GlImplementation::Uniform3iv(location, count, v);
 }
 
-void GlProxyImplementation::Uniform4f( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+void GlProxyImplementation::Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 {
   mUniformSampler.Increment();
-  GlImplementation::Uniform4f( location, x, y, z, w );
+  GlImplementation::Uniform4f(location, x, y, z, w);
 }
 
-void GlProxyImplementation::Uniform4fv( GLint location, GLsizei count, const GLfloat* v )
+void GlProxyImplementation::Uniform4fv(GLint location, GLsizei count, const GLfloat* v)
 {
   mUniformSampler.Increment();
-  GlImplementation::Uniform4fv( location, count, v );
+  GlImplementation::Uniform4fv(location, count, v);
 }
 
-void GlProxyImplementation::Uniform4i( GLint location, GLint x, GLint y, GLint z, GLint w )
+void GlProxyImplementation::Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
 {
   mUniformSampler.Increment();
-  GlImplementation::Uniform4i( location, x, y, z, w );
+  GlImplementation::Uniform4i(location, x, y, z, w);
 }
 
-void GlProxyImplementation::Uniform4iv( GLint location, GLsizei count, const GLint* v )
+void GlProxyImplementation::Uniform4iv(GLint location, GLsizei count, const GLint* v)
 {
   mUniformSampler.Increment();
-  GlImplementation::Uniform4iv( location, count, v );
+  GlImplementation::Uniform4iv(location, count, v);
 }
 
-void GlProxyImplementation::UniformMatrix2fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value )
+void GlProxyImplementation::UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
 {
   mUniformSampler.Increment();
-  GlImplementation::UniformMatrix2fv( location, count, transpose, value );
+  GlImplementation::UniformMatrix2fv(location, count, transpose, value);
 }
 
-void GlProxyImplementation::UniformMatrix3fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value )
+void GlProxyImplementation::UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
 {
   mUniformSampler.Increment();
-  GlImplementation::UniformMatrix3fv( location, count, transpose, value );
+  GlImplementation::UniformMatrix3fv(location, count, transpose, value);
 }
 
-void GlProxyImplementation::UniformMatrix4fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value )
+void GlProxyImplementation::UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
 {
   mUniformSampler.Increment();
-  GlImplementation::UniformMatrix4fv( location, count, transpose, value);
+  GlImplementation::UniformMatrix4fv(location, count, transpose, value);
 }
 
-GLuint GlProxyImplementation::CreateProgram( void )
+GLuint GlProxyImplementation::CreateProgram(void)
 {
   mProgramCount.Increment();
   return GlImplementation::CreateProgram();
 }
 
-void GlProxyImplementation::DeleteProgram( GLuint program )
+void GlProxyImplementation::DeleteProgram(GLuint program)
 {
   mProgramCount.Decrement();
-  GlImplementation::DeleteProgram( program );
+  GlImplementation::DeleteProgram(program);
 }
 
-void GlProxyImplementation::UseProgram( GLuint program )
+void GlProxyImplementation::UseProgram(GLuint program)
 {
   mUseProgramSampler.Increment();
-  GlImplementation::UseProgram( program );
+  GlImplementation::UseProgram(program);
 }
 
 void GlProxyImplementation::AccumulateSamples()
@@ -416,35 +415,28 @@ void GlProxyImplementation::AccumulateSamples()
 
 void GlProxyImplementation::LogResults()
 {
-  Debug::LogMessage( Debug::DebugInfo, "OpenGL ES statistics sampled over %d frames) operations per frame:\n", mTotalFrameCount );
-  LogCalls( mActiveTextureSampler );
-  LogCalls( mClearSampler );
-  LogCalls( mBindBufferSampler );
-  LogCalls( mBindTextureSampler );
-  LogCalls( mDrawSampler );
-  LogCalls( mUniformSampler );
-  LogCalls( mUseProgramSampler );
-  Debug::LogMessage( Debug::DebugInfo, "OpenGL ES Object Count:\n" );
-  LogObjectCounter( mBufferCount );
-  LogObjectCounter( mTextureCount );
-  LogObjectCounter( mProgramCount );
+  Debug::LogMessage(Debug::DebugInfo, "OpenGL ES statistics sampled over %d frames) operations per frame:\n", mTotalFrameCount);
+  LogCalls(mActiveTextureSampler);
+  LogCalls(mClearSampler);
+  LogCalls(mBindBufferSampler);
+  LogCalls(mBindTextureSampler);
+  LogCalls(mDrawSampler);
+  LogCalls(mUniformSampler);
+  LogCalls(mUseProgramSampler);
+  Debug::LogMessage(Debug::DebugInfo, "OpenGL ES Object Count:\n");
+  LogObjectCounter(mBufferCount);
+  LogObjectCounter(mTextureCount);
+  LogObjectCounter(mProgramCount);
 }
 
-void GlProxyImplementation::LogCalls( const Sampler& sampler )
+void GlProxyImplementation::LogCalls(const Sampler& sampler)
 {
-  Debug::LogMessage( Debug::DebugInfo, "  %s : Mean %5.2f  (Min:%5.2f, Max:%5.2f, StdDev:%5.2f, Actual:%d)\n",
-                     sampler.GetDescription(),
-                     sampler.GetMeanValue(), sampler.GetMin(), sampler.GetMax(),
-                     sampler.GetStandardDeviation(),
-                     sampler.GetCount() );
+  Debug::LogMessage(Debug::DebugInfo, "  %s : Mean %5.2f  (Min:%5.2f, Max:%5.2f, StdDev:%5.2f, Actual:%d)\n", sampler.GetDescription(), sampler.GetMeanValue(), sampler.GetMin(), sampler.GetMax(), sampler.GetStandardDeviation(), sampler.GetCount());
 }
 
-void GlProxyImplementation::LogObjectCounter( const ObjectCounter& sampler )
+void GlProxyImplementation::LogObjectCounter(const ObjectCounter& sampler)
 {
-  Debug::LogMessage( Debug::DebugInfo, "  %s : %u  (Peak:%u)\n",
-                     sampler.GetDescription(),
-                     sampler.GetCount(),
-                     sampler.GetPeak() );
+  Debug::LogMessage(Debug::DebugInfo, "  %s : %u  (Peak:%u)\n", sampler.GetDescription(), sampler.GetCount(), sampler.GetPeak());
 }
 
 void GlProxyImplementation::ResetSamplers()
index 626a797..6091440 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_GL_PROXY_IMPLEMENTATION_H
 
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -35,12 +35,11 @@ class EnvironmentOptions;
 class Sampler
 {
 public:
-
   /**
    * Constructor
    * @param description to write to the log
    */
-  Sampler( const char* description );
+  Sampler(const char* description);
 
   /**
    * Increment the counter for this frame
@@ -88,14 +87,13 @@ public:
   uint64_t GetCount() const;
 
 private: // Data
-
   const char* mDescription;
 
-  uint64_t mAccumulatedSquare;
-  uint64_t mAccumulated;
-  uint64_t mNumSamples;
-  float mMin;
-  float mMax;
+  uint64_t     mAccumulatedSquare;
+  uint64_t     mAccumulated;
+  uint64_t     mNumSamples;
+  float        mMin;
+  float        mMax;
   unsigned int mCurrentFrameCount;
 };
 
@@ -105,7 +103,7 @@ private: // Data
 class ObjectCounter
 {
 public:
-  ObjectCounter( const char* description );
+  ObjectCounter(const char* description);
 
   /**
    * Increment the counter
@@ -133,7 +131,7 @@ public:
   const char* GetDescription() const;
 
 private:
-  const char* mDescription;
+  const char*  mDescription;
   unsigned int mCount;
   unsigned int mPeak;
 };
@@ -145,12 +143,11 @@ private:
 class GlProxyImplementation : public GlImplementation
 {
 public:
-
   /**
    * Constructor
    * @param environmentOptions to check how often to log results
    */
-  GlProxyImplementation( EnvironmentOptions& environmentOptions );
+  GlProxyImplementation(const EnvironmentOptions& environmentOptions);
 
   /**
    * Virtual destructor
@@ -168,65 +165,63 @@ public:
   void PostRender() override;
 
   /* OpenGL ES 2.0 API */
-  void Clear( GLbitfield mask ) override;
-
-  void GenBuffers( GLsizei n, GLuint* buffers ) override;
-  void DeleteBuffers( GLsizei n, const GLuint* buffers ) override;
-  void BindBuffer( GLenum target, GLuint buffer ) override;
-
-  void GenTextures( GLsizei n, GLuint* textures ) override;
-  void DeleteTextures( GLsizei n, const GLuint* textures ) override;
-  void ActiveTexture( GLenum texture ) override;
-  void BindTexture( GLenum target, GLuint texture ) override;
-
-  void DrawArrays( GLenum mode, GLint first, GLsizei count ) override;
-  void DrawElements( GLenum mode, GLsizei count, GLenum type, const void* indices ) override;
-
-  void Uniform1f ( GLint location, GLfloat x ) override;
-  void Uniform1fv( GLint location, GLsizei count, const GLfloat* v ) override;
-  void Uniform1i ( GLint location, GLint x ) override;
-  void Uniform1iv( GLint location, GLsizei count, const GLint* v ) override;
-  void Uniform2f ( GLint location, GLfloat x, GLfloat y ) override;
-  void Uniform2fv( GLint location, GLsizei count, const GLfloat* v ) override;
-  void Uniform2i ( GLint location, GLint x, GLint y ) override;
-  void Uniform2iv( GLint location, GLsizei count, const GLint* v ) override;
-  void Uniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z ) override;
-  void Uniform3fv( GLint location, GLsizei count, const GLfloat* v ) override;
-  void Uniform3i ( GLint location, GLint x, GLint y, GLint z ) override;
-  void Uniform3iv( GLint location, GLsizei count, const GLint* v ) override;
-  void Uniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) override;
-  void Uniform4fv( GLint location, GLsizei count, const GLfloat* v ) override;
-  void Uniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w ) override;
-  void Uniform4iv( GLint location, GLsizei count, const GLint* v ) override;
-  void UniformMatrix2fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ) override;
-  void UniformMatrix3fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ) override;
-  void UniformMatrix4fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ) override;
-
-  GLuint CreateProgram( void ) override;
-  void DeleteProgram( GLuint program ) override;
-  void UseProgram( GLuint program ) override;
+  void Clear(GLbitfield mask) override;
+
+  void GenBuffers(GLsizei n, GLuint* buffers) override;
+  void DeleteBuffers(GLsizei n, const GLuint* buffers) override;
+  void BindBuffer(GLenum target, GLuint buffer) override;
+
+  void GenTextures(GLsizei n, GLuint* textures) override;
+  void DeleteTextures(GLsizei n, const GLuint* textures) override;
+  void ActiveTexture(GLenum texture) override;
+  void BindTexture(GLenum target, GLuint texture) override;
+
+  void DrawArrays(GLenum mode, GLint first, GLsizei count) override;
+  void DrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices) override;
+
+  void Uniform1f(GLint location, GLfloat x) override;
+  void Uniform1fv(GLint location, GLsizei count, const GLfloat* v) override;
+  void Uniform1i(GLint location, GLint x) override;
+  void Uniform1iv(GLint location, GLsizei count, const GLint* v) override;
+  void Uniform2f(GLint location, GLfloat x, GLfloat y) override;
+  void Uniform2fv(GLint location, GLsizei count, const GLfloat* v) override;
+  void Uniform2i(GLint location, GLint x, GLint y) override;
+  void Uniform2iv(GLint location, GLsizei count, const GLint* v) override;
+  void Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) override;
+  void Uniform3fv(GLint location, GLsizei count, const GLfloat* v) override;
+  void Uniform3i(GLint location, GLint x, GLint y, GLint z) override;
+  void Uniform3iv(GLint location, GLsizei count, const GLint* v) override;
+  void Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) override;
+  void Uniform4fv(GLint location, GLsizei count, const GLfloat* v) override;
+  void Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) override;
+  void Uniform4iv(GLint location, GLsizei count, const GLint* v) override;
+  void UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override;
+  void UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override;
+  void UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override;
+
+  GLuint CreateProgram(void) override;
+  void   DeleteProgram(GLuint program) override;
+  void   UseProgram(GLuint program) override;
 
 private: // Helpers
-
   void AccumulateSamples();
   void LogResults();
-  void LogCalls( const Sampler& sampler );
-  void LogObjectCounter( const ObjectCounter& sampler );
+  void LogCalls(const Sampler& sampler);
+  void LogObjectCounter(const ObjectCounter& sampler);
   void ResetSamplers();
 
 private: // Data
-
-  EnvironmentOptions& mEnvironmentOptions;
-  Sampler mActiveTextureSampler;
-  Sampler mClearSampler;
-  Sampler mBindBufferSampler;
-  Sampler mBindTextureSampler;
-  Sampler mDrawSampler;
-  Sampler mUniformSampler;
-  Sampler mUseProgramSampler;
-  ObjectCounter mBufferCount;
-  ObjectCounter mTextureCount;
-  ObjectCounter mProgramCount;
+  const EnvironmentOptions& mEnvironmentOptions;
+  Sampler                   mActiveTextureSampler;
+  Sampler                   mClearSampler;
+  Sampler                   mBindBufferSampler;
+  Sampler                   mBindTextureSampler;
+  Sampler                   mDrawSampler;
+  Sampler                   mUniformSampler;
+  Sampler                   mUseProgramSampler;
+  ObjectCounter             mBufferCount;
+  ObjectCounter             mTextureCount;
+  ObjectCounter             mProgramCount;
 
   int mCurrentFrameCount;
   int mTotalFrameCount;
index 8ab98aa..e587db8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 #include <dali/internal/system/common/configuration-manager.h>
 
 // EXTERNAL INCLUDES
-#include <fstream>
 #include <dali/integration-api/debug.h>
+#include <fstream>
 
 // INTERNAL INCLUDES
 #include <dali/devel-api/adaptor-framework/file-stream.h>
-#include <dali/internal/graphics/gles/egl-graphics.h>
+#include <dali/internal/graphics/common/graphics-interface.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";
+const std::string SYSTEM_CACHE_FILE                    = "gpu-environment.conf";
+const std::string DALI_ENV_MULTIPLE_WINDOW_SUPPORT     = "DALI_ENV_MULTIPLE_WINDOW_SUPPORT";
 const std::string DALI_BLEND_EQUATION_ADVANCED_SUPPORT = "DALI_BLEND_EQUATION_ADVANCED_SUPPORT";
-const std::string DALI_GLSL_VERSION = "DALI_GLSL_VERSION";
+const std::string DALI_GLSL_VERSION                    = "DALI_GLSL_VERSION";
 
-bool RetrieveKeyFromConfigFile( std::iostream& stream, const std::string& key, std::string& value )
+bool RetrieveKeyFromConfigFile(std::iostream& stream, const std::string& key, std::string& value)
 {
   bool keyFound = false;
 
   std::string line;
-  while( std::getline( stream, 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 == "" )
+    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::istringstream stream(line);
+    std::string        name;
     std::getline(stream, name, ' ');
-    if( name == key )
+    if(name == key)
     {
       std::getline(stream, value);
       keyFound = true;
@@ -74,21 +70,20 @@ bool RetrieveKeyFromConfigFile( std::iostream& stream, const std::string& key, s
   return keyFound;
 }
 
-
 } // unnamed namespace
 
-ConfigurationManager::ConfigurationManager( std::string systemCachePath, EglGraphics* eglGraphics, ThreadController* threadController )
-: mSystemCacheFilePath( systemCachePath + SYSTEM_CACHE_FILE ),
-  mEglGraphics( eglGraphics ),
-  mThreadController( threadController ),
-  mMaxTextureSize( 0u ),
-  mGlslVersion( 0u),
-  mIsMultipleWindowSupported( true ),
-  mIsAdvancedBlendEquationSupported( true ),
-  mMaxTextureSizeCached( false ),
-  mIsMultipleWindowSupportedCached( false ),
-  mIsAdvancedBlendEquationSupportedCached( false ),
-  mGlslVersionCached( false )
+ConfigurationManager::ConfigurationManager(std::string systemCachePath, GraphicsInterface* graphics, ThreadController* threadController)
+: mSystemCacheFilePath(systemCachePath + SYSTEM_CACHE_FILE),
+  mGraphics(graphics),
+  mThreadController(threadController),
+  mMaxTextureSize(0u),
+  mShaderLanguageVersion(0u),
+  mIsMultipleWindowSupported(true),
+  mIsAdvancedBlendEquationSupported(true),
+  mMaxTextureSizeCached(false),
+  mIsMultipleWindowSupportedCached(false),
+  mIsAdvancedBlendEquationSupportedCached(false),
+  mShaderLanguageVersionCached(false)
 {
 }
 
@@ -96,38 +91,38 @@ ConfigurationManager::~ConfigurationManager()
 {
 }
 
-void ConfigurationManager::RetrieveKeysFromConfigFile( const std::string& configFilePath )
+void ConfigurationManager::RetrieveKeysFromConfigFile(const std::string& configFilePath)
 {
-  Dali::FileStream configFile( configFilePath, Dali::FileStream::READ | Dali::FileStream::TEXT );
-  std::iostream& stream = configFile.GetStream();
-  if( stream.rdbuf()->in_avail() )
+  Dali::FileStream configFile(configFilePath, Dali::FileStream::READ | Dali::FileStream::TEXT);
+  std::iostream&   stream = configFile.GetStream();
+  if(stream.rdbuf()->in_avail())
   {
     std::string value;
-    if( !mMaxTextureSizeCached &&
-        RetrieveKeyFromConfigFile( stream, DALI_ENV_MAX_TEXTURE_SIZE, value ) )
+    if(!mMaxTextureSizeCached &&
+       RetrieveKeyFromConfigFile(stream, DALI_ENV_MAX_TEXTURE_SIZE, value))
     {
-      mMaxTextureSize = std::atoi( value.c_str() );
+      mMaxTextureSize       = std::atoi(value.c_str());
       mMaxTextureSizeCached = true;
     }
 
-    if( !mGlslVersionCached &&
-        RetrieveKeyFromConfigFile( stream, DALI_GLSL_VERSION, value ) )
+    if(!mShaderLanguageVersionCached &&
+       RetrieveKeyFromConfigFile(stream, DALI_GLSL_VERSION, value))
     {
-      mGlslVersion = std::atoi( value.c_str() );
-      mGlslVersionCached = true;
+      mShaderLanguageVersion       = std::atoi(value.c_str());
+      mShaderLanguageVersionCached = true;
     }
 
-    if( !mIsMultipleWindowSupportedCached &&
-        RetrieveKeyFromConfigFile( stream, DALI_ENV_MULTIPLE_WINDOW_SUPPORT, value ) )
+    if(!mIsMultipleWindowSupportedCached &&
+       RetrieveKeyFromConfigFile(stream, DALI_ENV_MULTIPLE_WINDOW_SUPPORT, value))
     {
-      mIsMultipleWindowSupported = std::atoi( value.c_str() );
+      mIsMultipleWindowSupported       = std::atoi(value.c_str());
       mIsMultipleWindowSupportedCached = true;
     }
 
-    if( !mIsAdvancedBlendEquationSupportedCached &&
-        RetrieveKeyFromConfigFile( stream, DALI_BLEND_EQUATION_ADVANCED_SUPPORT, value ) )
+    if(!mIsAdvancedBlendEquationSupportedCached &&
+       RetrieveKeyFromConfigFile(stream, DALI_BLEND_EQUATION_ADVANCED_SUPPORT, value))
     {
-      mIsAdvancedBlendEquationSupported = std::atoi( value.c_str() );
+      mIsAdvancedBlendEquationSupported       = std::atoi(value.c_str());
       mIsAdvancedBlendEquationSupportedCached = true;
     }
   }
@@ -135,25 +130,24 @@ void ConfigurationManager::RetrieveKeysFromConfigFile( const std::string& config
 
 uint32_t ConfigurationManager::GetMaxTextureSize()
 {
-  if( !mMaxTextureSizeCached )
+  if(!mMaxTextureSizeCached)
   {
-    RetrieveKeysFromConfigFile( mSystemCacheFilePath );
+    RetrieveKeysFromConfigFile(mSystemCacheFilePath);
 
-    if( !mMaxTextureSizeCached )
+    if(!mMaxTextureSizeCached)
     {
-      GlImplementation& mGLES = mEglGraphics->GetGlesInterface();
-      mMaxTextureSize = mGLES.GetMaxTextureSize();
+      mMaxTextureSize       = mGraphics->GetMaxTextureSize();
       mMaxTextureSizeCached = true;
 
-      Dali::FileStream configFile( mSystemCacheFilePath, Dali::FileStream::READ | Dali::FileStream::APPEND | Dali::FileStream::TEXT );
-      std::fstream& stream = dynamic_cast<std::fstream&>( configFile.GetStream() );
-      if( stream.is_open() )
+      Dali::FileStream configFile(mSystemCacheFilePath, Dali::FileStream::READ | Dali::FileStream::APPEND | Dali::FileStream::TEXT);
+      std::fstream&    stream = dynamic_cast<std::fstream&>(configFile.GetStream());
+      if(stream.is_open())
       {
         stream << DALI_ENV_MAX_TEXTURE_SIZE << " " << mMaxTextureSize << std::endl;
       }
       else
       {
-        DALI_LOG_ERROR( "Fail to open file : %s\n", mSystemCacheFilePath.c_str() );
+        DALI_LOG_ERROR("Fail to open file : %s\n", mSystemCacheFilePath.c_str());
       }
     }
   }
@@ -163,70 +157,68 @@ uint32_t ConfigurationManager::GetMaxTextureSize()
 
 uint32_t ConfigurationManager::GetShadingLanguageVersion()
 {
-  if ( !mGlslVersionCached )
+  if(!mShaderLanguageVersionCached)
   {
-    RetrieveKeysFromConfigFile( mSystemCacheFilePath );
+    RetrieveKeysFromConfigFile(mSystemCacheFilePath);
 
-    if ( !mGlslVersionCached )
+    if(!mShaderLanguageVersionCached)
     {
-      EglImplementation& eglImpl = mEglGraphics->GetEglImplementation();
-      if ( !eglImpl.IsGlesInitialized() )
+      if(!mGraphics->IsInitialized())
       {
-        // Wait until GLES is initialised, but this will happen once.
+        // Wait until Graphics Subsystem 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
-      mGlslVersion = mEglGraphics->GetGlesInterface().GetShadingLanguageVersion();
-      DALI_LOG_ERROR("mGlslVersion : %d\n", mGlslVersion);
-      mGlslVersionCached = true;
+      // Query from graphics and save the cache
+      mShaderLanguageVersion = mGraphics->GetShaderLanguageVersion();
+      DALI_LOG_ERROR("mShaderLanguageVersion : %d\n", mShaderLanguageVersion);
+      mShaderLanguageVersionCached = true;
 
-      Dali::FileStream configFile( mSystemCacheFilePath, Dali::FileStream::READ | Dali::FileStream::APPEND | Dali::FileStream::TEXT );
-      std::fstream& stream = dynamic_cast<std::fstream&>( configFile.GetStream() );
-      if ( stream.is_open() )
+      Dali::FileStream configFile(mSystemCacheFilePath, Dali::FileStream::READ | Dali::FileStream::APPEND | Dali::FileStream::TEXT);
+      std::fstream&    stream = dynamic_cast<std::fstream&>(configFile.GetStream());
+      if(stream.is_open())
       {
-        stream << DALI_GLSL_VERSION << " " << mGlslVersion << std::endl;
+        stream << DALI_GLSL_VERSION << " " << mShaderLanguageVersion << std::endl;
       }
       else
       {
-        DALI_LOG_ERROR( "Fail to open file : %s\n", mSystemCacheFilePath.c_str() );
+        DALI_LOG_ERROR("Fail to open file : %s\n", mSystemCacheFilePath.c_str());
       }
     }
   }
 
-  return mGlslVersion;
+  return mShaderLanguageVersion;
 }
 
 bool ConfigurationManager::IsMultipleWindowSupported()
 {
-  if ( !mIsMultipleWindowSupportedCached )
+  if(!mIsMultipleWindowSupportedCached)
   {
-    RetrieveKeysFromConfigFile( mSystemCacheFilePath );
+    RetrieveKeysFromConfigFile(mSystemCacheFilePath);
 
-    if ( !mIsMultipleWindowSupportedCached )
+    if(!mIsMultipleWindowSupportedCached)
     {
-      EglImplementation& eglImpl = mEglGraphics->GetEglImplementation();
-      if ( !eglImpl.IsGlesInitialized() )
+      if(!mGraphics->IsInitialized())
       {
-        // Wait until GLES is initialised, but this will happen once.
+        // Wait until Graphics Subsystem 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();
+      // Query from Graphics Subsystem and save the cache
+      mIsMultipleWindowSupported       = mGraphics->IsResourceContextSupported();
       mIsMultipleWindowSupportedCached = true;
 
-      Dali::FileStream configFile( mSystemCacheFilePath, Dali::FileStream::READ | Dali::FileStream::APPEND | Dali::FileStream::TEXT );
-      std::fstream& stream = dynamic_cast<std::fstream&>( configFile.GetStream() );
-      if ( stream.is_open() )
+      Dali::FileStream configFile(mSystemCacheFilePath, Dali::FileStream::READ | Dali::FileStream::APPEND | Dali::FileStream::TEXT);
+      std::fstream&    stream = dynamic_cast<std::fstream&>(configFile.GetStream());
+      if(stream.is_open())
       {
         stream << DALI_ENV_MULTIPLE_WINDOW_SUPPORT << " " << mIsMultipleWindowSupported << std::endl;
       }
       else
       {
-        DALI_LOG_ERROR( "Fail to open file : %s\n", mSystemCacheFilePath.c_str() );
+        DALI_LOG_ERROR("Fail to open file : %s\n", mSystemCacheFilePath.c_str());
       }
     }
   }
@@ -236,33 +228,32 @@ bool ConfigurationManager::IsMultipleWindowSupported()
 
 bool ConfigurationManager::IsAdvancedBlendEquationSupported()
 {
-  if ( !mIsAdvancedBlendEquationSupportedCached )
+  if(!mIsAdvancedBlendEquationSupportedCached)
   {
-    RetrieveKeysFromConfigFile( mSystemCacheFilePath );
+    RetrieveKeysFromConfigFile(mSystemCacheFilePath);
 
-    if ( !mIsAdvancedBlendEquationSupportedCached )
+    if(!mIsAdvancedBlendEquationSupportedCached)
     {
-      EglImplementation& eglImpl = mEglGraphics->GetEglImplementation();
-      if ( !eglImpl.IsGlesInitialized() )
+      if(!mGraphics->IsInitialized())
       {
-        // Wait until GLES is initialised, but this will happen once.
+        // Wait until graphics subsystem is initialised, but this will happen once per factory reset.
         // This method blocks until the render thread has initialised the graphics.
         mThreadController->WaitForGraphicsInitialization();
       }
 
-      // Query from GLES and save the cache
-      mIsAdvancedBlendEquationSupported = mEglGraphics->GetGlesInterface().IsAdvancedBlendEquationSupported();
+      // Query from Graphics Subsystem and save the cache
+      mIsAdvancedBlendEquationSupported       = mGraphics->IsAdvancedBlendEquationSupported();
       mIsAdvancedBlendEquationSupportedCached = true;
 
-      Dali::FileStream configFile( mSystemCacheFilePath, Dali::FileStream::READ | Dali::FileStream::APPEND | Dali::FileStream::TEXT );
-      std::fstream& stream = dynamic_cast<std::fstream&>( configFile.GetStream() );
-      if ( stream.is_open() )
+      Dali::FileStream configFile(mSystemCacheFilePath, Dali::FileStream::READ | Dali::FileStream::APPEND | Dali::FileStream::TEXT);
+      std::fstream&    stream = dynamic_cast<std::fstream&>(configFile.GetStream());
+      if(stream.is_open())
       {
         stream << DALI_BLEND_EQUATION_ADVANCED_SUPPORT << " " << mIsAdvancedBlendEquationSupported << std::endl;
       }
       else
       {
-        DALI_LOG_ERROR( "Fail to open file : %s\n", mSystemCacheFilePath.c_str() );
+        DALI_LOG_ERROR("Fail to open file : %s\n", mSystemCacheFilePath.c_str());
       }
     }
   }
@@ -270,8 +261,8 @@ bool ConfigurationManager::IsAdvancedBlendEquationSupported()
   return mIsAdvancedBlendEquationSupported;
 }
 
-} // Adaptor
+} // namespace Adaptor
 
-} // Internal
+} // namespace Internal
 
-} // Dali
+} // namespace Dali
index a3375ac..148b928 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_ENVIRONMENT_CONFIGURATION_MANAGER_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 
 namespace Dali
 {
-
 class FileStream;
 
 namespace Internal
 {
 namespace Adaptor
 {
-
-class EglGraphics;
+class GraphicsInterface;
 class ThreadController;
 
 /**
@@ -43,11 +41,10 @@ class ThreadController;
 class ConfigurationManager
 {
 public:
-
   /**
    * @brief Constructor
    */
-  ConfigurationManager( std::string systemCachePath, EglGraphics* eglGraphics, ThreadController* threadController );
+  ConfigurationManager(std::string systemCachePath, GraphicsInterface* graphics, ThreadController* threadController);
 
   /**
    * @brief Virtual Destructor for interface cleanup
@@ -57,7 +54,7 @@ public:
   /**
    * @brief Retrieve all keys from the config file if the file exists.
    */
-  void RetrieveKeysFromConfigFile( const std::string& configFilePath );
+  void RetrieveKeysFromConfigFile(const std::string& configFilePath);
 
   /**
    * @brief Get the maximum texture size.
@@ -66,8 +63,8 @@ public:
   uint32_t GetMaxTextureSize();
 
   /**
-   * @brief Get the GLSL version that the system supports
-   * @return the GLSL version.
+   * @brief Get the shader language version that the system supports
+   * @return the shader language version.
    */
   uint32_t GetShadingLanguageVersion();
 
@@ -84,34 +81,33 @@ public:
   bool IsAdvancedBlendEquationSupported();
 
   // Deleted copy constructor.
-  ConfigurationManager( const ConfigurationManager& ) = delete;
+  ConfigurationManager(const ConfigurationManager&) = delete;
 
   // Deleted move constructor.
-  ConfigurationManager( const ConfigurationManager&& ) = delete;
+  ConfigurationManager(const ConfigurationManager&&) = delete;
 
   // Deleted assignment operator.
-  ConfigurationManager& operator=( const ConfigurationManager& ) = delete;
+  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
-  EglGraphics* mEglGraphics;                     ///< EGL graphics
-  ThreadController* mThreadController;           ///< The thread controller
-  unsigned int mMaxTextureSize;                  ///< The largest texture that the GL can handle
-  unsigned int mGlslVersion;                     ///< The GLSL version that the system supports.
-  bool mIsMultipleWindowSupported:1;             ///< Whether multiple window is supported by the GLES
-  bool mIsAdvancedBlendEquationSupported:1;      ///< Whether blend equation advanced (extension) 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
-  bool mIsAdvancedBlendEquationSupportedCached:1;///< Whether we have checked the support of blend equation advanced (extension)
-  bool mGlslVersionCached:1;                     ///< Whether we have checked the GLSL version
+  ConfigurationManager& operator=(const ConfigurationManager&&) = delete;
+
+private:                                                          // Data
+  std::string        mSystemCacheFilePath;                        ///< The path of system cache file
+  GraphicsInterface* mGraphics;                                   ///< Graphics interface
+  ThreadController*  mThreadController;                           ///< The thread controller
+  unsigned int       mMaxTextureSize;                             ///< The largest texture that the GL can handle
+  unsigned int       mShaderLanguageVersion;                      ///< The shader language version that the system supports.
+  bool               mIsMultipleWindowSupported : 1;              ///< Whether multiple window is supported by the GLES
+  bool               mIsAdvancedBlendEquationSupported : 1;       ///< Whether blend equation advanced (extension) 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
+  bool               mIsAdvancedBlendEquationSupportedCached : 1; ///< Whether we have checked the support of blend equation advanced (extension)
+  bool               mShaderLanguageVersionCached : 1;            ///< Whether we have checked the shader language version
 };
 
-} // Adaptor
-} // Internal
-} // Dali
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
 
 #endif // DALI_INTERNAL_ENVIRONMENT_CONFIGURATION_MANAGER_H
index f09517e..520082b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 #include <dali/internal/window-system/common/gl-window-impl.h>
 
 // EXTERNAL HEADERS
-#include <dali/integration-api/core.h>
-#include <dali/devel-api/adaptor-framework/orientation.h>
 #include <dali/devel-api/adaptor-framework/gl-window.h>
-#include <dali/integration-api/events/touch-integ.h>
-#include <dali/integration-api/events/key-event-integ.h>
+#include <dali/devel-api/adaptor-framework/orientation.h>
 #include <dali/devel-api/events/key-event-devel.h>
+#include <dali/integration-api/core.h>
+#include <dali/integration-api/events/key-event-integ.h>
+#include <dali/integration-api/events/touch-integ.h>
 
 // INTERNAL HEADERS
+#include <dali/internal/graphics/gles/egl-graphics-factory.h>
+#include <dali/internal/window-system/common/display-utils.h>
 #include <dali/internal/window-system/common/event-handler.h>
 #include <dali/internal/window-system/common/orientation-impl.h>
-#include <dali/internal/window-system/common/window-factory.h>
 #include <dali/internal/window-system/common/window-base.h>
-#include <dali/internal/window-system/common/window-system.h>
+#include <dali/internal/window-system/common/window-factory.h>
 #include <dali/internal/window-system/common/window-impl.h>
 #include <dali/internal/window-system/common/window-render-surface.h>
+#include <dali/internal/window-system/common/window-system.h>
 #include <dali/internal/window-system/common/window-visibility-observer.h>
-#include <dali/internal/graphics/gles/egl-graphics-factory.h>
-#include <dali/internal/window-system/common/display-utils.h>
 
 namespace Dali
 {
@@ -44,50 +44,49 @@ namespace Internal
 {
 namespace Adaptor
 {
-
 namespace
 {
-const int MINIMUM_DIMENSION_CHANGE( 1 );
+const int MINIMUM_DIMENSION_CHANGE(1);
 
 #if defined(DEBUG_ENABLED)
-Debug::Filter* gWindowLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_WINDOW" );
+Debug::Filter* gWindowLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW");
 #endif
 
 } // unnamed namespace
 
-GlWindow* GlWindow::New( const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent )
+GlWindow* GlWindow::New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent)
 {
-  GlWindow* window = new GlWindow();
+  GlWindow* window       = new GlWindow();
   window->mIsTransparent = isTransparent;
-  window->Initialize( positionSize, name, className );
+  window->Initialize(positionSize, name, className);
   return window;
 }
 
 GlWindow::GlWindow()
 : mWindowBase(),
   mGraphics(),
-  mDisplayConnection( nullptr ),
-  mEventHandler( nullptr ),
+  mDisplayConnection(nullptr),
+  mEventHandler(nullptr),
   mPositionSize(),
-  mColorDepth( COLOR_DEPTH_24 ),
-  mIsTransparent( false ),
-  mIsFocusAcceptable( false ),
-  mIconified( false ),
-  mOpaqueState( false ),
-  mResizeEnabled( false ),
-  mVisible( false ),
-  mIsRotated( false ),
-  mIsWindowRotated( false ),
-  mIsTouched( false ),
+  mColorDepth(COLOR_DEPTH_24),
+  mIsTransparent(false),
+  mIsFocusAcceptable(false),
+  mIconified(false),
+  mOpaqueState(false),
+  mResizeEnabled(false),
+  mVisible(false),
+  mIsRotated(false),
+  mIsWindowRotated(false),
+  mIsTouched(false),
   mAvailableAngles(),
-  mPreferredAngle( 0 ),
-  mTotalRotationAngle( 0 ),
-  mWindowRotationAngle( 0 ),
-  mScreenRotationAngle( 0 ),
-  mOrientationMode( 0 ),
-  mWindowWidth( 0 ),
-  mWindowHeight( 0 ),
-  mNativeWindowId( -1 ),
+  mPreferredAngle(0),
+  mTotalRotationAngle(0),
+  mWindowRotationAngle(0),
+  mScreenRotationAngle(0),
+  mOrientationMode(0),
+  mWindowWidth(0),
+  mWindowHeight(0),
+  mNativeWindowId(-1),
   mKeyEventSignal(),
   mTouchedSignal(),
   mFocusChangeSignal(),
@@ -96,45 +95,45 @@ GlWindow::GlWindow()
   mGLInitCallback(),
   mGLRenderFrameCallback(),
   mGLTerminateCallback(),
-  mGLRenderCallback( nullptr ),
-  mEGLSurface( nullptr ),
-  mEGLContext( nullptr ),
-  mGLESVersion( Dali::GlWindow::GlesVersion::VERSION_3_0 ),
-  mInitCallback( false ),
-  mDepth( false ),
-  mStencil( false ),
-  mIsEGLInitialize( false ),
-  mMSAA( 0 )
+  mGLRenderCallback(nullptr),
+  mEGLSurface(nullptr),
+  mEGLContext(nullptr),
+  mGLESVersion(Dali::GlWindow::GlesVersion::VERSION_3_0),
+  mInitCallback(false),
+  mDepth(false),
+  mStencil(false),
+  mIsEGLInitialize(false),
+  mMSAA(0)
 {
 }
 
 GlWindow::~GlWindow()
 {
-  if( mEventHandler )
+  if(mEventHandler)
   {
-    mEventHandler->RemoveObserver( *this );
+    mEventHandler->RemoveObserver(*this);
   }
 
-  if( mGLTerminateCallback )
+  if(mGLTerminateCallback)
   {
     CallbackBase::Execute(*mGLTerminateCallback);
   }
 
-  if( mIsEGLInitialize )
+  if(mIsEGLInitialize)
   {
-    GraphicsInterface* graphics = mGraphics.get();
-    EglGraphics *eglGraphics = static_cast<EglGraphics*>( graphics );
-    Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
+    GraphicsInterface*                    graphics    = mGraphics.get();
+    EglGraphics*                          eglGraphics = static_cast<EglGraphics*>(graphics);
+    Internal::Adaptor::EglImplementation& eglImpl     = eglGraphics->GetEglImplementation();
 
-    if( mEGLSurface )
+    if(mEGLSurface)
     {
-      eglImpl.DestroySurface( mEGLSurface );
+      eglImpl.DestroySurface(mEGLSurface);
       mEGLSurface = nullptr;
     }
 
-    if( mEGLContext )
+    if(mEGLContext)
     {
-      eglImpl.DestroyContext( mEGLContext );
+      eglImpl.DestroyContext(mEGLContext);
       mEGLContext = nullptr;
     }
 
@@ -144,21 +143,21 @@ GlWindow::~GlWindow()
   }
 }
 
-void GlWindow::Initialize( const PositionSize& positionSize, const std::string& name, const std::string& className )
+void GlWindow::Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className)
 {
   int screenWidth, screenHeight;
 
   mPositionSize = positionSize;
-  WindowSystem::GetScreenSize( screenWidth, screenHeight );
-  if ( (mPositionSize.width == 0) || (mPositionSize.height == 0) )
+  WindowSystem::GetScreenSize(screenWidth, screenHeight);
+  if((mPositionSize.width == 0) || (mPositionSize.height == 0))
   {
-    mPositionSize.x = 0;
-    mPositionSize.y = 0;
-    mPositionSize.width = screenWidth;
+    mPositionSize.x      = 0;
+    mPositionSize.y      = 0;
+    mPositionSize.width  = screenWidth;
     mPositionSize.height = screenHeight;
   }
 
-  if( screenWidth > screenHeight )
+  if(screenWidth > screenHeight)
   {
     mOrientationMode = 1; // Default mode is landscape
   }
@@ -169,25 +168,25 @@ void GlWindow::Initialize( const PositionSize& positionSize, const std::string&
 
   // Create a window base
   auto windowFactory = Dali::Internal::Adaptor::GetWindowFactory();
-  Any surface;
-  mWindowBase = windowFactory->CreateWindowBase( mPositionSize, surface, ( mIsTransparent ? true : false ) );
-  mWindowBase->IconifyChangedSignal().Connect( this, &GlWindow::OnIconifyChanged );
-  mWindowBase->FocusChangedSignal().Connect( this, &GlWindow::OnFocusChanged );
+  Any  surface;
+  mWindowBase = windowFactory->CreateWindowBase(mPositionSize, surface, (mIsTransparent ? true : false));
+  mWindowBase->IconifyChangedSignal().Connect(this, &GlWindow::OnIconifyChanged);
+  mWindowBase->FocusChangedSignal().Connect(this, &GlWindow::OnFocusChanged);
 
-  if( Dali::Adaptor::IsAvailable() )
+  if(Dali::Adaptor::IsAvailable())
   {
     SetEventHandler();
   }
 
-  if( !mPositionSize.IsEmpty() )
+  if(!mPositionSize.IsEmpty())
   {
-    AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
+    AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
     mResizeEnabled = true;
   }
 
   mWindowBase->Show();
 
-  if( mIsTransparent )
+  if(mIsTransparent)
   {
     mColorDepth = COLOR_DEPTH_32;
   }
@@ -196,7 +195,7 @@ void GlWindow::Initialize( const PositionSize& positionSize, const std::string&
     mColorDepth = COLOR_DEPTH_24;
   }
 
-  SetClass( name, className );
+  SetClass(name, className);
 
   // For Debugging
   mNativeWindowId = mWindowBase->GetNativeWindowId();
@@ -204,23 +203,23 @@ void GlWindow::Initialize( const PositionSize& positionSize, const std::string&
 
 void GlWindow::SetEventHandler()
 {
-  mEventHandler = EventHandlerPtr( new EventHandler( mWindowBase.get(), *this ) );
-  mEventHandler->AddObserver( *this );
+  mEventHandler = EventHandlerPtr(new EventHandler(mWindowBase.get(), *this));
+  mEventHandler->AddObserver(*this);
 }
 
-void GlWindow::SetClass( const std::string& name, const std::string className )
+void GlWindow::SetClass(const std::string& name, const std::string className)
 {
-  mName = name;
+  mName      = name;
   mClassName = className;
-  mWindowBase->SetClass( name, className );
+  mWindowBase->SetClass(name, className);
 }
 
-void GlWindow::SetEglConfig( bool depth, bool stencil, int msaa, Dali::GlWindow::GlesVersion version )
+void GlWindow::SetEglConfig(bool depth, bool stencil, int msaa, Dali::GlWindow::GlesVersion version)
 {
   // Init Graphics
-  mDepth = depth;
-  mStencil = stencil;
-  mMSAA = msaa;
+  mDepth       = depth;
+  mStencil     = stencil;
+  mMSAA        = msaa;
   mGLESVersion = version;
 
   InitializeGraphics();
@@ -229,19 +228,19 @@ void GlWindow::SetEglConfig( bool depth, bool stencil, int msaa, Dali::GlWindow:
 void GlWindow::Raise()
 {
   mWindowBase->Raise();
-  DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Raise() \n", this, mNativeWindowId );
+  DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Raise() \n", this, mNativeWindowId);
 }
 
 void GlWindow::Lower()
 {
   mWindowBase->Lower();
-  DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Lower() \n", this, mNativeWindowId );
+  DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Lower() \n", this, mNativeWindowId);
 }
 
 void GlWindow::Activate()
 {
   mWindowBase->Activate();
-  DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Activate() \n", this, mNativeWindowId );
+  DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Activate() \n", this, mNativeWindowId);
 }
 
 void GlWindow::Show()
@@ -250,18 +249,18 @@ void GlWindow::Show()
 
   mWindowBase->Show();
 
-  if( !mIconified )
+  if(!mIconified)
   {
-    Dali::GlWindow handle( this );
-    mVisibilityChangedSignal.Emit( handle, true );
+    Dali::GlWindow handle(this);
+    mVisibilityChangedSignal.Emit(handle, true);
   }
 
-  if( mEventHandler )
+  if(mEventHandler)
   {
     mEventHandler->Resume();
   }
 
-  DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Show(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible );
+  DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Show(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible);
 }
 
 void GlWindow::Hide()
@@ -270,18 +269,18 @@ void GlWindow::Hide()
 
   mWindowBase->Hide();
 
-  if( !mIconified )
+  if(!mIconified)
   {
-    Dali::GlWindow handle( this );
-    mVisibilityChangedSignal.Emit( handle, false );
+    Dali::GlWindow handle(this);
+    mVisibilityChangedSignal.Emit(handle, false);
   }
 
-  if( mEventHandler )
+  if(mEventHandler)
   {
     mEventHandler->Pause();
   }
 
-  DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Hide(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible );
+  DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Hide(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible);
 }
 
 unsigned int GlWindow::GetSupportedAuxiliaryHintCount() const
@@ -289,50 +288,50 @@ unsigned int GlWindow::GetSupportedAuxiliaryHintCount() const
   return mWindowBase->GetSupportedAuxiliaryHintCount();
 }
 
-std::string GlWindow::GetSupportedAuxiliaryHint( unsigned int index ) const
+std::string GlWindow::GetSupportedAuxiliaryHint(unsigned int index) const
 {
-  return mWindowBase->GetSupportedAuxiliaryHint( index );
+  return mWindowBase->GetSupportedAuxiliaryHint(index);
 }
 
-unsigned int GlWindow::AddAuxiliaryHint( const std::string& hint, const std::string& value )
+unsigned int GlWindow::AddAuxiliaryHint(const std::string& hint, const std::string& value)
 {
-  return mWindowBase->AddAuxiliaryHint( hint, value );
+  return mWindowBase->AddAuxiliaryHint(hint, value);
 }
 
-bool GlWindow::RemoveAuxiliaryHint( unsigned int id )
+bool GlWindow::RemoveAuxiliaryHint(unsigned int id)
 {
-  return mWindowBase->RemoveAuxiliaryHint( id );
+  return mWindowBase->RemoveAuxiliaryHint(id);
 }
 
-bool GlWindow::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
+bool GlWindow::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
 {
-  return mWindowBase->SetAuxiliaryHintValue( id, value );
+  return mWindowBase->SetAuxiliaryHintValue(id, value);
 }
 
-std::string GlWindow::GetAuxiliaryHintValue( unsigned int id ) const
+std::string GlWindow::GetAuxiliaryHintValue(unsigned int id) const
 {
-  return mWindowBase->GetAuxiliaryHintValue( id );
+  return mWindowBase->GetAuxiliaryHintValue(id);
 }
 
-unsigned int GlWindow::GetAuxiliaryHintId( const std::string& hint ) const
+unsigned int GlWindow::GetAuxiliaryHintId(const std::string& hint) const
 {
-  return mWindowBase->GetAuxiliaryHintId( hint );
+  return mWindowBase->GetAuxiliaryHintId(hint);
 }
 
-void GlWindow::SetInputRegion( const Rect< int >& inputRegion )
+void GlWindow::SetInputRegion(const Rect<int>& inputRegion)
 {
-  mWindowBase->SetInputRegion( inputRegion );
+  mWindowBase->SetInputRegion(inputRegion);
 
-  DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "GlWindow::SetInputRegion: x = %d, y = %d, w = %d, h = %d\n", inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height );
+  DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "GlWindow::SetInputRegion: x = %d, y = %d, w = %d, h = %d\n", inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height);
 }
 
-void GlWindow::SetOpaqueState( bool opaque )
+void GlWindow::SetOpaqueState(bool opaque)
 {
   mOpaqueState = opaque;
 
-  mWindowBase->SetOpaqueState( opaque );
+  mWindowBase->SetOpaqueState(opaque);
 
-  DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "GlWindow::SetOpaqueState: opaque = %d\n", opaque );
+  DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "GlWindow::SetOpaqueState: opaque = %d\n", opaque);
 }
 
 bool GlWindow::IsOpaqueState() const
@@ -340,229 +339,227 @@ bool GlWindow::IsOpaqueState() const
   return mOpaqueState;
 }
 
-void GlWindow::SetPositionSize( PositionSize positionSize )
+void GlWindow::SetPositionSize(PositionSize positionSize)
 {
-  if( !mResizeEnabled )
+  if(!mResizeEnabled)
   {
-    AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
+    AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
     mResizeEnabled = true;
   }
 
-  bool needToMove = false;
+  bool needToMove   = false;
   bool needToResize = false;
 
   // Check moving
-  if( (fabs(positionSize.x - mPositionSize.x) > MINIMUM_DIMENSION_CHANGE) ||
-      (fabs(positionSize.y - mPositionSize.y) > MINIMUM_DIMENSION_CHANGE) )
+  if((fabs(positionSize.x - mPositionSize.x) > MINIMUM_DIMENSION_CHANGE) ||
+     (fabs(positionSize.y - mPositionSize.y) > MINIMUM_DIMENSION_CHANGE))
   {
     needToMove = true;
   }
 
   // Check resizing
-  if( (fabs(positionSize.width - mPositionSize.width) > MINIMUM_DIMENSION_CHANGE) ||
-      (fabs(positionSize.height - mPositionSize.height) > MINIMUM_DIMENSION_CHANGE) )
+  if((fabs(positionSize.width - mPositionSize.width) > MINIMUM_DIMENSION_CHANGE) ||
+     (fabs(positionSize.height - mPositionSize.height) > MINIMUM_DIMENSION_CHANGE))
   {
     needToResize = true;
   }
 
-  if( needToResize )
+  if(needToResize)
   {
-    if( needToMove )
+    if(needToMove)
     {
-      mWindowBase->MoveResize( positionSize );
+      mWindowBase->MoveResize(positionSize);
     }
     else
     {
-      mWindowBase->Resize( positionSize );
+      mWindowBase->Resize(positionSize);
     }
     mPositionSize = positionSize;
   }
   else
   {
-    if( needToMove )
+    if(needToMove)
     {
-      mWindowBase->Move( positionSize );
+      mWindowBase->Move(positionSize);
       mPositionSize = positionSize;
     }
   }
 
   // If window's size or position is changed, the signal will be emitted to user.
-  if( ( needToMove ) || ( needToResize ) )
+  if((needToMove) || (needToResize))
   {
-    Uint16Pair newSize( mPositionSize.width, mPositionSize.height );
-    Dali::GlWindow handle( this );
-    mResizeSignal.Emit( newSize );
+    Uint16Pair     newSize(mPositionSize.width, mPositionSize.height);
+    Dali::GlWindow handle(this);
+    mResizeSignal.Emit(newSize);
   }
 }
 
 PositionSize GlWindow::GetPositionSize() const
 {
-  PositionSize positionSize( mPositionSize );
-  if( mTotalRotationAngle == 90 || mTotalRotationAngle == 270 )
+  PositionSize positionSize(mPositionSize);
+  if(mTotalRotationAngle == 90 || mTotalRotationAngle == 270)
   {
     positionSize.height = mPositionSize.width;
-    positionSize.width = mPositionSize.height;
+    positionSize.width  = mPositionSize.height;
   }
 
   return positionSize;
 }
 
-void GlWindow::OnIconifyChanged( bool iconified )
+void GlWindow::OnIconifyChanged(bool iconified)
 {
-  if( iconified )
+  if(iconified)
   {
     mIconified = true;
 
-    if( mVisible )
+    if(mVisible)
     {
-      Dali::GlWindow handle( this );
-      mVisibilityChangedSignal.Emit( handle, false );
+      Dali::GlWindow handle(this);
+      mVisibilityChangedSignal.Emit(handle, false);
     }
 
-    if( mEventHandler )
+    if(mEventHandler)
     {
       mEventHandler->Pause();
     }
 
-    DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Iconified: visible = %d\n", this, mNativeWindowId, mVisible );
+    DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Iconified: visible = %d\n", this, mNativeWindowId, mVisible);
   }
   else
   {
     mIconified = false;
 
-    if( mVisible )
+    if(mVisible)
     {
-      Dali::GlWindow handle( this );
-      mVisibilityChangedSignal.Emit( handle, true );
+      Dali::GlWindow handle(this);
+      mVisibilityChangedSignal.Emit(handle, true);
     }
 
-    if( mEventHandler )
+    if(mEventHandler)
     {
       mEventHandler->Resume();
     }
 
-    DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Deiconified: visible = %d\n", this, mNativeWindowId, mVisible );
+    DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Deiconified: visible = %d\n", this, mNativeWindowId, mVisible);
   }
 }
 
-void GlWindow::OnFocusChanged( bool focusIn )
+void GlWindow::OnFocusChanged(bool focusIn)
 {
-  Dali::GlWindow handle( this );
-  mFocusChangeSignal.Emit( handle, focusIn );
+  Dali::GlWindow handle(this);
+  mFocusChangeSignal.Emit(handle, focusIn);
 }
 
 void GlWindow::OnOutputTransformed()
 {
   int screenRotationAngle = mWindowBase->GetScreenRotationAngle();
-  if( screenRotationAngle != mScreenRotationAngle )
+  if(screenRotationAngle != mScreenRotationAngle)
   {
     mScreenRotationAngle = screenRotationAngle;
-    mTotalRotationAngle = (mWindowRotationAngle + mScreenRotationAngle) % 360;
+    mTotalRotationAngle  = (mWindowRotationAngle + mScreenRotationAngle) % 360;
 
-    if( mTotalRotationAngle == 90 || mTotalRotationAngle == 270 )
+    if(mTotalRotationAngle == 90 || mTotalRotationAngle == 270)
     {
-      mWindowWidth = mPositionSize.height;
+      mWindowWidth  = mPositionSize.height;
       mWindowHeight = mPositionSize.width;
     }
     else
     {
-      mWindowWidth = mPositionSize.width;
+      mWindowWidth  = mPositionSize.width;
       mWindowHeight = mPositionSize.height;
     }
 
     // Emit Resize signal
-    Dali::GlWindow handle( this );
-    mResizeSignal.Emit( Dali::Uint16Pair( mWindowWidth, mWindowHeight ) );
+    Dali::GlWindow handle(this);
+    mResizeSignal.Emit(Dali::Uint16Pair(mWindowWidth, mWindowHeight));
   }
 }
 
-void GlWindow::OnTouchPoint( Dali::Integration::Point& point, int timeStamp )
+void GlWindow::OnTouchPoint(Dali::Integration::Point& point, int timeStamp)
 {
   PointState::Type state = point.GetState();
 
-  if( state == PointState::DOWN )
+  if(state == PointState::DOWN)
   {
     mIsTouched = true;
   }
 
-  if( state == PointState::UP )
+  if(state == PointState::UP)
   {
     mIsTouched = false;
   }
 
-  if( !mIsTouched && state == PointState::MOTION )
+  if(!mIsTouched && state == PointState::MOTION)
   {
     return;
   }
 
-  RecalculateTouchPosition( point );
-  Dali::TouchEvent touchEvent = Dali::Integration::NewTouchEvent( timeStamp, point );
-  Dali::GlWindow handle( this );
-  mTouchedSignal.Emit( touchEvent );
+  RecalculateTouchPosition(point);
+  Dali::TouchEvent touchEvent = Dali::Integration::NewTouchEvent(timeStamp, point);
+  Dali::GlWindow   handle(this);
+  mTouchedSignal.Emit(touchEvent);
 }
 
-void GlWindow::OnWheelEvent( Dali::Integration::WheelEvent& wheelEvent )
+void GlWindow::OnWheelEvent(Dali::Integration::WheelEvent& wheelEvent)
 {
   // TODO:
   //FeedWheelEvent( wheelEvent );
 }
 
-void GlWindow::OnKeyEvent( Dali::Integration::KeyEvent& keyEvent )
+void GlWindow::OnKeyEvent(Dali::Integration::KeyEvent& keyEvent)
 {
-  Dali::KeyEvent event = Dali::DevelKeyEvent::New( keyEvent.keyName, keyEvent.logicalKey, keyEvent.keyString, keyEvent.keyCode,
-                                                   keyEvent.keyModifier, keyEvent.time, static_cast<Dali::KeyEvent::State>(keyEvent.state),
-                                                   keyEvent.compose, keyEvent.deviceName, keyEvent.deviceClass, keyEvent.deviceSubclass );
-  Dali::GlWindow handle( this );
-  mKeyEventSignal.Emit( event );
+  Dali::KeyEvent event = Dali::DevelKeyEvent::New(keyEvent.keyName, keyEvent.logicalKey, keyEvent.keyString, keyEvent.keyCode, keyEvent.keyModifier, keyEvent.time, static_cast<Dali::KeyEvent::State>(keyEvent.state), keyEvent.compose, keyEvent.deviceName, keyEvent.deviceClass, keyEvent.deviceSubclass);
+  Dali::GlWindow handle(this);
+  mKeyEventSignal.Emit(event);
 }
 
-void GlWindow::OnRotation( const RotationEvent& rotation )
+void GlWindow::OnRotation(const RotationEvent& rotation)
 {
   mWindowRotationAngle = rotation.angle;
-  mTotalRotationAngle = ( mWindowRotationAngle + mScreenRotationAngle ) % 360;
-  if( mTotalRotationAngle == 90 || mTotalRotationAngle == 270 )
+  mTotalRotationAngle  = (mWindowRotationAngle + mScreenRotationAngle) % 360;
+  if(mTotalRotationAngle == 90 || mTotalRotationAngle == 270)
   {
-    mWindowWidth = mPositionSize.height;
+    mWindowWidth  = mPositionSize.height;
     mWindowHeight = mPositionSize.width;
   }
   else
   {
-    mWindowWidth = mPositionSize.width;
+    mWindowWidth  = mPositionSize.width;
     mWindowHeight = mPositionSize.height;
   }
 
-  mIsRotated = true;
+  mIsRotated       = true;
   mIsWindowRotated = true;
-  DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), OnRotation(): resize signal emit [%d x %d]\n", this, mNativeWindowId, mWindowWidth, mWindowHeight );
+  DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), OnRotation(): resize signal emit [%d x %d]\n", this, mNativeWindowId, mWindowWidth, mWindowHeight);
 
   // Emit Resize signal
-  Dali::GlWindow handle( this );
-  mResizeSignal.Emit( Dali::Uint16Pair( mWindowWidth, mWindowHeight ) );
+  Dali::GlWindow handle(this);
+  mResizeSignal.Emit(Dali::Uint16Pair(mWindowWidth, mWindowHeight));
 }
 
-void GlWindow::RecalculateTouchPosition( Integration::Point& point )
+void GlWindow::RecalculateTouchPosition(Integration::Point& point)
 {
   Vector2 position = point.GetScreenPosition();
   Vector2 convertedPosition;
 
-  switch( mTotalRotationAngle )
+  switch(mTotalRotationAngle)
   {
     case 90:
     {
-      convertedPosition.x = static_cast<float>( mWindowWidth ) - position.y;
+      convertedPosition.x = static_cast<float>(mWindowWidth) - position.y;
       convertedPosition.y = position.x;
       break;
     }
     case 180:
     {
-      convertedPosition.x = static_cast<float>( mWindowWidth ) - position.x;
-      convertedPosition.y = static_cast<float>( mWindowHeight ) - position.y;
+      convertedPosition.x = static_cast<float>(mWindowWidth) - position.x;
+      convertedPosition.y = static_cast<float>(mWindowHeight) - position.y;
       break;
     }
     case 270:
     {
       convertedPosition.x = position.y;
-      convertedPosition.y = static_cast<float>( mWindowHeight ) - position.x;
+      convertedPosition.y = static_cast<float>(mWindowHeight) - position.x;
       break;
     }
     default:
@@ -572,41 +569,40 @@ void GlWindow::RecalculateTouchPosition( Integration::Point& point )
     }
   }
 
-  point.SetScreenPosition( convertedPosition );
+  point.SetScreenPosition(convertedPosition);
 }
 
-void GlWindow::SetAvailableAnlges( const std::vector< int >& angles )
+void GlWindow::SetAvailableAnlges(const std::vector<int>& angles)
 {
-  if( angles.size() > 4 )
+  if(angles.size() > 4)
   {
-    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetAvailableAnlges: Invalid vector size! [%d]\n", angles.size() );
+    DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::SetAvailableAnlges: Invalid vector size! [%d]\n", angles.size());
     return;
   }
 
-  mWindowBase->SetAvailableAnlges( angles );
+  mWindowBase->SetAvailableAnlges(angles);
 }
 
-bool GlWindow::IsOrientationAvailable( WindowOrientation orientation ) const
+bool GlWindow::IsOrientationAvailable(WindowOrientation orientation) const
 {
-  if( orientation <= WindowOrientation::NO_ORIENTATION_PREFERENCE
-      || orientation > WindowOrientation::LANDSCAPE_INVERSE )
+  if(orientation <= WindowOrientation::NO_ORIENTATION_PREFERENCE || orientation > WindowOrientation::LANDSCAPE_INVERSE)
   {
-    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::IsOrientationAvailable: Invalid input orientation [%d]\n", orientation );
+    DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::IsOrientationAvailable: Invalid input orientation [%d]\n", orientation);
     return false;
   }
   return true;
 }
 
-int GlWindow::ConvertToAngle(  WindowOrientation  orientation )
+int GlWindow::ConvertToAngle(WindowOrientation orientation)
 {
   int convertAngle = 0;
-  if ( mOrientationMode == 0 )
+  if(mOrientationMode == 0)
   {
-    convertAngle = static_cast< int >( orientation );
+    convertAngle = static_cast<int>(orientation);
   }
-  else if( mOrientationMode == 1)
+  else if(mOrientationMode == 1)
   {
-    switch( orientation )
+    switch(orientation)
     {
       case WindowOrientation::LANDSCAPE:
       {
@@ -638,16 +634,16 @@ int GlWindow::ConvertToAngle(  WindowOrientation  orientation )
   return convertAngle;
 }
 
-WindowOrientation GlWindow::ConvertToOrientation( int angle ) const
+WindowOrientation GlWindow::ConvertToOrientation(int angle) const
 {
   WindowOrientation orientation = WindowOrientation::NO_ORIENTATION_PREFERENCE;
-  if ( mOrientationMode == 0 ) // Portrate mode
+  if(mOrientationMode == 0) // Portrate mode
   {
-    orientation = static_cast< WindowOrientation >( angle );
+    orientation = static_cast<WindowOrientation>(angle);
   }
-  else if( mOrientationMode == 1 ) // Landscape mode
+  else if(mOrientationMode == 1) // Landscape mode
   {
-    switch( angle )
+    switch(angle)
     {
       case 0:
       {
@@ -681,143 +677,142 @@ WindowOrientation GlWindow::ConvertToOrientation( int angle ) const
 
 WindowOrientation GlWindow::GetCurrentOrientation() const
 {
-  DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), GetCurrentOrientation(): %d\n", this, mNativeWindowId, mTotalRotationAngle );
-  return ConvertToOrientation( mTotalRotationAngle );
+  DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), GetCurrentOrientation(): %d\n", this, mNativeWindowId, mTotalRotationAngle);
+  return ConvertToOrientation(mTotalRotationAngle);
 }
 
-void GlWindow::SetAvailableOrientations( const Dali::Vector< WindowOrientation >& orientations )
+void GlWindow::SetAvailableOrientations(const Dali::Vector<WindowOrientation>& orientations)
 {
   Dali::Vector<float>::SizeType count = orientations.Count();
-  for( Dali::Vector<float>::SizeType index = 0; index < count; ++index )
+  for(Dali::Vector<float>::SizeType index = 0; index < count; ++index)
   {
-    if( IsOrientationAvailable( orientations[index] ) == false )
+    if(IsOrientationAvailable(orientations[index]) == false)
     {
       DALI_LOG_ERROR("Window::SetAvailableRotationAngles, invalid angle: %d\n", orientations[index]);
       continue;
     }
 
     bool found = false;
-    int angle = ConvertToAngle( orientations[index] );
+    int  angle = ConvertToAngle(orientations[index]);
 
-    for( std::size_t i = 0; i < mAvailableAngles.size(); i++ )
+    for(std::size_t i = 0; i < mAvailableAngles.size(); i++)
     {
-      if( mAvailableAngles[i] == angle )
+      if(mAvailableAngles[i] == angle)
       {
         found = true;
         break;
       }
     }
 
-    if( !found )
+    if(!found)
     {
-      DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetAvailableOrientations: %d\n", this, mNativeWindowId, angle );
-      mAvailableAngles.push_back( angle );
+      DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), SetAvailableOrientations: %d\n", this, mNativeWindowId, angle);
+      mAvailableAngles.push_back(angle);
     }
   }
-  SetAvailableAnlges( mAvailableAngles );
+  SetAvailableAnlges(mAvailableAngles);
 }
 
-void GlWindow::SetPreferredOrientation( WindowOrientation orientation  )
+void GlWindow::SetPreferredOrientation(WindowOrientation orientation)
 {
-  if( IsOrientationAvailable( orientation ) == false )
+  if(IsOrientationAvailable(orientation) == false)
   {
-    DALI_LOG_ERROR( "Window::SetPreferredOrientation, invalid orientation: %d\n", orientation );
+    DALI_LOG_ERROR("Window::SetPreferredOrientation, invalid orientation: %d\n", orientation);
     return;
   }
-  mPreferredAngle = ConvertToAngle( orientation );
-  DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetPreferredOrientation: %d\n", this, mNativeWindowId, mPreferredAngle );
-  mWindowBase->SetPreferredAngle( mPreferredAngle );
+  mPreferredAngle = ConvertToAngle(orientation);
+  DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), SetPreferredOrientation: %d\n", this, mNativeWindowId, mPreferredAngle);
+  mWindowBase->SetPreferredAngle(mPreferredAngle);
 }
 
-void GlWindow::SetChild( Dali::Window& child )
+void GlWindow::SetChild(Dali::Window& child)
 {
-  if( DALI_UNLIKELY( child ) )
+  if(DALI_UNLIKELY(child))
   {
-    mChildWindow = child;
-    Internal::Adaptor::Window& windowImpl = Dali::GetImplementation( mChildWindow );
-    WindowRenderSurface* renderSurface = static_cast<WindowRenderSurface*>( windowImpl.GetSurface() );
-    if( renderSurface )
+    mChildWindow                             = child;
+    Internal::Adaptor::Window& windowImpl    = Dali::GetImplementation(mChildWindow);
+    WindowRenderSurface*       renderSurface = static_cast<WindowRenderSurface*>(windowImpl.GetSurface());
+    if(renderSurface)
     {
       WindowBase* childWindowBase = renderSurface->GetWindowBase();
-      if( childWindowBase )
+      if(childWindowBase)
       {
-        childWindowBase->SetParent( mWindowBase.get() );
+        childWindowBase->SetParent(mWindowBase.get());
       }
     }
   }
 }
 
-void GlWindow::RegisterGlCallback( CallbackBase* initCallback, CallbackBase* renderFrameCallback, CallbackBase* terminateCallback )
+void GlWindow::RegisterGlCallback(CallbackBase* initCallback, CallbackBase* renderFrameCallback, CallbackBase* terminateCallback)
 {
-  if( mIsEGLInitialize == false )
+  if(mIsEGLInitialize == false)
   {
     InitializeGraphics();
   }
-  mGLInitCallback = std::unique_ptr< CallbackBase >(initCallback);
-  mGLRenderFrameCallback = std::unique_ptr< CallbackBase >( renderFrameCallback );
-  mGLTerminateCallback = std::unique_ptr< CallbackBase >( terminateCallback );
+  mGLInitCallback        = std::unique_ptr<CallbackBase>(initCallback);
+  mGLRenderFrameCallback = std::unique_ptr<CallbackBase>(renderFrameCallback);
+  mGLTerminateCallback   = std::unique_ptr<CallbackBase>(terminateCallback);
 
   mInitCallback = false;
 
-  if( !mGLRenderCallback )
+  if(!mGLRenderCallback)
   {
-    mGLRenderCallback = MakeCallback( this, &GlWindow::RunCallback );
+    mGLRenderCallback = MakeCallback(this, &GlWindow::RunCallback);
 
-    if( Dali::Adaptor::IsAvailable() )
+    if(Dali::Adaptor::IsAvailable())
     {
-      Dali::Adaptor::Get().AddIdle( mGLRenderCallback, true );
+      Dali::Adaptor::Get().AddIdle(mGLRenderCallback, true);
     }
     else
     {
-      DALI_LOG_RELEASE_INFO( "RegisterGlCallback: Adaptor is not avaiable\n" );
+      DALI_LOG_RELEASE_INFO("RegisterGlCallback: Adaptor is not avaiable\n");
     }
-
   }
 }
 
 bool GlWindow::RunCallback()
 {
-  GraphicsInterface* graphics = mGraphics.get();
-  EglGraphics *eglGraphics = static_cast<EglGraphics*>( graphics );
-  Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
+  GraphicsInterface*                    graphics    = mGraphics.get();
+  EglGraphics*                          eglGraphics = static_cast<EglGraphics*>(graphics);
+  Internal::Adaptor::EglImplementation& eglImpl     = eglGraphics->GetEglImplementation();
 
-  eglImpl.MakeContextCurrent( mEGLSurface, mEGLContext );
+  eglImpl.MakeContextCurrent(mEGLSurface, mEGLContext);
 
   int renderFrameResult = 0;
 
-  if( mIsRotated )
+  if(mIsRotated)
   {
-    mWindowBase->SetEglWindowBufferTransform( mTotalRotationAngle );
-    if( mIsWindowRotated )
+    mWindowBase->SetEglWindowBufferTransform(mTotalRotationAngle);
+    if(mIsWindowRotated)
     {
-      mWindowBase->SetEglWindowTransform( mWindowRotationAngle );
+      mWindowBase->SetEglWindowTransform(mWindowRotationAngle);
     }
     mIsRotated = false;
   }
 
-  if( !mInitCallback )
+  if(!mInitCallback)
   {
-    if( mGLInitCallback )
+    if(mGLInitCallback)
     {
       CallbackBase::Execute(*mGLInitCallback);
     }
     mInitCallback = true;
   }
 
-  if( mGLRenderFrameCallback )
+  if(mGLRenderFrameCallback)
   {
     renderFrameResult = CallbackBase::ExecuteReturn<int>(*mGLRenderFrameCallback);
   }
 
-  if( mIsWindowRotated )
+  if(mIsWindowRotated)
   {
-    mWindowBase->WindowRotationCompleted( mWindowRotationAngle, mPositionSize.width, mPositionSize.height );
+    mWindowBase->WindowRotationCompleted(mWindowRotationAngle, mPositionSize.width, mPositionSize.height);
     mIsWindowRotated = false;
   }
 
   if(renderFrameResult)
   {
-    eglImpl.SwapBuffers( mEGLSurface );
+    eglImpl.SwapBuffers(mEGLSurface);
   }
 
   return true;
@@ -830,39 +825,38 @@ void GlWindow::RenderOnce()
 
 void GlWindow::InitializeGraphics()
 {
-  if( !mIsEGLInitialize )
+  if(!mIsEGLInitialize)
   {
     // Init Graphics
-    std::unique_ptr< GraphicsFactory > graphicsFactoryPtr = Utils::MakeUnique< GraphicsFactory >();
-    auto graphicsFactory = *graphicsFactoryPtr.get();
+    std::unique_ptr<GraphicsFactory> graphicsFactoryPtr = Utils::MakeUnique<GraphicsFactory>(mEnvironmentOptions);
+    auto                             graphicsFactory    = *graphicsFactoryPtr.get();
 
-    mGraphics = std::unique_ptr< GraphicsInterface >( &graphicsFactory.Create() );
-    GraphicsInterface* graphics = mGraphics.get();
-    EglGraphics *eglGraphics = static_cast<EglGraphics*>( graphics );
-    eglGraphics->Initialize( mDepth, mStencil, mMSAA );
-    eglGraphics->Create();
+    mGraphics                      = std::unique_ptr<GraphicsInterface>(&graphicsFactory.Create());
+    GraphicsInterface* graphics    = mGraphics.get();
+    EglGraphics*       eglGraphics = static_cast<EglGraphics*>(graphics);
+    eglGraphics->Initialize(mDepth, mStencil, false, mMSAA);
 
-    mDisplayConnection = std::unique_ptr< Dali::DisplayConnection >( Dali::DisplayConnection::New( *graphics, Dali::RenderSurfaceInterface::Type::WINDOW_RENDER_SURFACE ) );
+    mDisplayConnection = std::unique_ptr<Dali::DisplayConnection>(Dali::DisplayConnection::New(*graphics, Dali::RenderSurfaceInterface::Type::WINDOW_RENDER_SURFACE));
     mDisplayConnection->Initialize();
 
     Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
-    if( mGLESVersion == Dali::GlWindow::GlesVersion::VERSION_2_0 )
+    if(mGLESVersion == Dali::GlWindow::GlesVersion::VERSION_2_0)
     {
-      eglImpl.SetGlesVersion( 20 );
+      eglImpl.SetGlesVersion(20);
     }
-    else if( mGLESVersion == Dali::GlWindow::GlesVersion::VERSION_3_0 )
+    else if(mGLESVersion == Dali::GlWindow::GlesVersion::VERSION_3_0)
     {
-      eglImpl.SetGlesVersion( 30 );
+      eglImpl.SetGlesVersion(30);
     }
 
-    if( eglImpl.ChooseConfig(true, mColorDepth) == false )
+    if(eglImpl.ChooseConfig(true, mColorDepth) == false)
     {
-      if( mGLESVersion == Dali::GlWindow::GlesVersion::VERSION_3_0 )
+      if(mGLESVersion == Dali::GlWindow::GlesVersion::VERSION_3_0)
       {
-        DALI_LOG_RELEASE_INFO( "InitializeGraphics: Fail to choose config with GLES30, retry with GLES20\n" );
-        eglImpl.SetGlesVersion( 20 );
+        DALI_LOG_RELEASE_INFO("InitializeGraphics: Fail to choose config with GLES30, retry with GLES20\n");
+        eglImpl.SetGlesVersion(20);
         mGLESVersion = Dali::GlWindow::GlesVersion::VERSION_2_0;
-        if( eglImpl.ChooseConfig(true, mColorDepth) == false )
+        if(eglImpl.ChooseConfig(true, mColorDepth) == false)
         {
           DALI_LOG_ERROR("InitializeGraphics: Fail to choose config with GLES20");
           return;
@@ -874,23 +868,22 @@ void GlWindow::InitializeGraphics()
         return;
       }
     }
-    eglImpl.CreateWindowContext( mEGLContext );
+    eglImpl.CreateWindowContext(mEGLContext);
 
-   // Create the EGL window
-    EGLNativeWindowType window = mWindowBase->CreateEglWindow( mPositionSize.width, mPositionSize.height );
-    mEGLSurface = eglImpl.CreateSurfaceWindow( window, mColorDepth );
+    // Create the EGL window
+    EGLNativeWindowType window = mWindowBase->CreateEglWindow(mPositionSize.width, mPositionSize.height);
+    mEGLSurface                = eglImpl.CreateSurfaceWindow(window, mColorDepth);
 
     mIsEGLInitialize = true;
   }
 }
 
-void GlWindow::OnDamaged(  const DamageArea& area )
+void GlWindow::OnDamaged(const DamageArea& area)
 {
-
 }
 
-} // Adaptor
+} // namespace Adaptor
 
-} // Internal
+} // namespace Internal
 
-} // Dali
+} // namespace Dali
index 684a8b1..a5f5fb0 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_WINDOWSYSTEM_COMMON_GL_WINDOW_IMPL_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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/public-api/object/ref-object.h>
-#include <dali/public-api/object/base-object.h>
 #include <dali/public-api/adaptor-framework/window.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/object/ref-object.h>
 
 // INTERNAL INCLUDES
-#include <dali/internal/graphics/gles/egl-graphics.h>
-#include <dali/public-api/adaptor-framework/key-grab.h>
 #include <dali/devel-api/adaptor-framework/gl-window.h>
 #include <dali/internal/adaptor/common/adaptor-impl.h>
+#include <dali/internal/graphics/gles/egl-graphics.h>
 #include <dali/internal/window-system/common/event-handler.h>
+#include <dali/public-api/adaptor-framework/key-grab.h>
 
 namespace Dali
 {
@@ -41,8 +41,8 @@ namespace Adaptor
 class WindowBase;
 
 class GlWindow;
-using GlWindowPtr = IntrusivePtr< GlWindow >;
-using EventHandlerPtr = IntrusivePtr< EventHandler >;
+using GlWindowPtr     = IntrusivePtr<GlWindow>;
+using EventHandlerPtr = IntrusivePtr<EventHandler>;
 
 /**
  * Window provides a surface to render onto with orientation.
@@ -50,13 +50,12 @@ using EventHandlerPtr = IntrusivePtr< EventHandler >;
 class GlWindow : public BaseObject, public EventHandler::Observer, public DamageObserver, public ConnectionTracker
 {
 public:
-
-  using KeyEventSignalType = Dali::GlWindow::KeyEventSignalType;
-  using TouchEventSignalType = Dali::GlWindow::TouchEventSignalType;
-  using FocusChangeSignalType = Dali::GlWindow::FocusChangeSignalType;
-  using ResizeSignalType = Dali::GlWindow::ResizeSignalType;
+  using KeyEventSignalType          = Dali::GlWindow::KeyEventSignalType;
+  using TouchEventSignalType        = Dali::GlWindow::TouchEventSignalType;
+  using FocusChangeSignalType       = Dali::GlWindow::FocusChangeSignalType;
+  using ResizeSignalType            = Dali::GlWindow::ResizeSignalType;
   using VisibilityChangedSignalType = Dali::GlWindow::VisibilityChangedSignalType;
-  using SignalType = Signal< void () >;
+  using SignalType                  = Signal<void()>;
 
   /**
    * @brief Create a new GlWindow. This should only be called once by the Application class
@@ -66,12 +65,12 @@ public:
    * @param[in] isTransparent Whether window is transparent
    * @return A newly allocated Window
    */
-  static GlWindow* New( const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent = false );
+  static GlWindow* New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent = false);
 
   /**
    * @copydoc Dali::GlWindow::SetEglConfig()
    */
-  void SetEglConfig( bool depth, bool stencil, int msaa, Dali::GlWindow::GlesVersion version );
+  void SetEglConfig(bool depth, bool stencil, int msaa, Dali::GlWindow::GlesVersion version);
 
   /**
    * @copydoc Dali::GlWindow::Raise()
@@ -106,42 +105,42 @@ public:
   /**
    * @copydoc Dali::GlWindow::GetSupportedAuxiliaryHint()
    */
-  std::string GetSupportedAuxiliaryHint( unsigned int index ) const;
+  std::string GetSupportedAuxiliaryHint(unsigned int index) const;
 
   /**
    * @copydoc Dali::GlWindow::AddAuxiliaryHint()
    */
-  unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value );
+  unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value);
 
   /**
    * @copydoc Dali::GlWindow::RemoveAuxiliaryHint()
    */
-  bool RemoveAuxiliaryHint( unsigned int id );
+  bool RemoveAuxiliaryHint(unsigned int id);
 
   /**
    * @copydoc Dali::GlWindow::SetAuxiliaryHintValue()
    */
-  bool SetAuxiliaryHintValue( unsigned int id, const std::string& value );
+  bool SetAuxiliaryHintValue(unsigned int id, const std::string& value);
 
   /**
    * @copydoc Dali::GlWindow::GetAuxiliaryHintValue()
    */
-  std::string GetAuxiliaryHintValue( unsigned int id ) const;
+  std::string GetAuxiliaryHintValue(unsigned int id) const;
 
   /**
    * @copydoc Dali::GlWindow::GetAuxiliaryHintId()
    */
-  unsigned int GetAuxiliaryHintId( const std::string& hint ) const;
+  unsigned int GetAuxiliaryHintId(const std::string& hint) const;
 
   /**
    * @copydoc Dali::GlWindow::SetInputRegion()
    */
-  void SetInputRegion( const Rect< int >& inputRegion );
+  void SetInputRegion(const Rect<int>& inputRegion);
 
   /**
    * @copydoc Dali::GlWindow::SetOpaqueState()
    */
-  void SetOpaqueState( bool opaque );
+  void SetOpaqueState(bool opaque);
 
   /**
    * @copydoc Dali::GlWindow::IsOpaqueState()
@@ -151,7 +150,7 @@ public:
   /**
    * @copydoc Dali::GlWindow::SetPositionSize()
    */
-  void SetPositionSize( PositionSize positionSize );
+  void SetPositionSize(PositionSize positionSize);
 
   /**
    * @copydoc Dali::GlWindow::GetPositionSize()
@@ -166,17 +165,17 @@ public:
   /**
    * @copydoc Dali::GlWindow::SetAvailableOrientations()
    */
-  void SetAvailableOrientations( const Dali::Vector< WindowOrientation >& orientations );
+  void SetAvailableOrientations(const Dali::Vector<WindowOrientation>& orientations);
 
   /**
    * @copydoc Dali::GlWindow::SetPreferredOrientation()
    */
-  void SetPreferredOrientation( WindowOrientation orientation );
+  void SetPreferredOrientation(WindowOrientation orientation);
 
   /**
    * @copydoc Dali::GlWindow::RegisterGlCallback()
    */
-  void RegisterGlCallback( CallbackBase* initCallback, CallbackBase* renderFrameCallback, CallbackBase* terminateCallback );
+  void RegisterGlCallback(CallbackBase* initCallback, CallbackBase* renderFrameCallback, CallbackBase* terminateCallback);
 
   /**
    * @copydoc Dali::GlWindow::RenderOnce()
@@ -193,10 +192,9 @@ public: // For implementation
    *
    * Currently the child window is default window.
    */
-  void SetChild( Dali::Window& child );
+  void SetChild(Dali::Window& child);
 
 private:
-
   /**
    * Private constructor.
    * @sa Window::New()
@@ -215,20 +213,20 @@ private:
    * @param[in] name The window title
    * @param[in] className The window class name
    */
-  void Initialize( const PositionSize& positionSize, const std::string& name, const std::string& className );
+  void Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className);
 
   /**
    * Called when the window becomes iconified or deiconified.
    *
    * @param[in] iconified The flag whether window is iconifed or deiconfied.
    */
-  void OnIconifyChanged( bool iconified );
+  void OnIconifyChanged(bool iconified);
 
   /**
    * Called when the window focus is changed.
    * @param[in] focusIn The flag whether window is focused or not.
    */
-  void OnFocusChanged( bool focusIn );
+  void OnFocusChanged(bool focusIn);
 
   /**
    * Called when the output is transformed.
@@ -245,7 +243,7 @@ private:
    *
    * @param[in] angles The list of the avaiabled rotation angle.
    */
-  void SetAvailableAnlges( const std::vector< int >& angles );
+  void SetAvailableAnlges(const std::vector<int>& angles);
 
   /**
    * @brief Check available window orientation for Available angle.
@@ -254,7 +252,7 @@ private:
    *
    * @return true is available window orientation. false is not available.
    */
-  bool IsOrientationAvailable( WindowOrientation orientation ) const;
+  bool IsOrientationAvailable(WindowOrientation orientation) const;
 
   /**
    * @brief Convert from window orientation to angle using orientation mode value.
@@ -263,7 +261,7 @@ private:
    *
    * @return The coverted angle value is returned.
    */
-  int ConvertToAngle( WindowOrientation orientation );
+  int ConvertToAngle(WindowOrientation orientation);
 
   /**
    * @brief Convert from angle to window orientation using orientation mode value.
@@ -272,7 +270,7 @@ private:
    *
    * @return The converted window orientation value is returned.
    */
-  WindowOrientation ConvertToOrientation( int angle ) const;
+  WindowOrientation ConvertToOrientation(int angle) const;
 
   /**
    * @brief Run Ui GL callback function.
@@ -289,12 +287,12 @@ private:
   /**
    * @brief Sets event handler for window's events.
    */
-  void SetEventHandler() ;
+  void SetEventHandler();
 
   /**
    * @brief calculate touch position for rotation.
    */
-  void RecalculateTouchPosition( Integration::Point& point ) ;
+  void RecalculateTouchPosition(Integration::Point& point);
 
   /**
    * @brief Sets window and class name.
@@ -302,132 +300,144 @@ private:
    * @param[in] name The name of the window
    * @param[in] className The class of the window
    */
-  void SetClass( const std::string& name, const std::string className );
+  void SetClass(const std::string& name, const std::string className);
 
 private:
-
   /**
    * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnTouchPoint
    */
-  void OnTouchPoint( Dali::Integration::Point& point, int timeStamp ) override;
+  void OnTouchPoint(Dali::Integration::Point& point, int timeStamp) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnWheelEvent
    */
-  void OnWheelEvent( Dali::Integration::WheelEvent& wheelEvent ) override;
+  void OnWheelEvent(Dali::Integration::WheelEvent& wheelEvent) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnKeyEvent
    */
-  void OnKeyEvent( Dali::Integration::KeyEvent& keyEvent ) override;
+  void OnKeyEvent(Dali::Integration::KeyEvent& keyEvent) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnRotation
    */
-  void OnRotation( const RotationEvent& rotation ) override;
+  void OnRotation(const RotationEvent& rotation) override;
 
 private: // From Dali::Internal::Adaptor::DamageObserver
-
   /**
    * @copydoc Dali::Internal::Adaptor::DamageObserver::OnDamaged()
    */
-  void OnDamaged( const DamageArea& area );
+  void OnDamaged(const DamageArea& area);
 
 public: // Signals
-
   /**
    * @copydoc Dali::GlWindow::FocusChangeSignal()
    */
-  FocusChangeSignalType& FocusChangeSignal() { return mFocusChangeSignal; }
+  FocusChangeSignalType& FocusChangeSignal()
+  {
+    return mFocusChangeSignal;
+  }
 
   /**
    * @copydoc Dali::GlWindow::ResizeSignal()
    */
-  ResizeSignalType& ResizeSignal() { return mResizeSignal; }
+  ResizeSignalType& ResizeSignal()
+  {
+    return mResizeSignal;
+  }
 
   /**
    * @copydoc Dali::GlWindow::KeyEventSignal()
    */
-  KeyEventSignalType& KeyEventSignal() { return mKeyEventSignal; }
+  KeyEventSignalType& KeyEventSignal()
+  {
+    return mKeyEventSignal;
+  }
 
   /**
    * @copydoc Dali::GlWindow::TouchSignal()
    */
-  TouchEventSignalType& TouchedSignal() { return mTouchedSignal; }
+  TouchEventSignalType& TouchedSignal()
+  {
+    return mTouchedSignal;
+  }
 
   /**
    * @copydoc Dali::GlWindow::VisibilityChangedSignal()
    */
-  VisibilityChangedSignalType& VisibilityChangedSignal() { return mVisibilityChangedSignal; }
+  VisibilityChangedSignalType& VisibilityChangedSignal()
+  {
+    return mVisibilityChangedSignal;
+  }
 
 private:
-
-  std::unique_ptr< WindowBase >               mWindowBase;
-  std::unique_ptr< GraphicsInterface >        mGraphics;                    ///< Graphics interface
-  std::unique_ptr< Dali::DisplayConnection >  mDisplayConnection;
-  std::string                                 mName;
-  std::string                                 mClassName;
-  EventHandlerPtr                             mEventHandler;         ///< The window events handler
-  PositionSize                                mPositionSize;
-  ColorDepth                                  mColorDepth;
-  Dali::Window                                mChildWindow;
-  bool                                        mIsTransparent:1;
-  bool                                        mIsFocusAcceptable:1;
-  bool                                        mIconified:1;
-  bool                                        mOpaqueState:1;
-  bool                                        mResizeEnabled:1;
-  bool                                        mVisible:1;
-  bool                                        mIsRotated:1;
-  bool                                        mIsWindowRotated:1;
-  bool                                        mIsTouched:1;
-
-  std::vector< int >                          mAvailableAngles;
-  int                                         mPreferredAngle;
-  int                                         mTotalRotationAngle;   ///< The angle of window + screen rotation angle % 360
-  int                                         mWindowRotationAngle;  ///< The angle of window rotation angle
-  int                                         mScreenRotationAngle;  ///< The angle of screen rotation angle
-  int                                         mOrientationMode;      ///< 0: Default portrati, 1:Default landscape
-  int                                         mWindowWidth;          ///< The width of the window
-  int                                         mWindowHeight;         ///< The height of the window
-  int                                         mNativeWindowId;       ///< The Native Window Id
+  std::unique_ptr<WindowBase>              mWindowBase;
+  std::unique_ptr<GraphicsInterface>       mGraphics; ///< Graphics interface
+  std::unique_ptr<Dali::DisplayConnection> mDisplayConnection;
+  std::string                              mName;
+  std::string                              mClassName;
+  EventHandlerPtr                          mEventHandler; ///< The window events handler
+  PositionSize                             mPositionSize;
+  ColorDepth                               mColorDepth;
+  Dali::Window                             mChildWindow;
+  bool                                     mIsTransparent : 1;
+  bool                                     mIsFocusAcceptable : 1;
+  bool                                     mIconified : 1;
+  bool                                     mOpaqueState : 1;
+  bool                                     mResizeEnabled : 1;
+  bool                                     mVisible : 1;
+  bool                                     mIsRotated : 1;
+  bool                                     mIsWindowRotated : 1;
+  bool                                     mIsTouched : 1;
+
+  std::vector<int> mAvailableAngles;
+  int              mPreferredAngle;
+  int              mTotalRotationAngle;  ///< The angle of window + screen rotation angle % 360
+  int              mWindowRotationAngle; ///< The angle of window rotation angle
+  int              mScreenRotationAngle; ///< The angle of screen rotation angle
+  int              mOrientationMode;     ///< 0: Default portrati, 1:Default landscape
+  int              mWindowWidth;         ///< The width of the window
+  int              mWindowHeight;        ///< The height of the window
+  int              mNativeWindowId;      ///< The Native Window Id
 
   // Signals
-  KeyEventSignalType                          mKeyEventSignal;
-  TouchEventSignalType                        mTouchedSignal;
-  FocusChangeSignalType                       mFocusChangeSignal;
-  ResizeSignalType                            mResizeSignal;
-  VisibilityChangedSignalType                 mVisibilityChangedSignal;
+  KeyEventSignalType          mKeyEventSignal;
+  TouchEventSignalType        mTouchedSignal;
+  FocusChangeSignalType       mFocusChangeSignal;
+  ResizeSignalType            mResizeSignal;
+  VisibilityChangedSignalType mVisibilityChangedSignal;
 
   // EGL, GL Resource
-  std::unique_ptr< CallbackBase >             mGLInitCallback;
-  std::unique_ptr< CallbackBase >             mGLRenderFrameCallback;
-  std::unique_ptr< CallbackBase >             mGLTerminateCallback;
-  CallbackBase*                               mGLRenderCallback;
-  EGLSurface                                  mEGLSurface;
-  EGLContext                                  mEGLContext;
-  Dali::GlWindow::GlesVersion                 mGLESVersion;
-  bool                                        mInitCallback:1;
-  bool                                        mDepth:1;
-  bool                                        mStencil:1;
-  bool                                        mIsEGLInitialize:1;
-  int                                         mMSAA;
+  EnvironmentOptions            mEnvironmentOptions;
+  std::unique_ptr<CallbackBase> mGLInitCallback;
+  std::unique_ptr<CallbackBase> mGLRenderFrameCallback;
+  std::unique_ptr<CallbackBase> mGLTerminateCallback;
+  CallbackBase*                 mGLRenderCallback;
+  EGLSurface                    mEGLSurface;
+  EGLContext                    mEGLContext;
+  Dali::GlWindow::GlesVersion   mGLESVersion;
+  bool                          mInitCallback : 1;
+  bool                          mDepth : 1;
+  bool                          mStencil : 1;
+  bool                          mIsEGLInitialize : 1;
+  int                           mMSAA;
 };
 
 } // namespace Adaptor
-} // namepsace Internal
+} // namespace Internal
 
 // Helpers for public-api forwarding methods
 
 inline Internal::Adaptor::GlWindow& GetImplementation(Dali::GlWindow& window)
 {
-  DALI_ASSERT_ALWAYS( window && "Window handle is empty" );
+  DALI_ASSERT_ALWAYS(window && "Window handle is empty");
   BaseObject& object = window.GetBaseObject();
   return static_cast<Internal::Adaptor::GlWindow&>(object);
 }
 
 inline const Internal::Adaptor::GlWindow& GetImplementation(const Dali::GlWindow& window)
 {
-  DALI_ASSERT_ALWAYS( window && "Window handle is empty" );
+  DALI_ASSERT_ALWAYS(window && "Window handle is empty");
   const BaseObject& object = window.GetBaseObject();
   return static_cast<const Internal::Adaptor::GlWindow&>(object);
 }